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

Samuel Lelievre samuel.lelievre.tex at free.fr
Sun Dec 13 20:13:07 CET 2009

My question 1 was a bit silly - the answer is just because
"leftbit" is shorter than "rightbit", hence no flaw there!

And to fix problem 2, one could introduce a negative space
after the leftbit to offset the title number extra length:
ask TeX the length of the title number, subtract that of a
one-digit title number (or not), and add \hspace*{-length}
where length is the length computed in this manner.

Finally, the use of clap isn't really necessary here, rlap
and llap are enough since we're not bothered by the center
bit having a nonzero length.  So, my solution to Florian's
question is pretty much the same as Herb's, whose commands
more or less redefine llap and rlap.  And I see Florian is
going for a solution that allows line breaks, which wasn't
going great in this approach.

SL

--
Date: Sun, 13 Dec 2009 19:13:35 +0100
From: Samuel Lelievre <samuel.lelievre.tex at free.fr>

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

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

\lipsum

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

\lipsum

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

\lipsum

\end{document}
{"ft_lang_label":"__label__en","ft_lang_prob":0.8220038,"math_prob":0.6622895,"size":2445,"snap":"2022-40-2023-06","text_gpt3_token_len":736,"char_repetition_ratio":0.10979107,"word_repetition_ratio":0.005882353,"special_character_ratio":0.2597137,"punctuation_ratio":0.101321585,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9683731,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-09-30T11:56:00Z\",\"WARC-Record-ID\":\"<urn:uuid:aa0b2486-ac58-49ac-9ff5-62d5e272d51a>\",\"Content-Length\":\"5154\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2bd95111-b40b-41b9-8b31-6a09a1231faf>\",\"WARC-Concurrent-To\":\"<urn:uuid:57610199-0867-4f52-9836-30bcdb32143c>\",\"WARC-IP-Address\":\"94.23.251.76\",\"WARC-Target-URI\":\"https://tug.org/pipermail/macostex-archives/2009-December/042264.html\",\"WARC-Payload-Digest\":\"sha1:FD2YD2JDXDHXCEYGHDFMVP52B5RLGNW6\",\"WARC-Block-Digest\":\"sha1:M35GOSJ6QOWGKVQ7GBZNGTLML57PKKH6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030335469.40_warc_CC-MAIN-20220930113830-20220930143830-00631.warc.gz\"}"}