# LaTeX, pdf and imported 90-degrees rotated EPS images

This post was written by eli on February 28, 2010
Posted Under: Software

The problem: In LaTeX, if I import an EPS file with \includegraphics and rotate it by 90 degrees, hell breaks lose in the resulting pdf file.

My processing chain, in case you wonder, is latex, dvips and ps2pdf. I avoid pdflatex since it won’t import EPS (as far as I can recall) but only images converted to pdf. Or something. It was a long time ago.

The figure is generated with

\begin{figure}[!btp]\begin{center}
\includegraphics[width=0.9\textheight,angle=-90]{blockdiagram.eps}
\caption{Modulator's block diagram}\label{blockdiagram}
\end{center}\end{figure}

which successfully rotates the figure as requested, but unfortunately this also causes the page appear in landscape format in Acrobat. While this is slightly annoying, the real problem is that the file will or won’t print properly, depending on the certain computer you print from, and possibly on the weather as well.

The curious thing about this is that if I choose angle=-89.99 it turns out like I want to, but I have a feeling that this will not end well.

Using \rotatebox instead didn’t work either:

\rotatebox{-90}{\includegraphics[width=0.9\textheight]{blockdiagram.eps}}

It looks like this does exactly the same (and the -89.99 trick also works). Now, it’s pretty evident that the clean 90 degrees value triggers off some hidden mechanism which tries to be helpful, but instead ends up messing up things. So this is how I solved this, eventually:

\begin{figure}[!btp]\begin{center}
\rotatebox{-1}{\includegraphics[width=0.9\textheight,angle=-89]{blockdiagram.eps}}
\caption{Modulator's block diagram}\label{blockdiagram}
\end{center}\end{figure}

In words: Rotate the EPS by 89 degrees, and then by another degree, so we have exactly 90 degrees. This leaves some room for precision errors, if the rotation involves actual calculations of coordinations (I have no idea if this is the case), but this is as close to 90 degrees as I managed to get, without having the page messed up.

Not an ideal solution. If you know how to do this better, please comment below!

Ah, I should mention that it’s possible to rotate the EPS file first, and then import it into the LaTeX doc as is. If the whole generation runs with makefile anyhow, this shouldn’t be too annoying. But it turns out (see here) that it’s not all that simple to rotate an EPS. I haven’t tried that solution, but it looks like it should work on any Linux machine. Anyhow, I didn’t feel like playing with bounding boxes.

Try:

ps2pdf -dAutoRotatePages=/None myfile.ps

This might help!

Cheers,

Rich

#1
Written By Rich on October 15th, 2010 @ 18:39

thanks Rich, I was having the same problem and the solution suggested works perfectly for me.

#2
Written By John on March 15th, 2011 @ 22:35

Thank you Rich, worked very well aslo in my case!
Cheers from Vienna, Uli

#3
Written By Uli on June 30th, 2012 @ 11:55