[OS X TeX] Geometry package, lists and hfill weirdness

Frank STENGEL fstengel at mac.com
Mon Oct 15 12:34:52 EDT 2007

Le 15 oct. 07 à 15:34, Charilaos Skiadas a écrit :

<snip>

>
> So two questions:
> 1. Is this a known behavior of the geometry package, and do you
> know of a way to circumvent it?

Actually no: what geometry does is change the (logical) paper
margins. The fact is that on an A4 sheet, article uses rather large
margins. So in any case the there!'' are truly placed at the right
margin. What you may want to do is add a \hbox{} after the hfill so
that the skip (hfill) is not gobbled (unskipped) when the line is cut.

Actually what happens (more or less) is that when TeX cuts a line it
kills any white space (stretchable or no) at the end of the line. If
this line is the last line of a paragraph, it adds the glue
(stretchable space) defined in \parfillskip, which here is equivalent
to a \hfil (one l, infinitely less springy than a \hfill) So you end
up with single line paragraphs of the form:

<left margin> \hfill Hi \hfill There! \hfil <right margin>

The \hfil being weak, it will be smashed by the \hfills therefore
giving the impression of:

<left margin> \hfill Hi \hfill There! <right margin>

> 2. How can I make the \filltwo calls in the enumerate environment
> distribute their arguments equidistant in a single line?

Try this:

\documentclass{article}
\usepackage[left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\newcommand{\filltwo}[2]{\par\hfill #1 \hfill {#2} \hfill\hbox{}}
\begin{document}
\begin{enumerate}
\item In list:\par
\hfill Hi \hfill there! \hfill\hbox{}
\item Also in list:
\filltwo{Hi}{there!}
\end{enumerate}
%Another way would be to use hfil
\par\hfil Hi \hfil there!\par % notice, no tailing \hfil, it is
\filltwo{Hi}{there!}
\end{document}

Another way would be to use boxes such as :

\hbox to 10cm{\hfill Hi \hfill There! \hfill}

HTH

--
Frank STENGEL (fstengel<at>mac.com)