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 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:

share|improve this question
add comment

1 Answer

up vote 12 down vote accepted

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.

share|improve this answer
    
Thanks, that was exactly what I was looking for! ;) –  sgbmyr Apr 5 '11 at 0:59
add comment

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.