2

I am writing my thesis report and I use the current section in \uppercase to be set as \lhead on every page (one sided printing). The current chapter is not used for the headers.

I have one chapter with no sections which runs over two pages where I would like the current chapter name to be the \lhead in \uppercase. Latex typesets the current chapter on the second page of the chapter correctly but in small case. How can I correct the chapter name here to uppercase?

Here is some code which reproduces the phenomenon. So I would like the header on page 4 to read "2. DEVELOPMENT STATUS". I have read the fancyhdr package documentation but found it confusing to understand how the marks are generated.

\documentclass[a4paper,12pt]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{}{\thechapter. \ #1}}
\lhead{\uppercase{\slshape \rightmark}}

\usepackage{blindtext}

\begin{document}
    \chapter{Introduction}
    \blindtext[2]
    \section{Goals}
    \blindtext[2]
    \section{Approach}
    \blindtext
    \chapter{Development Status}
    \blindtext[4]
\end{document}

Thank you in advance :)

2
  • 1
    Welcome, very good example. Well done. \renewcommand{\chaptermark}[1]{\markboth{}{\MakeUppercase{\thechapter. \ #1}}}
    – Johannes_B
    Jul 2, 2017 at 10:15
  • That worked, awesome! thanks a lot @Johnannes_B :) Jul 2, 2017 at 10:19

1 Answer 1

3

You should use \MakeUppercase.

\documentclass[a4paper,12pt]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{}{\thechapter. \ #1}}
\lhead{\MakeUppercase{\slshape \rightmark}}

\setlength{\headheight}{14.5pt}


\usepackage{blindtext}

\begin{document}
    \chapter{Introduction}
    \blindtext[2]
    \section{Goals}
    \blindtext[2]
    \section{Approach}
    \blindtext
    \chapter{Development Status}
    \blindtext[4]
\end{document}

I also added the required setting to \headheight.

enter image description here

5
  • Well I used \uppercase instead of \MakeUpperCase. Latex does not compile with the latter. The solution offered by Johannes_B however seems to work. Thanks a lot for the help! Jul 2, 2017 at 10:22
  • 1
    @Addiboy You should never use \uppercase in a LaTeX document. My solution works as advertised.
    – egreg
    Jul 2, 2017 at 10:41
  • Oh ok :) I am going to retry it in that case. Pardon me but I am a novice when it comes to Latex. Why am I not supposed to use \uppercase? Jul 2, 2017 at 10:43
  • And btw, I am sorry. Yes you are right....your solution works equally well :) Jul 2, 2017 at 10:45
  • @Addiboy Because it is not LaTeX.
    – Johannes_B
    Jul 2, 2017 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .