I am writing a thesis, under the chapter name at the top of the page I would like a line to appear, but I don't have the palest idea on how to do that, I hope you can help.

Edit: I definitely wasn't clear enough. I meant this part of the page, as shown below:

enter image description here

  • Which document class are you using? – Gonzalo Medina Jun 11 '13 at 11:26
  • @GonzaloMedina I am using book. – haunted85 Jun 11 '13 at 11:26
  • 4
    Use the fancyhdr package. – Gonzalo Medina Jun 11 '13 at 11:41

You can use the fancyhdr package to customize the headers/footers of your document; a little example:

\usepackage[a6paper]{geometry}% just for the example
\usepackage{lipsum}% just to generate text for the example



\section{A Test Section}


enter image description here

E stands for "even"; O, for "odd"; L, C, R stand for "left", "center", "right", respectively. So, for example, \fancyhead[EL]{<text>} will place <text> in the header to the left on even pages. By default, calling \pagestyle{fancy} draws a horizontal rule below the header.

I used \nouppercase since uppercased headers are not pleasing, but this is optional. The package documentation explains how you can further customize the marks used in the headers.

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.