Discussion:
Longtable, colortbl, and hline
(too old to reply)
r***@gmail.com
2007-07-28 20:31:30 UTC
Permalink
Hello,

I'm a relative LaTeX newbie, and I'm using longtable to create a multi-
page table. I'm using the repeating header feature of longtable to
reproduce the header at the top of each page, and using rowcolor from
colortbl to color the header row light blue. I also use vertical lines
and \hline between each row/column.

The problem is when I use rowtable to color the header row, the color
bleeds onto the left, right, and top line. By increasing
\arraystrethch, I am able to pull the color back from the vertical
lines, but it still bleeds especially onto the top \hline, and I
haven't found a way to fix this. This makes it look like the top hline
of the table is thinner than the rest and looks ugly.

I've tried all kinds of different things. I've tried to use \hhline,
I've tried to use \minrowclearance, trying to increase the width of
just the top \hline etc.. but either I'm doing it wrong or its not
working.

Does anyone have any suggestions or things I should look at to avoid
having the coloring from the rowcolor command bleed onto the top hline
on a long table, or to make just the top hline thicker? Again the
solution has to work in longtable, and particularly work for a
repeating header row.

Thank you very much.

-- Ron
Werner Grundlingh
2007-07-29 01:41:44 UTC
Permalink
Post by r***@gmail.com
Hello,
I'm a relative LaTeX newbie, and I'm using longtable to create a multi-
page table. I'm using the repeating header feature of longtable to
reproduce the header at the top of each page, and using rowcolor from
colortbl to color the header row light blue. I also use vertical lines
and \hline between each row/column.
The problem is when I use rowtable to color the header row, the color
bleeds onto the left, right, and top line. By increasing
\arraystrethch, I am able to pull the color back from the vertical
lines, but it still bleeds especially onto the top \hline, and I
haven't found a way to fix this. This makes it look like the top hline
of the table is thinner than the rest and looks ugly.
I've tried all kinds of different things. I've tried to use \hhline,
I've tried to use \minrowclearance, trying to increase the width of
just the top \hline etc.. but either I'm doing it wrong or its not
working.
Does anyone have any suggestions or things I should look at to avoid
having the coloring from the rowcolor command bleed onto the top hline
on a long table, or to make just the top hline thicker? Again the
solution has to work in longtable, and particularly work for a
repeating header row.
Thank you very much.
-- Ron
This may just be a visual 'illusion' that depends on the zoom level of
your viewer (Ghostview or Acrobat Reader, for example). Have you
zoomed into the PS/PDF output to see whether this is actually so? If
you're not sure about this, post a minimal example containing the
table. Regardless, with different screen resolutions, your output may
look different on other readers' screens/computers. Hence, I wouldn't
suggest just changing the line width to accommodate a specific, more-
appealing visual appearance on your own screen when it may look 100%
acceptable on a different screen...

Werner
RDub
2007-07-29 17:13:06 UTC
Permalink
Post by Werner Grundlingh
Post by r***@gmail.com
The problem is when I use rowtable to color the header row, the color
bleeds onto the left, right, and top line.
This may just be a visual 'illusion' that depends on the zoom level of
your viewer (Ghostview or Acrobat Reader, for example). Have you
zoomed into the PS/PDF output to see whether this is actually so? If
you're not sure about this, post a minimal example containing the
table. Regardless, with different screen resolutions, your output may
look different on other readers' screens/computers. Hence, I wouldn't
suggest just changing the line width to accommodate a specific, more-
appealing visual appearance on your own screen when it may look 100%
acceptable on a different screen...
Thank you for your response. I have absolutely observed the visual
illusions you describe, and it may very well be that. The bottom line
is I need it to look good in Acrobat Reader. I have only been able to
determine that the reason the line appears thinner is because the
coloring is overlapping on the hline by zooming in as far as I
possible can. I have an example posted. The pdf output is at:
http://iamron.net/example.pdf
The ps output is at:
http://iamron.net/example.ps

When first opened, it looks like the table has no top hline. If you
zoom in, then you see it. If you zoom in to the max zoom allowed in
reader and look at a corner, it appears (at least to me and I've tried
on a couple different screens) that the blue color is ever so slightly
cropping onto the top \hline. I've scaled the color back from the left
and right lines using the optional scale argument to rowcolor. If I
leave this out I get the same effect on the left and right lines.

My latex is:
\documentclass[letterpaper]{article}
\usepackage{longtable}
\usepackage{colortbl}
\begin{document}
\begin{longtable}{|c|c|p{4in}|}
\hline
\rowcolor[rgb]{0.92,0.98,1}[0.95\tabcolsep]\textbf{Col 1} &
\textbf{Col 2} & \makebox[4in]{\textbf{Col 3}}\endhead
\hline
Col 1 & Col 2& Col 3 \\
\hline
\end{longtable}
\end{document}

