How do I deal with very long section title shown in page header?

I do not what is the appropriate short title, but some like this solve the problem:

\chapter[Yang Mills Theories]
{Asymptotic Behaviour of Supersymmetric 
Yang Mills Theories in The Two 
Loop Approximation}

All sectioning commands (\chapter,\section, etc.) have this optional argument that is used in headers and table of contents.

Edit: The automatic truncation at some length in general is not a good idea for short titles, as usually this could left a string with no meaning. What if the key words of the chapter title are not "Asymptotic Behaviour" but "Loop Approximation" ? And what if the truncation left a incomplete word as "Asymptotic Behaviour of Super"... What "Super", maybe Superman? Do you really want a table of contents with truncated titles?

However, if that is no problem for you, this is an automatic solution using xtring:

mwe

\documentclass{book}
\usepackage{xstring}
\usepackage{lipsum}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE, RO]{\scriptsize \slshape \rightmark}
\fancyhead[RE, LO]{\scriptsize \slshape \leftmark}
\fancyfoot[R]{\scriptsize \thepage}
\def\mychapter#1{\StrLeft{#1}{20}[\Result]\chapter[\Result\ldots]{#1}}
\begin{document}
\pagestyle{fancy}
\mychapter{Asymptotic Behaviour of Supersymmetric Yang Mills 
Theories in The Two Loop Approximation}
\lipsum[2]
\section{Calculation of $\beta \left( g \right)$}
\lipsum[3-12]
\end{document}

I have found a package truncate that does this! Here is how

% !TEX encoding = UTF-8 Unicode
\documentclass[UTF8, english]{book}
\usepackage{babel}
\usepackage{blindtext}
\usepackage{lipsum}

\usepackage[fit, breakall]{truncate}
\usepackage{fancyhdr}

\fancyhf{}
\fancyhead[LE, RO]{\tiny \truncate{0.47 \textwidth} \leftmark}
\fancyhead[RE, LO]{\tiny \truncate{0.47 \textwidth} \rightmark}

\begin{document}
\pagestyle{fancy}

\chapter{Asymptotic Behaviour of Supersymmetric Yang Mills Theories in The Two Loop Approximation}

\blindtext

\section{Calculation of $\beta \left( g \right)$ and a lot more text over here which to too long to show}

\lipsum
\blindtext

\end{document}

There are two more pieces of detail to be noticed.

  1. Package truncate has to be included with option breakall, which allows truncation at any character. If not, the truncation would only happen at the end of words or hyphenation points, which could affect the positioning of header.
  2. Package truncate has to be included with option fit, which prints the output in its natural position.

Here is the output

truncate header