0

I'm partial to marking the initial state of my automata with a '>' (somewhat larger) pointing at the state. I find the "initial -->" distracting. Is there any way to change the default?

3 Answers 3

2

You can just decrease the initial distance and use arrows.meta to add a largish arrow.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{automata,arrows.meta}
\begin{document}
\begin{tikzpicture}[
    every initial by arrow/.style={-{Straight Barb[length=5pt,width=6pt]}},
    initial distance=0.01cm,initial text={}]
\node[state,initial] {$q_0$}; 
\end{tikzpicture}
\end{document}

enter image description here

1
  • Fooling around before seeing your answer I came to essentially the same solution. Thanks!
    – vonbrand
    Feb 23, 2020 at 0:15
2

This may interest you -- from the pgf manual chapter on decoration.markings at page 646 --

link--> http://ctan.imsc.res.in/graphics/pgf/base/doc/pgfmanual.pdf

enter image description here

Position and color can be adjusted as per your choice -- this is only a rough draft

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata, decorations.shapes, shapes.geometric}

\begin{document}

\begin{tikzpicture}[>=latex, decoration={shape= isosceles triangle, shape 
  width=0.65cm, shape height=0.45cm,shape sep=0.75cm,shape backgrounds}]
  \node[state] (q_0) {$q_0$};
  \draw[decorate, fill=red] (-2cm,0)-- node[above]{start} (q_0);
  \draw [decorate, fill=red](1,0);
\end{tikzpicture}

\end{document}
1

Set every initial by arrow style and fix scale and line width options.

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata, arrows.meta, positioning}
\begin{document}
\begin{tikzpicture}[initial text = {}, initial distance = {0.01mm},
     every initial by arrow/.style = { -{To[scale=2.0, line width=0.7pt]}  }]
%
        \node (q0) [state, accepting, initial] {$q_{0}$};
%
\end{tikzpicture}
\end{document}

DFA

See PGF/TikZ manual for more arrow tips.

You must log in to answer this question.

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