What do the toc related commands \@mkboth and \markboth do?

  • 2
    It is mostly the same as \markboth, the kernel docs suggest class and package writers sometimes use \@mkboth instead as then certain packages can redefine it to do nothing. See texdoc source2e
    – daleif
    Aug 30, 2014 at 15:26
  • 1
    Fair enough. I now edited the question to ask for \markboth as well.
    – Matti
    Aug 30, 2014 at 15:36

1 Answer 1


Here is the definition of \markboth from the LaTeX kernel:

    \let\label\relax \let\index\relax \let\glossary\relax
    \unrestored@protected@xdef\@themark {{#1}{#2}}%
    \@temptokena \expandafter{\@themark}%

It takes two arguments, designed to aid in the setting of the headers in twoside mode - the first is set as the left page header, while the second ends up in the right page header.

In contrast, \@mkboth is used as an internal kernel tool and may take on multiple functions. From source2e (section 65.3 marking conventions, p 310):

Commands like \tableofcontents that should set the marks in some page styles use a \@mkboth command, which is \let by the pagestyle command (\ps@...) to \markboth for setting the heading or to \@gobbletwo to do nothing.

For example, the empty page style (in latex.ltx) sets


while the headings page style (in article.cls) sets

  • Are \markboth and \@mkboth thus only intended to be used with twoside option?
    – Matti
    Aug 30, 2014 at 17:41
  • 1
    @Mappi: No. Their effect will depend on the twoside option, but you can use them in both.
    – Werner
    Aug 30, 2014 at 17:47
  • 2
    For anybody else who's also wondering what \unrestored@protected@xdef does, I asked this question (which was before I got enough reputation to comment everywhere, thus explaining why I didn't just ask in a comment on this answer.) Dec 31, 2017 at 2:32
  • @Werner: OK, but what does the \temptokena macro do? Dec 31, 2017 at 2:38
  • 1
    no \firatmark and \botmark are primitives so they will get the contents of \mark (both groups) but the latex macros \@leftmark and \@rightmark extract the first or second group respectively Jan 2, 2018 at 0:22

You must log in to answer this question.

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