我正在尝试构建的机器将有 15 种状态,当我编译时,这些状态开始在页面上运行。
\documentclass{article}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\usepackage{float}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows}
\tikzset{
->, % makes the edges directed
%>=stealth’, % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each ’state’ node
initial text=$ $, % sets the text that appears on the start arrow
}
\begin{document}
\begin{figure}[H]
1.19 a
%\centering
\begin{tikzpicture}
\node[state, initial](1) {};
\node[state, right of=1](2){};
\node[state, above right of=2](3){};
\node[state, right of=3](4) {};
\node[state, below right of=2](5){};
\node[state, right of=5](6){};
\node[state, below right of=4](7){};
\node[state,right of=7](8){};
\node[state,right of=8](9){};
\node[state,right of=9](10){};
\end{tikzpicture}
\end{figure}
\end{document}
答案1
您已经加载positioning
,因此您可能想要使用它。“使用它”意味着代替right of=
说right=of
或right=<distance> of
,并且类似地above
,below
和left
。使图表变小就像设置一个不太大的 一样简单node distance
。
\documentclass{article}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows}
\tikzset{
->, % makes the edges directed
%>=stealth', % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each 'state' node
initial text=$ $, % sets the text that appears on the start arrow
}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2em]
\node[state, initial](1) {};
\node[state, right=of 1](2){};
\node[state, above right=of 2](3){};
\node[state, right=of 3](4) {};
\node[state, below right=of 2](5){};
\node[state, right=of 5](6){};
\node[state, below right=of 4](7){};
\node[state,right=of 7](8){};
\node[state,right=of 8](9){};
\node[state,right=of 9](10){};
\end{tikzpicture}
\end{figure}
\end{document}
还请考虑不使用该float
包,而arrows.meta
使用arrows
。