The header might be a bit weird. But I would like to add a specified column type that is reserved to units.
For instance, take a look at the following working example:
\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{array}
\newcolumntype{M}{>{$} l <{$}}
\begin{document}
\begin{align}
R &= \sqrt{Q\: \frac{t}{\pi\: b\: n_{eff}}}
\end{align}
Where:\\
\begin{tabular}{M |l l}
R & Radius for BNBO & $\left[\si{\meter}\right]$ \\
Q & Extraction rate & $\left[\si{\cubic\meter\per\second}\right]$ \\
t & Time frame for BNBO & $\left[\si{\second}\right]$ \\
b & Aquifer thickness & $\left[\si{\meter}\right]$ \\
n_{eff} & Effective porosity & $\left[\si{--}\right]$ \\
\end{tabular}
\end{document}
This should return this:
Now, what I would like to do, is to be free of writing all the stuff before and after the unit. This means that instead of writing
$\left[\si{\cubic\meter\per\second}\right]$
I would simply just write
\cubic\meter\per\second
as the only thing for the unit description of Q.
As you can see, I have already defined a column with respect to math, the column M. I have tried to do it in a similar way with units, which returned an error. The code I tried was
\newcolumntype{U}{>{$\left[\si{ l <}\right]$}}
Inserting U into the third column and deleting math and siunitx
environment, like this
\begin{tabular}{M |l U}
R & Radius for BNBO & \meter \\
Q & Extraction rate & \cubic\meter\per\second \\
t & Time frame for BNBO & \si{\second \\
b & Aquifer thickness & meter \\
n_{eff} & Effective porosity & - \\
\end{tabular}
the following error occurs:
Package array Error: >{..} at wrong position: token ignored. \begin{tabular}{M |l U}
I can't really figure it out. Please help me!
Best Answer
This can be done with the help of the
collcell
package (loadsarray
).Just define your column as
and you're done.
MWE
Output
Notice that the right way to add some spacing is not
\\
but something like\bigskip
. Also, usignalign
when there is nothing to align is not the best choice, useequation
instead.If you really want, but I would avoid it, you can even add
\left
and\right