# [OS X TeX] writing twice to the same line

Samuel Lelievre samuel.lelievre.tex at free.fr
Sun Dec 13 13:13:35 EST 2009

Following my earlier post - an example ... and questions.

An example illustrating the use of \rlap, \clap and \llap
in section titles, to answer Florian's question.  I hoped
that would solve it perfectly, but I have to admit I note
the following flaws in the output:

1. In the titles produced this way, the spaces around the
center bit aren't quite equal - the one on the left being
slightly larger.

2. If section numbers get to 10, the center bit will move
slightly right - because the width for the section number
gets bigger and the width for the section title shorter.

Not sure how to explain (1) nor how to solve (2) - I'd be
interested in any hints!
SL

%%%%% rlap-clap-llap-in-sec-titles.tex %%%%%

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{lipsum}

\def\clap#1{\hbox to 0pt{\hss#1\hss}}

\title{\texttt{\string\rlap}, \texttt{\string\clap}
and \texttt{\string\llap} in section titles}
\author{}
\date{}

\begin{document}
\pagestyle{empty}

\maketitle
\pagestyle{empty}

\section[]{\rlap{leftbit}\hfill\clap{centerbit}%
\hfill\llap{rightbit}}

\lipsum[65]

\section[]{\rlap{longer leftbit}\hfill\clap{centerbit}%
\hfill\llap{rightbit}}

\lipsum[66]

\section[]{\rlap{leftbit}\hfill\clap{longer centerbit}%
\hfill\llap{rightbit}}

\lipsum[75]

\section[]{\rlap{leftbit}\hfill\clap{centerbit}%
\hfill\llap{longer rightbit}}

\lipsum[101]

\end{document}