How to make these two tables look better?
I propose this:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{nccmath}
\usepackage{booktabs, siunitx}
\begin{document}
\begin{table}[!h]
\centering
$ \begin{matrix}
\toprule
& P & PI & PD & PID \\
\midrule
P & 0.5\cdot P_\text{crit} & 0.45\cdot P_\text{crit} & 0.5\cdot P_\text{crit} & 0.6\cdot P_\text{crit} \\
\addlinespace
I & & \mfrac{P}{0.85\cdot T_\text{crit}} & & \mfrac{P}{0.5\cdot T\text{crit}} \\
\addlinespace
D & & & 0.2\cdot T_\text{crit}\cdot P & 0.12\cdot T_\text{crit}\cdot P \\
\bottomrule
\end{matrix}$
\end{table}
\begin{table}[!h]
\centering\sisetup{per-mode=fraction}
\begin{tabular}{ >{$}l<{$}l*{4}{S[table-format=3.1, table-alignment=center]}}
\toprule
& \shortstack{Unità di\\ misura}& {P} & {PI} & {PD} & {PID} \\
\midrule
P &\si{mm\per\!\min}&110 & 99 & 110 & 132 \\
\addlinespace
I & \si{mm\per\!\min\,\s} & & 247.8 & & 468.1 \\
\addlinespace
D & \si{mm\s\per\!\min} & & & 10.3 & 7.5 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
If you want some colour, you can have this:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{nccmath}
\usepackage{booktabs, siunitx}
\usepackage[table, svgnames]{xcolor}
\begin{document}
\begin{table}[!h]
\centering
$ \begin{matrix}
\toprule
& P & PI & PD & PID \\
\midrule
\cellcolor{Gainsboro}P & 0.5 · P_\text{crit} & 0.45 · P_\text{crit} & 0.5 · P_\text{crit} & 0.6 · P_\text{crit} \\
\addlinespace
\cellcolor{Gainsboro}I & & \mfrac{P}{0.85 · T_\text{crit}} & & \mfrac{P}{0.5 · T\text{crit}} \\
\addlinespace
\cellcolor{Gainsboro}D & & & 0.2 · T_\text{crit} · P & 0.12 · T_\text{crit} · P \\
\bottomrule
\end{matrix}$
\end{table}
\begin{table}[!h]
\centering\sisetup{per-mode=fraction}
\begin{tabular}{ >{\columncolor{Gainsboro}$}l<{$}l*{4}{S[table-format=3.1, table-alignment=center]}}
\toprule
% \cellcolor{white}& \shortstack{Unità di\\ misura}& {P} & {PI} & {PD} & {PID} \\
\multicolumn{2}{c}{\cellcolor{white} Unità di misura}& {P} & {PI} & {PD} & {PID} \\
\midrule
P &\si{mm\per\!\min}&110 & 99 & 110 & 132 \\
\addlinespace
I & \si{mm\per\!\min\,\s} & & 247.8 & & 468.1 \\
\addlinespace
D & \si{mm\s\per\!\min} & & & 10.3 & 7.5 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
A version that merges both tables to one table to get the formula in the same column as the calculated value:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{amsmath}
\newcommand*{\Pcrit}{\ensuremath{P_{\text{crit}}}}
\newcommand*{\Tcrit}{\ensuremath{T_{\text{crit}}}}
\begin{document}
\begingroup
\sisetup{per-mode=fraction}
\def\NP{\mskip.5\thinmuskip}
\begin{tabular}{
l
c
S[table-format=3.0]
S[table-format=3.1]
S[table-format=3.1]
S[table-format=3.1]
}
\toprule
& \shortstack{Unità di\\ misura} & {$P$} & {$PI$} & {$PD$} & {$PID$} \\
\midrule
$P$ &
& {$0.5\NP\Pcrit$} & {$0.45\NP\Pcrit$}
& {$0.5\NP\Pcrit$} & {$0.6\NP\Pcrit$} \\
\addlinespace
$I$ & & & {$\dfrac{P}{0.85\,\Tcrit}$} & & {$\dfrac{P}{0.5\,\Tcrit}$} \\
\addlinespace
$D$ & & & & {$0.2\,\Tcrit P$} & {$0.12\,\Tcrit P$} \\
\midrule
$P$ & \si{\milli\meter\per\minute} & 110 & 99 & 110 & 132 \\
\addlinespace
$I$ & \si{\milli\meter\per\minute\per\second} & & 247.8 & & 468.1 \\
\addlinespace
$D$ & \si{\milli\meter\second\per\minute} & & & 10.3 & 7.5 \\
\bottomrule
\end{tabular}
\endgroup
\end{document}
Without number alignemnt, because the number in a column have different units and are therefore not comparable.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{amsmath}
\newcommand*{\Pcrit}{\ensuremath{P_{\text{crit}}}}
\newcommand*{\Tcrit}{\ensuremath{T_{\text{crit}}}}
\begin{document}
\begingroup
\sisetup{per-mode=fraction}
\def\NP{\mskip.5\thinmuskip}
\begin{tabular}{lccccc}
\toprule
& \shortstack{Unità di\\ misura} & $P$ & $PI$ & $PD$ & $PID$ \\
\midrule
$P$ &
& $0.5\NP\Pcrit$ & $0.45\NP\Pcrit$
& $0.5\NP\Pcrit$ & $0.6\NP\Pcrit$ \\
\addlinespace
$I$ & & & $\dfrac{P}{0.85\,\Tcrit}$ & & $\dfrac{P}{0.5\,\Tcrit}$ \\
\addlinespace
$D$ & & & & $0.2\,\Tcrit P$ & $0.12\,\Tcrit P$ \\
\midrule
$P$ & \si{\milli\meter\per\minute} & 110 & 99 & 110 & 132 \\
\addlinespace
$I$ & \si{\milli\meter\per\minute\per\second} & & 247.8 & & 468.1 \\
\addlinespace
$D$ & \si{\milli\meter\second\per\minute} & & & 10.3 & 7.5 \\
\bottomrule
\end{tabular}
\endgroup
\end{document}
With repeated units:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{amsmath}
\newcommand*{\Pcrit}{\ensuremath{P_{\text{crit}}}}
\newcommand*{\Tcrit}{\ensuremath{T_{\text{crit}}}}
\begin{document}
\begingroup
\sisetup{per-mode=fraction}
\def\NP{\mskip.5\thinmuskip}
\def\UnitP{\si{\milli\meter\per\minute}}
\def\UnitI{\si{\milli\meter\per\minute\per\second}}
\def\UnitD{\si{\milli\meter\second\per\minute}}
\begin{tabular}{lccccc}
\toprule
& \shortstack{Unità di\\ misura} & $P$ & $PI$ & $PD$ & $PID$ \\
\midrule
$P$ & \UnitP
& $0.5\NP\Pcrit$ & $0.45\NP\Pcrit$
& $0.5\NP\Pcrit$ & $0.6\NP\Pcrit$ \\
\addlinespace
$I$ & \UnitI & & $\dfrac{P}{0.85\,\Tcrit}$ & & $\dfrac{P}{0.5\,\Tcrit}$ \\
\addlinespace
$D$ & \UnitD & & & $0.2\,\Tcrit P$ & $0.12\,\Tcrit P$ \\
\midrule
$P$ & \UnitP & 110 & 99 & 110 & 132 \\
\addlinespace
$I$ & \UnitI & & 247.8 & & 468.1 \\
\addlinespace
$D$ & \UnitD & & & 10.3 & 7.5 \\
\bottomrule
\end{tabular}
\endgroup
\end{document}
Here's a solution suggestion that's quite similar, overall, to Bernard's, with the following exceptions:
Use an
array
environment instead of atabular
(ormatrix
) env.Omit all instances of
\cdot
Snug up the "crit" subscripts to the letters "P" and "T", resp.
Use
\dfrac
in the upper table.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,amsmath,siunitx}
\begin{document}
\begin{table}[!h]
\centering
$\begin{array}{@{} l cccc @{}}
\toprule
& P & PI & PD & PID \\
\midrule
P & 0.5 P_{\!\mathrm{crit}} & 0.45 P_{\!\mathrm{crit}}
& 0.5 P_{\!\mathrm{crit}} & 0.6 P_{\!\mathrm{crit}} \\
\addlinespace
I & & \dfrac{P}{0.85 T_{\mkern-1.5mu\mathrm{crit}}}
& & \dfrac{P}{0.5 T_{\mkern-1.5mu\mathrm{crit}}} \\
\addlinespace
D & & & 0.2 T_{\mkern-1.5mu\mathrm{crit}} P
& 0.12 T_{\mkern-1.5mu\mathrm{crit}} P \\
\bottomrule
\end{array}$
\end{table}
\begin{table}[!h]
\centering
$\begin{array}{@{} cc S[table-format=3.0] *{3}{S[table-format=3.1]} @{}}
\toprule
& \text{Unità di} & {P} & {PI} & {PD} & {PID} \\
& \text{misura} \\
\midrule
P & \frac{\mathrm{mm}}{\mathrm{min}} &110 & 99 & 110 & 132 \\
\addlinespace
I & \frac{\mathrm{mm}}{\mathrm{min}\,\mathrm{sec}} & & 247.8 & & 468.1\\
\addlinespace
D & \frac{\mathrm{mm}\,\mathrm{sec}}{\mathrm{min}} & & & 10.3 & 7.5 \\
\bottomrule
\end{array}$
\end{table}
\end{document}