4

I'm trying to compile the fix mentioned by egreg in this thread: Strange behaviour with PGF/TikZ and Plain TeX output routine

Here's the code:

\input pgf

\catcode`@=11
\newbox\pgfutil@@Output@Box
\def\shipout{%
  \ifhmode\hskip\else\vskip\fi 1sp 
  \afterassignment\pgfutil@@Delayed@EveryShipout@Test
  \setbox\pgfutil@@Output@Box=}
\def\pgfutil@@Delayed@EveryShipout@Test{%
  \ifdim\lastskip=\z@ % it was \shipout\vbox or \shipout\hbox
    \expandafter\aftergroup
  \fi
  \pgfutil@@EveryShipout@Test}
\def\pgfutil@@EveryShipout@Test{%
  \unskip % remove the skip used as signal
  \ifvoid\pgfutil@@Output@Box
    \expandafter\aftergroup
  \fi
  \pgfutil@EveryShipout@Output}
\def\pgfutil@EveryShipout@Output{%
  \setbox\pgfutil@@Output@Box=\vbox{
    \setbox\z@=\hbox{%
      \pgfutil@abe
      \unhbox\pgfutil@abb
      \pgfutil@abc
      \global\let\pgfutil@abc\pgfutil@empty
    }%
    \wd\z@=\z@\ht\z@=\z@\dp\z@=\z@\box\z@
    \ifhbox\pgfutil@@Output@Box\unhbox\else\unvbox\fi\pgfutil@@Output@Box
  }%
  \pgfutil@@EveryShipout@Org@Shipout\box\pgfutil@@Output@Box
}
\catcode`@=12

%\def\bxxx{\box255}\output={\shipout\bxxx}
%\output={\shipout\relax\box255}

\setbox0=\hbox{A}
\shipout\box0

Hello world
\bye

I get this error message every time I try:

! Undefined control sequence.
\pgfutil@EveryShipout@Output ...ipout@Org@Shipout 
                                                  \box \pgfutil@@Output@Box 
\plainoutput ...headline \pagebody \makefootline }
                                                  \advancepageno \ifnum \out...
<output> {\plainoutput 
              }
<to be read again> 
\pgfutil@origend 
l.42    \bye

? 
! Output loop---25 consecutive dead cycles.
<to be read again> 
\pgfutil@origend 
l.42    \bye

I can't figure out what's wrong.

  • Welcome to TeX.SX! I don't think the code is necessary with PGF 3.0.0 – egreg Feb 22 '15 at 0:40
5

The simple file

\input pgf

\show\shipout

produces different results when compiled using TeX Live 2012, with PGF version 2.10, or under TeX Live 2014, with PGF version 3.0.0

Version 2.1.0

> \shipout=macro:
->\afterassignment \pgfutil@@EveryShipout@Test \setbox 255= .

Version 3.0.0

> \shipout=macro:
->\edef \AtBegShi@GroupLevel {\number \currentgrouplevel }\afterassignment \AtBegShi@Test \setbox \AtBeginShipoutBox =.

The conclusion we can draw from this code is that the main error in PGF 2.10, which was doing \setbox255=... has been fixed. In my experiment, the example file you show (purged from the added code)

\input pgf

\setbox0=\hbox{A}
\shipout\box0

Hello world
\bye

compiles flawlessly and produces the expected result.

5

The code from @egreg's answer supposes that there is

\let\pgfutil@@EveryShipout@Org@Shipout=\shipout

in the macros of pgf.tex. The error message shown in your post says that the line above is not processed. Maybe, a new or old version of PGF uses another control sequence names or does something different and the @egreg's code is incompatible with this because the line above is missing in the code. But this line cannot be in the path itself from principal reason: we don't know if the \shipout is still primitive or not. The line above works only if \shipout is primitive.

Recommendation: don't use this path if exactly don't know that the version of PGF is the same as version discussed here. I don't know the version evolution of PGF so I cannot say more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.