0

I would like to show the long chapter title in the TOC and the short title in the headers (which means I do not want the short title in the TOC).

\documentclass{report}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\normalsize\thepage}
\fancyhead[RE]{\footnotesize\itshape title}      
\fancyhead[LO]{\textcolor{black!90}{\footnotesize\itshape\leftmark}}
\renewcommand{\footrulewidth}{0.2pt}
\renewcommand{\headrulewidth}{0.2pt}
\usepackage[dvipsnames, table, svgnames]{xcolor}
\usepackage{lipsum}
\begin{document}
    \tableofcontents
    \chapter[Very long Very long Very long Very long  long long  long long  long]{Very long Very long Very long Very long Very long Very long Very long}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
        \lipsum[1-2]
    \section{Long and short titles testing}
        \lipsum[1-2]
    \section{Long and short titles testing}
        \lipsum[1-2]
        \chapter[Very long long  long long  long long  long Very long Very long Very long  long]{Very long Very long Very long Very long Very long Very long Very long}
        \lipsum[1-2]
        \section{Long and short titles testing}
        \lipsum[1-2]
        \section{Long and short titles testing}
        \lipsum[1-2]
        \section{Long and short titles testing}
        \lipsum[1-2]
        \section{Long and short titles testing}
        \lipsum[1-2]
\end{document}
2
  • What seems to be the problem? Commented May 6, 2021 at 18:45
  • I want to show the short title only in the header, not in the TOC. Commented May 6, 2021 at 18:54

1 Answer 1

1

Use \chaptermark{Very short title chap. 1} after \chapter.

a

b

\documentclass{report}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\normalsize\thepage}
\fancyhead[RE]{\footnotesize\itshape title}      
\fancyhead[LO]{\textcolor{black!90}{\footnotesize\itshape\leftmark}}
\renewcommand{\footrulewidth}{0.2pt}
\renewcommand{\headrulewidth}{0.2pt}
\usepackage[dvipsnames, table, svgnames]{xcolor}
\usepackage{lipsum}
\begin{document}
    \tableofcontents
    
    \chapter[Very long Very long Very long Very long  long long  long long  long TOC 1]{Very short title chap. 1}
    \chaptermark{Very short title chap. 1} % for a short  header <<<<<<<<<<<<<<<
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \chapter[Very long long  long long  long long  long Very long Very long Very long  long TOC 2]{Very short title chap. 2}
    \chaptermark{Very short title chap. 2} % for a short  header <<<<<<<<<<<<<<<
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
    \section{Long and short titles testing}
    \lipsum[1-2]
\end{document}

You might want to try this setup for the headers

\renewcommand{\chaptermark}[1]{\markboth{#1}{}} % remove Chapter xx from the header
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\normalsize\thepage}
\fancyhead[RE]{\footnotesize\itshape\nouppercase{Title of the report}} % use lower case    
\fancyhead[LO]{\textcolor{black!90}{\normalfont\footnotesize\itshape\nouppercase{\leftmark}}} % use lower case
\renewcommand{\footrulewidth}{0.2pt}
\renewcommand{\headrulewidth}{0.2pt}

You must log in to answer this question.

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