我想要添加右侧和底部的标签(строка столбец),如下图所示:
这是我当前矩阵的代码
\begin{equation}
T_{i j}(\varphi)=\left[\begin{array}{ccccccc}
1 & \ldots & \ldots & \ldots & \ldots & \ldots & 0 \\
\ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\
\ldots & \ldots & \cos \varphi & \ldots & -\sin \varphi & \ldots & \ldots \\
\ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\
\ldots & \ldots & \sin \varphi & \ldots & \cos \varphi & \ldots & \ldots \\
\ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\
0 & \ldots & \ldots & \ldots & \ldots & \ldots & 1
\end{array}\right]
生成以下内容
答案1
选项 1:使用nicematrix
(和mathtools
for\mathclap
命令)
\documentclass{article}
\usepackage{nicematrix, mathtools}
\newcommand{\up}[1]{\overset{\textstyle\uparrow}{\mathclap{\textstyle#1\strut}}}
\begin{document}
\[
T_{ij}(\varphi)=\begin{bNiceMatrix}[last-row, last-col]
1\\
& 1\\
& & \ddots\\
& & & \cos\varphi & & -\sin\varphi & & & & i^{\mathit{th}}\mathit{ row}\\
& & & & \ddots\\
& & & \sin\varphi & & \cos\varphi & & & & j^{\mathit{th}}\mathit{ row}\\
& & & & & & \ddots\\
& & & & & & & 1\\
& & & & & & & & 1\\
& & & \up{i^{\mathit{th}}\mathit{ column}} & & \up{j^{\mathit{th}}\mathit{ column}}
\end{bNiceMatrix}
\]
\end{document}
选项 2:无nicematrix
\usepackage{mathtools}
\newcommand{\up}[1]{\overset{\textstyle\uparrow}{\mathclap{\textstyle#1\strut}}}
\begin{document}
\[
T_{ij}(\varphi)=\underset{\up{i^{\mathit{th}}\mathit{ column}}\hspace{5.33em}\up{j^{\mathit{th}}\mathit{ column}}\hspace{.4em}}{\begin{bmatrix}
1\\
& 1\\
& & \ddots\\
& & & \cos\varphi & & -\sin\varphi\\
& & & & \ddots\\
& & & \sin\varphi & & \cos\varphi\\
& & & & & & \ddots\\
& & & & & & & 1\\
& & & & & & & & 1
\end{bmatrix}}
\begin{matrix}
\\ \\ \phantom{\ddots}\\ i^{\mathit{th}}\mathit{ row} \\ \phantom{\ddots}\\ j^{\mathit{th}}\mathit{ row} \\ \phantom{\ddots}\\ \\ {}
\end{matrix}
\]
\end{document}
答案2
这是一个建议。
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\newcommand{\Clap}[1]{\multicolumn{1}{w{c}{0mm}}{#1}}
\NiceMatrixOptions{code-for-first-row = \scriptstyle,code-for-first-col = \scriptstyle }
\setcounter{MaxMatrixCols}{12}
\newcommand{\blue}{\color{blue}}
\[\begin{pNiceMatrix}[last-row,last-col,nullify-dots,xdots/line-style={dashed,blue}]
1& & & \Vdots & & & & \Vdots \\
& \Ddots[line-style=standard] \\
& & 1 \\
\Cdots[color=blue,line-style=dashed]& & & \Clap{\blue \cos\theta} &
\Cdots & & & \Clap{\blue -\sin\theta} & & & \Cdots & \blue \leftarrow i \\
& & & & 1 \\
& & &\Vdots & & \Ddots[line-style=standard] & & \Vdots \\
& & & & & & 1 \\
\Cdots & & & \Clap{\blue \sin\theta} & \Cdots & & \Cdots & \Clap{\blue \cos\theta} & & & \Cdots & \blue \leftarrow j \\
& & & & & & & & 1 \\
& & & & & & & & & \Ddots[line-style=standard] \\
& & & \Vdots & & & & \Vdots & & & 1 \\
& & & \blue \overset{\uparrow}{i} & & & & \blue \overset{\uparrow}{j} \\
\end{pNiceMatrix}\]
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。