[Tex/LaTex] Set up sidewaysfigure to have the bottom of the figure toward the spine

double-sidedfloatsrotating

I am typesetting a book. There are a couple figures that are wider than they are tall, and appear too small if placed on a page in the usual fashion. I have found that using the sidewaysfigure environment from the rotating package, I can put these figures in landscape orientation taking up entire pages. This is satisfactory except for one issue: in the compiled pdf, the figures are oriented with the bottom away from the spine; I want the bottom toward the spine. If I use the package option figuresright or figuresleft, I can make the figure orientation independent of the page number, but this is not what I want. The clockwise and counterclockwise options do not appear to change anything (which makes sense, since the documentation states that these options are for one-sided documents, but I had hoped).

In using the sidewaysfigure environment from the rotating package in a two-sided document, how do I orient the figures with the bottom toward the spine?

Best Answer

Strange that there seems to be no such package option ... so I took the definition of \end@rotfloat and partially swapped the code for left and right hand pages. (And \let \endsidewaysfigure and \endsidewaystable to the new definition of \end@rotfloat.)

\documentclass{book}

\usepackage{rotating}

\makeatletter
\def\end@rotfloat{%
   \end{minipage}\end{lrbox}%
   \stepcounter{r@tfl@t}%
   \rot@label{RF\ther@tfl@t}%
   \rot@pageref{RF\ther@tfl@t}{\R@@page}%
   \edef\@tempa{Adding sideways \@captype\space on page \R@@page\space}
   \rot@mess@toks\expandafter{\@tempa}
   \wd\rot@float@box\z@
   \ht\rot@float@box\z@
   \dp\rot@float@box\z@
   \vbox to \textheight{%
    \setkeys{Grot}{units=360}%
    \if@rot@twoside
    \else
      \let\R@@page\rot@LR
    \fi
    \ifthenelse{\isodd{\R@@page}}{%
      \if@rot@twoside
        \rot@mess@toks\expandafter{\the\rot@mess@toks (right hand page)}%
      \fi
% BEGIN OF ORIGINAL LEFT HAND PAGE
      \@@line{%
        \hskip\rotFPbot
        \rotatebox{-90}{\box\rot@float@box}%
        \hskip\rotFPtop
      }%
      \vfill
% END OF ORIGINAL LEFT HAND PAGE
    }{%
      \if@rot@twoside
        \rot@mess@toks\expandafter{\the\rot@mess@toks (left hand page)}%
      \fi
% BEGIN OF ORIGINAL RIGHT HAND PAGE
      \vfill
      \@@line{%
        \hskip\rotFPtop
        \rotatebox{90}{\box\rot@float@box}%
        \hskip\rotFPbot
      }%
% END OF ORIGINAL RIGHT HAND PAGE
    }%
    \rot@message{\the\rot@mess@toks}
  }%
  \end@float
}
\let\endsidewaysfigure\end@rotfloat
\let\endsidewaystable\end@rotfloat
\makeatother

\begin{document}

\begin{sidewaysfigure}
\centering
\rule{15cm}{1cm}
\caption{First figure}
\end{sidewaysfigure}

\begin{sidewaysfigure}
\centering
\rule{15cm}{1cm}
\caption{Second figure}
\end{sidewaysfigure}

\end{document}