插入矩阵时我遇到了问题。我试过几次,之前没有出现错误。代码如下:
$$
\left[
\begin{array}{cc}
[RGA]_{11} & [RGA]_{12} \\
[RGA]_{21} & [RGA]_{22}
\end{array}
\right]
\text{ becomes }
\left[
\begin{array}{cc}
[RGA]_{11} & 1-[RGA]_{11} \\
1-[RGA]_{11} & [RGA]_{11}
\end{array}
\right]
$$
这不能编译,在第 5 行出现错误,而如果我写下:
$\left[
\begin{array}{cc}
[RGA]_{11} & [RGA]_{12} \\
a [RGA]_{21} & [RGA]_{22}
\end{array}
\right]
\text{ becomes }
\left[
\begin{array}{cc}
[RGA]_{11} & 1-[RGA]_{11} \\
1-[RGA]_{11} & [RGA]_{11}
\end{array}
\right]
$
作为一个愚蠢的例子,它编译通过了!知道哪里出了问题吗?
答案1
与 David 的评论一致......此外,避免使用 $$,RGA 看起来不应该像三个变量的乘积。
\documentclass{article}
\usepackage{amsmath}
\newcommand{\rga}{\text{[RGA]}}
\begin{document}
\[
\begin{bmatrix}
\rga_{11} & \rga_{12} \\
\rga_{21} & \rga_{22}
\end{bmatrix}
\text{ becomes }
\begin{bmatrix}
\rga_{11} & 1-\rga_{11} \\
1-\rga_{11} & \rga_{11}
\end{bmatrix}
\]
\end{document}