LaTeX 錯誤:缺少 $

LaTeX 錯誤:缺少 $

我的 LaTeX 檔案中有一些數學方程,我通常用 來表示這些方程以$進入數學模式。對於較長的方程,我會使用,\begin{math} ...但由於某種原因,這給了我一個錯誤,告訴我缺少一個$.

\begin{center}
\begin{math}
\example{ \Delta G = \Delta H - T\Delta S }
\label{1st_ex}
\end{math}
\end{center}

給我

Missing $ inserted <inserted text> $ l.302 \example {\Delta ....

即使我插入$它仍然會給我這個錯誤。

範例函數是

%list of equations
\usepackage[titles]{tocloft}
\newcommand{\listexamplename}{List of Equations}
\newlistof{example}{exp}{\listexamplename}
\newcommand{\example}[1]{%
\refstepcounter{example}
\par\noindent\text{Equation \theexample. #1}
\addcontentsline{exp}{example}
{\protect\numberline{\thechapter.\theexample}#1}\par}

答案1

僅根據您的問題中提供的信息,我會說您有三種可能的方法來編寫方程式:

\documentclass{article}
\begin{document}

\begin{equation}
    \Delta G = \Delta H - T\Delta S 
\label{eq:1st_ex}
\end{equation}

$\Delta G = \Delta H - T\Delta S $

\[\Delta G = \Delta H - T\Delta S \]

\end{document}

這將產生如下輸出:

在此輸入影像描述

相關內容