如果有,\documentclass[twoside]{report}
并且我将其更改为\documentclass[oneside]{report}
,\usepackage{fancyhdr}
则会自动打印左页眉和页脚。有没有办法告诉 fancyhdr/LaTeX 如果oneside
使用,则应用右侧页眉/页脚?
... 也许带有 if ... else 语句?
我尝试了一下,\@ifclasswith{report}{oneside}{True}{False}
结果如下You can't use \spacefactor in vertical mode. \@
。
答案1
我在以下帮助下找到了答案这回答。
添加到序言中:
% Check if oneside or twoside
\makeatletter
\@ifclasswith{report}{oneside}{
TRUE
}{
FALSE
}
\makeatother
...例如
% Check if oneside or twoside
\makeatletter
\@ifclasswith{report}{oneside}{
\newcommand{\ThesisTitle}{Thesis title text to insert ONESIDE}
}{
\newcommand{\ThesisTitle}{Thesis title text to insert TWOSIDE}
}
\makeatother