5

I'm trying to draw an automata using TikZ and the library automata. An accepting state I would like to denote by a double circle but the distance between the two circles should be larger than the default (which is initially 0.6pt). I do this by setting double distance=1.5pt but this does not play nicely together with the option shorten >=1pt as seen in the following minimal example:

\documentclass{minimal}

\usepackage{tikz}

\usetikzlibrary{automata,positioning}

\begin{document}
\begin{tikzpicture}[shorten >=1pt]
  \node[state] (1) {1};
  \node[state,accepting] (2) [below=of 1] {2};
  \path[->] (1) edge (2);
\end{tikzpicture}
%
\begin{tikzpicture}[shorten >=1pt,accepting/.style={double distance=1.5pt}]
  \node[state] (1) {1};
  \node[state,accepting] (2) [below=of 1] {2};
  \path[->] (1) edge (2);
\end{tikzpicture}
%
\begin{tikzpicture}[shorten >=1pt,accepting/.style={double distance=1.5pt}]
  \node[state] (1) {1};
  \node[state,accepting] (2) [below=of 1] {2};
  \path[->,shorten >=1.9pt] (1) edge (2);
\end{tikzpicture}
\end{document}

In the second automata the arrow touches the double circle of the accepting state. I can manually fix the problem by adding the missing 0.9pt to the shorten parameter but this is somehow tedious and error prone. Is there some automagically way how to handle this situation?

1

1 Answer 1

3

I just last week had to handle this in a paper myself... :) Add the option outer sep=.9pt in your definition of accepting/.style, which essentially adds a .9pt margin around your accepting nodes. The shorten will be measured from that additional margin.

2
  • 2
    Strictly speaking, the outer sep should be set to half the double distance plus \pgflinewidth, so for example accepting/.style={double distance=1.5pt, outer sep=0.75pt+\pgflinewidth}. That way, an arrow without shorten` will end at the outer edge of the double line node in the same way it would for a single line node.
    – Jake
    Mar 27, 2012 at 8:19
  • Thanks Ben and Jake! The problem is solved now. Having it done automatically is much easier and less painfull ;)
    – Stefan
    Mar 27, 2012 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .