乳胶配方错误

Latex Formula error

我正在尝试在 Latex 中创建这个公式:

我尝试使用的代码:pos(v) = \left\{\begin{matrix} 0 & v<0 \ v & otherwise \end{matrix}\right.

但由于某种原因,我的代码一直报错: 缺少 $ 插入。
<插入的文字>
$
是的,我试过将 $ 放在某些地方,但没有结果:(
希望有人知道如何纠正这个问题!提前致谢

这对我来说很好用。我的第一个猜测与环境有关。您是否将公式附在 $ 中?您必须这样做才能进入 math-mode:

$pos(v) = \left\{ \begin{matrix}   0 & v<0 \   v & otherwise \end{matrix} \right.$

或者,您可以使用

\begin{equation}
  pos(v) = \left\{
  \begin{matrix}
    0 & v<0 \
    v & otherwise
  \end{matrix}
  \right.
\end{equation}

使用数学的内容需要放在数学模式中(即,用内联数学符号包围 $...$ 或显示数学 \[...\] 或类似):

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
  pos(v) = \left\{
  \begin{matrix}
    0 & v < 0     \
    v & otherwise
  \end{matrix}
  \right.
\]

\[
  \text{pos}(v) = \begin{cases}
    0 & \text{if $v < 0$} \
    v & \text{otherwise}
  \end{cases}
\]

\end{document}

我建议使用 cases 来显示条件函数。此外,使用 \text 设置适当的文本内容,而不是仅在数学模式下设置文本;否则间距会很糟糕。