Subject: bug#49422: The preview package does not work with TikZ (TeXLive 2021)

From: Arash Esbati <[email-masked]>
Date: Tue, 06 Jul 2021 10:35:57 +0200

Hi Eugene,

Eugene Shalygin <[email-masked]> writes:

> activating the preview package with TikZ results in
> ! Undefined control sequence.
> \@outputpage ...istfalse \@parboxrestore \shipout
>                                                  \vbox {\set@typeset
> @protec...
>
> The MWE (this and the log files are attached):
> \documentclass{article}
> \usepackage{tikz}
> \usepackage[active]{preview}
> % \PreviewEnvironment[]{tikzpicture}
> \listfiles
> \begin{document}
>
> \begin{tikzpicture}
>
> \end{tikzpicture}
> \end{document}
>
> Uncommenting the \PreviewEnvironment command changes the undefined command
> to \pr@shipout. Commenting out \usepackage[active]{preview} makes the
> \shipout command available.

This is an example with TikZ where Preview-LaTeX works without problems
for me:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\usepackage{tikz}
\usepackage[displaymath,floats,graphics,footnotes,textmath]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}

This is inline math $a+b=c$ and this is displayed
\[ a+b=c \]

This is a TikZ\footnote{And a footnote} picture\\[3ex]
\begin{tikzpicture}
  \draw[thick,fill=yellow!50] (0,0) circle (3);
  \draw[thick,fill=orange!50] (0,0) circle (2.4);
  \foreach \letter [count=\i] in {A,...,Z} {
    \draw[very thin] (0,0) -- ({90-\i*360/26}:3);
    \path (0,0) --node[pos=.9,sloped,allow upside down,rotate=-90]
    {\letter} ({360/52+90-\i*360/26}:3);
  }
  \foreach \letter [count=\i] in {G,H,...,Z,A,B,...,F} {
    \path (0,0) --node[pos=.7,sloped,allow upside down,rotate=-90]
    {\small\letter} ({360/52+90-\i*360/26}:3);
  }
\end{tikzpicture}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-engine: luatex
%%% End:
--8<---------------cut here---------------end--------------->8---

The result how it looks in Emacs is attached.  Maybe you can create a
real-life document instead of an empty one exhibiting your problem?
Also provide the version of Emacs and AUCTeX you're using.

Best, Arash