[texhax] Checking the length of paragraph last line
William F. Adams
wadams at atlis.com
Fri Oct 14 22:33:21 CEST 2005
On Oct 14, 2005, at 3:42 PM, pierre.mackay wrote:
> Fifteen or so years back, someone came up with a macro that would, in
> effect, measure the last line of a paragraph so that you could decide
> whether to put an identifying tag (like an author's name) in the white
> space after a short final line or on the next line if the paragraph
> final line stretched near the right margin.
Would a discussion here from the beginning of September count?
Florian Knorn worked things out using _The LaTeX Companion 2e_ as
follows:
On Sep 8, 2005, at 4:05 AM, Florian Knorn wrote:
> Now things work out the exact way I previously "dreamt" of : ) However,
> I am sorry William, but I just discovered a similar, but better working
> way of implementing the url-on-new-line-or-not-issue in the LaTeX
> Companion (Example A-1-8 on p. 849). Better working in that the period
> now does not get pushed into a new line (as described in my last mail).
>
> Together with Karl's \gobble-tip (a command which I haven't heard of
> but
> then found in the Don's TeX-Bible), things work just right --- and I
> don't have to tamper with the BiBTeX style.
>
> So as a résumé for the after-world: here's my final code.
>
> \def\gobble#1{} % "eat" next token
>
> \newcommand{\fancyurl}[1]{% code for pushing the url around
> \hspace*{\fill}\nolinebreak[1]%
> \quad\hspace*{\fill}\finalhyphendemerits=0#1\gobble
> }
and Uwe Lück (uwe.lueck at web.de) had the following charming response
which you could query him on if need be:
At 16:49 07.09.05, 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.
I have a really miraculous algorithm for this general problem,
yet the present e-mail is too short to hold it
(cf. Simon Singh, Lueck's Last Algorithm, chap. 2.4 :-)
-- Uwe
p.s.: Place a "marker" phantom box (e.g. with a small random
height); typeset the paragraph in a testing \vbox with same
parameters as in the text, take line by line from the \vbox,
take word by word from each line into a measuring \hbox
-- until you find you find the "marker" box ...
William
--
William Adams, publishing specialist
voice - 717-731-6707 | Fax - 717-731-6708
www.atlis.com
More information about the texhax
mailing list