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.
Asked
Active
Viewed 9,747 times
4
Johannes_B
- 24,235
- 10
- 93
- 248
bhjghjh
- 491
2 Answers
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.)
\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

siunitxit is! – Holene Aug 28 '16 at 18:32\mathrm{cm}^3. – Sigur Aug 28 '16 at 18:33\mathrm{\,cm}^3– Holene Aug 28 '16 at 18:36\documentclass{article} \usepackage{textcomp} \let\sup\textsuperscript \begin{document} Log Ejected Density (g/cm\sup3) \end{document}– Fran Aug 29 '16 at 06:20