10

I found that the distance between the picture caption and the picture is a little large, as we can see in the pictureenter image description here

I use the code as follows, thus, how to reduce the distance between the caption and the picture?

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

Alternatively, you can use the skip key of the caption package; I used a value of 2pt, but you can choose the length that best suits your needs:

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

enter image description here

8

The spaces before and after a caption are controlled by \abovecaptionskip and \belowcaptionskip. Thus you can change the distance before the caption with

\setlength{\abovecaptionskip}{0cm}

Change the value as appropriate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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