控制给定图形中标题的垂直空间

控制给定图形中标题的垂直空间

\captionsetup之前提到过\caption{} 我找不到此属性的正确设置。我该如何调整标题的边距以使其清晰地显示出来?

\documentclass[english,a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{listings}
\usepackage{caption}
\usetikzlibrary{decorations.pathreplacing,calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\AddBelowPointcut}[3]{%
    \begin{tikzpicture}[overlay, remember picture]
        \draw [decoration={brace,amplitude=0.5em,mirror},decorate, thick,black]
                {($(#1.north west)-(0,0.2)$) -- ($(#2.north east)-(0,0.2)$) 
                node [align=center, text width=4cm, pos=0.5, anchor=west,below=0.3cm,scale=0.8] {#3}};
    \end{tikzpicture}
} %
\newcommand{\AddBelowPointcuttwo}[3]{%
    \begin{tikzpicture}[overlay, remember picture]
        \draw [decoration={brace,amplitude=0.5em,mirror},decorate, thick,black]
                {($(#1.north west)-(0,0.9)$) -- ($(#2.north east)-(0,0.9)$) 
                node [align=center, text width=4cm, pos=0.5, anchor=west,below=0.3cm,scale=0.8] {#3}};
    \end{tikzpicture}
} %
\newcommand{\AddBelowPointcuttwoname}[3]{%
    \begin{tikzpicture}[overlay, remember picture]
        \draw [->]
                {($(#1.south)-(-1,0.8)$) -- ($(#2.north)-(0.98,0.3)$) 
                node [align=center, text width=2cm, pos=0.5, anchor=west,below=0.3cm,scale=0.8] {#3}};
        \draw (0.8,-0.1) rectangle (2.1,-0.8);
    \end{tikzpicture}
} %
\newcommand{\AddBelowPointcuttwokw}[3]{%
    \begin{tikzpicture}[overlay, remember picture]
        \draw [->]
                {($(#1.south)-(-0.7,0.8)$) -- ($(#2.north)-(0.74,0.3)$) 
                node [align=center, text width=2cm, pos=0.5, anchor=west,below=0.3cm,scale=0.8] {#3}};
    \end{tikzpicture}
} %
\begin{document}

    \lipsum[1]


    \vspace{2.5em}


    \begin{figure}[ht]
    \begin{lstlisting}[
    basicstyle={\fontsize{8}{9}\ttfamily},mathescape,
    identifierstyle={\color{black}},
    tabsize=2,
    language=Java,
    numbersep=1pt,
    xleftmargin=0cm,frame=tlbr,framesep=2pt,framerule=0pt,
    morekeywords ={class,run}
    ]
    $\tikzmark{listing-ptkw-start}$pointcut$\tikzmark{listing-ptkw-end}$ $\tikzmark{listing-ptn-start}$getMedias()$\tikzmark{listing-ptn-end}$:$\tikzmark{listing-pt-start}$execution($\tikzmark{listing-p-start}$public MediaData[] AlbumData.getMedias(String)$\tikzmark{listing-p-end}$);$\tikzmark{listing-pt-end}$
\end{lstlisting}
%
\captionsetup{margin=0cm,position=below} %,belowskip=1pt,aboveskip=20pt}
\caption{\label{fig:text}text experiment ent experiment experiment}
%
\end{figure}

\AddBelowPointcut{listing-p-start}{listing-p-end}{braces again}
\AddBelowPointcuttwo{listing-pt-start}{listing-pt-end}{braces again}
\AddBelowPointcuttwoname{listing-ptn-start}{listing-ptn-end}{braces again}
\AddBelowPointcuttwokw{listing-ptkw-start}{listing-ptkw-end}{braces again}

\end{document}

在此处输入图片描述

我想要做的是这样的: 在此处输入图片描述

答案1

skip=选项用于调整标题和图形或表格内容之间的垂直空间。

例如:skip=10pt表示在标题和图形之间扩大10点。

相关内容