Truncate header in fancyhdr

Sometime header overlaps with fancyhdr when section titles are too long. Here it’s a possible fix from stackoverflow:

\usepackage{fancyhdr}
\usepackage[hyphenate]{truncate} % hyphenate words. Other options are: breakwords, breakall

\fancypagestyle{truncatehdr}{%
\fancyhf{} % remove everything
\lhead{\truncate{15em}{\leftmark}}
\rhead{\truncate{15em}{\rightmark}}
\cfoot{\thepage}}

\pagestyle{truncatehdr}

In this way you truncate the header to fit in.

If you want to ask me a question or leave me a message add @bougui505 in your comment.