I got a little automata tikzpicture but the more complex it got, the less readable it became. So I wanted to adjust the font size of the edge labels but I just can't figure out how to do that. Tried looking in the tikzpgf manual and also on here but I only find scale and fontsize for the nodes but not for the edge labels in the path commands.

For example I want to make the text in these two paths here smaller:


\begin{tikzpicture}[node distance=1.5cm]
\node  [state, initial] (Neutral)       {Neutral};   
    (UI Popup)
    [right=of Neutral]
    {Popped UI};

    [above right=of UI Popup]

\node[state, circle split]
    [below right=of UI Popup]
    {Digital [Off] \nodepart{lower} \includegraphics[width=0.5cm]{pin_off}};

\node[state, circle split]
    [right=of Digital_Off]
    {Digital [On] \nodepart{lower} \includegraphics[width=0.5cm]{pin_on}};

    \begin{scope}[on background layer]
\node[fit=(Digital_Off) (Digital_On), rectangle, rounded corners, draw=red, label=above:Digital state] (digital) {};

\path[->] [line width=0.3mm]
            (Neutral)       edge [scale=0.2] node [above]      {Tap}                    (UI Popup)
            (UI Popup)      edge [bend left] node [above left]  {Tap and select analog} (Sine)
                            edge [bend right] node [below left] {Tap and select digital}    (Digital_Off)
            (Digital_Off)   edge [bend left] node [above]      {Tap}                    (Digital_On)
            (Digital_On)    edge [bend left] node [below]      {Tap}                    (Digital_Off)
            %(digital)      edge [bend left] node [above]      {Tap}                    (Sine)    
            (digital)       edge [bend right] node [above]     {Long click}             (UI Popup)
            (Sine)          edge [bend left]  node [below]     {Long click}             (UI Popup)
\caption{Input pin behavior}


This tikzpicture is in a separate file which begins with \chapter{...} and the main.tex file looks like this:

%!TEX root = ./main.tex

\documentclass[11pt, a4paper, titlepage]{book}



% Lots of other stuff inside


enter image description here

  • 1
    can you add an MWE?
    – AndréC
    Jul 25, 2018 at 16:54
  • 1
    please show an example of your image in form of small but complete document. you can define edge node style with desired font size. or can use quotes syntax for edge labels and define font size for quotes.
    – Zarko
    Jul 25, 2018 at 16:54
  • 1
    image is welcome, but we like to see your code for it :-)
    – Zarko
    Jul 25, 2018 at 16:56
  • 1
    preamble of your document with to image related packages and used libraries are important too ...
    – Zarko
    Jul 25, 2018 at 17:00
  • by the way, your code has (many) errors. please check it again, and please provide preamble related to this image. discovering which libraries you use is not fun.
    – Zarko
    Jul 25, 2018 at 17:14

2 Answers 2


meanwhile i wait on your complete mwe, i test your image code in my tikz testbed, consequently my preamble can differ from what you use in your document ...

i would write code for your image on the following way:

\documentclass[tikz, margin=3mm]{standalone}
\newcommand\greencirc{\tikz\node[circle, draw, thick, fill=green,
                                 minimum size=3ex, node contents={}];}
\newcommand\whitecirc{\tikz\node[circle, draw, thick, fill=white,
                                 minimum size=3ex, node contents={}];}

node distance = 8mm and 12mm,
    MP/.style = {circle split, draw, inner sep=1pt,
                 align=center, font=\scriptsize},
state/.append style = {fill=#1, align=center},
state/.default = white,
every edge quotes/.append style={font=\scriptsize, align=center, auto}% style for edge labels
\node (Neutral)     [state, initial]            {Neutral};
\node (UI Popup)    [state, right=of Neutral]   {Popped\\ UI};
\node (Sine)        [state=gray!50, above right=of UI Popup]
\node (Digital Off) [MP, below right=of UI Popup]
        {Digital\\ {[Off]} \nodepart{lower} \\ \whitecirc};

\node (Digital On) [MP, right=of Digital Off]
        {Digital\\ {[On]} \nodepart{lower} \\  \greencirc};

%\scoped[on background layer]
\node  (digital) [rounded corners, draw=red, label=75:Digital state,
                  fit=(Digital Off) (Digital On)] {};
\path[thick, ->]
    (Neutral)       edge ["Tap"]                                    (UI Popup)
    (UI Popup)      edge [bend  left,"Tap and\\ select analog"]     (Sine)
                    edge [bend right,"Tap and\\ select digital" ']  (Digital Off)
    (Digital Off)   edge [bend left,"Tap" ']                        (Digital On)
    (Digital On)    edge [bend left,"Tap" ']                        (Digital Off)
    (digital)       edge [bend right, "Long\\ click" ']               (UI Popup)
    (Sine)          edge [bend left, "Long\\ click" ']                (UI Popup)

as you see, all fonts size are defined in nodes/edge quotes styles. also are replaced two images with new commands greencirc and whitecirc. similarly can be done for sine way in grayed node.

enter image description here

  • This looks way better than what I had, thank you! I am quite new to tikz and pgf and don't understand the styling (starting with MP/.style = ... yet but will look into it. Do you have any helpful links aside from the tikz manual which can help me get into that?
    – Someguy
    Jul 26, 2018 at 9:35
  • And also, why does ' change the position of the edge label? Or rather, where can I read into that, is that due to the quotes parameter?
    – Someguy
    Jul 27, 2018 at 11:31
  • ' is shortcut for swap, see 17.8 Placing Nodes on a Line or Curve Explicitly, page 236 (tikz & opgf manual, v 3.0.2.a.
    – Zarko
    Jul 27, 2018 at 12:38

Apparently scale DOES work, but I just tried it at the wrong part in the parameters.

What I tried was

    (UI Popup)      edge [scale=0.5] [bend left] node [above left]  {Tap and select analog} (Sine)

But correct would be

    (UI Popup)      edge [bend left] node [scale=0.5] [above left]  {Tap and select analog} (Sine)

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.