2

I have the following table.

enter image description here

I know how to make tables with only one number/character inside each square of the table. Also I know how to write characters outside the table, thanks to the answers from How can I write characters outside a table? but I don't know how to add such arrows and 3 different numbers in one single square.

Could someone tell me how can I do it?

Thanks in advance.

[In the picture there is also the pink little squares, but that's not big deal. I can represent them using a different color (the pink square is not that important)]

2 Answers2

4

A short excerpt of your table:

enter image description here

\documentclass{article}

\usepackage[table]{xcolor}


%%%%% modified tikzmark command from here: https://tex.stackexchange.com/a/182693/134144
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\tikzmark}[2]{\tikz[overlay, remember picture] \node[inner sep=0pt, outer sep=0pt, anchor=center] (#1) {#2};}
%%%%%%%%%%

\begin{document}

\begin{tabular}{l|ccc|ccc|}
\multicolumn{1}{c}{} & \multicolumn{3}{c}{$V_1=3$} & \multicolumn{3}{c}{$V_2 = 0$}\\
\cline{2-7}
& & & a & & & b \\
$U_1 = 0$  & & \tikzmark{b}{y}  & & & \tikzmark{a}{x} & \\
\arrayrulecolor{red}\cline{7-7}\arrayrulecolor{black}
& c & & & & \multicolumn{1}{c!{\color{red}\vrule}}{} & d\\
\cline{2-7}
\end{tabular}

\tikz[overlay,remember picture] {
  \draw[shorten >=5pt,shorten <=5pt,->] (a) -- (b);
}

\end{document}
leandriis
  • 62,593
3

Here's a partial answer, done with tikz:

\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\begin{document}
\begin{center}
  \begin{tikzpicture}
    \foreach \x in {0,2,...,10} \draw[thick] (\x,0)--(\x,6);
    \foreach \x in {0,2,...,6} \draw[thick] (0,\x)--(10,\x);
    \node at (1.5,1.5) {$3$};
    \draw[thick,red] (4,5)--(3,5)--(3,4);
    \draw[thick,->] (8.25,2.5)--(7.75,2.5);
    \node[above] at (1,6) {$V_1=3$};
    \node at (3.5,4.5) {\color{red}{$-2$}};
    \node at (8.5,2.5) {$\theta$};
    \node[left] at (0,5) {$x_1=0$};
  \end{tikzpicture}
\end{center}
\end{document}

If I compile it, I get this:

enter image description here Can you take it from here?