5

I am trying to generate a space (6pt) between the boxed figure and its caption. Since I am using tikz code \includegraphics did not work. Also I tried \setlength{\abovecaptionskip}{6pt}, \captionsetup[figure]{skip=6pt}. However they did not work. How to handle this problem?

enter image description here

\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}
  • Thank you, Yes there are packages unused for the solution of the problem. I wrote them just in case. – Zehra Nur Özbay Jul 29 '15 at 16:41
  • Don't use the center environment. Rather use the declaration \centering. – Werner Jul 29 '15 at 17:01
  • But using \centering or \begin{center} are the same? My problem is actually space between the borders of the box and the caption. I think it is caused because of the \floatstyle{boxed} style. But I could not find out how to fix. – Zehra Nur Özbay Jul 29 '15 at 17:39
  • @Werner Please consider re-opening the question, it asks about increasing the space above caption and the question you are referring to as duplicate discusses centering the figure (totally another issue). – AboAmmar Jul 29 '15 at 18:02
  • @egreg Please consider re-opening the question, it asks about increasing the space above caption and the question you are referring to as duplicate discusses centering the figure (totally another issue). – AboAmmar Jul 29 '15 at 18:12
3

enter image description here

\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}

The floatrow package and the caption package play roles with one another. The floatrow package can even have command over the caption package, that is why setting any \abovecaptionskip by caption will have no effect. However, we can pass the captionskip=<length> option to the \floatsetup for the floatrow. Only caption will be required to set the font size of captions. I cleaned the code by removing extra/duplicate packages and used a single \floatsetup including the required settings.

| improve this answer | |
  • Thank you.. your prompt reply is appreciated :) It is ok now @AboAmmar – Zehra Nur Özbay Jul 29 '15 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.