I have a (onesided) document with fancyhdr and pagestyle fancy so it displays the section-title on the right header and the subsection-title on the left header. If section and subsection titles are lengthy they start to overlap each other.
Example:
\documentclass[a4paper,10pt]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\begin{document}
\section{some section with quite a lengthy title}
\lipsum
\subsection{very very very long title of subsection}
\lipsum
\end{document}
I know of two solutions:
give short section/subsection headings like in
\documentclass[a4paper,10pt]{scrartcl} \usepackage[utf8x]{inputenc} \usepackage{lipsum} \usepackage{fancyhdr} \pagestyle{fancy} \begin{document} \section[short section]{some section with quite a lengthy title} \lipsum \subsection[short subsection]{very very very long title of subsection} \lipsum \end{document}I don't like this because I don't want to have the short version in my toc.
use
\sectionmarklike in\documentclass[a4paper,10pt]{scrartcl} \usepackage[utf8x]{inputenc} \usepackage{lipsum} \usepackage{fancyhdr} \pagestyle{fancy} \begin{document} \section{some section with quite a lengthy title} \sectionmark{short section} \lipsum \subsection{very very very long title of subsection} \subsectionmark{short subsection} \lipsum \end{document}But this just doesn't work right - the short subsection mark is not obeyed on page 2, but is used correctly on page 3. That feels just really wrong.
So, how can I make version 2 work 'right'?

\subsectionmark{}into the\subsection{}instead of repeating it. This lead to a fatal error on compilation. – Sunday Jan 23 '13 at 14:39If one puts everything together one has to repeat both titles:
– Sunday Jan 23 '13 at 14:42\subsection[very very very long title of subsection]{very very very long title of subsection\subsectionmark{short subsection}} \subsectionmark{short subsection}titlesecin your example, the problem mentioned by @sunday is not fixed. @andrew Would you have a solution that works even when one uses the packagetitlesec? Indeed I use this package to format the title of my section, subsection... and don't how to deal with that now. – Antoine Apr 17 '16 at 20:45titlepsetc. – Andrew Swann Apr 18 '16 at 07:00