减少图形下方的空间?

减少图形下方的空间?

由于页面限制,我现在希望减少图形(TikZ 绘图)后面的空白空间。

我个人认为它太大了。

以下是我的 MWE。我该如何修复它?

\documentclass[a4paper]{article}

\usepackage{lipsum} % for dummy text only
\usepackage{tikz} % for TikZ drawing

\begin{document}
\lipsum
The system architecture is shown in Figure~\ref{fig:systemarchitecture}.
\begin{figure}
    \centering
    \begin{tikzpicture}[block/.style={draw, fill=white, rectangle, minimum width=0.95*\columnwidth, anchor=west}, font=\small]
\node[block, minimum width=0.9*\columnwidth, minimum height = 3cm, fill=yellow, opacity=1, text opacity=1](phone) at (0,0){};
    \end{tikzpicture}
    \caption{System Architecture}
    \label{fig:systemarchitecture}
\end{figure}
\end{document}

答案1

不使用包的快速解决方法是添加负长度

`\abovecaptionskip{-<dimension>}` and `\belowcaptionskip{-<dimension>}`

调整标题前后的垂直空间,如下所示。

在此处输入图片描述

\documentclass[a4paper]{article}

\usepackage{lipsum} % for dummy text only
\usepackage{tikz} % for TikZ drawing
\addtolength\abovecaptionskip{-10pt}  %%%%
\addtolength\belowcaptionskip{-20pt}  %%%%
\begin{document}
\lipsum
The system architecture is shown in Figure~\ref{fig:systemarchitecture}.
\begin{figure}
    \centering
    \begin{tikzpicture}[block/.style={draw, fill=white, rectangle, minimum width=0.95*\columnwidth, anchor=west}, font=\small]
\node[block, minimum width=0.9*\columnwidth, minimum height = 3cm, fill=yellow, opacity=1, text opacity=1](phone) at (0,0){};
    \end{tikzpicture}
    \caption{System Architecture}
    \label{fig:systemarchitecture}
\end{figure}
\end{document

}

答案2

使用caption包并用减少跳过belowskip

\documentclass[a4paper]{article}

\usepackage{lipsum} % for dummy text only
\usepackage{tikz} % for TikZ drawing
\usepackage[belowskip=-20pt]{caption} % reduce/increase the skip after the figure with belowskip

\begin{document}
\lipsum
The system architecture is shown in Figure~\ref{fig:systemarchitecture}.
\begin{figure}
    \centering
    \begin{tikzpicture}[block/.style={draw, fill=white, rectangle, minimum width=0.95*\columnwidth, anchor=west}, font=\small]
\node[block, minimum width=0.9*\columnwidth, minimum height = 3cm, fill=yellow, opacity=1, text opacity=1](phone) at (0,0){};
    \end{tikzpicture}
    \caption{System Architecture}
    \label{fig:systemarchitecture}
\end{figure}
\end{document}

编辑:刚刚阅读了发布后的评论,这个解决方案已经发布了。

相关内容