-
Notifications
You must be signed in to change notification settings - Fork 114
fix: check if .gnuplot is up-to-date in a more reliable way #1399
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
fix: check if .gnuplot is up-to-date in a more reliable way #1399
Conversation
Fixes pgf-tikz#1397 Signed-off-by: Yukai Chou <[email protected]>
Signed-off-by: Yukai Chou <[email protected]>
Signed-off-by: Yukai Chou <[email protected]>
2a2796d to
dfd0114
Compare
|
The manual was built without errors, but the job failed at a latter step "Deploy tlcontrib", with Lines 58 to 65 in 757f4c2
Probably an issue with the image Update: Somehow the step now passed. |
Signed-off-by: Yukai Chou <[email protected]>
| \immediate\openout\pgf@plotwrite=\pgf@plotgnuplotfile\relax | ||
| \immediate\pgfutil@write\pgf@plotwrite{\pgf@gnuplot@head}% | ||
| \immediate\pgfutil@write\pgf@plotwrite{#2}% | ||
| \immediate\pgfutil@write\pgf@plotwrite{\pgf@plot@code}% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was buggy.
By using \pgf@plot@code in replace of #2 in writing to .gnuplot, it has to be defined. But currently \pgf@plot@code is only defined if the .gnuplot exists.
A minimal reproducing example:
% copied from https://github.com/pgf-tikz/pgf/issues/1397
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw plot[domain=-2:2] function{x**2};
\end{tikzpicture}
\end{document}If the \jobname.pgf-plot.gnuplot doesn't exist before the compilation, an error is raised:
! Undefined control sequence.
<write> \pgf@plot@code
Usually the error disappears in a following compilation, but the pgfplots manual building was broken because of the -halt-on-error option. See pgf-tikz/pgfplots#510 (comment).
The fix is simple, but I need some more time to setup a new l3build test suite which checks with shell escape, so .
diff --git a/tex/generic/pgf/modules/pgfmoduleplot.code.tex b/tex/generic/pgf/modules/pgfmoduleplot.code.tex
index 4dbaa14f..1b070a89 100644
--- a/tex/generic/pgf/modules/pgfmoduleplot.code.tex
+++ b/tex/generic/pgf/modules/pgfmoduleplot.code.tex
@@ -481,6 +481,7 @@
\pgfutilpreparefilename{#1.table}%
\let\pgf@plottablefile=\pgfretval
\let\pgf@plottablefile@quoted=\pgfretvalquoted
+ \edef\pgf@plot@code{\pgfutil@trimspaces@e{#2}}%
\begingroup
\endlinechar=-1 % suppress white space at end
% Check, whether it is up-to-date
@@ -490,7 +491,6 @@
\pgfutil@read\pgfutil@inputcheck to\pgf@temp% ignored
\pgfutil@read\pgfutil@inputcheck to\pgf@plot@line%
\closein\pgfutil@inputcheck
- \edef\pgf@plot@code{\pgfutil@trimspaces@e{#2}}%
\ifx\pgf@plot@code\pgf@plot@line%
\openin\pgfutil@inputcheck=\pgfretval\relax
\ifeof\pgfutil@inputcheck%There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New PR #1412 is proposed. It comes with a set of tests.
Motivation for this change
Fixes #1397
Checklist
Please signoff your commits to explicitly state your agreement to the Developer Certificate of Origin. If that is not possible you may check the boxes below instead: