Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have defined a custom float using the newfloat command from the float package. My custom float uses the ruled style, defined in the same package. This is a minimal example of what I'm doing:

\documentclass{article}

\usepackage{float}

\floatstyle{ruled}
\newfloat{Foo}{thp}{lop}
\floatname{Foo}{Foobar}

\begin{document}

\begin{Foo}
\begin{verbatim}
public void foo(int bar) {
  foo();
  bar();
}
\end{verbatim}
\caption{An example of a foobar program}
\end{Foo}

\end{document}

What I don't like, is the vertical space that lies between the last line of the contents and the bottom rule of the float. Is there a way to reduce that space?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can redefine the internal \fs@ruled macro to add a negative vertical skip before the bottom rule; add the following lines to the preamble of your document (change -0.7\baselineskip according to your needs):

\makeatletter
\renewcommand\fs@ruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled
  \def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}%
  \def\@fs@post{\vskip-0.7\baselineskip\kern2pt\hrule\relax}%
  \def\@fs@mid{\kern2pt\hrule\kern2pt}%
  \let\@fs@iftopcapt\iftrue}
\makeatother
share|improve this answer
    
Works great! Thanks a lot! –  3lectrologos Jun 3 '11 at 20:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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