为什么\ifoddpage
在下面的例子中似乎总是返回 false?这与问题 6143在同一论坛上。我正在使用 XeLaTeX 制作 pdf 文件(即xelatex test.tex
)
\documentclass[11pt,final,openright]{memoir}
% for Blurb, set this to the actual desired size as indicated by the
% size calculator on their web site
% See the memoir class documentation for an explanation of all the page
% layout parameters.
\setstocksize{594pt}{693pt}
\settrimmedsize{576pt}{684pt}{*}
\settrims{9pt}{9pt}
\setlrmarginsandblock{81pt}{54pt}{*} % calculates \textwidth
\setulmarginsandblock{72pt}{36pt}{*} % calculates \textheight
\setheadfoot{0pt}{18pt}
\setheaderspaces{0pt}{*}{*}
\raggedright % comment to force even justification
\setlength{\parindent}{0in} % paragraph indentations
\setlength{\parskip}{1em} % space between paragraph
\checkandfixthelayout % Set all the layout values
\usepackage{ifthen}
\newcounter{mycount}
\begin{document}
\whiledo{\themycount<130}{%
\ifoddpage
{Odd\\}%
\else
{Even\\}%
\fi
\stepcounter{mycount}%
}
\end{document}
答案1
您必须\checkoddpage
先调用,将其设置\ifoddpage
为 true 或 false。最好进行严格检查。这在您的代码中运行良好,可在分页符上切换奇数和偶数:
\strictpagechecktrue%
\whiledo{\themycount<130}{%
\checkoddpage%
\ifoddpage%
{Odd\\}%
\else
{Even\\}%
\fi
\stepcounter{mycount}%
}