0

Actually I already found an answer to the center text left/middle/right-problem:

The big question is how to add a filling rule between the text parts. I tried the following, facing the problem that the rule overlaps with the text:

\noindent \Large \makebox[0pt][l]{Number}%
\makebox[\textwidth][c]{\hrulefill Title \hrulefill}%
\makebox[0pt][r]{}

How to fix it properly ?

Leon
  • 515
  • 3
  • 8

1 Answers1

1

Two approaches:

Compute the alignment explicitly

{\Large \setbox0=\hbox{Title}
 \setbox1=\hbox{Number}
 \dimen0=\hsize \advance\dimen0 by-\wd0
 \divide\dimen0 by 2
 \dimen1=\dimen0 \advance\dimen1 by-\wd1
 \hbox to\hsize{\box1\leaders\hrule\hskip\dimen1 plus1fil
  \box0\leaders\hrule\hskip\dimen0plus 1fil}}

In order to overcome rounding errors, the leaders are made stretchable by adding plus 1fil.

Employ TeX's typesetting algorithm (preferred)

Give the first rulefill (between Number and Title) a minimum width of zero, plus 1fill of stretchability. But let the second rulefill (after Title) be at least as wide as the text Number, again plus 1fill of stretchability. Then TeX uses the same amount of stretchability for both rulefills, but adds the minimum width to the second rulefill, making it wider by the width of Number, exactly what is desired.

\hbox to\hsize{\Large
 \setbox0=\hbox{Number}\dimen0=\wd0
 \box0 \leaders\hrule\hfill
 Title\leaders\hrule\hskip\dimen0 plus 1fill}