2

any ideas about how to improve this table layout? IMHO it looks horrible.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{amsmath}

\begin{document}
\begin{table}[!h]
\centering
\begin{tabular}{c|c|c|c|c|c|c}
\toprule
\bfseries{Grandezza}&\bfseries{\makecell{Unità di \\ misura}}&\(\boldsymbol{t_a}\)&\(\boldsymbol{t_d}\)&\(\boldsymbol{t_p}\)&\bfseries{RMS}&\bfseries{Picco}\\ \hline \\[-1em]
\(\Delta t_i\)  &   \(s\)   &   0.2 & 0.2   &   0.3 &   &\\ \hline \\[-1em]
\(\dot{\theta}_{C}^{MAX}\)  &   \(rad/s\)   & 7.85  & 7.85 & 0  &  & 7.85 \\ 
\hline \\[-1em]
\(\overline{\dot{\theta}}_{C}\) &   \(rad/s\)   & 3.93  & 3.93  & 0 & 3.43 & 
\\ \hline \\[-1em]
 \(\ddot{\theta}_{C}^{MAX}\)& \(rad/s^{2}\) &   39.3 & -39.3    &   0 & 29.7 & 39.3 \\ \hline \\[-1em]
\(J_t\cdot\ddot{\theta}_{C}\)& \(Nm\)   & 66.81 &-66.81 & 0 &   & \\ \hline \\[-1em]
\(C_c\) & \(Nm\)&   1.4 &   1.4 &   0 & & \\ \hline \\[-1em]
\(C_{pd}\) & \(Nm\)  &  0.3 &   0 & 0 & & \\ \hline \\[-1em]
\(C_v^{Picco}\) & \(Nm\) &  1.57 &  1.57  & 0 & & \\ \hline \\[-1em]
\(C_v^{Medio}\) & \(Nm\) &  0.79 &  0.79  & 0 & & \\ \hline \\[-1em]
\(C_R^{Picco}\) & \(Nm\) &  3.27 &  2.97  & 0 & & \\ \hline \\[-1em]
\(T_{2}^{Picco}\)&\(Nm\)    & 70.1  & -63.8 & 0 &   & 70.1 \\ \hline \\[-1em]
\(T_{2}^{Media}\)&\(Nm\)    & 69.3  & -64.6 & 0 & 50.7  &  \\ \hline \\[-1em]
Tipo di moto & - &  Dir. & Retr. & - &  & \\ \hline \\[-1em]
&   &   &   &   &   & \\ \hline \\[-1em]
&   &   &   &   &   & \\ \hline \\[-1em]
&   &   &   &   &   & \\ 
\bottomrule
\end{tabular}
\caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
\label{tab:dimensionamento_tavola_rotante}
\end{table}
\end{document}
  • 1
    You're definitely right ;) – TeXnician Jan 2 '18 at 9:23
  • 5
    rules from booktabs and vertical lines are not intend to work together ... – Zarko Jan 2 '18 at 9:25
  • 6
    If you prefer having lots of horizontal and vertical lines, you must like the "prison cell" aesthetic... – Mico Jan 2 '18 at 10:03
  • 2
  • 1
    As you seem to require vertical and horizontal lines, which make tables look horrible, I think that you should have said so in your question and have saved several people their efforts in removing them. – Peter Wilson Jan 2 '18 at 19:20
7

Here are some more improvements and simplification of the table code. For a caption width equal to the table width, the simplest is to use the threeparttable environment, which measures this width. Also, I replaced \overline{\dot{\theta}} in the first line with \widebar{\dot{\theta}}, borrowed from the mathabx font package, which takes into account that maths Greek letters are italic.

