我在乳胶上写这个简单的代码

0 latex

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{matrix}
1 & 0\\
0 & 1
\end{matrix}
\end{document}
Run Code Online (Sandbox Code Playgroud)

此代码返回错误

缺少 $ 插入。$\end{矩阵}

rla*_*ter 5

matrix环境需要在数学模式。其中任何一个都可以工作:

% in-line math mode
\(
\begin{matrix}
1 & 0\\
0 & 1
\end{matrix}
\)
Run Code Online (Sandbox Code Playgroud)

或者

% display math mode
\[
\begin{matrix}
1 & 0\\
0 & 1
\end{matrix}
\]
Run Code Online (Sandbox Code Playgroud)

有一个TeX/LaTeX StackExchange 站点更适合此类问题。