0

The title should explain the problem.

\documentclass[justified, symmetric]{tufte-book}
\geometry{paperwidth = 8in, paperheight = 10.5in, right = 2.2in, marginparwidth = 1.5in}
\usepackage{ifthen, lipsum, showframe}
\begin{document}
%  ------------------------------
\textbf{\thepage} \marginnote{A margin note} \par
\lipsum[1-5]
\vspace{0.5cm}

\textbf{\thepage} \marginnote{\raggedleft A margin note} \par
\lipsum[6-9]
\vspace{0.6cm}

\textbf{\thepage} \marginnote{\ifthenelse{\isodd{\thepage}}{A margin note}{\raggedleft A margin note}} \par % <---- this note should be on the left side of the margin
\lipsum[6-9]
%  ------------------------------
\end{document}

The wrong page numbering also results in a wrong display of the margin note:

enter image description here

To be fair, a simple \clearpage before the third margin note solves the problem, but having to solve things manually is both impractical and annoying.

noibe
  • 2,084
  • It's a known issue that \thepage is not a reliable way to get the current page number in most situations. See for example https://texfaq.org/FAQ-oddpage, https://texfaq.org/FAQ-wrongpn and https://tex.stackexchange.com/q/473903/35864 and – moewe Feb 28 '19 at 16:56
  • Oh, didn't know that. Is there some more reliable counter that gives the correct number? – noibe Feb 28 '19 at 16:59
  • 2
    never use \thepage in a document, latex is not confused, it is just not telling you what you expected it to tell you. Use \pageref to get a page number. – David Carlisle Feb 28 '19 at 16:59
  • The ifoddpage package from the first link sounds like it could be what you are looking for. Otherwise \pageref+\label from the second link. – moewe Feb 28 '19 at 17:02
  • @DavidCarlisle how do I use \pageref as the argument of the \isodd{} command? – noibe Feb 28 '19 at 17:03
  • \pageref should work in ifthenelse (as I took precautions to make it work) just set a \label on the page you want to reference, but you may find specific tests like the ifoddpage mentioned above to be easier – David Carlisle Feb 28 '19 at 17:04
  • https://tex.stackexchange.com/q/74010/35864 might be more helpful. Since this question is about even/odd the \pageref duplicate might not be the best one. – moewe Feb 28 '19 at 17:04

0 Answers0