Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
\usetikzlibrary{shadows}

\def\nd{\tikz[scale=.65, baseline=1ex,shorten >=.1pt,node distance=1.8cm,on grid,semithick,auto,
every state/.style={fill=white,draw=black,circular drop shadow,inner sep=0mm,text=black},
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:

enter image description here

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Here is a possible solution:

enter image description here

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

\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
      drop shadow,inner sep=.3mm,text=black,minimum size=0},
    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.

share|improve this answer

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}
\usetikzlibrary{shadows}

\def\nd{\tikz[scale=.65, every node/.style={scale=0.65}, baseline=1ex,shorten >=.1pt,node distance=1.8cm,on grid,semithick,auto,
every state/.style={fill=white,draw=black,circular drop shadow,inner sep=0mm,text=black},
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}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.