我想画一个类似这样的表格
\begin{tabular}{ c | c | c}
$\bigcirc$ & & \\ \hline
& $\bigcirc$ & \\ \hline
& & $\bigcirc$ \\
\end{tabular}
对于矩阵球构造的主题,但为此我需要在一个单元格中放置多个球,并且它们不能仅仅列在一条水平线上(应该是从西北到东南的对角线)。此外,球需要用数字填充,以便以后在理论中使用,任何帮助都将不胜感激!*编辑;意识到数字填充问题可以用 tikz 解决
答案1
这看起来像是 TikZ 的工作。我确信这可以改进,但它应该足以让你入门。
\documentclass{article}
\usepackage{tikz}
% First a command to make the grid
\newcommand{\grid}{%
\draw (1,1) -- (1,4);
\draw (2,1) -- (2,4);
\draw (0,2) -- (3.,2);
\draw (0,3) -- (3,3);
}
% now set some parameters for the nodes
\tikzset{ball node/.style={draw,circle,inner sep=.1em,minimum size=2.5ex}}
% now define two commands for a single or double node
% the placement of the nodes is based on a (0,1) .. (2,3)
% coordinate system starting at the bottom left corner.
% This could probably be made more user friendly.
% Note that this uses plain TeX delimited commands.
% Syntax is \single(x,y){<number>} or \double(x,y){<num1>}{<num2>}
% I'm assuming a maximum 2 numbers per cell always in the same orientation.
\def\single(#1,#2)#3{\node[ball node] (A) at (#1.5,#2.5) {#3};}
\def\double(#1,#2)#3#4{\node[ball node](A) at (#1.25,#2.75) {#3};
\node[ball node] (B) at (#1.75,#2.25) {#4};}
\begin{document}
% now we draw a matrix with some cells filled in
\begin{tikzpicture}
\grid
\single(1,2){3}
\double(2,2){4}{5}
\single(0,1){3}
\double(0,2){1}{2}
% The next part is just for reference of the coordinate system
\begin{scope}[xshift=2in]
\node (A) at (1.5,0) {The grid coordinate system};
\grid
\foreach \x in {0,1,2}
\foreach \y in {1,2,3}
{\single(\x,\y){\x,\y}}
\end{scope}
\end{tikzpicture}
\end{document}