Please let me know if things looks better on your screen.

Again thank you for your time!

-- Ron
RDub
2007-07-29 17:20:48 UTC
Permalink
Well I went back and looked at my own PostScript output with Ghostview
and clearly the problem is in my conversion from PostScript to PDF! My
apologies for slightling latex, longtable, and colortbl!

Any suggestions on how to better do the conversion to get better
results? I'm using ps2pdf from ghostscript 7.07 on RHEL4

I'll see if I can try on a newer version.... does anyone know if a
newer version will make a difference?

-- Ron
Dan
2007-07-30 22:08:57 UTC
Permalink
Post by RDub
Well I went back and looked at my own PostScript output with Ghostview
and clearly the problem is in my conversion from PostScript to PDF! My
apologies for slightling latex, longtable, and colortbl!
Not necessarily.

The root of the problem is in the rules for rounding pixels.
Both the lines in the table and the colored regions are
implemented by filling a rectangular region with color (or black).
At most screen resolutions, the boundary lines are less than
one pixel wide. Theoretically, the thin lines and the blue colored
rectangle share a boundary. If the coordinates of that boundary
are rounded to an exact pixel count, it could happen that the
blue rectangle is increased by almost half a pixel, enough to
cover a black line less than one pixel wide.

I viewed your example 5 different ways: (1) PDF ceated by pdflatex,
(2) by latex + dvipdfmx, (3) by latex + dvips + ps2pdf (all viewed in
Acrobat Reader 7.0.9) (4) PS created by latex+dvips (viewed in
GSView 4.8) (5) DVI created by latex (viewed with windvi).

In all but one case some lines disappeared at some magnifications
(starting at 100% and going up). The exception was (3), however,
it gave inconsistent line widths.

The Ghostscript involved in (3) and (4) is 8.54. The LaTeX programs
come from TeXLive2007 on WinXP. Dvips version is 5.96. Dvipdfmx
reports the date 20061211 instead of a decimal version.


Dan
RDub
2007-07-31 23:48:04 UTC
Permalink
Post by Dan
I viewed your example 5 different ways: (1) PDF ceated by pdflatex,
(2) by latex + dvipdfmx, (3) by latex + dvips + ps2pdf (all viewed in
Acrobat Reader 7.0.9) (4) PS created by latex+dvips (viewed in
GSView 4.8) (5) DVI created by latex (viewed with windvi).
In all but one case some lines disappeared at some magnifications
(starting at 100% and going up). The exception was (3), however,
it gave inconsistent line widths.
Many thanks for spending time on the matter. Understanding that what
I'm seeing is a result of having to round pixels per your explanation,
I guess the question I end up with is if anything can be done to help
counter the effect I would even be fine with the line appearing
thicker than the others, I just really wish it wasn't thinner. However
I've read quite a few warnings that talk about it being very difficult
to change the thinkness of just one line in a LaTeX table, and being a
repeating header in a longtable doesn't help. I did try a few
different things with no luck. I even tried to use thicker lines for
all cells, but that top one always looks thinner.

It would be ideal if I could just pull the color back a pixel or point
from the top and bottom \hlines like I do with the left and right
ones. You can see in the example, if you zoom way in, the color
actually stops short of the left and right lines and there is
whitespace there. This makes the lines look normal when viewed at
100%. If I don't do this, these lines also look abnormal/disappear at
certain zoom levels.

Best regards,

-- Ron
Dan
2007-08-01 22:19:26 UTC
Permalink
Post by RDub
Post by Dan
I viewed your example 5 different ways: (1) PDF ceated by pdflatex,
(2) by latex + dvipdfmx, (3) by latex + dvips + ps2pdf (all viewed in
Acrobat Reader 7.0.9) (4) PS created by latex+dvips (viewed in
GSView 4.8) (5) DVI created by latex (viewed with windvi).
In all but one case some lines disappeared at some magnifications
(starting at 100% and going up). The exception was (3), however,
it gave inconsistent line widths.
Many thanks for spending time on the matter. Understanding that what
I'm seeing is a result of having to round pixels per your explanation,
I guess the question I end up with is if anything can be done to help
counter the effect I would even be fine with the line appearing
thicker than the others, I just really wish it wasn't thinner. However
I've read quite a few warnings that talk about it being very difficult
to change the thinkness of just one line in a LaTeX table,
The booktabs package has \toprule, \midrule and \bottomrule that
can be different thicknesses. Also a \specialrule command. I don't
know if longtables are affected however, and it is notorious for
discouraging vertical rules (but I don't know if it disables them).


Dan

Loading...