我一直在尝试创建一个矩阵(如下图所示),但至今我还没能弄清楚。
我尝试了以下代码(作为示例),但它与图片中看到的不太一样。有人可以指导我吗?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{blkarray}
\begin{document}
\[
\begin{blockarray}{ccccc}
a & b & c & d & e \\
\begin{block}{(ccccc)}
1 & 1 & 1 & 1 & 1 \\
0 & 1 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 & 1 \\
0 & 0 & 0 & 1 & 1 \\
0 & 0 & 0 & 0 & 1 \\
\end{block}
\end{blockarray}
\]
\end{document}
答案1
包含:{bNiceMatrix}
nicematrix
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[T_i =
\begin{bNiceMatrix}[first-row]
W_1 & W_2 & W_3 & \cdots & W_m \\
e_{11} & e_{22} & e_{31} & \cdots & e_{m1} \\
e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \\
e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \\
\vdots & \cdots & \cdots & \cdots & \vdots \\
e_{1K} & e_{2K} & e_{3K} & \cdots & e_{mK} \\
\end{bNiceMatrix}
\]
\end{document}
答案2
\bordermatrix
纯 TeX 中有宏:
$$
\delcode`(=\delcode`[ \delcode`)=\delcode`]
T_i =
\bordermatrix{ & W_1 & W_2 & W_3 & \cdots & W_m \cr
& e_{11} & e_{21} & e_{31} & \cdots & e_{m1} \cr
& e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \cr
& e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \cr
& \vdots & \cdots & \cdots & \cdots & \vdots \cr
& e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \cr }
$$
\bye
答案3
您几乎已经完成了,您只需更改括号的尖端block
并替换矩阵元素,其中您希望有点表示\cdots
水平点,\vdots
垂直点表示:
\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[T_i =
\begin{blockarray}{ccccc}
W_1 & W_2 & W_3 & \cdots & W_m \\
\begin{block}{[ccccc]} % <--- observe [ and ]
e_{11} & e_{22} & e_{31} & \cdots & e_{m1} \\
e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \\
e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \\
\vdots & \cdots & \cdots & \cdots & \vdots \\ % <--- observe dots
e_{1K} & e_{2K} & e_{3K} & \cdots & e_{mK} \\ % <--- observe dots
\end{block}
\end{blockarray}
\]
\end{document}
代码很简单,最终结果只需一次编译。