4

I wish to write a unit in LaTeX which should not be typeset in italics. My current code is Log Ejected Density $(\frac{g}{cm^{3}})$, which sets the unit italicized. Is there any package I can use to get a roman shape for the unit? I am using ShareLaTeX.

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
bhjghjh
  • 491

2 Answers2

15

Load the siunitx package. You can then enter units via the \si macro and a fairly natural looking input syntax.

The following screenshot shows three possibilities for the combination of units you mentioned in your posting. Choose whichever display method best suits your preferences. (Speaking for myself, I would not use the fraction method if the document is single-spaced.)

enter image description here

\documentclass{article}
\usepackage{siunitx}
\begin{document}
Log Ejected Density (\si{\gram\per\centi\meter\cubed})

Log Ejected Density (\si[per-mode=symbol]{\gram\per\centi\meter\cubed})

Log Ejected Density $\bigl(\si[per-mode=fraction]{\gram\per\centi\meter\cubed}\bigr)$
\end{document}
Mico
  • 506,678
9

You should look into the siunitx package.

\documentclass{article}

\usepackage{siunitx}

\begin{document}

Numbers and units: $m = \SI{5.98}{\micro\gram}$

Numbers: $N_A = \num{6.022e23}$

Units: \si{\milli\pascal}

\end{document}
Johannes_B
  • 24,235
  • 10
  • 93
  • 248
Holene
  • 6,920