groff
[Top][All Lists]
Advanced

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

Re: Is there any way to make alternate rows of a table have a light gray


From: Blake McBride
Subject: Re: Is there any way to make alternate rows of a table have a light gray background?
Date: Sat, 20 Nov 2021 14:30:01 -0600

Hi Tadziu,

Using the code you so graciously supplied, I am having a problem.  The
problem occurs when your table spans pages.  Since you are creating the
gray line _after_ the current line, sometimes you get an extra gray line on
the first page, and other times you get a double gray line on the second
page.

See the attached example.  I am running it with:  groff -t -mm -Tpdf
test.groff >test.pdf

In it, you can see an extra gray line at the end of the first page.  If you
change the top margin to .5i from 1i, you get a double gray line on the
second page instead.

I think all of this is caused by the creation of the gray box _after_ the
current line.  In my case, I always produce PDF files and the lines are
always the same height.

If there is a way to affect the current line rather than the "next" line, I
think the problem would go away.  I am not good enough with groff escape
sequences to easily do this.  Could you please help me with this?  I would
really appreciate it!

Thank you!

Blake McBride


On Wed, Jun 9, 2021 at 7:31 AM Tadziu Hoffmann <hoffmann@usm.uni-muenchen.de>
wrote:

>
> > The data is simple, but the table is wide and the data
> > occurs in a right triangle shape, with one point at the
> > top left, another point at the top right, and the other
> > point at the bottom right.  This means that it is hard to
> > accurately follow from the row heading on the left to the
> > appropriate column on the right.
>
> > Is there any way to make alternate rows of a table have a
> > light gray background?
>
> It is possible only with some trickery, and it's easier
> if all the lines have the same height, otherwise much more
> manual intervention will be necessary.  To make this fully
> automatic will probably require modifying tbl.
>
> In the attached example, the gray background is created by
> drawing filled boxes across the width of the table.  In fact,
> the background is drawn in advance for the *next* line, in
> order to prevent the horizontal line from being painted over,
> which can happen at low resolutions; however, this requires
> two slightly different versions of the fill because the line
> spacing is different around the horizontal line.
>
> TW is the width of the table and is set by tbl.  LW is a
> correction for (half) the line width and is only necessary
> because I'm using square linecaps.
>
>
>

Attachment: test.groff
Description: Binary data


reply via email to

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