On Mon, Nov 23, 2026 at 02:18:49PM -0800, Raymond Toy wrote:
> It would be nice if texinfo could produce borders for tables. This is easy
> to do in HTML with some CSS, but pdf don’t have that option.
> 
> Here is an image of a pdf table that would be easier to read if there were
> borders separating each row and column.
> 
> This is not a high priority to me; it’s just a minor wish item. I rarely
> look at the pdf and much prefer the HTML output.

It seems like there could be a large scope for customizing the formatting
of tables - making it more dangerous to start, so I would like to try to
keep the possibilities for customization for texinfo.tex to a minimum.

Horizontal lines are easier to implement (and would be enough in most
cases - I think it's more common only to have horizontal lines in tables
in than both horizontal and vertical lines).

Here's the diff I came up with to allow adding horizontal lines in between
the rows of a table:

diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index bca035a117..8006665736 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -4638,6 +4638,8 @@ $$%
 %
 \def\tab{\checkenv\multitable &\the\everytab}%
 
+\let\tximultitablehrule\relax
+
 \newtoks\everytab  % insert after every tab.
 %
 \envdef\multitable{%
@@ -4668,6 +4670,7 @@ $$%
       % Perhaps a \nobreak, then reset:
       \headitemcrhook
       \global\let\headitemcrhook=\relax
+      \tximultitablehrule
     }%
   }%
   %


You use it by defining \tximultitablehrule to \hrule before the @multitable,
like the following:

@tex
\global\let\tximultitablehrule\hrule
@end tex

This seemed to give good results and may be enough for your needs.

This works by adding \hrule to the \everycr definition that used in our
definition for @multitable.  \everycr is a TeX builtin with material to
be added at the end of each row in a table (technically, "horizontal
alignment").

The main thing I don't understand is if the vertical spacing around the
added horizontal rule is correct (I haven't digested all the documentation
on the TeX "alignment" feature used for table formatting).  So if someone
knows that using \everycr this way is wrong, information on this would be
appreciated.

The other possibility that we may consider having a hook for is for
adding a rule in only three places: at the beginning and end of the table,
and after the heading row.  (You could specify both, for example, to
have thicker lines around the table and the header row, and thinner lines
between the rows of the table.)


Reply via email to