![如何增加盒状图形底部边框和其标题之间的空间?](https://linux22.com/image/316109/%E5%A6%82%E4%BD%95%E5%A2%9E%E5%8A%A0%E7%9B%92%E7%8A%B6%E5%9B%BE%E5%BD%A2%E5%BA%95%E9%83%A8%E8%BE%B9%E6%A1%86%E5%92%8C%E5%85%B6%E6%A0%87%E9%A2%98%E4%B9%8B%E9%97%B4%E7%9A%84%E7%A9%BA%E9%97%B4%EF%BC%9F.png)
我正在尝试在方框图形和其标题之间生成一个空格(6pt)。由于我使用的是 tikz 代码,因此 \includegraphics 不起作用。我也尝试了\setlength{\abovecaptionskip}{6pt}
,\captionsetup[figure]{skip=6pt}
。但是它们不起作用。如何处理这个问题?
\documentclass[a4paper,12pt]{article}
\usepackage[margin=10pt,font=small,justification=centering]{caption}
\usepackage{tikz}
\usepackage{floatrow}
\usepackage{float,lipsum}
\floatstyle{boxed}
\restylefloat{figure}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\begin{document}
\begin{figure}[ht]
\begin{center}
\begin{tikzpicture}[thick,scale=1]
\filldraw[black]
(0,0) circle (2pt) (1,1) circle (2pt) (1,-1) circle (2pt)
(3,1) circle (2pt) (3,-1) circle (2pt) (4,0) circle (2pt);
\draw (0,0) -- (1,1) -- (1,-1) -- (0,0);
\draw (1,1) -- (3,1) -- (4,0) -- (3,-1) -- (3,1);
\draw (3,-1) -- (1,-1)--(1,1);
\draw (3,1)-- (3,-1); \draw (4,0) -- (0,0);
\node[above] at (1,1) {$v_1$};
\node[left] at (0,0) {$v_0$};
\node[below] at (1,-1) {$v_5$};
\node[below] at (3,-1) {$v_4$};
\node[right] at (4,0) {$v_3$};
\node[above] at (3,1) {$v_2$};
\end{tikzpicture}
\caption{$G$.}
\label{factorex}
\end{center}
\end{figure}
\end{document}
答案1
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usepackage{floatrow}
\floatsetup[figure]{%
style=Boxed,captionskip=12pt,capposition=bottom,margins=centering,%
}
\usepackage[font=small]{caption}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[thick,scale=1]
\filldraw[black]
(0,0) circle (2pt) (1,1) circle (2pt) (1,-1) circle (2pt)
(3,1) circle (2pt) (3,-1) circle (2pt) (4,0) circle (2pt);
\draw (0,0) -- (1,1) -- (1,-1) -- (0,0);
\draw (1,1) -- (3,1) -- (4,0) -- (3,-1) -- (3,1);
\draw (3,-1) -- (1,-1)--(1,1);
\draw (3,1)-- (3,-1); \draw (4,0) -- (0,0);
\node[above] at (1,1) {$v_1$};
\node[left] at (0,0) {$v_0$};
\node[below] at (1,-1) {$v_5$};
\node[below] at (3,-1) {$v_4$};
\node[right] at (4,0) {$v_3$};
\node[above] at (3,1) {$v_2$};
\end{tikzpicture}
\caption{$G$.}
\label{factorex}
\end{figure}
\end{document}
包floatrow
和caption
包相互发挥作用。floatrow
包甚至可以控制caption
包,这就是为什么设置任何\abovecaptionskip
bycaption
都不会产生任何效果。但是,我们可以将选项传递captionskip=<length>
给。只需要设置标题的字体\floatsetup
大小。我通过删除多余/重复的包来清理代码,并使用了一个包含所需设置的包。floatrow
caption
\floatsetup