4

Greetings to all of the community! Could anyone help on redefining the \bordermatrix to get results as shown?

https://tex.stackexchange.com/questions/59517/label-rows-of-a-matrix-by-characters

The initial question was about changing form of braces (and there is a thread about it) was quite easy to deal with, since Knuth gave said definition in TexBook (though it has some minor differences with the one given on the forum here). But how should i change those lines to get it done?

The \kbordermatrix and \blockarray (the image is taken from thread about those two) are out of the question, because our editorial is harsh on new usepackages at the moment. Or forever maybe)

First time here, looked through suggested questions, but simply might not see the answer. If any rules of form were violated by my first attempt, please give a good kick)

  • Welcome to TeX.SX! It is easier to help you if you add a minimal working example that takes the form \documentclass{...}\usepackage{....}\begin{document}...\end{document}. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. This makes it much easier for people to help you - and much more likely that they will! – Andrew Jun 20 '15 at 12:42
  • There are new definitions for \bordermatrix in “Math mode” by Herbert Voß, see texdoc mathmode, section 5. – egreg Jun 20 '15 at 12:52
  • Thanks for comments (fast!) i'll look into it. Funny, how i didn't notice texdoc the first time – Arseny Kharitonov Jun 20 '15 at 13:05
5

Define your own bordermatrix, derived from the one in latex.ltx:

\documentclass{article}
\makeatletter
\def\BorderMatrix#1{%
    \begingroup
    \m@th\@tempdima8.75\p@\setbox\z@\vbox{%
        \def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline }}%
        \ialign{\hfil$##$\hfil\kern2\p@\kern\@tempdima & \thinspace 
            \hfil $##$\hfil && \quad\hfil $##$\hfil\crcr\omit\strut
            \hfil\crcr\noalign{\kern-\baselineskip}#1\crcr\omit
            \strut\cr}}%
    \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
    \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
    \setbox\tw@\hbox{%
        $\kern\wd\@ne\kern-\@tempdima\left(\kern2pt
        \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
        \vcenter{\kern -\ht\@ne \unvbox\z@\kern-\baselineskip}%
        \kern-2\@tempdima\kern4\p@\right)$}%
    \null\;\vbox{\kern\ht\@ne\box\tw@}%
    \endgroup
}
\makeatother
\begin{document}

    $\bordermatrix{%
           &  1 &  2 \cr
         1 & x1 & x2 \cr
         2 & x3 & x4 \cr
         3 & x5 & x6 \cr
        }$
    \qquad
    $\BorderMatrix{%
         1 & 2  &    \cr
        x1 & x2 & 1 \cr
        x3 & x4 & 2 \cr
        x5 & x6 & 3 \cr
    }$

\end{document}

enter image description here

  • that is the best one yet! I'll look into your source closely. – Arseny Kharitonov Jun 20 '15 at 13:28
  • "Dublin. I have much, much to learn." – Arseny Kharitonov Jun 20 '15 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.