[texhax] Positioning that depends on space available in the current line

Arnaud Schmittbuhl aschmittbuhl at libertysurf.fr
Mon Jun 20 14:28:25 CEST 2011


Le Mon, 20 Jun 2011 14:14:44 +0200,
Aleksandar Zec <zealeksanman at gmail.com> a écrit :

> Hello,
> 
> I would like to achieve this effect:
> 
> aaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaa             bbbbb
> 
> aaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaa
>    bbbbbbbbbbbbbbbbbbbbbb
> 
> 'aaa' is a normal paragraph text. 'bbb' is a signature that should be
> positioned
> 
> (1) on the right end of the last line if there is enough place;
> (2) in the next line if there is not enough place, right aligned.
> 
> Any package/trick to do this automatically?


The Texbook p. 106

\def\signed{#1}{{\unskip\nobreak\hfil\penalty50
  \hskip2em\hbox{}\nobreak\hfil #1
  \parfillskip=0pt \finalhyphendemerits=0 \par}}

-- 
Arnaud Schmittbuhl


More information about the texhax mailing list