# How to set -dAutoRotatePages#/None in MikTeX

I'm using MikTeX 2.9 on Windows 7.

I understand one needs to tell GS explicitly not to auto rotate pages by supplying:

-dAutoRotatePages#/None


as parameter to ps2pdf (or gswin32c, as indicated here).

Is there a way to also supply this parameter to \MiKTeX-2.9\miktex\bin\latex.exe? That is, can I run something like:

latex.exe [parameter] main.tex


and the produced DVI will not exhibit undesired autorotated pictures?

The reason for asking this is that I use Texniccenter, and the build setup (to DVI) only allows to pass options to latex.exe.

-
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  ienissei Jun 3 '12 at 7:32
A tip: If you indent lines by 4 spaces or enclose words in backticks , they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). –  ienissei Jun 3 '12 at 7:32
Running latex only generates a .dvi file, it does not run GhostScript. That may be done by your editor in a 'build' system, which is where you would need to add the parameter. Exactly how do you run ps2pdf (the final stage of PDF creation using the dvips route)? –  Joseph Wright Jun 3 '12 at 8:11
You have to set the parameter in your editor and not in MiKTeX. What Editor are you using? You'll find answers for TeXnicCenter and TeXWorks here: tug.org/PSTricks/main.cgi?file=pdf/pdfoutput The option for ps2pdfis set in the same way. –  Herbert Jun 3 '12 at 8:15
@ Joseph, Herbert: I don't run ps2pdf at all. If I run pdflatex, the unwanted autorotation does not occur. –  Johannes Jun 3 '12 at 13:29

## Install GhostScript

Make sure you have GhostScript installed and you have set PATH to its location. gswin64c.exe is for 64 bit version and gswin32c for 32 bit version. I use 64 bit version in this answer.

## Create a batch file

The following batch will compile your TeX input file 4 times, convert the resulting DVI to PS and finally convert the PS to PDF.

Save it as combo.bat, for example, in any directory. Set the PATH system variable to this batch location such that your operating system can find the batch when you call it later.

rem This is combo.bat. It takes a single argument which is a file name without extension

echo off

rem remove the previous PDF if any
del %1.pdf

rem compile 4 times
latex -draftmode -interaction=batchmode %1
latex -draftmode -interaction=batchmode %1
latex -draftmode -interaction=batchmode %1
latex %1

dvips -t unknown %1

gswin64c -r10000 -dCompatibilityLevel=1.5 -dAutoRotatePages=/None -dPDFSETTINGS=/prepress -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=%1.pdf %1.ps

rem remove unnecessary files
del %1.aux
del %1.dvi
del %1.log
del %1.out
del %1.ps
del %1.toc
del %1.nav
del %1.snm


## Configure TeXnicCenter

Configure TeXnicCenter as follows:

-
This will produce a PDF file (and probably one where the autorotation issue is fixed). However, will it also produce a "correct" DVI file? –  Johannes Jun 3 '12 at 13:42
@Johannes: Are you sure that latex will automatically rotate its content in DVI? I don't think latex` does rotation automatically. –  kiss my armpit Jun 3 '12 at 13:45
See the example files I posted in response to Ulrike's comment. Not sure which binary/program is automatically rotating content (latex/dvips/ps2pdf?) -- all I can tell is that in YAP, the final output appears rotated. –  Johannes Jun 4 '12 at 9:45