数学模式中的 \text{} 错误

数学模式中的 \text{} 错误

当我编译以下代码时:

\subsection{Force}
A force accelerates that standard body by exactly 
$ 1 \text{ m/s^2 } $ 
is defined to have a magnitude of 
$ 1 \text(N) $
The direction of a force is the direction of the acceleration is causes.

我收到此错误:

Missing $ inserted. <inserted text> 
                $ l.196 $ 1 \text{m/s^2}
                       $ I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.

! Extra }, or forgotten $. \textdef@ ...th {#1}\let \f@size
#2\selectfont #3}
                                                  } l.196 $ 1 \text{m/s^2}
                       $ I've deleted a group-closing symbol because it seems to be spurious, as in `$x}$'. But perhaps the } is legitimate and you forgot something else, as in `\hbox{$x}'. In such cases the way to recover is to insert both the forgotten and the deleted material, e.g., by typing `I$}'.

到底是怎么回事?

答案1

你不应该那样做。请siunitx改用。

\documentclass{article}
\usepackage[detect-all]{siunitx}
\begin{document}
    \subsection{Force}
A force accelerates that standard body by exactly
\SI{1}{\meter\per\second^2}
is defined to have a magnitude of
\SI{1}{\newton}.
The direction of a force is the direction of the acceleration is causes.
\end{document}

在此处输入图片描述

相关内容