Skip to content

Conversation

@muzimuzhi
Copy link
Member

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:

@muzimuzhi muzimuzhi force-pushed the trim-spaces-for-gnuplot-function branch from 2a2796d to dfd0114 Compare August 9, 2025 19:27
@muzimuzhi
Copy link
Member Author

muzimuzhi commented Aug 9, 2025

The manual was built without errors, but the job failed at a latter step "Deploy tlcontrib", with

E: The repository 'http://deb.debian.org/debian-security testing-security Release' does not have a Release file.

- name: Deploy tlcontrib
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
apt-get update -qq
apt-get install -qq libxml-parser-perl libxml-xpath-perl libtext-unidecode-perl tree
cp build/doc/pgfmanual.pdf ../
bash ci/update_tlcontrib.sh

Probably an issue with the image registry.gitlab.com/islandoftex/images/texlive:latest?


Update: Somehow the step now passed.

@hmenke hmenke merged commit 5bf93bf into pgf-tikz:master Aug 14, 2025
3 checks passed
@muzimuzhi muzimuzhi deleted the trim-spaces-for-gnuplot-function branch August 15, 2025 00:27
\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}%
Copy link
Member Author

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%

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

no changes but plot function calls gnuplot

2 participants