# Problem with \bordermatrix

I need to write a complicated determinant of matrix, that has a structure as in the attached picture.

• Welcome to TeX.SX! You like to pose difficult questions, don't you? :-D – egreg Oct 9 '16 at 11:39

Some manual work is still needed, but I hope you don't have so many objects like these in your document.

\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@
\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@
\kern-4\p@
\hbox{\hskip 0.5em \copy\z@}%
\endgroup
}
\newcommand{\spanrows}[3][0pt]{%
\dimen@=#2\dimexpr\ht\@arstrutbox+\dp\@arstrutbox\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}{\LARGE0}} && 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}


The \spanrows command has two arguments: the number of rows to span and the text. There is also an optional argument, so with the call

\spanrows[10pt]{4}{text}


the amount given in the optional argument is added to the height, in case the matrix has rows of exceptional height.

• I am working at solving the problem, but I don't think I will success. Please help me! Oh – tranhoang10 Oct 10 '16 at 2:06
• @tranhoang150488 I added it; however, if k>2, this is a complicated way to write zero, isn't it? – egreg Oct 10 '16 at 6:49
• @tranhoang10 Please note that the local way of saying thanks is to upvote answers and to accept the answer which helps you most by clicking the greyed-out check mark at the top left of the relevant answer. – cfr Nov 1 '16 at 3:14

Here is a way with 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}


If you want arrows instead of braces, you can obtain them with pstricks (compile with 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}$


I would like to iterate my motto here that some matrices are not meant to be typeset. Notice that in the screenshot you have, whoever made that is actually trying to be precise on details a user never would really care primarily. It's not Fortran compilers would read the specs off your matrix. They need to know what is in the matrix and there is a very well defined structure in your matrix which you don't use at all not even mentioned which is truly a waste.

Here is what I would do:

\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}


You can see that in your second example, I didn't even understand the pattern so I left question marks. Instead you can keep typing different terms of y(...) and they would automatically separated instead of row numbers that mean not much in terms of content.