[OS X TeX] Problem with \hfill

Piet van Oostrum piet at cs.uu.nl
Mon Oct 3 10:08:31 EDT 2005

>>>>> Ewan Delanoy <delanoy at math.univ-lyon1.fr> (ED) wrote:

>ED>  Hello all,
>ED>  if I resize my page settings with the following commands :

>ED> \addtolength{\textwidth}{4cm}
>ED> \addtolength{\textheight}{4cm}

You don't say when you do this. For example when you do this somewhere
inside the document (after \begin{document}) this almost certainly will
give you problems somewhere.

>ED>  then \hfill has an unwanted behaviour : for example,

>ED> \hfill {Q. E. D. } \newline              in the source file

>ED> produces

>ED> Line n      (...) Q.
>ED> Line n+1  E.D.

>ED>  in the output file. Does anyone know a way to fix this ?

Supposing the changes to \texwidth are in the preamble, I would guess that
the Q.E.D. doesn't fit on the line. But without a complete example it is
hard to tell. Note that you have *two* spaces after the D. One before and
one after the }. One of these will be eliminated by the \newline, but the
other will remain and cause the text to be wider than you may have thought.
By the way, the {} there won't give you anything except the extra space.
Also if you want to keep the QED together, place it in an \mbox.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list