# how do I change the following table?

I have the following table:

\documentclass{article}

\begin{document}

\begin{tabular}{|l|l|l|l|l|l|l|l|l|}
& a & b & c & d & e & f & g & h \\
a & \\
b \\
c \\
d \\
e \\
f \\
g \\
h \\
\end{tabular}

\end{document}


and I would like to change it in two ways.

1. First, I would like to make all cells square, independently of their content. For example, each cell should be 1cm x 1cm.

2. I want to draw an arrow from (b,f) to (c,c) and (d,d) such that the arrow looks like a hypergraph: it begins as one line and then splits into two (possibly squiggly) lines that point to cell (c,c) and cell (d,d) each separately. It would be nice to get it done with tikz.

Thanks.

• Wild guess does this have to do something with a chessboard, if so maybe have a look at the chessboard package – albert Nov 21 '18 at 14:05
• @albert, it is actually not related to chess :-) – user2299502 Nov 21 '18 at 14:14
• – samcarter_is_at_topanswers.xyz Nov 21 '18 at 14:15

## 1

I have trouble understanding your question. Do you want this

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) grid (8,8);
\foreach \x/\letter in {8/a,7/b,6/c,5/d,4/e,3/f,2/g,1/h}
\draw (0,\x-0.5) node[left] {\letter};
\foreach \x/\letter in {1/a,2/b,3/c,4/d,5/e,6/f,7/g,8/h}
\draw (\x-0.5,8) node[above] {\letter};
\draw (1.5,2.5)--(2.25,4);
\draw[->] (2.25,4)--(3.5,4.5);
\draw[->] (2.25,4)--(2.5,5.5);
\end{tikzpicture}
\end{document}


## 2 [edit 1]

Do you want this?

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,2,3,4,5,6,7,8}
\draw (0,\x) -- (\x,\x);
\foreach \x in {0,1,2,3,4,5,6,7}
\draw (\x,8) -- (\x,\x);
\draw[fill=blue] (0,0)--(8,8);
\foreach \x/\letter in {8/a,7/b,6/c,5/d,4/e,3/f,2/g,1/h}
\draw (0,\x-0.5) node[left] {\letter};
\foreach \x/\letter in {1/a,2/b,3/c,4/d,5/e,6/f,7/g,8/h}
\draw (\x-0.5,8) node[above] {\letter};
\draw (1.5,2.5)--(2.25,4);
\draw[->] (2.25,4)--(3.5,4.5);
\draw[->] (2.25,4)--(2.5,5.5);
\foreach \x/\textincell in {1/aa,2/ba,3/ca,4/da,5/ea,6/fa,7/ga}
\draw (\x-0.5,8-0.5) node {\textincell};
\foreach \x/\textincell in {1/ab,2/bb,3/cb,4/db,5/eb,6/fb}
\draw (\x-0.5,7-0.5) node {\textincell};
\foreach \x/\textincell in {1/ac,2/bc,3/cc,4/dc,5/ec}
\draw (\x-0.5,6-0.5) node {\textincell};
\draw (\x-0.5,5-0.5) node {\textincell};
\foreach \x/\textincell in {1/ae,2/be,3/ce}
\draw (\x-0.5,4-0.5) node {\textincell};
\foreach \x/\textincell in {1/af,2/bf}
\draw (\x-0.5,3-0.5) node {\textincell};
\draw (0.5,1.5) node {ag};
\end{tikzpicture}
\end{document}


I could do better if I used two nested \foreachs. However, as I'm not familiar with it, I am afraid of being wrong.

This solution is for you to add arbitrary text to each cell (but remember that each cell can contain only a limited amount of text!) -- it is not the best solution to add cell names (aa, be, etc.).

• yes, that's it, thanks! but how would I add text to the cells? that's why I wanted to keep it a tabular environment. – user2299502 Nov 21 '18 at 16:43
• it would be nice if after the split, the lines were more squiggly (arced), but I think I can try to figure it out. – user2299502 Nov 21 '18 at 16:44
• also, would it be possible to make the lower half of the grid not appear (below the diagonal)? that's another reason why I thought of using a tabular environment, because then I can do that with multicol. – user2299502 Nov 21 '18 at 16:46
• @user2299502 Sorry for replying late! I already edited my answer. Hope it helps you now! – user156344 Nov 22 '18 at 9:44
• thanks! just two more small changes: the diagonal boxes shouldn't be cut, they should be there in full. and it should be the lower left half that is not there, not the right one. I will also try to play with it to see if I can get it to work. – user2299502 Nov 22 '18 at 10:39