I would like to include the section name of the page's displayed section in my header tags in the fancyhdr package, something like

\fancyhf[HR]{SECTION NAME}

How can I go about doing this?

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Speravir
    Commented Mar 21, 2014 at 4:40

2 Answers 2


titleps provides this out-of-the-box and is not that different in interface/usage from fancyhdr. You might be interested in reading titleps for fancyhdr users.

If you wish to do this straight with fancyhdr, you'll have to patch the sectional unit constructions to store the titles, or use the title marks with some massaging.

You would use

\usepackage{titleps}% http://ctan.org/pkg/titleps
\setheadrule{.4pt}% Header rule
\sethead{\subsectiontitle}% left
        {}%                 center
        {\sectiontitle}%    right

Here's a very minimal example with the addition of the sectional unit number as well:

enter image description here

\usepackage{titleps}% http://ctan.org/pkg/titleps
\setheadrule{.4pt}% Header rule
\sethead{\thesubsection\ \subsectiontitle}% left
        {}%                                 center
        {\thesection\ \sectiontitle}%       right
\section{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
  • Thank you! This is exactly the answer I was looking for. I will upvote you when I have the reputation to do so.
    – encircled
    Commented Mar 26, 2014 at 2:15

I use the fancyhdr package for this task. I usually prepare several new commands to have full control of what will be shown in the header and footer. I enclose a small demonstration.

\mysection{Welcome}{My welcome\ldots}
\mysubsection{Hello World!}{\ldots My Hello World!}
My first page.\newpage 
My second page.

page 1

page 2

You must log in to answer this question.

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