如何在这个矩阵中添加方括号?
(a1,...,an) 和 (x1,...,xm) 不在括号中。
\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{align*}
D=
\begin{array}{ccccc}
&a_1&a_2&\ldots&a_n\\
x_1&(\mu_{11},\nu_{11})&(\mu_{12},\nu_{12})&\ldots&(\mu_{1n},\nu_{1n})\\
x_2&(\mu_{21},\nu_{21})&(\mu_{22},\nu_{22})&\ldots&(\mu_{2n},\nu_{2n})\\
\vdots&\vdots&\ddots&\vdots\\
x_m&(\mu_{m1},\nu_{m1})&(\mu_{m2},\nu_{m2})&\ldots&(\mu_{mn},\nu_{mn})
\end{array}
\end{align*}
\end{document}
答案1
和nicematrix
。
\documentclass{article}
\usepackage{nicematrix,amssymb}
\begin{document}
\begin{align*}
D=
\begin{bNiceMatrix}[first-col,first-row]
&a_1&a_2&\ldots&a_n\\
x_1&(\mu_{11},\nu_{11})&(\mu_{12},\nu_{12})&\ldots&(\mu_{1n},\nu_{1n})\\
x_2&(\mu_{21},\nu_{21})&(\mu_{22},\nu_{22})&\ldots&(\mu_{2n},\nu_{2n})\\
\vdots&\vdots&\ddots&\vdots\\
x_m&(\mu_{m1},\nu_{m1})&(\mu_{m2},\nu_{m2})&\ldots&(\mu_{mn},\nu_{mn})
\end{bNiceMatrix}
\end{align*}
\end{document}
编辑:我们还可以改进你的矩阵使用\Ldots
,\Vdots
和\Ddots
\documentclass{article}
\usepackage{amssymb}
\usepackage{nicematrix}
\begin{document}
\begin{align*}
D=
\begin{bNiceMatrix}[first-col, first-row]
& a_1 & a_2 & \Ldots & a_n \\
x_1 & (\mu_{11},\nu_{11}) & (\mu_{12},\nu_{12}) & \Ldots & (\mu_{1n},\nu_{1n}) \\
x_2 & (\mu_{21},\nu_{21}) & (\mu_{22},\nu_{22}) & \Ldots & (\mu_{2n},\nu_{2n}) \\
\Vdots & \Vdots & \Vdots & \Ddots & \Vdots \\
x_m & (\mu_{m1},\nu_{m1}) & (\mu_{m2},\nu_{m2}) & \Ldots & (\mu_{mn},\nu_{mn})
\end{bNiceMatrix}
\end{align*}
\end{document}
答案2
\documentclass{article}
\usepackage{blkarray,amsmath}
\begin{document}
\begin{align*}
D=
\begin{blockarray}{c c c c c}
&a_1&a_2&\ldots&a_n\\
\begin{block}{c [c c c c]}
x_1&(\mu_{11},\nu_{11})&(\mu_{12},\nu_{12})&\ldots&(\mu_{1n},\nu_{1n})\\
x_2&(\mu_{21},\nu_{21})&(\mu_{22},\nu_{22})&\ldots&(\mu_{2n},\nu_{2n})\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
x_m&(\mu_{m1},\nu_{m1})&(\mu_{m2},\nu_{m2})&\ldots&(\mu_{mn},\nu_{mn})\\
\end{block}
\end{blockarray}
\end{align*}
\end{document}