3

In some beamer slides I found several finite automata similar to this one:

enter image description here

How to reproduce that style in Latex? Which package and configuration I should set?

TikZ should be the way to go, but actually I didn't found any configuration to obtain exactly the same style. Maybe I have not checked the documentation deeply enough.

EDIT:

A minimal working example using TikZ, replicating the automaton in the figure above:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\begin{document}
    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto] 
    \node[state,initial] (0)   {$0$}; 
    \node[state,accepting](1) [right=of 0] {$1$};
    \path[->] 
    (0) edge  node {$G$} (1)
        edge [loop above] node {not $G$} (0)
    (1) edge [loop above] node {true} (1);
    \end{tikzpicture}
\end{document}

Which gives:

enter image description here

  • 1
    If your problem is that you cannot find any configuration with the exact same style, maybe you could add a minimal working example (MWE) with another style which we then could tweak to resemble your image? – samcarter_is_at_topanswers.xyz Oct 8 '18 at 13:10
  • I'm sorry, you're right, I've just added a MWE and the generated image. – Marco Favorito Oct 8 '18 at 13:24
2

Welcome to TeX.SE! It is rather simple to cook up something similar.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{automata,positioning,shadows.blur}
\begin{document}
    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto,font=\sffamily] 
    \node[state,blur shadow,fill=white] (0)   {$0$}; 
    \node[state,accepting,blur shadow,fill=white](1) [right=of 0] {$1$};
    \draw[thick,latex-] (0.210) -- ++(210:0.5);
    \draw[thick,rounded corners=3mm,-latex](0.north) -- ++(135:1) -- ++(-135:1) 
    node[midway,above left]{not G}  -- (0.west);
    \draw[thick,rounded corners=3mm,-latex](1.east) -- ++(45:1) -- ++(150:1) 
    node[midway,above right]{true}-- (1.north);
    \end{tikzpicture}
\end{document}

enter image description here

  • Thank you for your answer. However, I'm looking for a package or TkiZ theme that cope with all the details of your code (I don't know if it already exists and how it's called). Your code is really helpful, indeed it answers the part of the question "similar to this image". Unfortunately, it seems too low level to use your hints for a bigger automaton. – Marco Favorito Oct 8 '18 at 14:00
  • @MarcoFavorito I do not know if such a package exists. However, the nice thing about TikZ is that you can define and modify your own styles. That is, you only have to redefine state to also drop a shadow and so on. Then you do not have to repeat these things. – user121799 Oct 8 '18 at 14:04
  • Oh, I see! Thank you, it will definitely be helpful! – Marco Favorito Oct 8 '18 at 14:06
1

I found out that the tool that generates the automaton in the question with exactly the same style is OmniGraffle, a software for Mac only. Hence, it is not a Latex package.

You can find another example below:

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.