在 LaTeX 中输入矩阵以及矩阵中增加公式。
LATEX 中 array 环境可以定义二维数组,具体需要定义列数,并用 \\ 换行,数组可作为一个公式块,在外套用 \left、\right 等定界符。
\mathbf{X} =
\left(\begin{array}{cccc}x_{11} & x_{12} & \ldots & x_{1n}\\x_{21} & x_{22} & \ldots & x_{2n}\\\vdots & \vdots & \ddots & \vdots\\x_{n1} & x_{n2} & \ldots & x_{nn}\\\end{array}
\right)
矩阵变量一般要加粗以区别于其他变量,即 \mathbf{}。
\left 和 \right 后的定界符为包裹矩阵的符号,可以设置为:()、[]、{}等。可以使用 amsmath 宏包中有排版矩阵的环境来代替,如:不带定界符的 matrix,以及带各种定界符的矩阵阵 pmatrix (、bmatrix [、Bmatrix {、vmatrix |、Vmatrix ||。
\begin{matrix} 1 & 2 \\ 3 & 4 \end{matrix}\begin{pmatrix} x_{11} & x_{12} & \ldots & x_{1n}\\ x_{21} & x_{22} & \ldots & x_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ x_{n1} & x_{n2} & \ldots & x_{nn}\\
\end{pmatrix}
矩阵中排版分式
\mathbf{H}=
\begin{bmatrix}\dfrac{\partial^2 f}{\partial x^2} &\dfrac{\partial^2 f}{\partial x \partial y} \\[8pt]\dfrac{\partial^2 f}{\partial x \partial y} &\dfrac{\partial^2 f}{\partial y^2}
\end{bmatrix}
\\[8pt]:增加行间距8pt
参考:
- 一份(不太)简短的 LATEX 2ε 介绍