Subject: Re: bug#20749: 11.88; Meta Bug: Long standing preview bug with TIKZ (6 years!?)

From: Nicolas Richard <[email-masked]>
Date: Mon, 08 Jun 2015 19:42:23 +0200

Tassilo Horn <[email-masked]> writes:
>> Isn't this https://sourceforge.net/p/pgf/bugs/316/ again ?
>
> Oh, yes, seems so.  And 315 seems also related.
>
>> For some reason, it seems that upstream is not fixing it even though a
>> patch is available.
>
> Why do you think that?  AFAICS, no official has done a statement on
> that, and the issue is just one year old.

Err... yeah maybe I'm being pessimistic again.

>> FWIW I've been running with that patch for a few months have yet to
>> see a problem with it.
>
> Which one?

The "correct patch". More precisely, it's :
--- /tmp/pgfutil-latex-ctan.def	2015-06-08 19:36:06.890121795 +0200
+++ /usr/local/texlive/2014/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def	2015-06-08 19:39:09.686116394 +0200
@@ -134,16 +134,17 @@
 % material to get lost.
 
 \AtBeginDocument{
-  \@ifpackageloaded{preview}{%
-    % Ok, package loaded. Swap definitions of everyshi.sty's shipout
-    % and preview.sty's shipout:
-    \let\pgf@temp\pr@shipout% This is the original shipout
-    \let\pr@shipout\@EveryShipout@Shipout% This is what preview.sty should call
-    \let\@EveryShipout@Org@Shipout\pgf@temp% Everyshi should now use the original one
-  }{}%    
+\@ifpackageloaded{preview}{%
+% Ok, package loaded. Swap definitions of everyshi.sty's shipout
+% and preview.sty's shipout:
+\ifPreview
+\let\shipout\@EveryShipout@Org@Shipout%This is the null version of \shipout, created by preview and saved by everyshi
+\let\@EveryShipout@Org@Shipout\pr@shipout% This is the original shipout
+\let\pr@shipout\@EveryShipout@Shipout%
+\fi
+}{}%
 }
 
-
 % Guess the driver:
 
 \def\pgfutil@guessdriver{

>             And do you also save \shipout before \begin{document} and
> restore it afterwards as indicated by the comment by Kirill Müller?

I don't.

> In any case: if there's anything that we could put into preview.dtx to
> fix the issue from our side, that would be awesome.  Patch welcome!

I admit I haven't looked into it, but I'm afraid I won't be able to
help.

Nico.