0

I'm trying to add units to some quantities for my physics homework. Here's what I want:

  • Normal Text
  • Math Commands Allowed
  • All Bold
  • One command to accomplish the above

For example, if I want to write the units for Newton's Gravitational Constant, I need to write

$\bm{\frac{m^3}{kg*s^2}}$

Note that \bm is my defined command for boldmath. The result is equation-like, with every letter a variable. I want the letters to be normal text (still bold). If I try to put the letters into a \text{} command using amsmath, the letters will be normal but not bold. I'm willing to write out the commands separately if I have to, but if there's a way to define a new command where I can just write the units, that would be perfect.

  • 3
    Are you aware of the siunitx package? – GuM Aug 26 '18 at 21:56
  • The letters are in math mode because you put them there. So, you basically want to write Area=13 m^3 and put the unit in bold, where only the numbers are interpreted as math. – phollox Aug 26 '18 at 21:56
  • May I suggest that you change the title of your question to “A command for typesetting physical quantities with units?”, or something similar? It would be more informative, and more likely to help other users with the same problem. (Note that, although I have got enough rep points to edit your question myself, I prefer to ask your permission in advance.) – GuM Aug 26 '18 at 22:14
  • 3
    Regardless of siunitx being perfect for the task at hand, I'd recommend reading up a little bit more on the basics of LaTeX. – basseur Aug 26 '18 at 22:14
6

I recommend that you use siunitx. It is capable of detecting the surrounding font settings. But frankly, bold units don't really add to the readability.

\documentclass{article}
\usepackage{siunitx}
\sisetup{
  detect-all,
  per-mode=fraction,
}
\begin{document}

\textbf{\si{\cubic\m\per\kg\per\square\s}}

\end{document}

enter image description here

Usage with numbers:

\textbf{$G = \SI{6.67408(31)e-11}{\cubic\m\per\kg\per\square\s}$}

enter image description here

  • +1 for the last sentence (about boldfacing)! – GuM Aug 26 '18 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.