Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.


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 will be passed to ps2pdf without -dAutoRotatePages=/None but the 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?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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