Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm currently working on several projects, where the authors are read from a textfile. I'm also displaying the authors in the header using fancyhdr. This works great if there are just 2 or 3 contributors, but if there are more, the text starts overlapping.

screenshot

The overlapping is also dependent on the document title, which is shown the left.

Is there a way to detect whether the text overlaps, and if it does, use a fallback text (an URL) instead of the authors instead?

Header specification looks like this at the moment:

\usepackage{fancyhdr} % Fancy headers

% Capture title and author
\makeatletter                                                                                                                                         
\let\Title\@title
\let\Author\@author
\makeatother

% Fancy headers configuration
\pagestyle{fancy}
\fancyhead{} % Clear all header fields
\fancyhead[LO,LE]{\bfseries \Title}
\fancyhead[RO,RE]{\Author}
\fancyfoot{} % Clear all footer fields
\fancyfoot[CO,CE]{Page \thepage}
\renewcommand{\headrulewidth}{0.3pt}
\renewcommand{\footrulewidth}{0pt}
share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

I'd say

\makeatletter
\let\Title\@title
\let\Author\@author
\normalfont\sbox0{\normalfont\Title\quad\Author}
\ifdim\wd0>\textwidth\def\Author{<whatever>}\fi

This will use <whatever> if there's not at least a quad of space between the title and the list of authors.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.