[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] Line Breaks
From: |
Deri James |
Subject: |
[Groff] Line Breaks |
Date: |
Sun, 6 Mar 2011 14:24:06 +0000 |
User-agent: |
KMail/1.13.6 (Linux/2.6.33.7-desktop-2mnb; KDE/4.5.5; x86_64; ; ) |
Apologies for asking a rather esoteric question!
There are several troff commands which cause a line break, the most obvious
being ".br". When a line break occurs 2 things may happen:-
1. The current line is flushed, and
2. Position is moved to start of new line
I say "may" because if the current line is empty then 2 does not occur. This
example illustrates it:-
.sp |2i
1.
.br
.br
2.
Results in output:-
1.
2.
i.e. the 2nd (and any subsequent .br is ignored). This is exactly what you
want, use .sp if you want extra space.
However, if you change the above to:-
.sp |2i
1.
.br
\X'ps:'\c
.br
2.
the output becomes:-
1.
<blank line>
2.
The second .br now does its job because it thinks there is "something" in the
current line, whereas in fact the \X command should just be passed through to
the output device.
My question is: Is this desirable behaviour? Or should \X \Y .device and
.devicem all be "transparent" with regards to whether a line break triggers a
position movement?
The reason for the question is because it is difficult to write macros which
interface with the output drivers which behave "nicely" with existing macro
packages. An example can be found in Keith Marshalls 'pdfmark' macros where he
has to buffer all the .pdfinfo calls into a diversion to later be output by a
call to .pdfsync. The reason for this is because calls to the 'ms' macro .NH
include a '.br' at the start so if a call to .NH occurs at the top of page no
space is inserted but if it occurs while a line is pending a blank line does
occur.
So the general "problem" case is:-
top-of-page | after-a-previous-break
\X command
break
will cause an unintended blank line.
Does my analysis make sense? Is it desirable to make \X et al "transparent" so
this effect won't happen. Will it break something else? Will I be able to work
out how to "fix" it? (That last one is sort of rhetorical - you don't have to
answer!!).
Cheers
Deri
- [Groff] Line Breaks,
Deri James <=