36

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.

init_js
  • 257
v_2e
  • 1,530
  • 1
    Is this for an article submission, or for personal use? If it's the former, they probably have specifications/requirements you have to adhere to. – Werner Aug 22 '12 at 19:23
  • 1
    @Werner : Currently I need it for my personal use. When I submit to journal, I use the functions and style they provide, of course. – v_2e Aug 22 '12 at 20:00

2 Answers2

31

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}
Ian Thompson
  • 43,767
  • 1
    Thanks! It helps somewhat. I obtain a running author and title (with a nice line separating them from the rest of a page), but how do I make the title appear on the odd pages only and the author - on the even pages only? – v_2e Aug 22 '12 at 19:58
  • 4
    @v_2e: If you're using twoside, you can specify \fancyhead[O]{...} for Odd-side headings, and \fancyhead[E]{...} for Even. Additional identifiers like L and R to denote the Left or Right side of the page. – Werner Aug 22 '12 at 20:03
  • 1
    Well, thanks a lot! I did \fancyhead[LO]{Running title} and \fancyhead[RE]{Running author} in combination with twoside document class option, and it did exactly what I needed! :) – v_2e Aug 22 '12 at 20:11
  • I tried this but got nothing, @v_2e, could you copy your preamble here? Thanks! – Vuk Stojiljkovic Nov 10 '21 at 21:04
  • @VukStojiljkovic --- It would be better for you to ask a new question; few people will see your comment here. Also, please explain exactly what went wrong in your case. It is unlikely that anyone will be able to help on the basis of the information you provided. – Ian Thompson Nov 11 '21 at 10:43
  • @VukStojiljkovic , here is the minimum working preamble: \documentclass[twoside]{article} \usepackage{fancyhdr} \fancyhead[LO]{Odd-Left-text} \fancyhead[RE]{Even-Right-text} \pagestyle{fancy} – v_2e Nov 12 '21 at 06:15
2

I had to piece together different parts of these answers to get what I needed. Two-sided, two-column, alternating left and right headers, with no header on the first page. And two-sided line numbers. You can insert a title however you want later, but the idea is that you won't want a header over your title.

\documentclass[twocolumn,twoside]{article}
% Line numbers package
\usepackage[switch,columnwise]{lineno}
% Creates example text
\usepackage{lipsum} 
% Headers
\usepackage{fancyhdr}
\pagestyle{fancy}
\thispagestyle{empty}
\fancyhead[LO]{My Running Title for Header}
\fancyhead[RE]{2013 Firstauthor and Secondauthor}
\begin{document}
\linenumbers
\lipsum[1-20]
\end{document}

This is just an expansion on the nice answers already shown here. And it works.

  • The header is not made to depend on the actual title provided in the document : the only trick here is that you don't specify one, so it does not answer the question – titus Sep 08 '19 at 20:24