TikZ 中自动机中的缩放节点,在方程内部。

TikZ 中自动机中的缩放节点,在方程内部。

我无法扩展以下节点(这是我最初想要的)

\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}

我曾经inner sep=0mm缩小过它们的尺寸。我尝试过scale=.65让整体变小,因为我想经常使用这个自动机作为方程中的符号。什么方法可以代替呢?输出是一个相当大的符号:

在此处输入图片描述

答案1

这是一个可能的解决方案:

在此处输入图片描述

\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}

我用:

  • font=\scriptsize减小符号尺寸,

  • node distance=6mm减少节点之间的距离,

  • minimum size=0减小节点的大小,

  • inner sep=.3mm保持符号和节点之间的边距。

答案2

我猜你正在寻找一种方法来缩放全局坐标,以及每个节点。在这种情况下,你只需要引入every node/.style={scale=0.65},就像

\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}

在此处输入图片描述

相关内容