2017-06-18 67 views
1

我想创建这样的公式在乳胶:乳胶公式错误

enter image description here

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

但由于某些原因我的代码一直给一个错误: 失踪插入$。
<插入的文本>
$
是的,我已经试过放置$在一些地方,没有结果:(
希望有人知道如何提前纠正此!感谢

回答

1

这对我来说工作正常。?我的第一个猜测将你包围在公式中$进行相关的环境你必须这样做才能进入数学模式

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

Alt键ernatively,可以使用使用数学需要放在里面数学模式(即,通过内联的数学符号$ ... $或显示数学\[\] ...或类似的包围)

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

含量:

enter image description here

\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来设置适当的文本内容,而不是仅在数学模式下设置文本;否则间距将会非常可怕。