
我嘗試使用以下程式碼添加在文件中偶數頁上運行的短標題和在奇數頁上運行的作者:
\documentclass[11pt]{article}
\usepackage{lipsum}
\title{\bf THE TITLE}
\author{FIRST AUTHOR\footnote{{\tt [email protected]} Address}
\and SECOND AUTHOR\footnote{second author address}
\and THIRD AUTHOR\footnote{third author address}}
\date{~}
\begin{document}
\maketitle
\pagestyle{myheadings}
\markboth{The short title}{F. Author S. Author T. Author}
\lipsum
\lipsum
\end{document}
可以看出,作者被插入到偶數頁的頂部(如奇數頁),而不是我想要的短標題。
我真的不知道如何透過保持與類別相同的文件佈局(邊距、寬度、長度等)來修復它article
。
任何幫助,將不勝感激。
答案1
使用設定標題fancyhdr
,並且您可以包括ifoddpage
查看您位於奇數頁還是偶數頁(runningheads
如下所示)。
\documentclass{article}
\usepackage{lipsum}
\title{\bfseries THE TITLE}
\author{FIRST AUTHOR\footnote{\texttt{[email protected]} Address}
\and SECOND AUTHOR\footnote{second author address}
\and THIRD AUTHOR\footnote{third author address}}
\date{~}
\usepackage{fancyhdr,ifoddpage}
\fancypagestyle{runningheads}{%
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% Remove header rule
%\renewcommand{\footrulewidth}{0pt}% Remove footer rule (default)
\fancyhead[L]{% Left header
\checkoddpage% Update \ifoddpage
\ifoddpage
F.~Author, S.~Author, T.~Author% Odd pages
\else
The short title% Even pages
\fi
}%
\fancyhead[R]{\thepage}% Right header
}
\pagestyle{runningheads}
\begin{document}
\maketitle
\lipsum
\lipsum
\end{document}
答案2
這是維爾納解決方案的簡化版本,使用fancyhdr
E
和O
選項代替\ifoddpage
。此外,它沒有定義新的頁面樣式,因為在本例中這不是必需的。
\documentclass{article}
\usepackage{lipsum}
\title{\bfseries THE TITLE}
\author{FIRST AUTHOR\footnote{\texttt{[email protected]} Address}
\and SECOND AUTHOR\footnote{second author address}
\and THIRD AUTHOR\footnote{third author address}}
\date{~}
\usepackage[twoside]{fancyhdr}
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% Remove header rule
%\renewcommand{\footrulewidth}{0pt}% Remove footer rule (default)
\fancyhead[LO]{F.~Author, S.~Author, T.~Author} % Left header
\fancyhead[LE]{The short title} % Left header
\fancyhead[R]{\thepage}% Right header
\pagestyle{fancy}
\begin{document}
\maketitle
\lipsum
\lipsum
\end{document}