TeXnik - Tips TeX and LaTeX

Welcome to the TeXnik website (under construction)

TUG logo

Main page

Search CTAN:


Google c.t.t.

Google d.c.t.t.



Author-/Titlename in header |  Examples  |  fancyheader |  letter class |  plain pagestyle for fancyhdr |  short headers  |  Table in the header/footer | 

  • Creating Headers and Footers Using LaTeX
  • Page Layout in LaTeX

  • Author-/Titlename in header
    Write in latex preamble:

    % for example title on the left and author on the right (with package fanyhdr)

    plain style for fancyhdr
    For chapters latex always uses the \thispagestyle{plain} command to switch from the actual headerstyle to plain. This can be modified by fancyhdr. For example write in latex preamble:

      \fancyfoot[C]{\bfseries \thepage}
    This gives a bold centered pagenumber.

    Short Headers
    just under your chapter write in tex(red)

    \chaptermark{My short Title} 
    or for a section

    Footer and header with fyncyhdr
    Package fancyhdr gives the possibility to define own header and/or footer.
    First some definitions:
    even (left) pages:

    LE CE RE
    Text (even page)
    LE CE RE
    odd (right) pages:
    LO CO RO
    Text (odd page)
    LO CO RO
    the contents of header and/or footer is set by:
    \fancyhead[LE,...]{ the headertext } \fancyfoot[LE,...]{ the footertext }
    \fancyhead[CE,...]{ the headertext } \fancyfoot[CE,...]{ the footertext }
    \fancyhead[RE,...]{ the headertext } \fancyfoot[RE,...]{ the footertext }
    remember that there is a difference between the first pages of chapters, which are in plain-style and the other ones in fancy style:
    You can redefine the plain style in another way.

    A header- and a footline are the defaults. No lines are given by the width 0pt.

    Example for special header and footer (\chaptermark is rewritten for twoside-option, where on the left page the chapter and on the right page the section are part of the header:
    \renewcommand{\chaptermark}[1]{% twoside and 
        \ifnum \c@secnumdepth >\m@ne
        \hfill\thechapter\quad \if @mainmatter
            \@chapapp\ \thechapter\quad
        \ifnum \c@secnumdepth >\m@ne
          \if @mainmatter
            \@chapapp\ \thechapter\quad
    \renewcommand\sectionmark[1]{\markright{\thesection\ #1}}
    % positioning
    \fancyhead{}% delte the defaults
    \fancyhead[RE,LO]{\bf\large\thepage} % right-even and left-odd
    \fancyhead[LE]{\colorbox{myColor}{\parbox{0.9\columnwidth}{\leftmark}}} % even pages!
    \fancyhead[RO]{\colorbox{myColor}{\parbox{0.9\columnwidth}{\rightmark}}} % odd pages!
    \fancyfoot{} % clear

    local time: Sat Jun 22 21:07:09 CEST 2024 ; file is: 1823.17623842593 days old
    contact webmaster _at_ TeXnik.de