23

I would like to draw a horizontal line/rule beneath my multi-line caption to separate the caption more clearly from the rest of the text.

A quick example:

\begin{figure}[tb]
  \begin{center}
    \includegraphics[width=\textwidth]{./fig/test}
  \end{center}
  \caption{`Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
            do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            Ut enim ad minim veniam, quis nostrud exercitation ullamco
            laboris nisi ut aliquip ex ea commodo consequat. Duis aute
            irure dolor in reprehenderit in voluptate velit esse cillum
            dolore eu fugiat nulla pariatur. Excepteur sint occaecat
            cupidatat non proident, sunt in culpa qui officia deserunt
            mollit anim id est laborum`}
  \label{fig:test}
\end{figure}

At the end of the caption I would like to put something like \newline\hrule or something similiar to the suggestions made in a related post:

1 Answer 1

24

You can use the caption package to define a new caption format incorporating the rule; something along these lines:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}

\DeclareCaptionFormat{myformat}{#1#2#3\hrulefill}
\captionsetup[figure]{format=myformat}

\begin{document}
\begin{figure}[tb]
  \centering
    \includegraphics[width=\textwidth]{./fig/test}
  \caption{`Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
            do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            Ut enim ad minim veniam, quis nostrud exercitation ullamco
            laboris nisi ut aliquip ex ea commodo consequat. Duis aute
            irure dolor in reprehenderit in voluptate velit esse cillum
            dolore eu fugiat nulla pariatur. Excepteur sint occaecat
            cupidatat non proident, sunt in culpa qui officia deserunt
                mollit anim id est laborum`}
  \label{fig:test}
\end{figure}

\end{document}

Here's the result:

I used the demo option for the graphicx package in order to make my example compilable for everyone; do not include that option in your actual code.

1
  • Thanks, that was exactly what I was looking for! ;)
    – sgbmyr
    Apr 5, 2011 at 0:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .