我发现图片标题和图片之间的距离有点大,正如我们在图片中看到的那样
我使用的代码如下,那么如何减少标题和图片之间的距离呢?
\usepackage[latin1]{inputenc}
\usetikzlibrary{trees}
\usepackage{verbatim}
\usetikzlibrary{trees,decorations.pathmorphing}
\begin{figure}[ht!]
{\centering
\tikzset{level 1/.style={level distance=1.0cm, sibling distance=0.5cm}}
\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}
\begin{tikzpicture}[grow=down, -stealth, edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=2mm}}]
{\node[bag]{$S_0{:}(\{a{\mapsto}1\},A{<}a{=}1{>}B,t_{i_1}{\geq}0,0)$}
child{edge from parent node{$$}; \node[bag]{$S_{n-1}{:}(...,stop_{good},t_{i_3}{\geq}3,0)$}
};
}
\end{tikzpicture}
}
\caption{LTS of A Pick Activity}
\end{figure}
答案1
或者,您可以使用包skip
的键caption
;我使用了值2pt
,但您可以选择最适合您需求的长度:
\documentclass{article}
\usepackage[skip=2pt]{caption}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\usetikzlibrary{trees,decorations.pathmorphing}
\begin{figure}[ht!]
{\centering
\tikzset{level 1/.style={level distance=1.0cm, sibling distance=0.5cm}}
\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}
\begin{tikzpicture}[grow=down, -stealth, edge from parent/.style={draw,decorate,decoration={snake, post=lineto, post length=2mm}}]
{\node[bag]{$S_0{:}(\{a{\mapsto}1\},A{<}a{=}1{>}B,t_{i_1}{\geq}0,0)$}
child{edge from parent node{$$}; \node[bag]{$S_{n-1}{:}(...,stop_{good},t_{i_3}{\geq}3,0)$}
};
}
\end{tikzpicture}
}
\caption{LTS of A Pick Activity}
\end{figure}
\end{document}
答案2
标题前后的空格由\abovecaptionskip
和控制\belowcaptionskip
。因此,您可以使用 更改标题前的距离
\setlength{\abovecaptionskip}{0cm}
根据需要更改该值。