0

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
  • Your example is incomplete and uses local files, so can't be tested. With a class like scrartcl you could use \addsec instead of \section*. Commented Feb 7, 2021 at 15:09
  • Same problem as covered here: tex.stackexchange.com/q/168378 Commented Apr 9, 2021 at 0:30

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .