joaomlourenco / novathesis

A LaTeX template for academic monographs (e.g., dissertations and thesis). This template serves both beginners and proficient LaTeX users.
http://joaomlourenco.github.io/novathesis/
LaTeX Project Public License v1.3c
751 stars 119 forks source link

[BUG] rules from `booktabs` only cover first column of a table #402

Closed tpdsantos closed 1 year ago

tpdsantos commented 1 year ago

Version 6.9.6 When creating a table using the tabular environment and using \toprule, \midrule and \bottomrule these rules are only applied in the first column.

Do you use a cloud-based service? Which one? No

Do you use a local service? pdfTeX Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)

Distributor ID: Ubuntu Description: Ubuntu 20.04.5 LTS Release: 20.04 Codename: focal

What went wrong? When I create a table using tabular and add \toprule, \midrule or \bottomrule, these rules only cover the first column.

Expected behavior The booktabs rules should cover all columns in the table.

Instructions to Reproduce the Error Starting from a fresh distribution of the template from 6.9.6 version, add to 5_packages.tex:

\usepackage{booktabs}

In the main text, add:

\begin{table}[bt!]
  \centering
  \caption{System and column parameters of the GSSR set-up.}
  \begin{tabular}{lrl}
    \toprule
    Parameter & Value & Units \\
    \midrule
    $V_x$ & 4.5 & ml \\
    $L_c$ & 10.0 & cm \\
    $D_c$ & 1.0 & cm \\
    $\epsilon_t$ & 0.6 & - \\
    Pe & 300.0 & - \\
    \bottomrule
  \end{tabular}
\end{table}

The result is this:

image

And the result should be this:

image

Additional context Regarding booktabs, I only have this issue with the novathesis template, if I create a simple document with booktabs the rules work without any issue.

joaomlourenco commented 1 year ago

This works for me in version 6.9.6. You must be introducing some error somewhere. Please search for errors in your template.log file.

tpdsantos commented 1 year ago

Which latex version did you use for testing?With the version I am using, only the 6.9.6 version works, everything else above that does not work...

joaomlourenco commented 1 year ago

I'm using TexLive 2022. Why don't you upgrade for a newer TeXLive distribution?

Which version are you using?

tpdsantos commented 1 year ago

With Ubuntu 20.04 LTS the installed version is TexLive 2019. I'm finishing my PhD in March so I don't want to do any upgrades until then...

Anyway, I found a workaround that works, thanks anyway!

joaomlourenco commented 1 year ago

Thanks for the feedback. I'll doble check the compatibility level with TeXLive 2019.

May I ask you to please publish here a brief note with your workaround, so that it will be useful for other users? Thank you.

tpdsantos commented 1 year ago

In every table, instead of using the booktabs rules, I use the subrules macro \cmidrule{n-m} where n and m are the start and end columns of the rule. The only hassle with this is that you have, in every table, insert the number of columns of that table. The best workaround I got was to add this to your preamble:

\renewcommand{\toprule}{\cmidrule[1.0pt]}
\renewcommand{\midrule}{\cmidrule}
\renewcommand{\bottomrule}{\cmidrule[1.0pt]}

For me the thicknesses look practically the same as the top rules. In the table itself, you would introduce it in this way:

\begin{table}[bt!]
  \centering
  \caption{System and column parameters of the GSSR set-up.}
  \begin{tabular}{lrl}
    \toprule{1-3}
    Parameter & Value & Units \\
    \midrule{1-3}
    $V_x$ & 4.5 & ml \\
    $L_c$ & 10.0 & cm \\
    $D_c$ & 1.0 & cm \\
    $\epsilon_t$ & 0.6 & - \\
    Pe & 300.0 & - \\
    \bottomrule{1-3}
  \end{tabular}
\end{table}

You have to adapt the column numbers everytime you create a new table.

joaomlourenco commented 1 year ago

Thank you for sharing your experience.