While writing a paper I was puzzled to see that although I was not putting anything in LaTeX code to affect the orientation of the page (Image 1), some pages were rotated at the final pdf file (Image 2). But why was that? Although I did play around to see if there was something wrong with the images, or the code, or whatever could possible go wrong with the LaTeX, the output was the same.
From the final pdf document (Image 2, “page” 3) it is obvious that LaTeX does not do anything wrong. The page has the proper portrait orientation, but the pdf page is rotated. Looking around to see what could go wrong with the ps2pdf conversion I found out that:
“By default Ghostscript determines viewing page orientation based on the dominant text orientation on the page. Sometimes, when the page has text in several orientations or has no text at all, wrong orientation can be selected.” [1]
Since the images used are eps files [2], which means that they are text files, and they have plenty of text vertically oriented, Ghostscript takes their orientation as the proper one. When I manually run:
ps2pdf -dAutoRotatePages=/None file.ps file.pdf
these orientation issues removed.
Another idea is to use some extra invisible text (like white text in a white background) in order to increase the horizontal text. That way Ghostscript will select the right orientation from the beginning. A way to do it is presented in [3], but in my case it didn’t work well as it was also increasing the length of caption resulting in its displacement. Moreover, if highlighted the text become visible.
[1] Ps2pdf/Orientation
[2] wikipedia.org/EncapsulatedPostScript
[3] TeX-stackexchange.com/phantom-and-line-break