# Scaling nodes in automata in TikZ, inside equation.

I fail to scale the nodes (which is what I initially wanted) of the following

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\usetikzlibrary{automata}
\usetikzlibrary{graphs}

\def\nd{\tikz[scale=.65, baseline=1ex,shorten >=.1pt,node distance=1.8cm,on grid,semithick,auto,
accepting/.style ={fill=gray,text=white}]{
\node[state] (A) {$z$};
\node[state,accepting] (B) [above right=of A] {$y$};
\node[state] (C) [below right=of B] {$x$};
\path (A) edge (B)
edge [bend left] node {$z$} (C);}
}

\begin{document}

$\frac{\partial}{\partial x}\left(\nd\right)$

\end{document}


I used inner sep=0mm to reduce their size. And I tried to use scale=.65 to make the whole smaller, because I would like to use this automata regularly as symbols in equations. What would work instead? The output is a rather huge symbol:

-

Here is a possible solution:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\usetikzlibrary{automata}
\usetikzlibrary{graphs}

\def\nd{%
\begin{tikzpicture}%
[font=\scriptsize,
baseline=1ex,shorten >=.1pt,node distance=6mm,on grid,
semithick,auto,
every state/.style={fill=white,draw=black,circular
accepting/.style={fill=gray,text=white}]
\node[state] (A) {$z$};
\node[state,accepting] (B) [above right=of A] {$y$};
\node[state] (C) [below right=of B] {$x$};
\path (A) edge (B)
edge [bend left] node[below] {$z$} (C);
\end{tikzpicture}%
}
\begin{document}

$\frac{\partial}{\partial x}\left(\nd\right)$

\end{document}


I use:

• font=\scriptsize to reduce the size of symbols,

• node distance=6mm to reduce the distance between the nodes,

• minimum size=0 to reduce the size of the nodes,

• inner sep=.3mm to keep a margin between symbols and nodes.

-

I guess you are looking for a way to scale not only the global coordinates but also every single node. In this case you just have to introduce every node/.style={scale=0.65}, like

\documentclass{article}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\usetikzlibrary{automata}
\usetikzlibrary{graphs}

\def\nd{\tikz[scale=.65, every node/.style={scale=0.65}, baseline=1ex,shorten >=.1pt,node distance=1.8cm,on grid,semithick,auto,
accepting/.style ={fill=gray,text=white}]{
\node[state] (A) {$z$};
\node[state,accepting] (B) [above right=of A] {$y$};
\node[state] (C) [below right=of B] {$x$};
\path (A) edge (B)
edge [bend left] node {$z$} (C);}
}

\begin{document}

\begin{align*}
\frac{\partial}{\partial x}\left(\nd\right)
\end{align*}

\end{document}


-