groff
[Top][All Lists]
Advanced

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

[Groff] grotty and \D'l 0 0'


From: Werner LEMBERG
Subject: [Groff] grotty and \D'l 0 0'
Date: Thu, 29 Nov 2007 17:24:48 +0100 (CET)

There is an interesting problem which should be solved somehow,
however I have no idea how to do it `right'.

Using grotty, this code

  x \D'l 1m 0' x

  x \D'l 0 1v' x

produces

  x --x

  x |
    |x

[You have to use the current CVS or version 1.19.0 and earlier -- the
versions inbetween handle this incorrectly.]

As can be seen, a line of length 1m (1v) is drawn as *two* character
cells, not one, but still takes only a length (height) of one
character cell.  This result may be surprising but it is the correct
one so that it is completely analogous to the output of other devices
-- it took a long time until I came to this conclusion :-)

Now the interesting problem: It is not possible to generate a vertical
or horizontal line which occupies just one character cell!  For
example, saying

  x \D'l .1m 0' x

  x \D'l 0 .1v' x

produces

  x +x

  x +x

The line lengths are rounded to the next multiple of the horizontal
and vertical device resolution, which is 0 here in both directions --
the line more or less degenerates to a dot, represented with `+'.

Now consider this table:

  foo

  .TS
  l. |
  x
  .TE

  bar

`groff -t' produces

  foo
    |
  x |

  bar

which is not what Joe User would expect.  Additionally, if you start
the input with the table directly, you get a

  character above first line discarded

warning which is annoying.

Here's my question: Any idea how to produce `|' or `-' using \D'...'?

A straightforward solution which I currently favour is to define new
\D subcommands \D'h...' and \D'v...' to indicate a horizontal and
vertical line, respectively.  Consequently, new groff intermediate
output commands `Dh' and Dv' have to be defined.  However, I'm
hesitating to introduce them since non-groff devices would have to be
updated too.

Using \l and \L isn't a good solution since it expands to characters
on all devices, not real lines.  Additionally, you have to explicitly
specify the line drawing character to be used (depending on the
device), while grotty does that automatically for \D'l...'.  With
other words, I would have to sacrifice the device independence of the
GNU tbl preprocessor...


    Werner




reply via email to

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