Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is my problem:

Im writing my thesis using the book class. I want my thesis to be onesided (left and right margins of same size), but I would also like to use the fancyhdr package to give me chapter names in the pagehead of even pages and section names in the pagehead of odd pages.

Trying to do so together with the "oneside" option gives me a warning when compiling saying that the [E] option is useless when the book is "onesided".

Example code:

\documentclass[11pt,a4paper, oneside]{book}
...
\fancyhf{} 
\pagestyle{fancy}
\headheight 20pt
\fancyhead[LE]{\rightmark}

Any good ideas would be much appreciated! I already tried the geometry package, and it messes up a lot of the formatting in the book class. I guess what I'm basically looking for is how to use the "twosided" option without LaTeX shifting every other page to a side.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

I also recommend using the geometry package. However, if you insist on not "messing up" any formatting, you may temporarily enable the oneside class option, then use the \showthe command to find out the value of the lengths \evensidemargin (and \oddsidemargin) with this option, then switch back to twoside and change the two length values.

\documentclass{book}% Defaults to [twoside]

% \showthe\evensidemargin% Retrieve length value with class option [oneside]

% Apply length value of class option [oneside]
\evensidemargin 62pt
\oddsidemargin 62pt

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{blindtext}

\begin{document}

\blinddocument

\end{document}

(The blindtext package is only used to add some dummy text to the example.)

share|improve this answer
    
Thanks for your help, guys. All of your answers were very helpful! –  user2954 Jan 18 '11 at 9:09

Use twoside with symmetry page margins.

\documentclass[11pt,a4paper,twoside]{book}
\usepackage[centering,headheight=20pt]{geometry}
\usepackage{fancyhdr}
...

I wonder how geometry messes up you document. It may be solved easier than page headings.

share|improve this answer
    
I haven't used it before, what is centering for? –  xport Jan 15 '11 at 12:55
1  
@xport: See p. 9 of the manual. –  lockstep Jan 15 '11 at 12:58
    
@xport…: What about reading the manual? That's what it's for. –  Thorsten Donig Jan 15 '11 at 12:59
    
Thanks for your help, guys. All of your answers were very helpful! –  user2954 Jan 18 '11 at 9:09

Somehow I can't see where geometry messes up the page layout. The below example shows no undesired behaviour.

\documentclass[11pt,a4paper,english]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[%
  headheight=14pt,
  includeheadfoot,
  margin=3cm
]{geometry}
\usepackage{fancyhdr}
\usepackage{blindtext}

% Setup for headers anf footers (fancyhdr)
\fancyhf{}
\fancyhead[RE]{\nouppercase{\rightmark}}
\fancyhead[LO]{\nouppercase{\leftmark}}
\fancyhead[LE,RO]{\thepage}
\pagestyle{fancy}

\begin{document}
  \Blinddocument
\end{document}

The blindtext package is only for creating an example document thus not part of the solution.

share|improve this answer
    
Thanks for your help, guys. All of your answers were very helpful! –  user2954 Jan 18 '11 at 9:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.