# A new float style for LaTeX: plainruled

Posted on April 22, 2011

Today, I’ve been so annoyed by LaTeX’s figures appearance that I’ve defined some tiny new style for the package float. This style simply draws a horizontal rule below and above the body of the figure.

Defining the style is very simple:

\makeatletter
\newcommand\fs@plainruled{\def\@fs@cfont{\rmfamily}\let\@fs@capt\floatc@plain%
\def\@fs@pre{\hrule\kern2pt}%
\def\@fs@mid{\kern2pt\hrule\vspace\abovecaptionskip\relax}%
\def\@fs@post{}%
\let\@fs@iftopcapt\iffalse}
\makeatother

Then you can use the style plainruled as any predefined style of the package float, e.g. you can make it the default for any figure by adding the following to the preamble of your document:

\floatstyle{plainruled}
\restylefloat{figure}

In order to see the difference, let’s have a trivial figure in the body of your document:

\begin{figure}
\centering
Some interesting \\figure contents.
\caption{Some figure caption.}
\label{fig:f1}
\end{figure}

Without my settings above this figure is rendered like this:

Using the style plainruled it renders like this:

This is nothing amazing, but simply useful. Therefore I wanted to keep this somewhere I and possibly others might find it for future reference.