1

I am currently trying to display the current section in the top-right header, but as I am using unnumbered sections, they do not appear and the only displayed section is Contents, which it now says on every page. My current code looks something like this:

\usepackage{fancyhdr}
\fancyhead[R]{\rightmark}

\begin{document}
\section*{Abreviations}
\addcontentsline{toc}{section}{Abreviations}
\subfile{sections/Abreviations}
\tableofcontents
\end{document}

Any help or advice is appreciated!

2
1

Unnumbered sections don't set marks. But you can set them yourself, like

\markright{Abbreviations}

\documentclass{article}

\usepackage{fancyhdr}
\fancyhead[R]{\rightmark}
\pagestyle{fancy}

% Unnumbered section
\newcommand{\UNsection}[1]{\section*{#1}
  \markright{#1}}

\begin{document}

\UNsection{Abreviations}

\addcontentsline{toc}{section}{Abreviations}

Put your abbreviations here

\tableofcontents
\end{document}

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.