10

The text in my fancyhead is written in small caps. I would like to have it not in small caps. How can I do?

This is my fancyhead:

\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}

something like that:

enter image description here

2 Answers 2

5

To get a format similar to the one in the example page, you can do like this:

\documentclass[a4paper]{book}
\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[RE]{\itshape\nouppercase{\leftmark}}
\fancyhead[LO]{\itshape\nouppercase{\rightmark}}
\fancyhead[LE,RO]{\thepage}

I assume two-sided printing. Here are the header for an even and an odd page.

enter image description here

enter image description here

8

Use \nouppercase:

\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\nouppercase{\sl{\rightmark}}}}
\rhead[\fancyplain{}{\nouppercase{\sl{\leftmark}}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}

I prefer the use of \itshape over \sl and \rmfamily over \rm

\usepackage{lipsum,fancyhdr}
\lhead[\rmfamily\thepage]{\fancyplain{}{\itshape\nouppercase\rightmark}}
\rhead[\fancyplain{}{\itshape\nouppercase\leftmark}]{\rmfamily\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}

In this case \rmfamily looks superfluous.

2
  • 2
    Using \itshape or \rmfamily is not only a personal preference; the two letter commands should never be used: they exist only for compatibility with older documents and document classes may not implement them.
    – egreg
    Dec 18, 2012 at 8:41
  • The replacement for \sl is \slshape, not \itshape. Dec 18, 2012 at 9:55

You must log in to answer this question.

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