I want to compile the temporary.tex file containing PSTricks code twice. One with -jobname=Rotated and the other one with -jobname=Unrotated. The resulting Rotated.ps will be passed to ps2pdf without -dAutoRotatePages=/None but the Unrotated.ps will be passed to ps2pdf with -dAutoRotatePages=/None.

The following code throws some errors. The error messages can be seen by yourself.

% this input file name is filename.tex
% compile it with pdflatex -shell-escape filename.tex






        % do nothing


\foreach \outputname/\isautorotate in {Rotated/true,Unrotated/false}
    \foreach \compiler/\ext in {latex \JobName{\outputname}/tex,dvips/dvi,ps2pdf \AutoRotatePages/ps}
        \immediate\write18{\compiler\space \outputname.\ext}

\foreach \filename in {Rotated,Unrotated}{\begin{center}\includegraphics{\filename}\end{center}}

How to fix this problem?


will pass a macro with value true or false to \AutoRotatePages so you could redefine your macro to accept such a string but simpler is just to do

 \csname AutoRotatePages\isautorotate\endcsname

together with


\def\AutoRotatePagesfalse{ -dAutoRotatePages=/None }

No need for a new if

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.