我正在尝试在方框图形和其标题之间生成一个空格(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