[Tex/LaTex] How to add running title and author

header-footer

How can I add the so-called "running" title and author name on the top of each page? This feature is often used in journals so that the short running title is shown on the top of odd pages and the running author name is shown on the even pages.

In journal style files they usually provice the \titlerunning and \authorrunning commands to do it quickly, but how can I add them myself?

And also it would be very good (almost necessary) to add a line separating this running title of the rest of a page.

Best Answer

Try the fancyhdr package. The simplest approach is to set the headings manually.

\documentclass{article}
\title{Owl stretching time}
\author{M Python}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{M Python}
\rhead{Owl stretching time}
\begin{document}
\maketitle
abc
\newpage
def
\newpage
\end{document}

Using the arguments given to \author and \title is slightly more difficult, because these are cleared when \maketitle is executed. However, you can make copies using \let.

\documentclass{article}
\title{Owl stretching time}
\author{M Python}
\usepackage{fancyhdr}
\pagestyle{fancy}
\makeatletter
\let\runauthor\@author
\let\runtitle\@title
\makeatother
\lhead{\runauthor}
\rhead{\runtitle}
\begin{document}
\maketitle
abc
\newpage
def
\newpage
\end{document}
Related Question