There is a problem with the MWE: A solution for the MWE was found. But this solution does not work for the actual project. So far, I could not work out the reason for this. Therefore, other solutions are still much welcomed.
I am working on a project in which I have to rotate some figures and some tables in a twoside document. The image below shows the results I want to achieve by automated determination of the rotation angles:
-90°on verso (left) pages,+90°on recto (right) pages if the verso page is not rotated,-90°on recto pages if the verso page is rotated.
We assume left-to-right (LTR) script (e.g. English language) here.
My macro \rotateRectoVerso only works in the first two cases. For obvious reasons it cannot work in the third case. The solution has to work with https://ctan.org/pkg/endfloat. So far I would like to keep the captions unharmed since a reader usually reads the book unrotated and finding the figure might be easier this way.
In classes in which \Ifthispageodd is not defined one might compare
If Then Else for odd page/even page.
\documentclass[paper=b7,twoside,14pt]{scrbook}
\usepackage{tikz}
% I could not solve my problem with these
%\usepackage{hvfloat}
%\usepackage[twoside]{rotating}
\newcounter{imagecounter}
\newcommand{\examplePic}[1]{
\stepcounter{imagecounter}
\begin{tikzpicture}
\draw (-2,-2) -- (0,0) node {\bfseries\huge J\Alph{imagecounter}} -- (2,2);
\end{tikzpicture}
}
%works in many cases
\newcommand{\rotateRectoVerso}[1]{\Ifthispageodd{\rotatebox{90}}{\rotatebox{-90}}{#1}}
\usepackage[nomarkers,heads,nolists,noheads]{endfloat}
\begin{document}
\chapter{manual}
Foo.
\begin{figure}
\examplePic{}
\caption{normal}
\end{figure}
\begin{figure}
\rotatebox{90}{\examplePic{}}
\caption{manually rotated}
\end{figure}
\begin{figure}
\rotatebox{-90}{\examplePic{}}
\caption{manually rotated}
\end{figure}
\begin{figure}
\examplePic{}
\caption{normal}
\end{figure}
\begin{figure}
\rotatebox{-90}{\examplePic{}}
\caption{manually rotated}
\end{figure}
\begin{figure}
\rotatebox{-90}{\examplePic{}}
\caption{manually rotated}
\end{figure}
\chapter{auto}
The first two pairs work (after a second compilation). The last does not.
\clearpage
\begin{figure}
\rotateRectoVerso{\examplePic{}}
\caption{automatically rotated}
\end{figure}
\begin{figure}
\examplePic{}
\caption{normal}
\end{figure}
\begin{figure}
\examplePic{}
\caption{normal}
\end{figure}
\begin{figure}
\rotateRectoVerso{\examplePic{}}
\caption{automatically rotated}
\end{figure}
\begin{figure}
\rotateRectoVerso{\examplePic{}}
\caption{automatically rotated}
\end{figure}
\begin{figure}
\rotateRectoVerso{\examplePic{}}
\caption{automatically rotated}
\end{figure}
\end{document}
