4

How can I customize the header to have \author, the \title and the \date in the header and underline it?

Since I use a Koma Script document class I want to avoid the fancyhdr package and use scrlayer-scrpage. I have tried \chead{\title \author \date} but it does not change maybe due to the automark option in \usepackage[automark]{scrlayer-scrpage}. I want the header to be on every page except the title page and list of contents.

So in fancyhdr the code would be:

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{Lady Gaga: Test}
\fancyhead[RE,LO]{\today}
\fancyfoot[CE,CO]{\thepage}
\fancyfoot[LE,RO]{}
1
5

Here is how you could 'translate' your fancyhdr into scrlayer-scrpage:

\documentclass[headinclude=true]{scrbook}
\usepackage{blindtext}

\usepackage[headsepline=.5pt]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles

\ohead{Lady Gaga: Test}
\ihead{\today}
\cfoot*{\pagemark}

% If you want to change the font/shape etc.:
%   \setkomafont{pageheadfoot}{...}
%   \setkomafont{pagenumber}{...}

\begin{document}
    \blinddocument
\end{document}

If you want to automate the author/title insertion, you could add

   ...
\usepackage{titling}
\author{Lady Gaga}
\title{Test}
\date{\today}

\ohead{\theauthor: \thetitle}
\ihead{\thedate}
\cfoot*{\pagemark}
   ...

enter image description here

0

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.