0

I'm trying to use \hhline to draw partial lines in my tables (for which I can't use \cline since my tables contain coloured cells and it is a well-known problem that this combination doesn't work). I'm noticing two kinds of artifacting, however (MWE below):

  1. All \hhline{=}s aren't drawn as solid lines, but rather as dots and dashes, where vertical crossings have a longer darker dash. Although it is subtle, it is disturbing to the eye and appears at any zoom size in multiple different PDF viewers. It's not the case for a standard \hline\hline so it shouldn't be for \hhline.

  1. When an \hhline is used elsewhere in a table, \hline\hline suddenly only breaks 3/4 of each vertical line that crosses it.

How do I get rid of these artifacts? (Before anyone suggests it: no, I'm not switching from tabular to NiceMatrix, as suggested here.)

\documentclass{article}
\usepackage{hhline}

\begin{document}

\begin{tabular}{c|c} A & B \ \hhline{=:=} C & D \end{tabular} \hspace{2em} \begin{tabular}{c|c} A & B \ \hline\hline C & D \end{tabular} \hspace{2em} \begin{tabular}{c|c} A & B \ \hline\hline C & D \ \hhline{~-} E & F \end{tabular} \hspace{2em} \begin{tabular}{c|c} A & B \ \hline\hline C & D \ \hline E & F \end{tabular}

\end{document}

Mew
  • 843
  • Maybe consider using tabularray instead to avoid such problems. – samcarter_is_at_topanswers.xyz Dec 10 '23 at 13:33
  • I know you state otherwise, but if this is what annoys you, you should really consider using the nicematrix package as it draws lines as one single stroke whereever this is possible. – Jasper Habicht Dec 10 '23 at 13:55
  • @JasperHabicht The reason I don't want to switch over is because I am generating these tables automatically, and am letting LaTeX do the colouring with \cellcolor based on this computation. – Mew Dec 10 '23 at 13:59
  • 1
    using xpdf I don't see the overprint as darker even at full zoom however it does overprint as a feature of standard array | add the array package. – David Carlisle Dec 10 '23 at 16:13
  • 1
    It's not the case for a standard \hline\hline so it shouldn't be for \hhline. er... that's like saying it's not the case that apples have orange skin so it shouldn't be the case for oranges. – David Carlisle Dec 10 '23 at 16:14
  • @DavidCarlisle Does the orange purport to be different than an orange? Did you not write \hhline{=...} with the goal that it looked like \hline\hline? – Mew Dec 10 '23 at 18:11
  • 1
    yes but the whole point of hhline, unlike hline is that it is made up of multiple segments, so the fact that hline shows as a continuous line and hhline sometimes shows artifacts at the joins is hardly a surprise. With the format version of tabular there is a negative space half the width of | so the segments will overlap, althoiugh as I say xpdf does not make that noticable as far as I can see the array package version of tabular does not have that negative space. I could not reproduce the vertical line overlapping into the double hline gap. – David Carlisle Dec 10 '23 at 20:31

0 Answers0