tikz 子图和子标题之间的间距

tikz 子图和子标题之间的间距

在通过 添加图形时,我无法缩小子标题和图形之间的尺寸tikz。我尝试了负面效果\vspace,并\captionsetup{skip=...}根据设置(或更改?)答案,但似乎没有什么用。任何帮助都非常感谢 :)

在此处输入图片描述

\documentclass{scrreprt}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\newcommand{\subaxeswest}[5]{
\hspace{-25pt}
\subfloat[#5]{%
\begin{tikzpicture}
    \node (image) at (0,0) [inner sep=6pt]{\includegraphics[width=#1\textwidth]{#2}};
    \draw [->] (image.south west) -- ++(0.5,0) node[right]{\footnotesize #3};
    \draw [->] (image.south west) -- ++(0,0.5) node[above]{\footnotesize #4};
\end{tikzpicture}
\captionsetup{skip=-10pt} % this doesn't have any effect at all??
\vspace{-10pt}            % this neither
}}
\begin{document}
    \begin{figure}[h!]
        \centering
        \subaxeswest{0.45}{example-image-a}{y}{x}{caption one}
        \quad
        \subaxeswest{0.45}{example-image-b}{y}{z}{caption two}
        \caption{Foo}
    \end{figure}
\end{document}

答案1

在你的序言中,你必须使用captionsetup命令subfloat

\documentclass{scrreprt}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\newcommand{\subaxeswest}[5]{
\hspace{-25pt}
\captionsetup[subfloat]{captionskip=-15pt}
\subfloat[#5]{%
\begin{tikzpicture}
    \node (image) at (0,0) [inner sep=6pt]{\includegraphics[width=#1\textwidth]{#2}};
      \draw [->] (image.south west) --++ (0.5,0) node[right]{\footnotesize #3};
    \draw [->] (image.south west) --++ (0,0.5) node[above]{\footnotesize #4};
\end{tikzpicture}
}}
\begin{document}
    \begin{figure}[h!]
        \centering
        \subaxeswest{0.45}{example-image-a}{y}{x}{caption one}
        \quad
        \subaxeswest{0.45}{example-image-b}{y}{z}{caption two}
         \caption{Foo}
    \end{figure}

     \begin{figure}[h!]
     \subfloat[First sub-figure\label{subfig-1:dummy}]{%
       \includegraphics[width=0.45\textwidth]{example-image-a}
     }
     \quad
     \subfloat[First sub-figure\label{subfig-2:dummy}]{%
       \includegraphics[width=0.45\textwidth]{example-image-b}
     }
     \caption{Baz}
     \label{fig:dummy}
   \end{figure}
\end{document}

在此处输入图片描述

相关内容