Graphics, Figures & Tables ⇒ Space between algorithm body and caption
Space between algorithm body and caption
Hello,
I am using algorithm package with style "boxed". The caption is too close to the box of the algorithm. How can I add some space between algorithm body and caption?
Thanks in advance...
I am using algorithm package with style "boxed". The caption is too close to the box of the algorithm. How can I add some space between algorithm body and caption?
Thanks in advance...
NEW: TikZ book now 40% off at Amazon.com for a short time.

Space between algorithm body and caption
If you load the caption package, you could just use
after loading the caption package. (The default is 2pt)
If you won't use the caption package, you need to copy the relevant code (which is \fs@boxed) out of the float package into the preamble of your document and adapt it.
Code: Select all
\captionsetup[boxed]{skip=6pt}
If you won't use the caption package, you need to copy the relevant code (which is \fs@boxed) out of the float package into the preamble of your document and adapt it.
Space between algorithm body and caption
sorry, I am not so familiar with the environment.
I have a block like this :
where should I put \captionsetup[boxed]{skip=6pt} expression?
I have a block like this :
Code: Select all
\begin{algorithm}
\caption{Caption ...}
....
\end{algorithm}
Space between algorithm body and caption
Right after \usepackage[...]{caption} in your document preamble. For example:sercan wrote:where should I put \captionsetup[boxed]{skip=6pt} expression?
Code: Select all
\documentclass{article}
\usepackage{float}
\floatstyle{boxed}
\restylefloat{table}
\usepackage[labelfont=bf]{caption}
\captionsetup[boxed]{skip=6pt}
\begin{document}
\begin{table}[!ht] \def\B#1{$\displaystyle{n\choose#1}$}
\begin{center} \begin{tabular}{c|cccccccc}
$n$&\B0&\B1&\B2&\B3&\B4&\B5&\B6&\B7\\ \hline
0 & 1\\
1 & 1&1\\
2 & 1&2&1\\
3 & 1&3&3&1\\
4 & 1&4&6&4&1\\
5 & 1&5&10&10&5&1\\
6 & 1&6&15&20&15&6&1\\
7 & 1&7&21&35&35&21&7&1
\end{tabular} \end{center}
\caption{Pascal's triangle. This is a re-styled \LaTeX\ \texttt{table} with \texttt{skip=6pt}.}
\end{table}
\end{document}
Re: Space between algorithm body and caption
Thank you sommerfee.
It works just fine for algorithms. However, my other captions (for figures and tables) are also affected. Can I force this setting to be applied just for algorithms?
It works just fine for algorithms. However, my other captions (for figures and tables) are also affected. Can I force this setting to be applied just for algorithms?
Space between algorithm body and caption
Yes, this setting affects all "boxed" floats.sercan wrote:However, my other captions (for figures and tables) are also affected.
Use \captionsetup[algorithm]{skip=...} instead.Can I force this setting to be applied just for algorithms?
Re: Space between algorithm body and caption
no, i used \captionsetup[algorithm]{skip=...} but it still affects figures and tables.
interestingly, figures seems different than before
interestingly, figures seems different than before

Space between algorithm body and caption
It seems that either your document class or one of your packages is incompatible to the caption package.sercan wrote:no, i used \captionsetup[algorithm]{skip=...} but it still affects figures and tables.
Are you able to give me a small but complete example which shows the problem?
Re: Space between algorithm body and caption
I think it is something else related to my environment.
Adding the line \usepackage{caption} is enough the change some pieces.
But \captionsetup[algorithm]{skip=...} works just fine. I have used this for different font sizes, only algorithm captions are affected with new font size.
Thank you sommerfee, you have been extremely helpful
Adding the line \usepackage{caption} is enough the change some pieces.
But \captionsetup[algorithm]{skip=...} works just fine. I have used this for different font sizes, only algorithm captions are affected with new font size.
Thank you sommerfee, you have been extremely helpful
