答案1
仍然需要一些手动工作,但我希望您的文档中不要有太多这样的对象。
\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}
\makeatletter
\newcommand{\tranhoang@uparrowfill}{%
\par % make sure we're in vertical mode
\begingroup\offinterlineskip
\sbox\z@{$\uparrow$}%
\sbox\tw@{\hskip 0.5em \hb@xt@\wd\z@{\hss$|$\hss}}%
\hbox{\hskip 0.5em \copy\z@}%
\kern-4\p@
\leaders\vbox{\kern-4\p@\copy\tw@\kern-4\p@}\vfill
\kern-4\p@
\copy\tw@
\endgroup
}
\newcommand{\tranhoang@downarrowfill}{%
\par % make sure we're in vertical mode
\begingroup\offinterlineskip
\sbox\z@{$\downarrow$}%
\sbox\tw@{\hskip 0.5em \hb@xt@\wd\z@{\hss$|$\hss}}%
\copy\tw@
\kern-4\p@
\leaders\vbox{\kern-4\p@\copy\tw@\kern-4\p@}\vfill
\kern-4\p@
\hbox{\hskip 0.5em \copy\z@}%
\endgroup
}
\newcommand{\spanrows}[3][0pt]{%
\dimen@=#2\dimexpr\ht\@arstrutbox+\dp\@arstrutbox\relax
\advance\dimen@ #1\relax
\vbox to \dimen@{
\kern\p@
\tranhoang@uparrowfill
\strut#3%
\tranhoang@downarrowfill
\kern\p@
}%
}
\makeatother
\newdimen\tranhoangwidth
\begin{document}
\[
\settowidth\tranhoangwidth{$n-k$ rows}
\langle k\colon e_{k + 1},\dots, e_n\rangle =
\begin{blockarray}{lllll}
\begin{block}{|llll|\BAmultirow{\tranhoangwidth}}
x_1 & x_2 & \dots & x_n & \spanrows{4}{$k$ rows} \\
x_1 & x_2 & \dots & x_n \\
\dots & \dots & \dots & \dots \\
x_1 & x_2 & \dots & x_n \\[0.5ex]
\end{block}
\begin{block}{|llll|\BAmultirow{\tranhoangwidth}}
y_1^{p^{e_{k + 1}}} & y_2^{p^{e_{k + 1}}} & \dots & y_n^{p^{e_{k + 1}}} &
\spanrows{3}{$n-k$ rows} \\
\dots & \dots & \dots & \dots \\
y_1^{p^{e_n}} & y_2^{p^{e_n}} & \dots & y_n^{p^{e_n}} \\
\end{block}
\end{blockarray}
\]
\[
\settowidth\tranhoangwidth{$n-k$ rows}% the widest label
\begin{blockarray}{lll@{\quad}llll}
\begin{block}{|lll@{\quad}lll|\BAmultirow{\tranhoangwidth}}
x_1 & \dots & x_n & x_1 & \dots & x_n & \spanrows{4}{$n+1$ rows} \\
y_1 & \dots & y_n & y_1 & \dots & y_n \\
\dots & \dots & \dots & \dots & \dots & \dots \\
y_1^{p^{n-1}} & \dots & y_n^{p^{n-1}} & y_1^{p^{n-1}} & \dots & y_n^{p^{n-1}} \\
\end{block}
\begin{block}{|lll@{\quad}lll|\BAmultirow{\tranhoangwidth}}
&&& x_1 & \dots & x_n & \spanrows{3}{$k-1$ rows} \\
&&& \dots & \dots & \dots \\
&&& x_1 & \dots & x_n \\
\end{block}
\begin{block}{|lll@{\quad}lll|\BAmultirow{\tranhoangwidth}}
&&& y_1 & \dots & y_n & \spanrows[10pt]{9}{$n-k$ rows} \\
&&& \dots & \dots & \dots \\
&&& y_1^{p^{s_1-1}} & \dots & y_n^{p^{s_1-1}} \\
&\smash{\raisebox{1ex}{\LARGE$0$}}
&& y_1^{p^{s_1+1}} & \dots & y_n^{p^{s_1+1}} \\
&&& \dots & \dots & \dots \\
&&& y_1^{p^{s_k-1}} & \dots & y_n^{p^{s_k-1}} \\
&&& y_1^{p^{s_k+1}} & \dots & y_n^{p^{s_k+1}} \\
&&& \dots & \dots & \dots \\
&&& y_1^{p^{n-1}} & \dots & y_n^{p^{n-1}} \\
\end{block}
\end{blockarray}
\]
\end{document}
该\spanrows
命令有两个参数:要跨越的行数和文本。还有一个可选参数,因此调用
\spanrows[10pt]{4}{text}
如果矩阵具有特殊高度的行,则可选参数中给出的量将添加到高度中。
答案2
这里有一种方法blkarray
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blkarray, makebox}
\usepackage{mathtools}
\begin{document}
\[ \langle\mkern1mu k\colon e_{k + 1},\dotsm, e_n\mkern0.5mu\rangle =%
\begin{blockarray}{llllc}
\begin{block}{|llll|c\Right{\}}{$ k $ rows}}%
x_1 & x_2 & \dotsm & x_n & \!\! \\
x_1 & x_2 & \dotsm & x_n \\
\makebox*{$ x_1 $}{$\cdot$} & \makebox*{$ x_2 $}{$\cdot$} & \dotsm & \makebox*{$ x_n$}{$\cdot$} \\
x_1 & x_2 & \dotsm & x_n \\[0.5ex]
\end{block}
\begin{block}{|llll|c\Right{\}}{$n- k $ rows}}%
y_1^{p^{e_{k + 1}}} & y_2^{p^{e_{k + 1}}} & \dotsm & y_n^{p^{e_{k + 1}}} & \!\! \\
\makebox*{$ x_1 $}{$\cdot$} & \makebox*{$ x_2 $}{$\cdot$} & \dotsm & \makebox*{$ x_n$}{$\cdot$}\\
y_1^{p^{e_n}} & y_2^{p^{e_n}} & \dotsm & y_n^{p^{e_n}} \\
\end{block}
\end{blockarray} \]
\end{document}
如果您想要使用箭头而不是括号,可以使用以下方法获取它们pstricks
(使用 进行编译xelatex
):
.......
\usepackage{pst-node} %
\begin{document}
\[ \begin{pspicture}%
$ \langle\mkern1mu k\colon e_{k + 1},\dotsm, e_n\mkern0.5mu\rangle =%
\begin{blockarray}{|llll|c}
x_1 & x_2 & \dotsm & x_n & \pnode[0,1ex]{A} \\
x_1 & x_2 & \dotsm & x_n \\
\makebox*{$ x_1 $}{$\cdot$} & \makebox*{$ x_2 $}{$\cdot$} & \dotsm & \makebox*{$ x_n$}{$\cdot$} \\
x_1 & x_2 & \dotsm & x_n & \pnode[0,-1ex]{B} \\[0.5ex]%
y_1^{p^{e_{k + 1}}} & y_2^{p^{e_{k + 1}}} & \dotsm & y_n^{p^{e_{k + 1}}} & \pnode[0,1ex]{C} \\
\makebox*{$ x_1 $}{$\cdot$} & \makebox*{$ x_2 $}{$\cdot$} & \dotsm & \makebox*{$ x_n$}{$\cdot$}\\
y_1^{p^{e_n}} & y_2^{p^{e_n}} & \dotsm & y_n^{p^{e_n}} & \pnode[0,-1ex]{D}
\end{blockarray} $%
\psset{arrows=<->, arrowinset=0.15}
\ncline{A}{B}\ncput*{$ k $\rlap{\enspace rows}}
\ncline{C}{D}\ncput*{$ n $\rlap{$- k $\enspace \text{rows}}}
\end{pspicture}\]
答案3
我想在这里重申我的座右铭:有些矩阵不是用来排版的。请注意,在您的屏幕截图中,无论是谁做的,实际上都是在试图精确地描述用户根本不会真正关心的细节。Fortran 编译器不会读取矩阵的规格。他们需要知道矩阵中有什么,并且矩阵中有一个定义非常明确的结构,而您根本不会使用它,甚至没有提到它,这确实是一种浪费。
以下是我要做的事情:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
Let $x,y$, be row vectors of size $n$, $\otimes$ denote the Kronecker product
and also the notation $y(a,b,\cdots)$ denote the rows
\[\begin{bmatrix}y_1^{p^{a}}&\cdots&y_k^{p^{a}}\\
y_1^{p^{b}}&\cdots&y_k^{p^{b}}\\
&\vdots\end{bmatrix}\]
Then, following determinant of an $n\times n$ matrix is well-defined
\[
\langle k: e_{k+1},\cdots,e_n\rangle =
\left|
\begin{array}{c}
\mathbf{1}_{k\times 1} \otimes x \\
y(e_{k+1},\cdots,e_n)
\end{array}
\right|
\]
also the following is well-defined too
\[
\left|
\begin{array}{cc}
x & x \\
y(0,\cdots,n-1)&y(0,\cdots,n-1)\\
0 & \mathbf{1}_{k- 1\times 1} \otimes x\\
0 &
y(0,1,\cdots,s_k,??????)
\end{array}
\right|
\]
\end{document}
您可以看到,在您的第二个示例中,我甚至不理解这种模式,所以我留下了问号。相反,您可以继续输入不同的术语y(...)
,它们会自动分隔开,而不是在内容方面意义不大的行号。
答案4
这是一个{vNiceMatrix}
使用 的解决方案nicematrix
。
\documentclass{article}
\usepackage{nicematrix,tikz}
\begin{document}
\begin{center}
\NiceMatrixOptions{xdots={horizontal-labels,line-style=<->}}
$\langle k\colon e_{k + 1},\dots, e_n\rangle =
\begin{vNiceMatrix}[last-col=5]
x_1 & x_2 & \dots & x_n
& \Vdotsfor{4}:{\makebox[4mm][l]{\small $k$ rows}} \\
x_1 & x_2 & \dots & x_n & \\
\dots & \dots & \dots & \dots \\
x_1 & x_2 & \dots & x_n \\[1mm]
y_1^{p^{e_{k+1}}} & y_2^{p^{e_{k + 1}}} & \dots & y_n^{p^{e_{k + 1}}}
& \Vdotsfor{3}:{\makebox[4mm][l]{\small $n-k$ rows}} \\
\dots & \dots & \dots & \dots \\
y_1^{p^{e_n}} & y_2^{p^{e_n}} & \dots & y_n^{p^{e_n}} \\
\end{vNiceMatrix}$
\end{center}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。