0
Density & 7.7 g/cm^3 \\ \hline

I am using this for a table and its showing me an error "! missing $ inserted" , even though my purpose of using '^' is getting fulfilled.

  • 2
    Welcome to TeX.SX! You need to be in math mode ($) every time you use ^. – TeXnician Jun 27 '17 at 12:52
  • 1
    Or if you don't want to bother with math mode, consider using siunitx – user36296 Jun 27 '17 at 13:02
  • Thanks @texnician , how can i modify this, i mean what part of the text should be between $...$ ? – Dhruv Gulhar Jun 27 '17 at 13:03
  • For example \documentclass{article} \usepackage{siunitx} \begin{document} \SI[per-mode=symbol]{7.7}{\gram\per\cubic\centi\meter} \end{document} or \SI{7.7}{g/cm^3} – user36296 Jun 27 '17 at 13:05
  • 1
    The other option would be a g/cm$^3$ or if you do not want that g/cm\textsuperscript{3}. – TeXnician Jun 27 '17 at 13:13
2

As pointed out by the TeXnician in his/her/its comment ^ only works in math mode.

To circumvent getting in this situation in the first place, I would rather use siunitx instead of manually writting the unit.

\documentclass{article}
\usepackage{siunitx}

\begin{document}

\SI[per-mode=symbol]{7.7}{\gram\per\cubic\centi\meter}

\SI{7.7}{g/cm^3}

\end{document}

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.