Documenter.jl icon indicating copy to clipboard operation
Documenter.jl copied to clipboard

Improve styling of tables in LaTeXWriter

Open odow opened this issue 1 year ago • 6 comments

The current tables have all borders and don't distinguish headers from subsequent rows.

Current

image image

New

image

odow avatar Sep 15 '22 23:09 odow

Maybe worth to use \usepackage{booktabs} and use \toprule, \midrule and \bottomrule instead of \hline. Looks nicer IMO:

image

vs

image

KristofferC avatar Sep 16 '22 08:09 KristofferC

For larger tables I do find that it improves readability if you have some horizontal lines to guide you between the rows. Do you think it would still look good to have either light or dark gray lines between the rows? I do agree that it makes sense to distinguish the header from the body rows though.

mortenpi avatar Sep 17 '22 06:09 mortenpi

Before

image

After

image

odow avatar Sep 18 '22 21:09 odow

It's much better than before but the horizontal lines in between the rows is not very nice IMO. I kind of agree with

For larger tables I do find that it improves readability if you have some horizontal lines to guide you between the rows.

so how about something like

gnome-shell-screenshot-8smf40

with a very faint grey background to guide you? Generated with:

\documentclass[12pt]{article}
\usepackage{booktabs}

\usepackage{color, colortbl}
\usepackage[table]{xcolor}
\definecolor{Gray}{gray}{0.93}
\usepackage[first=0,last=9]{lcg}
\newcommand{\ra}{\rand0.\arabic{rand}}

\begin{document}

\rowcolors{2}{Gray}{white}
\begin{table}[ht]
\centering
\begin{tabular}{cccccccc}
\toprule
&col1 &col2 &col3 &col4 & col5 &col6 &col7\\
\midrule
row1& \ra & \ra & \ra & \ra & \ra & \ra & \ra \\
row2& \ra & \ra & \ra & \ra & \ra & \ra & \ra \\
row2& \ra & \ra & \ra & \ra & \ra & \ra & \ra \\
row2& \ra & \ra & \ra & \ra & \ra & \ra & \ra \\
row2& \ra & \ra & \ra & \ra & \ra & \ra & \ra \\
row3& \ra & \ra & \ra & \ra & \ra & \ra & \ra \\
\bottomrule
\end{tabular}
\caption{My Table}
\end{table}

\end{document}

KristofferC avatar Sep 19 '22 07:09 KristofferC

I'll let @mortenpi decide. But I'd vote no lines and no color.

Is this really less readable?

image

odow avatar Sep 20 '22 03:09 odow

First, color >> lines, so that's a great suggestion!

As for the readability of color vs no color: I think for small, dense tables no color maybe even more readable. But I am concerned about large tables, with potentially some whitespace. E.g. this example

image

If you would make it even bigger and have more variation in the line lengths, I think it would become tricky to read without any horizontal guides.

mortenpi avatar Sep 20 '22 03:09 mortenpi

Here's a big table from the JuMP docs:

No color

image

With color

image

For now, I think the current state of the PR is an improvement in all cases, but it's hard to be perfect in every case. In the interest of increment change, I'd vote we merge, wait to see how things go in the ecosystem, and come back for more fixes/if anyone complains.

odow avatar Sep 28 '22 03:09 odow

Sounds good. Yea, there is always more bikeshedding that can be done with these things. But all the PRs you made are already a massive improvement to the look of the PDF, so thank you very much for taking them all on @odow!

mortenpi avatar Sep 28 '22 04:09 mortenpi