I would like to create a figure with one line on top of it, and another one at the bottom, that separate the figure form the text. I have tried using the following code:

\begin{figure}[h]
    \par\noindent\rule{\textwidth}{0.1pt}
    \centering
    \includegraphics[width=0.5\textwidth]{capacidad_campo.png}
    \caption{Diagrama que muestra los diferentes posibles estados sobre la capacidad de campo del suelo. Fuente: \url{http://www.soilwater.com.au/laboratory.html}}
    \par\noindent\rule{\textwidth}{0.1pt}
\end{figure}

The bottom line works just fine, but the top line gets stuck to the figure image, and the vspace is just separating the image from the caption.

Thank you for your help.

  • Is this what you want: \par\noindent\rule{\textwidth}{0.1pt}\par\medskip? – Sigur Oct 20 at 17:28
up vote 4 down vote accepted

try the following:

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

\begin{document}
    \begin{figure}[h]
    \centering
\rule[1ex]{\textwidth}{0.1pt}
    \includegraphics[width=0.5\textwidth]{capacidad_campo.png}
\caption{Diagrama que muestra los diferentes posibles estados sobre la capacidad de campo del suelo. Fuente: \protect\url{http://www.soilwater.com.au/laboratory.html}}
\rule[1ex]{\textwidth}{0.1pt}
    \end{figure}
\end{document}

enter image description here

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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