I have a command that checks to see if the page number of a label is even/odd, using \ifthenelse{\isodd{\pageref{mylabel}}}...
that works well. I just came across a situation where I try to use the same command in my appendix, but my command fails.
This is because I've changed the appendix numbering. I use
\appendix
\pagenumbering{arabic}\renewcommand{\thepage}{A.\arabic{page}}
to create page numbers like A.1, A.2, etc. The \isodd
command returns false on all these page numbers.
I'd like to have one command that is able to check for even/odd in both cases - regular and appendix page numbering.
I may be open to a different page numbering scheme in the appendix, though it needs to be clearly different than the regular page numbering.
Edit: Here's minimal code showing the effect I see. On Page 3, it shows it knows which label is on an even/odd page. On Page 6, it shows incorrectly that both are on even pages.
\documentclass{book}
\usepackage{ifthen}
\newcommand{\pagecheck}[1]{\ifthenelse{\isodd{\pageref{#1}}}{ The label is on an odd page. }{ The label is on an even page. }}
\begin{document}
\section{One}\label{firstsection}
\clearpage
\section{Two}\label{secondsection}
\clearpage
\pagecheck{firstsection}\pagecheck{secondsection}
\clearpage
\appendix
\pagenumbering{arabic}\renewcommand{\thepage}{A.\arabic{page}}
\section{Appendix A}\label{appA}
\clearpage
\section{Appendix B}\label{appB}
\clearpage
\pagecheck{appA}\pagecheck{appB}
\end{document}
mylabel
won't be known so\pageref
acts as 0 and\ifodd
will be false, but it should pick up on the second run, the setting of\thepage
is not used at all, so your\renewcommand
has no affect on the test