2

KOMA class allows titles (\title{}) and subtitles (\subtitle{}). I want to make a header that automatically inserts both.

In the standard article class the title can be achieved using the command \runtitle:

\usepackage{fancyhdr}
\pagestyle{fancy}
    \fancyhf{} %clear header footer
    \fancyhead[L]{\today} 
    \fancyhead[R]{\runtitle} 

but is there a similar \subtitle command? Ideally:

\usepackage{fancyhdr}
\pagestyle{fancy}
    \fancyhf{} %clear header footer
    \fancyhead[L]{\today} 
    \fancyhead[C]{\runtitle}
    \fancyhead[R]{\runsubtitle} 
  • You can usually put almost anything you want in the fancyhead. Try something like this: In the Preamble, \def\subtitle#1{\def\mysubtitle{#1}} then \subtitle{Your Subtitle} then in the fancyhdr portion, \fancyhead[R]{\mysubtitle}. You can also use code to style it, perhaps if you want italics or small caps. – user103221 Jan 26 '17 at 0:19
  • But how does this automatically pull from the content in KOMA's \subtitle{} command? – invictus Jan 26 '17 at 3:51
  • also this straight up does not work – invictus Jan 26 '17 at 3:55
  • fancyhdr and koma-script are incompatible. Better use scrlayer-scrpage for your headers and footers. – Johannes_B Jan 26 '17 at 7:29
  • Sorry, I was not making a KOMA-specific comment. Just general purpose. Works for me, but I am using an entirely different setup, which does not already have a \subtitle{} command. – user103221 Jan 26 '17 at 15:42
1

Use the KOMA-script package scrlayer-scrpage. I guess the header will get pretty crowded that way.

invictusKomaHeader

\documentclass[headinclude]{scrbook}
\usepackage{scrlayer-scrpage}
\usepackage{blindtext}
\ihead{\today}
\makeatletter
\chead{\@title}
\ohead{\@subtitle}
\makeatother
\begin{document}
\title{The Wombats Journey}
\subtitle{Spring}
\author{Carl Capybara}
\maketitle
\Blinddocument
\end{document}
| improve this answer | |

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.