2

I'm new here and I'm into headers with package fancyhdr. My request is: I want on even pages, CHAPTER NUMBER, in the odd pages CHAPTERTITLE. So in a way like: [E] \chaptername \thechapter [O] \chaptermark

I face some issues with \renewcommand on \leftmark and \rightmark that I cant't edit both entry simoultaneously. Do you have any suggestions? Thanks

    \documentclass[a4paper,12pt,twoside,titlepage,openright,fleqn,onecolumn,draft]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm, bindingoffset=5mm]{geometry}                                                            
\usepackage{lastpage}
\usepackage{fancyhdr} 
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}}
\setlength{\headheight}{15pt}

\pagestyle{fancy}
\fancyhf{}
\renewcommand\chaptermark[1]{%
\markboth{\MakeUppercase{\chaptername\ \thechapter}}{#1}}

\fancyhead[RE]{\slshape \leftmark}
\fancyhead[LO]{\slshape \leftmark}
\fancyhead[LE,RO]{\slshape \thepage}
\renewcommand{\headrulewidth}{0.4pt}

\usepackage{blindtext}

\begin{document}
\chapter{CCC1}
\Blindtext\Blindtext\Blindtext
\section{SS1}
\Blindtext\Blindtext\Blindtext
\chapter{CCC2}
\Blindtext\Blindtext\Blindtext
\section{SS2}
\Blindtext\Blindtext\Blindtext
\end{document}
  • Welcome to TeX.SX! A tip: You can use backticks ` to mark your inline code. Could you please provide a minimal working example (MWE) so that we could help you more easily? – ebosi Apr 19 '16 at 12:40
  • It would help if you could specify where the relevant pieces should appear. Left, centered or right? – user31729 Apr 19 '16 at 12:47
  • Sure, i'm adding a few code lines. i'm feeling a newbie =( – Chris Apr 19 '16 at 12:47
  • Don't worry: we've all started at the beginning, and you're here at the right place for your questions! – ebosi Apr 19 '16 at 12:56
  • You want following hearder, don't you? [2n]_____Chapter X_|_Chapter-Name_______[2n+1] – ebosi Apr 19 '16 at 12:59
1

the answer provided by Christian Hupfer solves, in a specific way, the issue. But when I've added nomenclature nomencl and bibliography bibtex, headings become painful. So I discovered \usepackage{titleps}, instead of fancyhdr that provide simple solution: set up plain and main pagestyle and other styles builded up eg. for nomenclature and bibliography , changing pagestyle whenever you want.

  • I can't solve things which aren't in your 'MWE' -- As your answer implies: My answer is useless for you and I can delete it – user31729 Apr 20 '16 at 6:18
  • @ChristianHupfer I'm sorry, next time I'll be more specific. I discovered this issue later. BTW thank you – Chris Apr 20 '16 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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