groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Horizontal positioning, .nr vs \R


From: Larry Kollar
Subject: [Groff] Horizontal positioning, .nr vs \R
Date: Tue, 23 Mar 2010 10:42:18 -0500

I have some long headings that run two, sometimes three, lines in my table of 
contents. The heart of the macro I'm using to set these lines looked like:

 .  ie (u;\w'\\$*'+\\*[ind:0])>(u;\\n[toc:colwid]-0.25i) \{\
 .   ll (u;\\n[LL]-0.25i)
 .   nop \\$*
 .   nr toc:horiz \\n[.k]
 .   ll \\n[LL]u
 .   sp -1
 .   nop \h'\\n[toc:horiz]u'\|\\*[LDR]\|\\*[TOCpg]
 .  \}
 .  el \{\
 .   nop \\$*\|\\*[LDR]\|\\*[TOCpg]
 .  \}

The above was almost perfect, except that entries that require more than one 
line had a small but noticeable extra gap between the end of the text and the 
start of the leader. However, this breaks:

 .ds LDR \a
 .  ie (u;\w'\\$*'+\\*[ind:0])>(u;\\n[toc:colwid]-0.25i) \{\
 .   ll (u;\\n[LL]-0.25i)
 .   nop \\$*\R'toc:horiz \\n[.k]'
 .   ll \\n[LL]u
 .   sp -1
 .   nop \h'\\n[toc:horiz]u'\|\\*[LDR]\|\\*[TOCpg]
 .  \}
 .  el \{\
 .   nop \\$*\|\\*[LDR]\|\\*[TOCpg]
 .  \}

Setting the toc:horiz register inline using the \R escape causes the leader to 
start very close to the page number when the last line of the heading has only 
one word.

This line *does* work:

 .   nop \\$*\h'0'\R'toc:horiz \\n[.k]'

In other words, forcing a zero horizontal motion flushes the single word out 
and sets the .k register properly. Is this expected behavior, and if so, is 
\h'0' the correct way to flush a partial line?

-- Larry




reply via email to

[Prev in Thread] Current Thread [Next in Thread]