
我試圖在方框圖和標題之間產生一個空格(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
for floatrow
。只caption
需要設定字幕的字體大小。我透過刪除額外/重複的套件來清理程式碼,並使用一個\floatsetup
包含所需設定的套件。