[texhax] determine remaining space

Florian Knorn floz at gmx.de
Wed Sep 7 19:31:36 CEST 2005


now THAT works like a charm ::))

thanks a lot, William !!

final question --- is there a way of keeping natbib from placing a
period (.) after my NOTE = {\magicmacro{\url{http://asdfasfd}}} entry ?
I mean other then tampering with the actual style file (the plain one in
my case)?

Because what happens now are entries like


[1]  Author 1, Title bla bla blabla blabla
     sept. 2004.        urlurlurlurlurlurl
     .

and here where it doesn't

[2]  Author 2, Title bla bla blabla blabla
     some more bla, sept. 2004.
                        urlurlurlurlurlurl
     .

(notice the "trailing" period).

Thanks, again, for your kind help !

Florian




William F. Adams schrieb:

> On Sep 7, 2005, at 10:49 AM, Florian Knorn wrote:
>
>> so i would like to have a macro \calcremainingspace so i could go 
>> within
>> an item:
>>
>> @WHATEVER{bla,
>>     AUTHOR = {...},
>>     TITLE = {...},
>>     NOTE = {\magicmacro{\url{http://theurl}}}
>> }
>>
>> and in my stylesheet have defined
>>
>> \newlength{urlwidth}
>>
>> \newcommand{\magicmacro}[1]{%
>>     \settowidth{\urlwidth}{#1}%
>>     \ifthenelse{\remainingspace<\urlwidth}{%
>>        \newline\hfill#1%
>>     }{%
>>        \hfill#1%
>>     }%
>> }
>>
>> anybody got an idead ? i'm sure it can't be that hard, but i just could
>> find anything of help.
>
>
> I'm afraid I was a bit rushed before. Here's a version worked up as a 
> macro which is non-redundant:
>
> \documentclass{minimal}
>
> \setlength{\textwidth}{2.375in}
> \setlength{\parindent}{0pt}
>
> \newcommand{\magicmacro}[1]{\hfill\allowbreak\strut\hfill{#1\parfillskip
> =0pt\par\unskip\parfillskip=0pt plus 1fil}}
>
> \begin{document}
> [1]  Author 1, Title bla bla blabla blabla
>      sept. 2004.        \magicmacro{urlurlurlurlurlurl}
>
>
> and here where it doesn't
>
> [1]  Author 1, Title bla bla blabla blabla
>      some more bla, sept. 2004.
> \magicmacro{urlurlurlurlurlurl}
>
>
> This is an extra paragraph.
> \end{document}
>
> William
>



More information about the texhax mailing list