[texhax] determine remaining space

Uwe Lück uwe.lueck at web.de
Thu Sep 8 11:25:55 CEST 2005


At 16:49 07.09.05, Florian Knorn wrote:

>in my bibliography, i have a lot of urls. i would like to have them
>typeset like in the latex companion (2nd ed.). that is, the url is
>always the last entry in an bibliography item and right-aligned. it goes
>into a new line if the remaining space in the line is not enough to hold
>the entire url. if it is, the url stays in the same line.

At 19:21 07.09.05, William F. Adams answered:

>I'm afraid I was a bit rushed before. Here's a version worked up as a
>macro which is non-redundant:
>
>\newcommand{\magicmacro}[1]{\hfill\allowbreak\strut\hfill{#1\parfillskip 
>=0pt\par\unskip\parfillskip=0pt plus 1fil}}

The problem is analogous to placing the author's name right-aligned
after a short text, which TeXbook p. 14 deals with. Accordingly, an
alternative would be something like

\newcommand*{\magicmacro}[1]{{%
   \nobreak\hfil\null\nobreak\hfil#1\parfillskip=0pt\par}}

\null varies William's \strut, the usual \baselineskip suffices for
proper space above the url line.

Lucky typesetting,
Uwe. 



More information about the texhax mailing list