Page Layoutfancyhdr | Section Name in the right Header

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ajmal88
Posts: 9
Joined: Sun Sep 02, 2012 1:27 am

fancyhdr | Section Name in the right Header

Post by ajmal88 »

Hi!

I am using fancyhdr to customize my footer and header. Right now I have it exactly as I want it except that I want to have the current section name in the right header. Currently it is just printing 0,1,2,3,4,5 and 6 in the right header.

In the preamble I have:

Code: Select all

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{Author: Name of author}
\chead{Student ID: number}
\rhead{\the section}
\lfoot{\textcopyright university name}
\cfoot{title of project}
\rfoot{Page \thepage\ of \pageref{LastPage}}
After doing some searching on the net I found that this could be achieved by using

Code: Select all

\rhead{\the section}
, but TeXstudio does not recognize this command. I only want the right header to display the current section and don't bother about subsections etc. It should only print the name of the section i.e, Introduction, Literature Review, Theory, Results etc. without any numbering in front of it.

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

fancyhdr | Section Name in the right Header

Post by localghost »

Usually running headers are done by placing commands like \leftmark and \rightmark in the fields where their content shall appear. If that doesn't help, prepare a proper minimal example.


Thorsten
Post Reply