Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  diabonas Mar 26 '12 at 18:00
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
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 '12 at 8:19
    
@Jake, good point, thanks! –  Ben Lerner Mar 27 '12 at 12:16
    
Thanks Ben and Jake! The problem is solved now. Having it done automatically is much easier and less painfull ;) –  Stefan Mar 27 '12 at 14:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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