\documentclass[a4paper, italian]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{babel}
\usepackage[showframe]{geometry}
\usepackage[table, svgnames]{xcolor}
\usepackage{siunitx}
\def\rd{\radian}
\usepackage{amsmath}
\usepackage{makecell, booktabs, threeparttable}
\renewcommand{\theadfont}{\small\bfseries\boldmath}
\newcommand{\colhead}[1]{{\small\bfseries\boldmath#1}}

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<-6> mathx5 <6-7> mathx6 <7-8> mathx7
<8-9> mathx8 <9-10> mathx9
<10-12> mathx10 <12-> mathx12
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widebar}{0}{mathx}{"73}

\begin{document}

\begin{table}[!htb]
\centering\sisetup{per-mode = symbol, table-format = 2.2, table-number-alignment = center}
\renewcommand{\arraystretch}{1.6}
\setlength{\tabcolsep}{9pt}
\begin{threeparttable}
\rowcolors{2}{WhiteSmoke!80!Lavender}{Gainsboro!50!Lavender}
\begin{tabular}{ >{$}l<{$}cSS[table-format=-2.2]S[table-format=1.1]SS}
\rowcolor{SlateGray!40}
\textbf{\small Grandezza} & \thead{Unità di\\misura}& \colhead{$t_a$} & \colhead{$t_d$} & \colhead{$t_p$}
& \colhead{RMS} & \colhead{Picco} \\
 \Delta t_i & \si{\second} & 0.2 & 0.2 & 0.3 & &\\
\dot{\theta}_{C}^{\max} & \si{\rd\per\s} & 7.85 & 7.85 & 0 & & 7.85 \\
\widebar{\dot{\theta}}_{C} & \si{\rd\per\s} & 3.93 & 3.93 & 0 & 3.43 & \\
\ddot{\theta}_{C}^{\max} & \si{\rd\per\square\s} & 39.3 & -39.3 & 0 & 29.7 & 39.3 \\
J_t\cdot\ddot{\theta}_{C} & \si{\N\m} & 66.81 & -66.81 & 0 & & \\
C_c & \si{\N\m}& 1.4 & 1.4 & 0 & & \\
C_\text{pd} & \si{\N\m} & 0.3 & 0 & 0 & & \\
C_v^\text{Picco} & \si{\N\m} & 1.57 & 1.57 & 0 & & \\
C_v^\text{Medio} & \si{\N\m} & 0.79 & 0.79 & 0 & & \\
C_R^\text{Picco} & \si{\N\m} & 3.27 & 2.97 & 0 & & \\
T_{2}^\text{Picco} &\si{\N\m} & 70.1 & -63.8 & 0 & & 70.1 \\
T_{2}^\text{Media} &\si{\N\m} & 69.3 & -64.6 & 0 & 50.7 & \\
\text{Tipo di moto} & -- & {Dir.} & {Retr.} & {--} & & \\
\end{tabular}
\caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
\label{tab:dimensionamento_tavola_rotante}
\end{threeparttable}
\end{table}

\end{document} 

enter image description here

| improve this answer | |
  • @Mico: I've updated – and added the precision that the table code was simplified ;o) – Bernard Jan 2 '18 at 13:18
11

Some suggestions:

  • Fewer, but better spaced horizontal lines

  • No vertical lines. None!

  • Use an array environment instead of a tabular environment.

  • Use \si for the units

  • Use S column type for the numeric columns

enter image description here

\documentclass{article}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,makecell,amsmath,siunitx}
\sisetup{per-mode=symbol}
\begin{document}
\begin{table}[!h]
\renewcommand\arraystretch{1.33}
\centering
$\begin{array}{@{} lc S[table-format=2.2]
                      S[table-format=-2.2]
                      S[table-format=1.1]
                      S[table-format=2.2]
                      S[table-format=2.2] @{}}
\toprule
\text{\bfseries Grandezza}&
\makecell{\text{\bfseries Unità di}\\ \text{\bfseries misura}}&
{\boldsymbol{t_a}} &
{\boldsymbol{t_d}} &
{\boldsymbol{t_p}} &
{\text{\bfseries RMS}} &
{\text{\bfseries Picco}}\\ 
\midrule
\Delta t_i  & \si{\second} &   0.2 & 0.2   &   0.3 &   &\\  
\dot{\theta}_{C}^{\mathrm{MAX}} & \si{\radian\per\second} & 7.85 & 7.85 & 0  &  & 7.85 \\ 
\bar{\dot{\theta}}_{C}          & \si{\radian\per\second} & 3.93 & 3.93  & 0 & 3.43 & \\  
\ddot{\theta}_{C}^{\mathrm{MAX}}& \si{\radian\per\second\squared}& 39.3 & -39.3 & 0 & 29.7 & 39.3 \\  
J_t\cdot\ddot{\theta}_{C}& \si{\newton\meter} & 66.81 &-66.81 & 0 & & \\  
C_c                      & \si{\newton\meter}  &   1.4 &   1.4 &   0 & & \\  
C_{pd}                   & \si{\newton\meter} &  0.3 &   0 & 0 & & \\  
C_v^{\mathrm{Picco}}     & \si{\newton\meter} &  1.57 &  1.57  & 0 & & \\  
C_v^{\mathrm{Medio}}     & \si{\newton\meter} &  0.79 &  0.79  & 0 & & \\  
C_R^{\mathrm{Picco}}     & \si{\newton\meter} &  3.27 &  2.97  & 0 & & \\  
T_{2}^{\mathrm{Picco}}   & \si{\newton\meter} & 70.1  & -63.8 & 0 &   & 70.1 \\  
T_{2}^{\mathrm{Media}}   & \si{\newton\meter} & 69.3  & -64.6 & 0 & 50.7  &  \\  
\text{Tipo di moto}      & \text{--}          & {\text{Dir.}} & {\text{Retr.}} & \text{--} & & \\
\bottomrule
\end{array}$
\caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
\label{tab:dimensionamento_tavola_rotante}
\end{table}
\end{document}
| improve this answer | |
  • This is nice, but i prefer to have vertical and horizontal lines and moreover number are not aligned – it8 Jan 2 '18 at 9:47
  • 4
    @iacopo Why do you thing the numbers are not aligned? They are aligned at the decimal marker. – TeXnician Jan 2 '18 at 9:49
  • 6
    @iacopo Vertical lines are a typographical sin. Horizontal rules are, too, when they serve no purpose; the only needed ones here are top, after header, bottom. The last line is quite mysterious: probably an explanation in the caption (or as a note to the table, after the bottom rule) that \tau_a refers to direct motion and \tau_d to retrograde motion is better. – egreg Jan 2 '18 at 11:38
7

Here's one version (without vertical rules although you like them). Further improvements:

  • typesetting units with siunitx (you can use it's options to change appearance)
  • aligning the columns left where possible and number columns at the decimal marker
  • adjusted the vertical spacing (your leftmost column is a vertical monster)

What you could consider:

  • changing the caption width to table width
  • making the number of decimal places consistent

table

Code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{amsmath}

\begin{document}
\begin{table}[!h]
\centering
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{llS[table-format=2.2]SSS[table-format=2.2]S[table-format=2.2]}
\toprule
Grandezza & Unità di & $t_a$ & {$t_d$} & $t_p$ & {RMS} & {Picco}\\[-.4em]
& misura & & & & &\\\midrule
\(\Delta t_i\)  &   \si{\second}   &   0.2 & 0.2   &   0.3 &   &\\
\(\dot{\theta}_{C}^{MAX}\)  &   \si{\radian\per\second}   & 7.85  & 7.85 & 0  &  & 7.85 \\ 
\(\overline{\dot{\theta}}_{C}\) &   \si{\radian\per\second}   & 3.93  & 3.93  & 0 & 3.43 & \\
 \(\ddot{\theta}_{C}^{MAX}\)& \si{\radian\per\square\second} &   39.3 & -39.3    &   0 & 29.7 & 39.3 \\
\(J_t\cdot\ddot{\theta}_{C}\)& \si{\newton\metre}   & 66.81 & -66.81 & 0 &   & \\
\(C_c\) & \si{\newton\metre}&   1.4 &   1.4 &   0 & & \\
\(C_{pd}\) & \si{\newton\metre}  &  0.3 &   0 & 0 & & \\
\(C_v^{Picco}\) & \si{\newton\metre} &  1.57 &  1.57  & 0 & & \\
\(C_v^{Medio}\) & \si{\newton\metre} &  0.79 &  0.79  & 0 & & \\ 
\(C_R^{Picco}\) & \si{\newton\metre} &  3.27 &  2.97  & 0 & & \\
\(T_{2}^{Picco}\)&\si{\newton\metre}    & 70.1  & -63.8 & 0 &   & 70.1 \\
\(T_{2}^{Media}\)&\si{\newton\metre}    & 69.3  & -64.6 & 0 & 50.7  &  \\
Tipo di moto & -- &  {Dir.} & {Retr.} & {--} &  & \\
\bottomrule
\end{tabular}
\caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
\label{tab:dimensionamento_tavola_rotante}
\end{table}
\end{document}

Edit: Here's a version with "horizontal rules" that does not look too awful.

colored

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
\usepackage{siunitx}
\usepackage{amsmath}
\begin{document}
\begin{table}[!h]
\centering
\renewcommand{\arraystretch}{1.6}
\setlength{\tabcolsep}{9pt}
\rowcolors{2}{black!2}{gray!20}
\begin{tabular}{llS[table-format=2.2]SSS[table-format=2.2]S[table-format=2.2]}
\rowcolor{gray!40}Grandezza & Unità di & $t_a$ & {$t_d$} & $t_p$ & {RMS} & {Picco}\\[-.4em]
\rowcolor{gray!40}& misura & & & & &\\
\(\Delta t_i\)  &   \si{\second}   &   0.2 & 0.2   &   0.3 &   &\\
\(\dot{\theta}_{C}^{MAX}\)  &   \si{\radian\per\second}   & 7.85  & 7.85 & 0  &  & 7.85 \\ 
\(\overline{\dot{\theta}}_{C}\) &   \si{\radian\per\second}   & 3.93  & 3.93  & 0 & 3.43 & \\
 \(\ddot{\theta}_{C}^{MAX}\)& \si{\radian\per\square\second} &   39.3 & -39.3    &   0 & 29.7 & 39.3 \\
\(J_t\cdot\ddot{\theta}_{C}\)& \si{\newton\metre}   & 66.81 & -66.81 & 0 &   & \\
\(C_c\) & \si{\newton\metre}&   1.4 &   1.4 &   0 & & \\
\(C_{pd}\) & \si{\newton\metre}  &  0.3 &   0 & 0 & & \\
\(C_v^{Picco}\) & \si{\newton\metre} &  1.57 &  1.57  & 0 & & \\
\(C_v^{Medio}\) & \si{\newton\metre} &  0.79 &  0.79  & 0 & & \\ 
\(C_R^{Picco}\) & \si{\newton\metre} &  3.27 &  2.97  & 0 & & \\
\(T_{2}^{Picco}\)&\si{\newton\metre}    & 70.1  & -63.8 & 0 &   & 70.1 \\
\(T_{2}^{Media}\)&\si{\newton\metre}    & 69.3  & -64.6 & 0 & 50.7  &  \\
Tipo di moto & -- &  {Dir.} & {Retr.} & {--} &  & \\
\end{tabular}
\caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
\label{tab:dimensionamento_tavola_rotante}
\end{table}
\end{document}
| improve this answer | |
  • Ok, this is a good version but i need vertical and horizontal lines – it8 Jan 2 '18 at 9:46
  • 2
    @iacopo You asked for good-looking. I've added a compromise with "horizontal rules" (kind of). – TeXnician Jan 2 '18 at 9:53
2

like this:

enter image description here

what is ugly is meter of personal taste (personally i don't like vertical lines, but you insist to have them ...). at least the code for above table is more correct ...

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{makecell}
\renewcommand\theadfont{\small\bfseries}
\renewcommand{\theadgape}{}
\setcellgapes{3pt}

\usepackage{siunitx}

\begin{document}
\begin{table}[ht]
\centering
\makegapedcells
\begin{tabular}{|>{$}l<{$}|
                s|
           *{3}{S[table-format=-2.2]|}
                S[table-format= 2.2]|
                S[table-format= 2.1]|
                }
    \Xhline{1pt}
\thead[b]{\text{Grandezza}}
    &   \multicolumn{1}{c|}{\thead[b]{Unità di \\ misura}}
        &   {\thead[b]{$t_a$}}
            &   {\thead[b]{$t_d$}}
                &   {\thead[b]{$t_p$}}
                    &   {\thead[b]{RMS}}
                        &   {\thead[b]{Picco}}                                      \\
    \Xhline{0.8pt}
\Delta t_i                  &   s           &  0.2  &  0.2  & 0.3   &       &       \\  \hline
\dot{\theta}_{C}^{\max}     &   rad/s       &  7.85 &  7.85 & 0     &       & 7.85  \\  \hline
\overline{\dot{\theta}}_{C} &   rad/s       &  3.93 &  3.93 & 0     &  3.43 &       \\  \hline
\ddot{\theta}_{C}^{\max}    &   rad/s^{2}   & 39.3  & -39.3 & 0     & 29.7  & 39.3  \\  \hline
J_t\cdot\ddot{\theta}_{C}   &   Nm          & 66.81 & -66.81& 0     &       &       \\  \hline
C_c                         &   Nm          &   1.4 &   1.4 & 0     &       &       \\  \hline
C_{pd}                      &   Nm          &  0.3  &   0   & 0     &       &       \\  \hline
C_v^{\mathrm{Picco}}        &   Nm          &  1.57 &  1.57 & 0     &       &       \\  \hline
C_v^{\mathrm{Medio}}        &   Nm          &  0.79 &  0.79 & 0     &       &       \\  \hline
C_R^{\mathrm{Picco}}        &   Nm          &  3.27 &  2.97 & 0     &       &       \\  \hline
T_{2}^{\mathrm{Picco}}      &   Nm          & 70.1  & -63.8 & 0     &       & 70.1  \\  \hline
T_{2}^{\mathrm{Media}}      &   Nm          & 69.3  & -64.6 & 0     & 50.7  &       \\  \hline
\text{Tipo di moto}         &   {-}         & {Dir.}&{Retr.}& {--}  &       &       \\
    \Xhline{1pt}
\end{tabular}
    \caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
    \label{tab:dimensionamento_tavola_rotante}
\end{table}
\end{document}
| improve this answer | |
  • May it be that the end of the code is missing? – TeXnician Jan 2 '18 at 10:01
  • yes, i lost it in copy/past process ... (we still have holydays :-)). corrected now. happy new year! – Zarko Jan 2 '18 at 10:03
  • This is good, i know horizontal rules are not nice to see but i need them for educational purposes. Can you align the numbers btw? Thank you! And happy new year of course! – it8 Jan 2 '18 at 10:26
  • 2
    numbers are aligned. at decimal point. – Zarko Jan 2 '18 at 10:27
2

Here is another suggestion with vertical and less horizontal lines.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{amsmath}
\usepackage{siunitx}


\begin{document}
\begin{table}[!h]
\renewcommand{\arraystretch}{1.4}
\centering
\begin{tabular}{l|l|S[table-format=2.2]|S[table-format=-2.2]|S[table-format=1.1]|S[table-format=2.2]|S[table-format=2.2]}
\hline
\bfseries{Grandezza}&\bfseries{\makecell{Unità di \\ misura}}&\(\boldsymbol{t_a}\)&\(\boldsymbol{t_d}\)&\(\boldsymbol{t_p}\)&\bfseries{RMS}&\bfseries{Picco}\\\hline
\(\Delta t_i\)  &   \si{\s}   &   0.2 & 0.2   &   0.3 &   &\\ 
\(\dot{\theta}_{C}^{MAX}\)  &  \si{\radian\per\s}  & 7.85  & 7.85 & 0  &  & 7.85 \\ 

\(\overline{\dot{\theta}}_{C}\) &   \si{\radian\per\s}   & 3.93  & 3.93  & 0 & 3.43 & 
\\ 
 \(\ddot{\theta}_{C}^{MAX}\)& \si{\radian\per\s\square} &   39.3 & -39.3    &   0 & 29.7 & 39.3 \\ \hline
\(J_t\cdot\ddot{\theta}_{C}\)& \si{\newton\metre}   & 66.81 &-66.81 & 0 &   & \\ 
\(C_c\) & \si{\newton\metre}&   1.4 &   1.4 &   0 & & \\ 
\(C_{pd}\) & \si{\newton\metre}  &  0.3 &   0 & 0 & & \\ 
\(C_v^{Picco}\) & \si{\newton\metre} &  1.57 &  1.57  & 0 & & \\ \hline
\(C_v^{Medio}\) & \si{\newton\metre} &  0.79 &  0.79  & 0 & & \\ 
\(C_R^{Picco}\) & \si{\newton\metre} &  3.27 &  2.97  & 0 & & \\ 
\(T_{2}^{Picco}\)& \si{\newton\metre}    & 70.1  & -63.8 & 0 &   & 70.1 \\
\(T_{2}^{Media}\)& \si{\newton\metre}   & 69.3  & -64.6 & 0 & 50.7  &  \\ \hline
Tipo di moto & - &  {Dir.} & {Retr.} & {-} &  & \\ 
&   &   &   &   &   & \\
&   &   &   &   &   & \\
&   &   &   &   &   & \\ 
\hline
\end{tabular}
\caption{Tabella riassuntiva per il dimensionamento del riduttore della tavola rotante}
\label{tab:dimensionamento_tavola_rotante}
\end{table}


\end{document}

enter image description here

| improve this answer | |
1

I highly recommend Markus Püschel's excellent Small Guide to Making Nice Tables.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.