Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve styling of tables in LaTeXWriter #1938

Merged
merged 4 commits into from
Sep 28, 2022

Conversation

odow
Copy link
Collaborator

@odow odow commented Sep 15, 2022

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

Current

image

image

New

image

@odow odow added the Format: LaTeX Related to the LaTeX / PDF output label Sep 15, 2022
@KristofferC
Copy link
Member

KristofferC commented Sep 16, 2022

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

image

vs

image

@mortenpi
Copy link
Member

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.

@odow
Copy link
Collaborator Author

odow commented Sep 18, 2022

Before

image

After

image

@KristofferC
Copy link
Member

KristofferC commented Sep 19, 2022

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}

@odow
Copy link
Collaborator Author

odow commented Sep 20, 2022

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

Is this really less readable?

image

@mortenpi
Copy link
Member

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.

The current tables have all borders and don't distinguish headers
from subsequent rows.
@odow
Copy link
Collaborator Author

odow commented Sep 28, 2022

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.

@mortenpi
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: LaTeX Related to the LaTeX / PDF output Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants