# Matrix ball construction table

I want to draw a table similar to this

\begin{tabular}{ c | c | c}
$\bigcirc$ &  &  \\ \hline
& $\bigcirc$ &  \\ \hline
&  & $\bigcirc$ \\
\end{tabular}


for the subject of matrix ball construction, but for this I need to put more than one ball in a cell, and they cannot just be listed in a horizontal line (supposed to be in a NW to SE diagonal). Also the balls will need to be filled with numbers for later in the theory, any help with this will be very much appreciated! *edit; realised that the number filling problem can be solved with tikz

-
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks , they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). – Kurt Feb 21 '13 at 1:45

This looks like a job for TikZ. I'm sure this can be improved on, but it should be enough to get you started.

\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}
`

-
This is perfect thanks for the help – rskmacdonald Feb 21 '13 at 9:37