[Tex/LaTex] How to remove the circles in states of automata in TikZ

automatatikz-arrowstikz-pgf

I try to draw an LTS instead of an automata, but I don't know whether TikZ has any specific options for LTS, so I tried to draw an automata, but in LTS you don't have usually circles around the states, so now I need to remove the circles in the states. I have the following code segment:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{automata,arrows,positioning}

\begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=5 cm, scale = 1, transform shape]

    \node[initial,state,initial text=]  (1A)                    {$1A$};
    \node[state]                        (1B)    [below of=1A]   {$1B$};
    \node[state]                        (2A)    [right of=1A]   {$2A$};

    \path[->] (1A) edge [loop above]    node    {$a$}           (1A)
              (1A) edge [bend left=10]  node    {$b$}           (1B)
              (1A) edge [bend left=10]  node    {$c$}           (2A);

    \end{tikzpicture}
\end{figure}
\end{document}

How can I draw an LTS in TikZ, or just remove the circles from the states of the automata above? Also, is it possible to change the placement of the text on edges? For example, the transition value is always written at the middle of the edge, is it possible to somehow push it closer to one state or the other (only for certain edges, not all of them)?

Best Answer

The style of a state node is determined by the state without output style, so you could add draw=none to that style in order to remove the node border for all state nodes, i.e. state without output/.append style={draw=none}. To reduce the size, you will also have to set the minimum size, and adjust the inner sep, e.g. state without output/.append style={draw=none,inner sep=2pt,minimum size=0pt}. The inner sep value defines the distance from the node content to its border, i.e. the whitespace you refer to.

However, it's actually a bit less work to just redefine the state style, i.e. state/.style={circle,inner sep=2pt}, where you can adjust the inner sep to your liking.

To shift a node along a path, use the pos=<fraction> as an option to the node, where <fraction> is a number between 0 and 1. See example below, for the $a$ and $b$ edge labels.

Note that the right of= syntax is deprecated in favor of right=of defined by the positioning library (which you have loaded), see Difference between "right of=" and "right=of" in PGF/TikZ.

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{automata,arrows.meta,positioning}

\begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}[
      >=Stealth,
      shorten >=1pt,
      auto,
      node distance=5 cm,
      scale = 1,
      transform shape,
      state/.style={circle,inner sep=2pt}
      ]

    \node[initial,state,initial text=]  (1A)                    {$1A$};
    \node[state]                        (1B)    [below=of 1A]   {$1B$};
    \node[state]                        (2A)    [right=of 1A]   {$2A$};

    \path[->] (1A) edge [loop above]    node    {$a$}           (1A)
              (1A) edge [bend left=10]  node[pos=0.2]    {$b$}           (1B)
              (1A) edge [bend left=10]  node[pos=0.75]    {$c$}           (2A);

    \end{tikzpicture}
\end{figure}
\end{document}

enter image description here