# Units, units in fractions

I'm new to latex and trying to figure out the notation.

I'm trying to type out conversions, like (for example) 5 lbf * (4.4482 N / 1 lbf)= etc etc.

I'm not sure how to make the units show as units, or, at least, not as italics. I've seen how you can use \si{N}, but lbf isn't an SI unit, and I don't know how to combine \si with \frac.

• Hi, welcome. siunitx lets you declare new units, see e.g. tex.stackexchange.com/questions/27614/… Then if you've defined an \lbf unit, you can do e.g. \SI{4.4482}{\newton\per\lbf}. Note capital \SI which is for a number with a unit. Feb 4 '19 at 20:19
• The siunitx package allows you to define your own units and typesets them in a consistent way. Feb 4 '19 at 20:20

Units are placed in upright font, and the spacing between a number and its unit is smaller than the usual spacing between words. Furthermore, the number and its unit should not be broken up over two lines of text.

This is a good article that discusses typesetting mathematics for science: http://www.tug.org/TUGboat/Articles/tb18-1/tb54becc.pdf

The following macro can be placed in the preamble to help with units. In works in and out of mathmode.

\providecommand*{\unit}[1]{\ensuremath{\mathrm{\,#1}}}


Here is my example:

\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}

\providecommand*{\unit}[1]{\ensuremath{\mathrm{\,#1}}}

\begin{document}
You can type units in manually, $1\,\mathrm{lbf} = 4.4482\,\mathrm{N}$

Or you can use the macro defined above:
\begin{equation*}
5.00\unit{lbf} \left(\frac{4.4482\unit{N} }{ 1\unit{lbf}}\right) = 22.2\unit{N}
\end{equation*}

These give the same result:

22.2\unit{N}

22.2\,N

$22.2\,\mathrm{N}$

Since mathmode gets rid of whitespace, this doesn't look right:

$1\,\mathrm{N} = 1\,\mathrm{kg m/s^2}$

This looks right:

$1\,\mathrm{N} = 1\,\mathrm{kg\,m/s^2}$

\end{document}