Consistent Latex units in non italics
January 27, 2015 at 07:23 PM | categories: latex | View Comments
Yet another latex tidbit. Its purpose - remove italics from the units inside math mode.
in the header :
1: \newcommand{\unit}[1]{\ensuremath{\, \mathrm{#1}}}
in the body :
1: $\tau=0.0257\left[\unit{N\cdot m^{-2}}\right]$
If you want to take this approach to the very extreme, you could have the units of every var defined in the header :
1: \newcommand{\tauunit}{\unit{N}\cdot\unit{m}^{-2}}
And use them consistently without silly unit mistakes inside your manuscript :
1: $\tau=0.4\tauunit$
Copyright (C) 2015 by Avi Gozolchiani. See the License for information about copying.