我想创建这样的分配矩阵
\usepackage{kbordermatrix,blkarray}
\usepackage{amsmath}
\usepackage{amsmath,stackengine}
\stackMath
\[
\stackinset{c}{-2.8\baselineskip}{c}{}{\rule{.4pt}{5.2\baselineskip}}{%
\stackinset{c}{1.9\baselineskip}{c}{}{\rule{.4pt}{5.2\baselineskip}}{%
\stackinset{c}{3.1\baselineskip}{c}{}{\rule{.4pt}{5.2\baselineskip}}{%
\stackinset{c}{}{c}{2\baselineskip}{\rule{6.9\baselineskip}{.4pt}}{%
\stackinset{c}{}{c}{-3\baselineskip}{\rule{6.9\baselineskip}{.4pt}}{%
\bbordermatrix{ & 1 & 2 & 3 & 4 & 5 & 6 \cr
1 & 1.5 & 3.5 & 1 & (1) & 1 & 4 \cr
2 & 1.8 & (1) & 3.1 & 2.6 & 1.9 & 1.8 \cr
3 & (1) & 1 & 1 & 1.4 & 1.1 & 2.1 \cr
4 & 3.8 & 4 & (1) & 5.6 & 2.8 & 2.2 \cr
5 & 3 & 3.3 & 1 & 4.6 & 4.6 & 5 \cr
6 & 4.8 & 4.9 & 3.2 & 5.5 & 2.8 & (1) \cr
}}}}}}
\]
答案1
blkarray
以下是使用和获得它的方法pstricks
。我添加了auto-pst-pdf
来编译pdflatex
,但这需要使用开关enable-write18
(MiKTeX) 或-shell-escape
(TeX Live、MacTeX) 启动编译器:
\documentclass[12pt, svgnames]{article}
\usepackage[utf8]{inputenc}
\usepackage{blkarray, bigstrut, amsmath}
\usepackage{pst-node, auto-pst-pdf}
\begin{document}
\[ \begin{postscript}
\begin{blockarray}{c*{6}{c}}
\begin{block}{c*{6}{>{$ \footnotesize $}c}}
& \thead{1} & \thead{2} & \thead{3} & \thead{4} & \thead{5} & \thead{6} \\
\end{block}
\begin{block}{>{\footnotesize }c(*{6}{c})}
1 & \rnode{A}{1.5} & 3.5 & 1 & (1) & \Rnode{E}{1} & \rnode{B}{4}\bigstrut[t] \\
2 & 1.8 & (1) & 3.1 & 2.6 & 1.9 & 1.8 \\
3 & (1) & 1 & 1 & 1.4 & 1.1 & 2.1 \\
4 & 3.8 & 4 & (1) & 5.6 & 2.8 & 2.2 \\
5 & 3 & 3.3 & 1 & 4.6 & 4.6 & 5 \\
6 & \Rnode{D}{4.8} & 4.9 & 3.2 & 5.5 & \Rnode{F}{2.8} & \Rnode{C}{(1)}\bigstrut[b] \\
\end{block}
\end{blockarray}
\psset{linewidth=0.4pt, linecolor=LightSteelBlue, nodesep = -1.4em}
\ncline[nodesepB=-.8em]{A}{B}
\ncline{C}{D}
\psset{nodesep=-1em}
\ncline{A}{D}
\ncline{B}{C}
\ncline{E}{F}
\end{postscript} \]
\end{document}