Unit column in table with square brackets and siunitx
Please unlearn your habit of using
\left ... \right
all overDrop the
[]
, they do nothing to the interpretation of that columnuse the
s
column, and in that column just write say\meter
In code
\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{array,booktabs}
\newcolumntype{M}{>{$} c <{$}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\begin{document}
\begin{tabular}{M l s } %|
\toprule
\mc{Variable} & Meaning & \mc{Unit} \\
\midrule
R & Radius for BNBO & \meter\\
Q & Extraction rate & \cubic\meter\per\second\\
t & Time frame for BNBO & \second\\
b & Aquifer thickness & \meter\\
n_{\textup{eff}} & Effective porosity & \mc{---} \\
\bottomrule
\end{tabular}
\end{document}
This can be done with the help of the collcell
package (loads array
).
Just define your column as
\newcolumntype{U}{>{$[\collectcell\si} l <{\endcollectcell]$}}
and you're done.
MWE
\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{collcell} % loads array
\newcolumntype{M}{>{$} l <{$}}
\newcolumntype{U}{>{$[\collectcell\si} l <{\endcollectcell]$}}
\begin{document}
\begin{equation}
R = \sqrt{Q\: \frac{t}{\pi\: b\: n_{eff}}}
\end{equation}
Where:\bigskip
\begin{tabular}{M |l U}
R & Radius for BNBO & \meter\\
Q & Extraction rate & \cubic\meter\per\second\\
t & Time frame for BNBO & \second\\
b & Aquifer thickness & \meter\\
n_{\textit{eff}} & Effective porosity & -\\
\end{tabular}
\end{document}
Output
Notice that the right way to add some spacing is not \\
but something like \bigskip
. Also, usign align
when there is nothing to align is not the best choice, use equation
instead.
If you really want, but I would avoid it, you can even add \left
and \right
\newcolumntype{U}{>{$\left[\collectcell\si} l <{\endcollectcell\right]$}}
You add no meaning with the units in brackets; in my opinion it's even wrong, as usually brackets denote abstract dimensions, such as “length·time–1” or “force·length”.
The s
column type is what you're looking for. I also removed all \:
spacing commands, which are wrong, and set “eff” in upright type.
Note also that Where:\bigskip
would allow a page break after it.
\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{siunitx}
\newcolumntype{M}{>{$} l <{$}}
\newcommand{\eff}{\textrm{eff}}
\begin{document}
\begin{equation}
R = \sqrt{Q \frac{t}{\pi b n_{\eff}}}
\end{equation}
Where:\\*[\bigskipamount]
\begin{tabular}{M l s}
R & Radius for BNBO & \meter\\
Q & Extraction rate & \cubic\meter\per\second\\
t & Time frame for BNBO & \second\\
b & Aquifer thickness & \meter\\
n_{\eff} & Effective porosity & \multicolumn{1}{c}{--}\\
\end{tabular}
\end{document}