I'm looking to get chapter names in the header of my document. I am using the article class, and the code below is an example of how each chapter/section begins.

\noindent {\huge \textbf {Chapter 1}}

What I'm looking to achieve is a header with the following on the right-hand side:


The header for the pages in chapter two should be:


and so on.

Could anyone assist me with this? I know a little about the fancyhdr package, but as I understand, it uses the chapter name in the book class, while I am looking to insert text, and the section name in the article class.

  • For the sake of consistency, I suggest creating a macro to set your chapters, just like \chapter in other document classes that have them. What do you want on the left page header? Do you only have one \section per "chapter"? – Werner Apr 24 '14 at 14:20
  • ...and what about numbering of the sections like what usually happens when you use \section? – Werner Apr 24 '14 at 14:26
  • 1
    Welcome to TeX.SX! Why not using the book class if you have chapters? – egreg Apr 24 '14 at 14:26
  • @Werner I would like the left page header blank. There is only one section, and several subsections per chapter. There is a code snippet that I found lately that suppresses the number beside the Introduction. – Matthew Apr 24 '14 at 14:41
  • 1
    I don't know too much about why you should choose one class over another, but I am using report class. You can have chapters (and I have them in my fancyhdr output. Incidentally, I have just inserted an abstract by just writing "Abstract" and putting some text after it. I don't really understand the point of the abstract environment TBH! – FionaSmith Apr 24 '14 at 15:03

In the following minimal example I reformatted \section to be like \chapter by making it a display and inserting Chapter~ before the numbering (all provided by titlesec:

enter image description here

\usepackage[a5paper]{geometry}% Just for this example
\fancyhead[L]{}% No header on Left pages

  {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\renewcommand{\sectionmark}[1]{\markright{\MakeUppercase{Chapter~\thesection: #1}}{}}

\section{A new section}

Effectively \section now looks like \chapter (nothing has been done to affect the way \section* is handled).

| improve this answer | |

The titlesec package allows to create new sectioning levels. So I create a chapter level, between part and section, that doesn't start a new page since it is in an article. Of course I have to define its formatting and how it appears in the headers/footers and in the table of contents. All this can be done by titlesec and its companion packagestitlepsandtitletoc`. So here is an attempt:

\documentclass[english, twoside]{article}

\usepackage[pagestyles, newparttoc, explicit,outermarks]{titlesec}%

 \titleformat{\chapter}[block]{\Large\bfseries\boldmath\filleft\lsstyle}{\MakeUppercase{\chaptertitlename}\enspace\thechapter: } {1em} {\MakeUppercase{#1}}%


{\contentslabel[\thecontentslabel.]{1.2em}}{}{\titlerule*[1pc]{.} \contentspage}

\settitlemarks{chapter, section}%\ifthesection{}




\section{A First Section. }
\section{A Second Section}


\section{Section A}
\section{Section B}


enter image description here

| improve this answer | |
  • There seems to be something wrong with your even headers. – Werner Apr 24 '14 at 18:35
  • @Werner: You're right. I forgot to check all the details. This is due to the fact that in tne article class, the tableofcontents is a \section command. All other even page headers, which I didn't join to my answer, are normal. I'll check for a workaround. – Bernard Apr 24 '14 at 21:13
  • @Werner: Finally it had nothing to do with table of contents (which I turned into a chapter any way), but in the way the marks were set. I changed the default innermarks to outermarksand used the ifthesection test. – Bernard Apr 24 '14 at 23:54

If you just a line in the beginning of each chapter redefining you header you should be able to achieve this using fancyhdr. You can read more about using the fancyhdr package here.

The following code should give you what you want.





\noindent {\huge \textbf {Chapter 1}}
\fancyhead[RE,RO]{CHAPTER 1: \rightmark}
\noindent {\huge \textbf {Chapter 2}}
\fancyhead[RE,RO]{CHAPTER 2: \rightmark}
\section{A new section}
| improve this answer | |

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.