[texhax] determine remaining space

Florian Knorn floz at gmx.de
Wed Sep 7 19:15:04 CEST 2005


hey william !

thank you very much for your help !!

i got it working, sort of. a few problems remain, surely due to the use
in bibtex, but that's okay / i hope to be able to fix them.

but besides -- i tried many ways of determining the remaining space. why
do things like \newlength{\temp} \settowidth{\temp}{\fill} not work ?

i'd still have some other use for the wanted macro (\remainingspace that
is).

have you, or anybody else got any ideas for that ?


William F. Adams schrieb:

> On Sep 7, 2005, at 10:49 AM, Florian Knorn wrote:
>
>> could anybody plz tell me a macro that returns the remaing space in the
>> current text line ? like \remainingspace would contain the length like
>> "3cm" if the remaining space to the end of the line is 3cm.
>>
>> now here is what i would like to be able to do with it.
>>
>> 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.
>>
>> here is an example for that (where url fits)
>>
>> [1]  Author 1, Title bla bla blabla blabla
>>      sept. 2004.        urlurlurlurlurlurl
>>
>> and here where it doesn't
>>
>> [1]  Author 1, Title bla bla blabla blabla
>>      some more bla, sept. 2004.
>>                         urlurlurlurlurlurl
>
>
> Instead of trying to work it out manually, set it up so that TeX will
> place things where they should go automagically, say something like this:
>
> \documentclass{minimal}
>
> \setlength{\textwidth}{2.375in}
> \setlength{\parindent}{0pt}
> \begin{document}
> \parfillskip=0pt[1]  Author 1, Title bla bla blabla blabla
>      sept. 2004.  \hfill\allowbreak\strut\hfill     
> \strut\hfill\hbox{{\hfill urlurlurlurlurlurl}}
>
> \parfillskip=0pt plus 1fil
> and here where it doesn't
>
> \parfillskip=0pt[1]  Author 1, Title bla bla blabla blabla
>      some more bla, sept. 2004.
>                   \hfill\allowbreak\strut\hfill     
> \strut\hfill\hbox{{\hfill urlurlurlurlurlurl}}
>
> \parfillskip=0pt plus 1fil
> This is an extra paragraph.
> \end{document}
>
> The key here is to restore \parfillskip after the paragraph ends.
>
> William



More information about the texhax mailing list