我想做类似下面的事情
\documentclass[a4paper, 12pt, oneside]{article}
\begin{documnet}
\if@twoside
The page is doublesided. All good.
\else
\textbf{{\Huge The page is not double sided! change!}}
\fi
\end{document}
为了确保在打印书籍之前没有忘记将单面模式改为双面模式。
我写作时只使用一面,因为电脑屏幕是单面的。
我怎样才能实现这个目标?
答案1
只需改变
\if@twoside
The page is doublesided. All good.
\else
\textbf{{\Huge The page is not double sided! change!}}
\fi
到
\makeatletter
\if@twoside
The page is doublesided. All good.
\else
\textbf{{\Huge The page is not double sided! change!}}
\fi
\makeatother
\makeatletter
通过使用和来包含条件\makeatother
。这样 latex 就可以@twoside
正确读取变量(\makeatother
将编译器恢复为@
以默认方式读取符号(我认为)。