3

After Opening Page running heads should always be [running authors], no matter what's the page number (Odd/Even). Then the next page should be [short Title].

Opening Page - Empty
Second Page - [running authors] (Odd/Even Pages)
Third Page - [Short Title] (Odd/Even Pages)
4th Page - [running authors] (Odd/Even Pages)
5th Page - [Short Title] (Odd/Even Pages)

so on....

3
  • 1
    You should be more specific on the document class and the purpose? Is your document a collection of articles/essays with multiple authors?
    – user31729
    Nov 7, 2014 at 13:38
  • 2
    An MWE is essential here. I don't understand the 'Odd/Even' bit, either. Don't you want authors on every even page and short title on every odd page. (If the opening page is page 1, it is odd, and the second, fourth, sixth etc. will always be even while the third, fifth, seventh etc. will always be odd.)
    – cfr
    Nov 7, 2014 at 15:19
  • ChristianHupfer - article.cls is the class file. either multiple authors or single author..
    – jeecabz
    Nov 8, 2014 at 0:44

2 Answers 2

2

If you want the same running head for each page, the code is pretty simple.

It's enough to write into your preamble:

\renewcommand\rightmark{[Short Title]}
\renewcommand\leftmark{[running authors]}

Where \leftmark and \rightmark are the contents of respectively left page head and right page head. So you could write a document like:

\documentclass[openany]{book}

\renewcommand\rightmark{[Short Title]}
\renewcommand\leftmark{[running authors]}

\begin{document}

\part{Introduction}
    \chapter{Bla} \newpage Bla\newpage Bla 
    \newpage Bla\newpage Bla \newpage Bla\newpage Bla 

\part{Example 1:\\Foo}
    \chapter{Bla} \newpage Bla\newpage Bla 

\part{Appendix}
    Bla \newpage Bla\newpage Bla 

\end{document}

and have correct running heads as desired. I prefer this rather than using fancyhdr.

0
3

There's little need to tap into the \author and/or \title macros to extract what you need. It's probably just as easy to retype the authors and short title in a fancyhdr implementation.

If you're using a twoside setup, then fancyhdr allows for specifying a Even/Odd header:

\documentclass[twoside]{article}
\usepackage{fancyhdr,lipsum}
\pagestyle{fancy}
\fancyhf{}% Clear header/footer
\fancyhead[CE]{[running authors]}% Centred header on Even page
\fancyhead[CO]{[Short title]}% Centred header on Odd page
\begin{document}
\thispagestyle{plain}
\lipsum[1-20]

\end{document}

Setting \thispagestyle{plain} ensures that the first page has the default plain page style. The above also assumes that you're using a twoside article display.

If you're not using a twoside article, then you could condition on whether or not \value{page} is odd/even - inside the header/footer this is fine, as page styles are set appropriately during shipout; one reason why \thepage works in these areas.

\documentclass{article}
\usepackage{fancyhdr,lipsum}
\pagestyle{fancy}
\fancyhf{}% Clear header/footer
\fancyhead[C]{%
  \ifodd\value{page}\relax
    [Short title]% Odd page header
  \else
    [running authors]% Even page header
  \fi}
\begin{document}
\thispagestyle{plain}
\lipsum[1-20]

\end{document}

Fundamentally, both approaches above assume that the opening page is numbered 1 (odd), making the second page even, and so forth.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .