Quero traçar o seguinte LaTeX
(claro, de uma forma que pareça mais bonita):
Até agora cheguei ao seguinte.
\documentclass{article}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{% <---- BEWARE
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{tabular}{cccccccc}
\cline{4-5}
& & & \multicolumn{1}{|c}{\circled{M1}}\tikzmark{b} & \multicolumn{1}{|c|}{M2} & & & \\
\cline{4-5}
& & & \multicolumn{1}{|c}{R1} & \multicolumn{1}{|c|}{R2} & & & \\
\cline{4-5}
& & & & & & & \\
\cline{1-2}\cline{4-5}\cline{7-8}
\multicolumn{1}{|c|}{\circled{M1}}\tikzmark{a}&\multicolumn{1}{c|}{M2} & & \multicolumn{1}{|c}{\circled{M1}}\tikzmark{x} & \multicolumn{1}{|c|}{M2} & & \multicolumn{1}{|c}{\circled{M1}}\tikzmark{c} & \multicolumn{1}{|c|}{M2} \\
\cline{1-2}\cline{4-5}\cline{7-8}
\multicolumn{1}{|c|}{R1}&\multicolumn{1}{c|}{R2} & & R1 & R2 & & \multicolumn{1}{|c}{R1} & \multicolumn{1}{|c|}{R2} \\
\cline{1-2}\cline{4-5}\cline{7-8}
& & & & & & & \\
\cline{4-5}
& & & \multicolumn{1}{|c}{\circled{M1}}\tikzmark{d} & \multicolumn{1}{|c|}{M2} & & & \\
\cline{4-5}
& & & \multicolumn{1}{|c}{R1} & \multicolumn{1}{|c|}{R2} & & & \\
\cline{4-5}
\end{tabular}
\begin{tikzpicture}[overlay, remember picture, yshift=.25\baselineskip, shorten >=.5pt, shorten <=.5pt]
\draw [->] ({pic cs:a}) [bend right] to ({pic cs:x});
\draw [->] ({pic cs:b}) [bend right] to ({pic cs:x});
\draw [->] ({pic cs:c}) [bend right] to ({pic cs:x});
\draw [->] ({pic cs:d}) [bend right] to ({pic cs:x});
\end{tikzpicture}
\end{document}
Não consigo controlar as flechas e parece que elas tendem a terminar em um ponto específico. Como posso escolher onde pode ser o ponto final? Ou talvez algo em LaTeX que defina automaticamente algum caminho para as setas, de modo que elas cruzem os menores lugares da figura?
Responder1
Aqui está uma versão sem tikzmark que funciona atribuindo nomes diferentes aos nós que você já está criando no \circled
comando.
\documentclass{article}
%\url{https://tex.stackexchange.com/q/563076/86}
\usepackage{tikz}
\newcommand*\circled[2][char]{\tikz[baseline=(#1.base),remember picture]{% <---- BEWARE
\node[shape=circle,draw,inner sep=2pt] (#1) {#2};}}
\begin{document}
\begin{tabular}{cccccccc}
\cline{4-5}
& & & \multicolumn{1}{|c}{\circled[b]{M1}} & \multicolumn{1}{|c|}{M2} & & & \\
\cline{4-5}
& & & \multicolumn{1}{|c}{R1} & \multicolumn{1}{|c|}{R2} & & & \\
\cline{4-5}
& & & & & & & \\
\cline{1-2}\cline{4-5}\cline{7-8}
\multicolumn{1}{|c|}{\circled[a]{M1}}&\multicolumn{1}{c|}{M2} & & \multicolumn{1}{|c}{\circled[x]{M1}}& \multicolumn{1}{|c|}{M2} & & \multicolumn{1}{|c}{\circled[c]{M1}} & \multicolumn{1}{|c|}{M2} \\
\cline{1-2}\cline{4-5}\cline{7-8}
\multicolumn{1}{|c|}{R1}&\multicolumn{1}{c|}{R2} & & R1 & R2 & & \multicolumn{1}{|c}{R1} & \multicolumn{1}{|c|}{R2} \\
\cline{1-2}\cline{4-5}\cline{7-8}
& & & & & & & \\
\cline{4-5}
& & & \multicolumn{1}{|c}{\circled[d]{M1}} & \multicolumn{1}{|c|}{M2} & & & \\
\cline{4-5}
& & & \multicolumn{1}{|c}{R1} & \multicolumn{1}{|c|}{R2} & & & \\
\cline{4-5}
\end{tabular}
\begin{tikzpicture}[overlay, remember picture, yshift=.25\baselineskip, shorten >=.5pt, shorten <=.5pt]
\draw [->] (a) [bend right] to (x);
\draw [->] (b) [bend right] to (x);
\draw [->] (c) [bend right] to (x);
\draw [->] (d) [bend right] to (x);
\end{tikzpicture}
\end{document}