I have the next environnement:
\usepackage{fancyhdr}
\pagestyle{fancy}
My problem is the next one. I have a section and a subsection with a too long name and they are overlapping on the page header. I know this solution
\section[section with\\ long title]{section with long title}
But this solution will modify the section name in the table of contents.
I also try the next solution:
\fancyhead[L]{
\begin{minipage}[t]{0.48\textwidth}
\begin{flushleft}
\rightmark
\end{flushleft}
\end{minipage}
}
\fancyhead[R]{
\begin{minipage}[t]{0.48\textwidth}
\begin{flushright}
\leftmark
\end{flushright}
\end{minipage}
}
It is working but the header overlap the lines at the top of the page.
So the big question is: how to say to fancy page style to automatically break the section and/or subsection name in the header of the page without modify the toc and also replace the hline under the header to not cover a part of the text on the page?
titlesec, the[toctitles]option makes the optional (shorter) argument for \section be used only in the header, not in the table of contents. Also, notetitlepsis an easier-to-use alternative tofancyhdr. – Bernard Oct 20 '17 at 13:30