我尝试写一个乘法点并使用\cdot
, 4 = 2\cdot{2}
。但我收到错误消息Missing $ inserted
。我忘记了什么?
答案1
TeX 及其各种衍生产品(例如 LaTeX)区分普通散文(文本模式) 和数学 (数学模式)。在两者之间切换的最简单、最原始的方法是使用数学开关,即$
。
这是一个示例文档,向您展示它的典型用法。
\documentclass{article}
\begin{document}
This is some normal text, written in text-mode. In between dollar signs,
such as $ x = \frac{1}{2} = \frac{10}{20} = \frac{2}{5} \cdot \frac{5}{4} $,
one may write mathematics (using macros that only work in math-mode, such
as \verb:\frac:). For displayed equations, which are centered and put on
their own line, you can put math in between \verb:\[: and \verb:\]:, like this:
\[ E = mc^2 \]
If you want to number equations or to align them horizontally in a particular way,
you should consider using environments such as \texttt{equation}, \texttt{align},
or \texttt{gather} from the \texttt{amsmath} package.
\end{document}