0

The running headers are occasionally too long, I tried using \sectionmark but it doesn't work...

MWE:

\documentclass[twocolumn,a4paper,10pt]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}

\tableofcontents


\section{Introduction}

\lipsum{5}

\section{Here's long text that is two long for the page and I'd like to substitute it but can't figure out how}
\sectionmark[long text]

\lipsum{5}

\end{document}
1
  • The fancyhdr documentation, section 33 "Large chapter/section titles" describes a couple of solutions. May 9, 2022 at 18:57

1 Answer 1

1

Section-like commands have an optional argument for such cases.

\documentclass[twocolumn,a4paper,10pt]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}

\tableofcontents


\section{Introduction}

\lipsum{5}

%The next line
\section[This is the shortened version]{Here's long text that is two long for the page and I'd like to substitute it but can't figure out how}
%\sectionmark[long text]

\lipsum{5}

\end{document}
2
  • I don't see an answer here.
    – user26732
    May 9, 2022 at 19:14
  • @user26732 Now the place is marked %The next line. May 9, 2022 at 19:16

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.