[texhax] determine remaining space
William F. Adams
wadams at atlis.com
Wed Sep 7 19:21:39 CEST 2005
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
--
William Adams, publishing specialist
voice - 717-731-6707 | Fax - 717-731-6708
www.atlis.com
More information about the texhax
mailing list