0

I have a problem just as the following picture. Long section names are placed in the header, which overlaps the header number, it will be only seen if one uses short words. enter image description here I use the following code in my class file:

\automark[chapter]{chapter} \ihead{\headmark} \ohead{\pagemark}

I have tried to use code such as \mbox, but the previous correct header(like page 5) goes wrong. Thanks!

  • 1
    most document classes allow a "short form" of a header for just this reason: \chapter[short form]{long form}. if the document class you're using (you don't say which one) always places the optional form in the table of contents, and you don't want that, then you can provide an alternate form of the header with \markboth{short form}{short form}. again, this likely depends on the document class you are using. – barbara beeton Sep 28 '17 at 14:13
  • 1
    That's why the sectioning commands have an optional parameter for a short title, e.g. \chapter[bug 3 Lange Abschnittsnamen]{bug 3 LangeAbschnittsnamen werden in der ...}. The short title goes into the header and the ToC. And please learn about minimal working example (MWE). – Mike Sep 28 '17 at 14:16
  • Thanks for you answer. I use the class of my university, it is based on KOMA-Script. Now the problem is, we want to show the long form not the short form, do you have any idea? – Chuan Sep 29 '17 at 7:21
1

You can use a \parbox inside \ihead:

\ihead{\parbox[c][3\baselineskip][c]{.9\linewidth}{\headmark}}

Then the header must be enlarged. So you have to add headlines=3.25 to the class options. Alternatively you can use

\PassOptionsToPackage{headlines=3.25}{typearea}

before \documentclass{<your class>}.

\PassOptionsToPackage{headlines=3.25}{typearea}% option headlines is needed!
\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\renewcommand\chaptermarkformat{}% to remove the chapter number in header

\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}

\clearpairofpagestyles
\ohead*{\pagemark}
\ihead{\parbox[c][3\baselineskip][c]{.9\linewidth}{\headmark}} 

\usepackage{blindtext}% only for dummy text
\begin{document} 

\chapter{bug 3 - Lange Abschnittsnamen werden in der Kopfzeile des D.o.kuments mit zu wenig Abstand gesetzt, was man nur sieht wenn man kurze Wörter verwendet und der Text lang genug ist.} 
\Blindtext[10]
\chapter{Kurzer Titel}
\Blindtext[10]
\end{document}

enter image description here


If your class uses the outdated package scrpage2 the example changes to

\PassOptionsToPackage{headlines=3.25}{typearea}% option headlines is needed!
\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\renewcommand\chaptermarkformat{}% to remove the chapter number in header

\usepackage{scrpage2}
\pagestyle{scrheadings}
\automark[chapter]{chapter}

\clearscrheadings
\ohead[\pagemark]{\pagemark}
\ihead{\parbox[c][3\baselineskip][c]{.9\linewidth}{\headmark}} 

\usepackage{blindtext}% only for dummy text
\begin{document} 

\chapter{bug 3 - Lange Abschnittsnamen werden in der Kopfzeile des D.o.kuments mit zu wenig Abstand gesetzt, was man nur sieht wenn man kurze Wörter verwendet und der Text lang genug ist.} 
\Blindtext[10]
\chapter{Kurzer Titel}
\Blindtext[10]
\end{document}

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.