General ⇒ Matrix row and column numbers
Matrix row and column numbers
I would like to display row numbers to the left of a matrix and column numbers above. Anyone knows how to do that?
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Matrix row and column numbers
It took a while, but there might come a solution from PSTricks. Take a look at the psmatrix environment. You will find examples on the homepage.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- countbela666
- Posts: 64
- Joined: Thu Apr 26, 2007 2:44 pm
Matrix row and column numbers
Here is an example provided by Herbert Voss in his excellent review of the latex math mode:
Regards
Marcel
Code: Select all
Code, edit and compile here:
\documentclass{article}\makeatletter\newif\if@borderstar\def\bordermatrix{\@ifnextchar*{%\@borderstartrue\@bordermatrix@i}{\@borderstarfalse\@bordermatrix@i*}%}\def\@bordermatrix@i*{\@ifnextchar[{%\@bordermatrix@ii}{\@bordermatrix@ii[()]}}\def\@bordermatrix@ii[#1]#2{%\begingroup\m@th\@tempdima8.75\p@\setbox\z@\vbox{%\def\cr{\crcr\noalign{\kern 2\p@\global\let\cr\endline }}%\ialign {$##$\hfil\kern 2\p@\kern\@tempdima & \thinspace %\hfil $##$\hfil && \quad\hfil $##$\hfil\crcr\omit\strut %\hfil\crcr\noalign{\kern -\baselineskip}#2\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\@firstoftwo#1%\if@borderstar\kern2pt\else\kern -\wd\@ne\fi%\global\setbox\@ne\vbox{\box\@ne\if@borderstar\else\kern 2\p@\fi}%\vcenter{\if@borderstar\else\kern -\ht\@ne\fi%\unvbox\z@\kern-\if@borderstar2\fi\baselineskip}%\if@borderstar\kern-2\@tempdima\kern2\p@\else\,\fi\right\@secondoftwo#1 $%}\null \;\vbox{\kern\ht\@ne\box\tw@}%\endgroup}\makeatother\begin{document}$\bordermatrix{%& 1 & 2 \cr1 & x1 & x2 \cr2 & x3 & x4 \cr3 & x5 & x6}$$\bordermatrix*[\{\}]{%x1 & x2 & 1 \crx3 & x4 & 2 \crx5 & x6 & 3 \cr
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
a thousand worlds for you to see here, take my hand and follow me...