I'm trying to define a header style for my paper based on the scrartcl class. After digging through some documentation I came along the scrpage2 package to create the headings. I get the layout as I want it, which is great, but I don't get the automark command. It puts in a heading, which is great, but it seems strange.

By strange I mean that it puts Contents as the header for Contents, which is what I expect, but on the next page (notice the \vfill and \pagebreak) it puts 3 Third as the heading, which is not what I expected.

I expect it to put the very first section or subsection it finds on a page in the header.

Have I misunderstood how the automark command works or do I need to put in extra options? (Like \automark[subsection]{section})

EDIT: Double weird: it works when I replace all \sections in the example with a \blinddocument. I'm sorry I am so unclear, though, I just have no clue at all.



\usepackage[automark]{scrpage2} % This should be set AFTER setting up the page geometry


\title{A Minimal Working Example}



\subsection{First of Fourth}

P.S. It's been a few years since I last used latex and a bit of a struggle to get re-acquainted, but my classmates are already jealous of the layout. So thanks for the help, everyone!


Page headings in Latex

Page headings in Latex are given in terms of "left marks" and "right marks". Typing \markboth{left}{right} means that the heading on the left (even) page should be left, and the heading on the right (odd) page should be right, from now until it is changed again.

If more than one \markboth happens on the same page, then Latex takes the last left mark and the first right mark. You can see this behavior in the following example:


This is the first page

This is the second page


Page headings using scrpage2

To answer your question, then: automark sets it up so that calling new chapters and sections automatically calls \markboth (or equivalent). In your case, sections are being put on the left page as the left mark, and this is why you see what you do.

The key to changing this is the command

\automark[right side]{left side}

One thing you might want to do is just put sections on the odd pages and the author on even pages. You could accomplish this by

\automark[section]{section} % section at top of every page
\lehead{Zsub}               % but overwrite even pages with the author

Of course, you could put anything you want inside lehead. If you really want to put the section at the top of every page you can use the right mark on the left page.


For more information on automark, lehead, and how to further customize the headers, you can see the scrpage2 chapter in the KOMA-Script guide (English version).

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.