# pdfoutput=1 can't replace pdflatex for auto-pst-pdf

It is frequently mentioned that latex and pdflatex are the same program invoked with different defaults for the variable \pdfoutput (0 in the former, 1 in the latter case); see What is the practical difference between latex and pdflatex?. A common advice to enforce pdflatex is therefore to put \pdfoutput=1 within the first 5 lines of the preamble (like http://arxiv.org/help/submit_tex#pdflatex). This fails for the first example using auto-pst-pdf on https://www.tug.org/PSTricks/main.cgi?file=pdf/pdfoutput.

\documentclass[12pt]{article}

\usepackage{pstricks}
\usepackage{auto-pst-pdf}

\pagestyle{empty}

\begin{document}

\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
\pscircle*[linecolor=cyan]{5}
\psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
\Huge\sffamily\bfseries
\rput(-4.5,4.5){A} \rput(4.5,4.5){B}
\rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
\rput(0,0){auto-pst-pdf}
\rmfamily
\rput(0,-3.8){PSTricks}
\rput(0,3.8){\LaTeX}
\end{pspicture}

% removed by poster: \includegraphics{foo}% can be foo.jpg or foo.png

\end{document}


compiles just fine with

$pdflatex -shell-escape minimal.tex  and yields the desired minimal.pdf. Adding \pdfoutput=1  before (or after) \begindocumentclass[12pt]{article} followed by $ latex -shell-escape minimal.tex


or even

$pdflatex -shell-escape minimal.tex  fails with No pages of output and ------------------------------------------------- auto-pst-pdf: Auxiliary LaTeX compilation ------------------------------------------------- This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012) entering extended mode Package auto-pst-pdf Warning: Creation of minimal-autopp.dvi failed. This warning occured on input line 124. Package auto-pst-pdf Warning: Could not create minimal-pics.pdf. Auxiliary files not deleted. This warning occured on input line 124. ------------------------------------------------- auto-pst-pdf: End auxiliary LaTeX compilation -------------------------------------------------  In either case, the corresponding log file minimal-autopp.log says Package ifplatform Warning: shell escape is disabled, so I can only detect \ifwindows. ) \c@app@runs=\count111 ! Package auto-pst-pdf Error: "shell escape" (or "write18") is not enabled: auto-pst-pdf will not work! . See the auto-pst-pdf package documentation for explanation. Type H <return> for immediate help. ... l.134 Or turn off auto-pst-pdf.} % You need to run LaTeX with the equivalent of "pdflatex -shell-escape" Or turn off auto-pst-pdf.  So, it seems like the auxiliary pdflatex process which generates the minimal-pics.pdf is now missing the option -shell-escape. PS: Adding the option [crop=off] to auto-pst-pdf as in auto-pst-pdf Problem does not change anything (and I guess it shouldn't have worked in the first place if that would have been the problem). - Do not use the statement \pdfoutput=... it can be done automatically by the system. Do you have Perl installed? – Herbert Apr 22 '13 at 8:30 – Claudio Fiandrino Apr 22 '13 at 8:38 arXiv's recommendation to put \pdfoutput=1 within the first five lines suggests that they do some sort of preprocessing. This practice is definitely not recommended for normal document writing. – egreg Apr 22 '13 at 8:44 @Herbert: Yes, Perl is installed: $ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux-gnu-thread-multi-64int –  zieglerk Apr 22 '13 at 9:00
@zieglerk: that is not possible. When the file is open you cannot modify the shell escape feature, it's too late. –  Herbert Apr 22 '13 at 11:07

The shell-escape feature cannot be activated from within a source file. When the file is open you cannot modify the shell escape feature, it's too late. This is a safe behaviour otherwise one could do any unsecure action.