pgf-tikz / pgf

A Portable Graphic Format for TeX
https://pgf-tikz.github.io/
1.08k stars 104 forks source link

pgfsyspdfmark is undefined when used in aux file #1330

Open user202729 opened 1 month ago

user202729 commented 1 month ago

Brief outline of the bug

As in the title. When \usepackage{tikz} is deleted, the error surface.

Suggestion: include appropriate \providecommand if the command appear in aux file.

(Once reported in https://tex.stackexchange.com/questions/550704/pgfsyspdfmarkpgfid1889951814980839 but neglected.)

Minimal working example (MWE)

To reproduce:

\documentclass{article}
\usepackage{tikz}
\begin{document}
123
\begin{tikzpicture}[remember picture]
\end{tikzpicture}
\end{document}

Compile, delete \usepackage{tikz}, then compile again.

Error: Undefined control sequence. \pgfsyspdfmark

jasperhabicht commented 1 month ago

Wouldn't this still break since \begin{tikzpicture} is then undefined?

But I think your argument is focused on remaining commands in the aux file: Isn't this a general problem? Is this even addressed in a consistent manner in different packages? I don't think so.

If, to take another package as example, I have the following code

\documentclass{article}

\begin{filecontents}[overwrite]{mybib.bib}
    @article{test,
        title={title}
    }
\end{filecontents}

\usepackage{biblatex}
\addbibresource{mybib.bib}

\begin{document}
    Citing \cite{test}.
    \printbibliography
\end{document}

and compile this using pdflatex and run biber, then delete \usepackage{biblatex}, \addbibresource{mybib.bib}, \cite{test} and \printbibliography and compile then again using pdflatex, I get a similar error, since \abx@aux@refcontext is undefined.

Thus, I would argue that this is normal behaviour of LaTeX and the user should recompile from scratch after having used packages that write to the aux file. So, I do understand your point, but I think that this is not a bug really.