pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
198 stars 33 forks source link

Undefined control sequence when using soft clip #443

Closed SolidTux closed 2 years ago

SolidTux commented 2 years ago

Example

\documentclass{standalone}

\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            % xmin=-3, xmax=3,
            % ymin=-3, ymax=3,
        ]
        \path[name path=x0] (axis cs:-2,0) -- (axis cs:2,0);
        \path[name path=x1] (axis cs:-2,2) -- (axis cs:2,2);
        \addplot fill between [
                of=x0 and x1,
                % soft clip={domain=0:1},
            ];
    \end{axis}
\end{tikzpicture}
\end{document}

Description I get the following error log (full log attached), when I comment out all three commented lines (all three seem to be necessary)

Package pgfplots info on input line 20: Setting layers 'axis background,axis gr
id,axis ticks,axis lines,axis tick labels,pre main,main,axis descriptions,axis 
foreground'...
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 20.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 20.
! Undefined control sequence.
\tikzlibsoftclip@setkey@@ ...ikz@resetexpandcount 
                                                  \tikz@scan@one@point \tikz...
l.20     \end{axis}

? 

The behaviour does not change when I set compat=1.18 (or latest or 1.17 for that matter) and appears with both pdflatex and lualatex. This comes originally from a document that worked in the past (but it's a long time since I tried to compile it so I don't know which versions I had back then).

Versions

hmenke commented 2 years ago

Your version of PGF is too old. The internal command \tikz@resetexpandcount is only available in PGF 3.1.9a. https://github.com/pgf-tikz/pgf/commit/442b0d4759ab71c8d03f6b32c7e1386b14cab6c3 As a temporary workaround you can add

\makeatletter
\providecommand\tikz@resetexpandcount{\tikz@expandcount=100\relax}
\makeatother

to your preamble.

SolidTux commented 2 years ago

Wow, that was fast! Thank you so much!