Page LayoutUnnumbered section names in header: problem with \markright

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
JefVL
Posts: 13
Joined: Sat Mar 22, 2014 10:27 pm

Unnumbered section names in header: problem with \markright

Post by JefVL »

Hi all,

I'm working on my thesis and there is a little issue that I can't seem to solve... I need to use unnumbered sections for my word of thanks and list of abbreviations, but I'd like the titles to show up in the header. I'm using the package "fancyhdr", which has already helped me a lot with my page numbering and my numbered sections, but for some weird reason these two unnumbered sections won't work properly. I've tried using the \markright{Word of thanks} command, but somehow it shows up on the left in the header. My list of abbreviations (which is right after my table of contents) does show up on the right, but it's showing "Contents" in the header instead of "Abbreviations". Any suggestions? Here's a MWE:

Code: Select all

\documentclass[11pt,a4paper,oneside]{article}

\usepackage{fancyhdr}

\pagestyle{fancy}
\setlength{\headheight}{15pt}

\begin{document}

\section*{Word of thanks\markright{Word of thanks}}  %% I've tried placing the \markright command on a separate line too, with no avail
\thispagestyle{fancy}
\cfoot[]{}    %% Using these two commands to prevent page numbering showing up in my footer
\rfoot[]{}

\newpage

\tableofcontents
\lhead[]{}
\cfoot[]{}
\rfoot[]{}

\newpage

\section*{Abbreviations\markright{Abbreviations}}
\thispagestyle{fancy}
\cfoot[]{}
\rfoot[]{}

\end{document}
Thanks in advance!

EDIT: trimmed the MWE a bit
Last edited by JefVL on Wed Mar 26, 2014 12:04 am, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

JefVL
Posts: 13
Joined: Sat Mar 22, 2014 10:27 pm

Re: Unnumbered section names in header: problem with \markri

Post by JefVL »

Anyone? Please?
esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm

Unnumbered section names in header: problem with \markright

Post by esdd »

Here is a Suggestion:

Code: Select all

\documentclass[a4paper]{article}

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\rhead{\leftmark}
%\rfoot{\thepage}
\setlength{\headheight}{15pt}

\usepackage{blindtext}

\begin{document}

\section*{Word of thanks\markboth{\MakeUppercase{Word of thanks}}{}}
\clearpage
\tableofcontents

\clearpage
\section*{Abbreviations\markboth{\MakeUppercase{Abbreviations}}{}}

\clearpage
\blinddocument
\end{document}
Best regards
Elke
JefVL
Posts: 13
Joined: Sat Mar 22, 2014 10:27 pm

Re: Unnumbered section names in header: problem with \markri

Post by JefVL »

Works like a charm, thanks a lot!
Post Reply