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.

I created my thesis and used this code to created heading. The document is setted to book class and oneside option. I got a page where both the left and right are number. Instead I would have the page number at the right and at the left the section

\usepackage{fancyhdr}
\pagestyle{fancy}

\makeatletter
\DeclareRobustCommand{\format@sec@number}[2]{{\normalfont\upshape#1}#2}
\renewcommand{\chaptermark}[1]{%
  \markboth{\format@sec@number{\ifnum\c@secnumdepth>\m@ne\@chapapp\ \thechapter. \fi}{#1}}{}}
\renewcommand{\sectionmark}[1]{%
  \markright{\format@sec@number{\ifnum\c@secnumdepth>\z@\thesection. \fi}{#1}}}
\makeatother

\fancyhf{}
\fancyhead[R]{\itshape\nouppercase{\leftmark}}
\fancyhead[L]{\itshape\nouppercase{\rightmark}}
\fancyhead[L,R]{\thepage}
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You are defining both side heading to be page numbers via

\fancyhead[L,R]{\thepage}

hence you get the page numbers on both sides. Try the following code:

\documentclass[oneside]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}

\makeatletter
\DeclareRobustCommand{\format@sec@number}[2]{{\normalfont\upshape#1}#2}
\renewcommand{\chaptermark}[1]{%
  \markboth{\format@sec@number{\ifnum\c@secnumdepth>\m@ne\@chapapp\ \thechapter. \fi}{#1}}{}}
\renewcommand{\sectionmark}[1]{%
  \markright{\format@sec@number{\ifnum\c@secnumdepth>\z@\thesection. \fi}{#1}}}
\makeatother

\fancyhf{}
\fancyhead[R]{\thepage}
\fancyhead[L]{\itshape\nouppercase{\rightmark}}
\begin{document}
\chapter{Some chapter}
\section{Some section}
\lipsum[1-10]
\section{Some other section}
\lipsum[11-20]
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.