2017-06-18 100 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來設置適當的文本內容,而不是僅在數學模式下設置文本;否則間距將會非常可怕。