1

Edit 2:

Curiously, as well as my captions defaulting to the inside, my headers are on the opposite side than I ask them to be using

\fancyhead[LE,RO]{\leftmark}

Something is making my document get odd and even pages mixed up I think.

Edit:

If I chose my document class to be article and don't use 'twoside' then it points the captions in the correct direction. But then my page headers don't change with odd or even page numbers.


I have a Latex document in which some large figures are rotated sideways to fit them on the page.

I do this using \usepackage[]{rotating} and \begin{sidewaysfigure*}[]

The captions seem to be pointing toward the inside of the page, but I want them to point outwards. In other words, I want an even page number to be on the right hand side and have the sideways caption on the right hand side of the page. I changed to \usepackage[counterclockwise]{rotating}

but it doesn't seem to make any difference. Here is all of my preamble.

\documentclass[12pt,twoside]{ociamthesis} 
\usepackage[bottom=37mm,top=10mm,left=33mm,right=33mm]{geometry}
\usepackage{natbib}
\usepackage{calc}
\usepackage{aas_macros}
\usepackage{color}
\usepackage{longtable}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{eucal}
\usepackage{hyperref}
\usepackage{multicol}
\usepackage{nomencl}
\usepackage{geometry}
\usepackage{setspace}
\usepackage[counterclockwise]{rotating}
\usepackage{changepage}
\usepackage{subfigure}
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{xfrac}
\usepackage{fancyhdr}
\setlength{\parindent}{0pt}
\setlength{\headheight}{30pt} 
\usepackage[font={footnotesize}]{caption}
\let\oldtabular\tabular
\renewcommand{\tabular}{\footnotesize\oldtabular}
\include{mymacros}
\makenomenclature
\renewcommand{\nomname}{List of Symbols}
\renewcommand*{\nompreamble}{\begin{multicols}{2}}
\renewcommand*{\nompostamble}{\end{multicols}}
\setlength{\columnsep}{3em}
3
  • 1
    Try load package rotating without option counterclockwise. And do not load packages twice (longtable, geometry).
    – Zarko
    Aug 23, 2015 at 21:08
  • It doesn't seem to change anything, whether I have counterclockwise in there or not. Aug 23, 2015 at 21:40
  • 1
    ociamthesis must be a one-sided document (margins are the same on both sides). Rotating treats one sided documents as always being odd pages. Aug 24, 2015 at 16:12

1 Answer 1

1

Rotating treats every page of a one-sided document (like article) as an odd page. Anyway, given \rotatebox the rest is fairly easily done.

As it turns out, the page number inside a float is NOT reliable, hence the use of the ifoddpage package. Also, I assume the only reason for rotating a table or figure is if it is too big to fit normally, so I used the whole page.

\documentclass{article}
\usepackage{graphicx}
\usepackage{ifoddpage}
\usepackage{mwe}

\makeatletter
\let\floatpage=\oddpage@page
\makeatother

\newcommand{\sidewaysbox}[1]% #1 = contents
{\centering\checkoddpage% needs to run twice
 \ifoddpage
   \rotatebox{-90}{\begin{minipage}{\textheight}
   \centering #1
   \end{minipage}}%
 \else
   \rotatebox{90}{\begin{minipage}{\textheight}
   \centering #1
   \end{minipage}}%
 \fi}

\begin{document}

\begin{figure}
\sidewaysbox{\includegraphics{example-image}
\caption{odd page \floatpage}}
\end{figure}

\begin{figure}
\sidewaysbox{\includegraphics{example-image}
\caption{even page \floatpage}}
\end{figure}

\end{document}

This version does not necessarily take up the whole page, but anything bigger than 0.7\textheight will anyway.

\documentclass{article}
\usepackage{graphicx}
\usepackage{ifoddpage}
\usepackage{mwe}

\makeatletter
\let\floatpage=\oddpage@page
\makeatother

\newsavebox{\tempbox}

\newcommand{\sidewaysbox}[2]% #1 = contents, #2 = caption
{\savebox{\tempbox}{#1}%
\centering\checkoddpage% needs to run twice
 \ifoddpage
   \rotatebox{-90}{\begin{minipage}{\wd\tempbox}
   \usebox{\tempbox} #2
   \end{minipage}}%
 \else
   \rotatebox{90}{\begin{minipage}{\wd\tempbox}
   \usebox{\tempbox} #2
   \end{minipage}}%
 \fi}

\begin{document}

\begin{figure}
\sidewaysbox{\includegraphics{example-image}}
  {\caption{odd page \floatpage}}
\end{figure}

\lipsum[1-3]

\begin{figure}
\sidewaysbox{\includegraphics{example-image}}
  {\caption{even page \floatpage}}
\end{figure}

\lipsum[4-6]
\end{document}
5
  • Thank you for the reply. However, I get the error message 'LaTeX Error: File `ifoddpage.sty' not found.' I guess it's something I need to install, but I don't currently know how to do that. Aug 24, 2015 at 11:59
  • Is there any way to do the same this without using the "ifoddpage" package? Also I am rotating images, not tables, but I guess I can do a similar thing. Aug 24, 2015 at 12:58
  • 1
    If you are using MikTex, find the package manger, search for ifoddpage by name (not keyword) and hit the + icon. Alternatively, google "ctan ifoddpage", copy ifoddpage.sty into your editor and save as ifoddpage.tex, then add \input{iffoddpage} into you preamble between \makeatletter and \makeatother. A third option is to manually rotate +90 or -90 each time. Aug 24, 2015 at 15:46
  • Yes I guess I would like to specify what size the image is as I do now, buy stating the width of the image. Aug 24, 2015 at 16:36
  • 1
    In my (now deleted) comment I meant I could leave room for text if the image didn't fill the whole page. I'll add it now. Aug 24, 2015 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .