tags:

views:

717

answers:

2

Hi,

I hope also Latex questions are welcome here on Stackoverflow since it's not really programming related.

I have a problem in defining the correct style for the header using the fancyhdr package. What I'd like to achieve is to have

  • On odd pages on the left side the following text "My paper title"
  • On even pages on the right side the text "Firstname Surname"

(Replaced with the correct text of course).

At the moment I have the following "test" Latex document:

\documentclass[a4paper,12pt,T2A,oneside]{article}
\usepackage[english]{babel}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage[pdfborder=0 0 0]{hyperref}



%define the header
\pagestyle{fancy}

\fancyhf{}
\fancyhf[ROH,LEH]{Firstname Surname}
\fancyhf[REH,LOH]{\bfseries My paper title}

\begin{document}

\title{My title \\}
\author{\small{Firstname Surname}}
\date{June 9, 2009}

\maketitle


\section{Introduction}
blablabla asdfasdf asdf ads fad sf

adsfadsf a fdasfd asfd 

\subsection{This is a subsection}
Some text\ldots

\pagebreak

some further text

\pagebreak

some additional text

% Stop your text
\end{document}

I tried different variations of this part

\fancyhf{}
\fancyhf[ROH,LEH]{Firstname Surname}
\fancyhf[REH,LOH]{\bfseries My paper title}

but I can't make it work. At the moment the text is printed on each page, odd and even. I also found this wiki article which describes the different meanings of "ROH" etc... and it's also clear, but for some reason it doesn't work for me. I must make some silly mistake which I can't get right now...

Thx for any help!

//Edit:
Tex distribution: gwTeX
OS: Mac OS X 10.5.8

+2  A: 

Your \documentclass[a4paper,12pt,T2A,oneside]{article} specifies oneside - that is one sided article - so all headers would get printed on all pages by fancyhdr. Change that to twoside:

\documentclass[a4paper,12pt,T2A,twoside]{article}

See this article for information on how you might have to change page borders when using this option.

Mark Pim
That was it exactly. Thanks a lot.
Juri
Just another question. Do you maybe have some links or know how to change the default formatting/alignment of section titles defined with `\section{some section title}`? That would be great.
Juri
Found something that seems to work: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=secthead
Juri
A: 

Another problem I encountered, which isn't directly related to the fancyhdr, but may still be of interest is how to modify the formatting of section headers.

These two links helped me a lot:

Juri