-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
comma as decimal separator in table doesn't work with lua backend. #452
Comments
It's worth pointing out that the issue doesn't arise with \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\begin{document}
\begin{tikzpicture}
\datavisualization [school book axes, visualize as line]
data [separator=\space] {
x y
0.5 0
1.5 1
2.5 1
3.5 0
};
\end{tikzpicture}
\pgfset{/pgf/number format/read comma as period}
\begin{tikzpicture}
\datavisualization [school book axes, visualize as line]
data [separator=\space] {
x y
0,5 0
1,5 1
2,5 1
3,5 0
};
\end{tikzpicture}
\end{document} |
That's because pgfplots/tex/generic/pgfplots/pgfplots.code.tex Lines 4681 to 4685 in 9f4e2b1
Setting \pgfplotsset{compat=1.18, lua backend=false} works too (by hiding the problem).
|
The root cause has been reported to @dbitouze (in response to your comment in tex-sx) The problem is not uncovered in tikz examples because it's only For a very specific (hence maybe highly limited) workaround, try the patch to % !TeX program = lualatex
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\makeatletter
\def\pgfplots@LUA@survey@point{%
\ifpgfmathparsenumber@comma@as@period
% Assume each point is a single number without any math function calls.
% Only then is reading comma as period unambiguous.
\edef\pgfplots@loc@TMPa{pgfplots.texSurveyPoint(%
gsub("\pgfplots@current@point@x", ",", "."),%
gsub("\pgfplots@current@point@y", ",", "."),%
gsub("\pgfplots@current@point@z", ",", "."),%
"\pgfplots@current@point@meta")}%
\pgfplotsutil@directlua{%
gsub = string.gsub
\pgfplots@loc@TMPa
}%
\else
\edef\pgfplots@loc@TMPa{pgfplots.texSurveyPoint(%
"\pgfplots@current@point@x",%
"\pgfplots@current@point@y",%
"\pgfplots@current@point@z",%
"\pgfplots@current@point@meta")}%
\pgfplotsutil@directlua{\pgfplots@loc@TMPa}%
\fi
% increase \pgfplots@current@point@coordindex:
\advance\c@pgfplots@coordindex by1
}%
\makeatother
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot table [
x = x,
y = y,
/pgf/number format/read comma as period
] {
x y
1,2 0,9
1,4 1,3
};
\end{axis}
\end{tikzpicture}
\end{document} Update: An answer to question https://tex.stackexchange.com/q/687857 is added, though I'm a little resistant to posting experimental patch to different places. Hope it provides some more (user-friendly?) info. |
Compiling the following example with lualatex
(This is LuaHBTeX, Version 1.15.0 (TeX Live 2022) (format=lualatex 2023.1.23) 24 JAN 2023 18:08) )
results in an empty diagram.
Warning in the log-file:
NOTE: coordinate (--,--,--) [--](was (1,2,0,9,--) [--]) has been dropped because of a coordinate filter.
The text was updated successfully, but these errors were encountered: