3

The arrow from the circle around the checkmark to the 1 starts within the circle, not its border, and its arrowhead pierces the border of the target circle. I would like, instead, for the arrow to run from circle to circle.

I suspect the problem is because the arrow and starting and ending at the borders of the underlying text object, not the circle I've drawn around them.

\documentclass[tikz,border=2mm]{standalone}
\usepackage{amsmath,amssymb}

\usetikzlibrary{arrows,matrix,quotes}

\begin{document}

\begin{tikzpicture}

\tikzset{%
  square matrix/.style={
    matrix of nodes,
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth,
    nodes in empty cells,
    nodes={draw,
      minimum size=#1,
      anchor=center,
      align=center,
      inner sep=0pt
    },
  },
  square matrix/.default=1.2cm,
  arc/.style={->,> = latex'}
}

\matrix[square matrix] (A)
{
        & $h_0$ & $h_1$ & $h_2$ \\
$t_0$   & & & \\
};

\node[circle] at (A-2-2) (a) {$\checkmark$};
\node[circle,fill=white] at ([xshift=0.3cm]A-2-3) (b) {$1$};
\draw[color=orange] (a) circle(0.4);
\draw[color=orange] (b) circle(0.4);
\draw[arc,color=orange,dashed] (a) to["{\textbf{\scriptsize WP1}}"] (b);
\end{tikzpicture}
\end{document}
  • 1
    What exactly are you trying to do here? Not really clear – daleif Oct 18 at 15:13
1

Like this?

enter image description here

I only a little bit simplified your code -- use only one node for check mark and for number 1 in circle:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{amsmath,amssymb}

\usetikzlibrary{arrows,matrix,quotes}

\begin{document}

\begin{tikzpicture}

\tikzset{%
  square matrix/.style={matrix of nodes,
                        column sep=-\pgflinewidth,
                        row sep=-\pgflinewidth,
                        nodes in empty cells,
                        nodes = {draw, minimum size=#1, inner sep=0pt,
                                 anchor=center,
                                 align=center},
                        },
  square matrix/.default=1.2cm,
  arc/.style={-latex'},  % <---
C/.style = {circle, draw=orange, text=black, 
            minimum size=1.5em, inner sep=0pt}, % <---
}

\matrix[square matrix] (A)
{
        & $h_0$ & $h_1$ & $h_2$ \\
$t_0$   &       &       &       \\
};

\node (a) [C] at (A-2-2.center) {$\checkmark$}; % <---
\node (b) [C] at (A-2-3.center) {$1$};          
\path[arc,draw=orange,densely dashed] (a) to["\scriptsize {\textbf{WP1}}"] (b); % <---
\end{tikzpicture}
\end{document}

or you might looking for the following result:

enter image description here

For it you only need to move coordinates for circle placement. For example to:

\node (a) [C] at ([xshift=-3pt] A-2-2.center) {$\checkmark$};
\node (b) [C] at ([xshift= 3pt] A-2-3.center) {$1$};

Other code is the same as before.

1

I do not know if I understand the question correctly, but if I do, you want to synchronize the sizes of the circles without guessing hard-coded radii. This can be done with eqparbox, and one can make this a style, equal size. So if you want to have two nodes of the same sizes, just add equal size to the node options. If you want to have groups of nodes having the same sizes, use e.g. equal size=A for the first group, equal size=B for the next group, and so on.

\documentclass[tikz,border=2mm]{standalone}
\usepackage{amsmath,amssymb}
\usepackage{eqparbox}
\newbox\eqnodebox
\usetikzlibrary{arrows,matrix,quotes}

\begin{document}

\begin{tikzpicture}

\tikzset{%
  square matrix/.style={
    matrix of nodes,
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth,
    nodes in empty cells,
    nodes={draw,
      minimum size=#1,
      anchor=center,
      align=center,
      inner sep=0pt
    },
  },
  square matrix/.default=1.2cm,
  arc/.style={->,> = latex'},
  equal size/.style={execute at begin
    node={\setbox\eqnodebox=\hbox\bgroup},
    execute at end
    node={\egroup\eqmakebox[#1][c]{\copy\eqnodebox}}},equal size/.default=A
}

\matrix[square matrix] (A)
{
        & $h_0$ & $h_1$ & $h_2$ \\
$t_0$   & & & \\
};

\node[circle,draw=orange,equal size,inner sep=1pt] at (A-2-2) (a) {$\checkmark$};
\node[circle,draw=orange,equal size,inner sep=1pt] at ([xshift=0.3cm]A-2-3) (b) {$1$};
\draw[arc,color=orange,dashed] (a) to["WP1" font=\bfseries\scriptsize] (b);
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.