2

I am also posting my solution. Please save your time and energy on this Question!

I have experienced a strange behavior after upgrading TikZ 2 to TikZ 3 when loading and using the TikZ and PSTricks packages (via auto-pst-pdf) at the same time. Please consider this situation of generating barcodes.

%! latex or pdflatex or xelatex or lualatex
%! with ----shell-escape or --enable-write18
%! bug0001-problem.tex
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}
\usepackage{tikz}
\begin{document}
My first barcode is:\par
\begin{pspicture}(3,1in)
\psbarcode{978-80-87106-00-6}{includetext guardwhitespace}{isbn}
\end{pspicture}\par
My first QR code is:\par
\begin{pspicture}(1,1in)
\psbarcode{http://www.cstug.cz/}{}{qrcode}
\end{pspicture}\par
\begin{tikzpicture}
\node{Hello World!};
\end{tikzpicture}
\end{document}

I had no problem when using TikZ 2, but I got this error message with TikZ 3.

Error: /typecheck in --div--

Operand stack:

1 2 0.0 TeXcolorgray 65781.8

Execution stack:

%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1932 1 3 %oparray_pop 1931 1 3 %oparray_pop 1915 1 3 %oparray_pop 1803 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- --nostringval-- 5 --nostringval-- %repeat_continue --nostringval--

Dictionary stack:

--dict:1180/1684(ro)(G)-- --dict:0/20(G)-- --dict:126/200(L)-- --dict:179/300(L)--

Current allocation mode is local

Current file position is 601489

GPL Ghostscript 9.10: Unrecoverable error, exit code 1

PDFCROP 1.38, 2012/11/02 - Copyright (c) 2002-2012 by Heiko Oberdiek.

==> 2 pages written on `bug0001-problem-pics.pdf'.

I am still tracking down the problem I experienced in a real project: I haven't got the barcodes at all. The realproject.pdf file was empty and therefore pdfcrop generated an error and there was no cropped version of the PDF file. My project is huge, so I wasn't able to emulate my real situation on a small scale yet. If I do, I'll extend this Question. Still, I couldn't hand over the TeX code generating this sort of error to a TeXist/publisher, because I wasn't able to hide it by \batchmode or \nonstopmode.

My question is: How to fix it when TikZ 3 is loaded to get no error message of this kind as in TikZ 2?

2 Answers 2

4

Run it with pdflatex --shell-escape

\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}
\ifpdf\usepackage{tikz}\fi 
\begin{document}

My first barcode is:\par
\begin{pspicture}(3,1in)
\psbarcode{978-80-87106-00-6}{includetext guardwhitespace}{isbn}
\end{pspicture}\par
My first QR code is:\par
\begin{pspicture}(1,1in)
\psbarcode{http://www.cstug.cz/}{}{qrcode}
\end{pspicture}\par
\begin{tikzpicture}
\node{Hello World!};
\end{tikzpicture}

\end{document}

or run it with xelatex and

\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{pst-barcode}
\usepackage{tikz}
\begin{document}
[...]
1
  • And how does it work with LuaLaTeX? I get the error /usr/local/texlive/2017/texmf-dist/tex/latex/ifplatform/ifplatform.sty:93: Package catchfile Error: Is not only me? Aug 25, 2017 at 7:15
1

It is better not to know how much time I spent on this one in a real project with deadline as I was getting no barcodes after upgrading the TeX Live distribution/TikZ. Of course, I could use a separate TeX file just for the barcodes, well, I wanted to solve it.

The problem is causing TikZ 3 for sure, because my code is running with TikZ 2. The auto-pst-pdf package is calling for the pst-pdf package and it calls for the system shell (latex->dvips->ps2pdf->pdfcrop). I basically limited loading of the TikZ 3 package when generating the DVI output by wrapping the \usepackage{tikz} command by \ifpdf ... \fi or alternatively for instance in lualatex by \ifcsname directlua\endcsname ... \fi. If we generate a PDF file (the actual typesetting) the TikZ 3 package is loaded, if we generate a DVI file (generating the barcodes in the system shell) we skip that loading. Then there is no error message:

PDFCROP 1.38, 2012/11/02 - Copyright (c) 2002-2012 by Heiko Oberdiek.

==> 2 pages written on `bug0001-solution-pics.pdf'.

I enclose my solution and a page preview.

%! pdflatex or xelatex or lualatex
%! with ----shell-escape or --enable-write18
%! bug0001-solution.tex
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}
\ifpdf
% This is another approach when running lualatex:
% \ifcsname directlua\endcsname
\usepackage{tikz}
% Plus loading tikz libraries...
\else
% Or run \batchmode or \nonstopmode as pst-pdf does...
\newenvironment{tikzpicture}[1]{}{}
\def\tikzset{}
\fi 
\begin{document}
My first barcode is:\par
\begin{pspicture}(3,1in)
\psbarcode{978-80-87106-00-6}{includetext guardwhitespace}{isbn}
\end{pspicture}\par
My first QR code is:\par
\begin{pspicture}(1,1in)
\psbarcode{http://www.cstug.cz/}{}{qrcode}
\end{pspicture}\par
\begin{tikzpicture}
\node{Hello World!};
\end{tikzpicture}
\end{document}

a solution

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .