[pstricks] Border matrix macro from mathmode doc in plain Tex
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Sat Nov 1 11:40:03 CET 2008
John Smith schrieb:
>> \newdimen\@tempdima
>> \newdimen\@tempdimb
>
>
> What's \@tempdimb for?
sorry, shouldn't be there
> At large fonts and using the star version with square brackets, the right
> hand border numbers are too close to the bracket. What determines this
> spacing?
you can control only the space before the right delimiter,
see example
Herbert
\documentclass{article}
\makeatletter
\newif\if at borderstar
\def\bordermatrix{\@ifnextchar*{%
\@borderstartrue\@bordermatrix at i}{\@borderstarfalse\@bordermatrix at i*}%
}
\def\@bordermatrix at i*{\@ifnextchar[{\@bordermatrix at ii}{\@bordermatrix at ii[()]}}
\def\@bordermatrix at ii[#1]#2{%
\begingroup
\m at 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 at borderstar\kern2pt\else\kern-\wd\@ne\fi%
\global\setbox\@ne\vbox{\box\@ne\if at borderstar\else\kern2\p@\fi}%
\vcenter{\if at borderstar\else\kern-\ht\@ne\fi%
\unvbox\z@\kern-\if at borderstar2\fi\baselineskip}%
\if at borderstar\kern-2\@tempdima\kern2\p@\else\,\fi
\kern-10pt%%%% <======= Space before the right delimiter
\right\@secondoftwo#1$}%
\null\,\vbox{\kern\ht\@ne\box\tw@}%
\endgroup
}
\makeatother
\begin{document}
\huge
$\bordermatrix*{%
x1 & x2 & 1 \cr
x3 & x4 & 2 \cr
x5 & x6 & 3 \cr
1 & 2
}$
$\bordermatrix*[{[]}]{%
x1 & x2 & 1 \cr
x3 & x4 & 2 \cr
x5 & x6 & 3 \cr
1 & 2
}$
$\bordermatrix*[\{\}]{%
x1 & x2 & 1 \cr
x3 & x4 & 2 \cr
x5 & x6 & 3 \cr
1 & 2
}$
\end{document}
More information about the PSTricks
mailing list