I'd like to put:
- some text on the outer side of the page,
- some another text on the inner side of the page.
For this, I make use of the (\checkoddpage
) \ifoddpage
test provided by the changepage
package. That works pretty well, except if it turns out that there isn't enough space left on the current page where the code is inserted, as pointed out by the following MWE (the first two are okay, not the last two).
\documentclass{book}
\usepackage[inner=10mm,outer=30mm]{geometry}
\usepackage[strict]{changepage}
\newcommand{\onouterside}{%
\begin{minipage}[t]{0.3\linewidth}
Some text supposed to be on the outer side.
\end{minipage}
}
\newcommand{\oninnerside}{%
\begin{minipage}[t]{0.75\linewidth}
Some text supposed to be on the inner side.
\end{minipage}
}
\newcommand{\test}{%
\checkoddpage%
\ifoddpage%
\oninnerside
\hspace*{11mm}%
\onouterside
\else%
\hspace*{-20mm}%
\onouterside
\hspace*{11mm}%
\oninnerside
\fi%
}
\begin{document}
\test
\newpage
\test
\newpage
\rule{0.4pt}{.969\textheight}\par
\test
\newpage
\mbox{}
\newpage
\rule{0.4pt}{.969\textheight}\par
\test
\end{document}
How could I make the odd/even page test robust? Should I get the vertical space of the texts and compare it to the vertical space left on the current page and, if so, how could I know the latter one?