答案1
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=0.7]
\draw (0,0) rectangle (7,3) (3,3) -- (3,0) -- (0,3)
(0.2,0.2) node[above right,font=\Huge]{$0$}
foreach \X [count=\Y] in {1,3,7} {(0,3.5-\Y) node[red,left] {$\X$}
(-0.5+\Y,3) node[red,above] {$\X$}}
foreach \X [count=\Y] in {2,4,5,6} {(2.5+\Y,3) node[above] {$\X$}};
\end{tikzpicture}
\end{document}
至于您评论中的代码:
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=0.7]
\draw (0,0) rectangle (6,3) (3,3) -- (3,0) -- (0,3)
(0.4,0.4) node[above right,font=\Huge]{$\mathbf 0$}
foreach \X/\Z [count=\Y] in {i_1,\cdots/\vdotswithin{i_1},i_k} {(0,3.5-\Y)
node[red,left] {$\Z$}
(-0.5+\Y,3) node[red,above] {$\X$}}
foreach \X [count=\Y] in
{i_{k+1},\cdots,i_N} {(2.5+\Y,3) node[above] {$\X$}};
\end{tikzpicture}
\end{document}
答案2
例如,这个简单的 TeX 代码在矩形周围创建数字:
\hbox to150bp{\def\h{\hskip0pt plus2fil}\hfil 1\h 3\h 7\h 2\h 4\h 5\h 6\hfil}
\medskip
\hbox{\llap{\vbox to30bp{\def\h#1{\hbox{#1}}\h1\vfil\h3\vfil\h7}\kern8bp}%
\pdfliteral{q 1 j 1 J 0 0 m 150 0 l 150 30 l 0 30 l s 60 30 m 60 0 l 0 30 l S Q}}
\bye
答案3
tabular
您可以使用latex 中的一些简单工具来获取它( array,diagbox,multirow
):
\documentclass{article}
\usepackage{xcolor}
\usepackage{array, diagbox, multirow}
\begin{document}
{\sffamily\renewcommand{\arraystretch}{1.3}
\begin{tabular}{ >{\color{red}}c|*{3}{>{\color{red}}c}|*{4}{c}|}
\multicolumn{1}{c}{} & 1 & 3 & \multicolumn{1}{c}{\color{red}7} & 2 & 4 & 5 & \multicolumn{1}{c}{6} \\ \cline{2-8}
1 & \multicolumn{3}{c|}{\multirow{3}{*}{\diagbox[height=3.85pc, width=4.3pc]{\huge 0}{}}}& & & & \\
3 & & & & & & & \\
7 & & & & & & & \\[-0.4pt] \cline{2-8}
\end{tabular}}
\end{document}