# auto-pst-pdf: Not working properly with rotations >=45°

I'm using psfrag to replace text in .eps-figures. Since I'm working also with other graphic formats I use pdflatex and therefore the package auto-pst-pdf. Everything worked quite well so far. Today I tried to rotate a picture with an angle of 90° and I noticed that this works only for angles <= 45°. If the angle exceeds 45°, e.g. 60°, the figure is printed with an angle of -30° which is (60-90)°.

LaTeX example:

\documentclass{article}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage[on]{auto-pst-pdf}

\begin{document}

\begin{figure}%
\centering
\psfragfig[angle=60]{test.eps}
\end{figure}

end{document}


Thus, 90° results in 0°, 100°->10°, 134°->46°. BUT 135°->135° (?!) and then 136°=->-44°=(136-180)° and so on.

It seems that auto-pst-pdf does not pass the argument of the option angle correctly to the includegraphics-command.

Does anybody has an idea what's the reason for this and how a rotation of 90° can be achieved?

-
In my version of auto-pst-pdf the options of \psfragfig are passed to \includegraphics. angle can't get loss. But perhaps ps2pdf does some autorotating. Do you have the same problem is you use a picture without text e.g. tiger.eps from CTAN? (add the option width=8cm). – Ulrike Fischer Jun 20 '12 at 14:27
The problem depends indeed on text. I've tried it with the tiger and I've also drawn a simple rectangle. One version with, the other without text. Without text everything works fine. Adding the text, the explained effects occur. – Michael Ma Jun 20 '12 at 14:50
If you are on windows you could try \expandafter\def\expandafter\autorotatenone\expandafter{\detokenize{-dAutoRotat‌​ePages#/None}} and then \usepackage[on,ps2pdf=\autorotatenone]{auto-pst-pdf} – Ulrike Fischer Jun 20 '12 at 15:17
Yes, I'am on Windows but unfortunately that did not help, nothing changed. – Michael Ma Jun 20 '12 at 15:31
Could you put one of the problematic eps somewhere for download? – Ulrike Fischer Jun 20 '12 at 15:37

OK I think I solved it. I had a problem with an invisible unicode char in my utf8-encoded files which truncated the argument. Life was easier when we all used 8bit-encodings. The following worked for me. There is perhaps a simpler way to hide the hash, but I don't have time now. (I used crop=off as I have currently a problem with pdfcrop).

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\begingroup
\catcode\#=11
\gdef\autorotatonone{-dAutoRotatePages#/None}
\endgroup

\usepackage[crop=off,pspdf={\autorotatonone}]{auto-pst-pdf}

\begin{document}

\begin{postscript}%
\includegraphics[angle=60]{test.eps}%
\end{postscript}

\begin{postscript}
\includegraphics[angle=60]{test_text.eps}%
\end{postscript}

\end{document}

-
Fantastic! I honestly don't understand what you did, but it works without any complaint. By the way, I don't have any problems if I skip crop=off. Thx for your time and the effort you made. So did I get that right, when text is present ps2pdf does some autorotating because auto-pst-pdf does not pass the option correctly? In that case we might inform Will Robertson, the author of auto-pst-pdf`. – Michael Ma Jun 21 '12 at 6:47
On windows auto-pst-pdf doesn't use the option on purpose - perhaps because Will didn't get around the problem how to pass the #, or because he didn't know that you should replace the = used on linux with an #. It would certainly a good idea to inform him. – Ulrike Fischer Jun 21 '12 at 7:42
I've written him an email. So that should it be so far. – Michael Ma Jun 21 '12 at 9:16