1

I need to write a table with numerical values. I chose to use siunitx for alignment and rounding off, which is very nice. However, this header is a bit elaborate, with some math content, and must specify the column units. Here's the MWE

\documentclass{article}
\usepackage{booktabs,booktabs,tabularx,siunitx}
\sisetup{table-auto-round = true} 
\begin{document}
    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            \multicolumn{1}{c}{$A_\mathrm{nom}$} &
            \multicolumn{1}{c}{$\frac{\dot{m} C_p \Delta T}{A_\mathrm{nom}}$} &
            \multicolumn{1}{c}{$k$} &
            \multicolumn{1}{c}{$\Delta T$} \\
            \multicolumn{1}{c}{[\si{mm^2}]} &
            \multicolumn{1}{c}{[\si{W/m^2}]} &
            \multicolumn{1}{c}{[\si{W/m.K}]} &
            \multicolumn{1}{c}{[\si{\degreeCelsius}]} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}
\end{document}

But I dislike the alignment and vertical separation between the lines. I rather have a split cell, similar to @egreg answer on this post: https://tex.stackexchange.com/a/543235/50886. But it did not work. Do you guys have any suggestion? All comments are appreciated

phollox
  • 554

1 Answers1

2

Here are a buncho of different optionas all using \thead from the makecell package. I have changed the fraction in the second column header to try to increase the readability:

enter image description here

\documentclass{article}
\usepackage{booktabs,tabularx,siunitx}
\usepackage{amsmath}
\sisetup{table-auto-round = true} 
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}
\begin{document}
    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            {\thead{$A_\mathrm{nom}$\\{} [\si{mm^2}]}} &
            {\thead{$\frac{\dot{m} C_p \Delta T}{A_\mathrm{nom}}$\\{} [\si{W/m^2}]}} &
            {\thead{$k$\\{} [\si{W/m.K}]}} &
            {\thead{$\Delta T$\\{} [\si{\degreeCelsius}]}} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}


    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            {\thead{$A_\mathrm{nom}$\\{} [\si{mm^2}]}} &
            {\thead{$\dfrac{\dot{m} C_p \Delta T}{A_\mathrm{nom}}$\\{} [\si{W/m^2}]}} &
            {\thead{$k$\\{} [\si{W/m.K}]}} &
            {\thead{$\Delta T$\\{} [\si{\degreeCelsius}]}} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}


    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            {$A_\mathrm{nom}$ [\si{mm^2}]} &
            {$\frac{\dot{m} C_p \Delta T}{A_\mathrm{nom}}$ [\si{W/m^2}]} &
            {$k$ [\si{W/m.K}]} &
            {$\Delta T$ [\si{\degreeCelsius}]} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}



    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            {$A_\mathrm{nom}$ [\si{mm^2}]} &
            {$\dfrac{\dot{m} C_p \Delta T}{A_\mathrm{nom}}$ [\si{W/m^2}]} &
            {$k$ [\si{W/m.K}]} &
            {$\Delta T$ [\si{\degreeCelsius}]} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}


    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            {\thead{$A_\mathrm{nom}$\\{} [\si{mm^2}]}} &
            {\thead{$(\dot{m} C_p \Delta T)/(A_\mathrm{nom})$\\{} [\si{W/m^2}]}} &
            {\thead{$k$\\{} [\si{W/m.K}]}} &
            {\thead{$\Delta T$\\{} [\si{\degreeCelsius}]}} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}


    \begin{table}
        \centering
        \caption{Table MWE}
        \begin{tabular}{
                S[table-format = 1.2]
                S[table-format = 1.4]
                S[table-format = 2.3]
                S[table-format = 1.4]
            }
            \toprule
            {$A_\mathrm{nom}$ [\si{mm^2}]} &
            {$(\dot{m} C_p \Delta T)/(A_\mathrm{nom})$ [\si{W/m^2}]} &
            {$k$ [\si{W/m.K}]} &
            {$\Delta T$ [\si{\degreeCelsius}]} \\
            \midrule
            1.55    &   1.12345 &   10.2344     &   0.33122 \\
            1.75    &   2.34567 &   20.8455     &   0.54947 \\
            2.25    &   3.45678 &   30.5666     &   0.86800 \\
        \end{tabular}
    \end{table}
\end{document}
leandriis
  • 62,593