8

I would like to put a source under the caption of my figure. The only thing that is not working is when I put the URL, the caption and the URL don't stay in the middle. Also \url{...} didn't work by itself:

\begin{figure}[!h]
\centering
\includegraphics[width=70mm]{figure3}
\linespread{1}\caption{TITLE OF IMAGE
\\ \small{source by:\protect\url{www.aly-abbara.com/livre_gyn_obs/images/testosterone_DHT.html}}}
\label{figure3}
\end{figure}
2
  • Welcome to TeX.SE. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). I took the liberty to format you post a little. See this link for more details on available formatting. Commented Apr 19, 2012 at 3:24
  • 1
    While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Commented Apr 19, 2012 at 3:25

3 Answers 3

8

If the source information must not follow possible modifications made beforehand to the caption layout, I agree with Peter Grill's solution; however, I'd like to propose an alternative solution using the caption* command from the caption package; with this approach, the additional (unnumbered, unlisted) caption will also be sensible to modifications made to the caption layout.

Consider the following example: the first image shows that the source doesn't obey the 7cm width declared for captions; in the second image (using \caption*), the source will obey the 7cm modification:

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

\captionsetup[figure]{width=7cm}

\begin{document}

\begin{figure}
  \centering
  \includegraphics[width=70mm]{figure3}
  \caption{TITLE OF IMAGE}
  \small source by:\url{www.aly-abbara.com/livre_gyn_obs/images/testosterone_DHT.html}
  \label{figure3} 
\end{figure}

\begin{figure}
  \centering
  \includegraphics[width=70mm]{figure3}
  \caption{TITLE OF IMAGE}
   \caption*{\small source by:\url{www.aly-abbara.com/livre_gyn_obs/images/testosterone_DHT.html}}
  \label{figure4}
\end{figure}

\end{document}

enter image description here

5

You can place additional text outside of the \caption:

enter image description here

Also, as @GonzaloMedina pointed out, \small is a switch and does not take a parameter.

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

\begin{document}
\begin{figure}[!h]
\centering
\includegraphics[width=70mm]{figure3}
\linespread{1}
\caption{TITLE OF IMAGE}
 \small source by:\url{www.aly-abbara.com/livre_gyn_obs/images/testosterone_DHT.html}
\label{figure3}
\end{figure}
\end{document}
0
0

Similar to Peter's answer, but if you wanted to make the URL, a part of the caption and into a hyperlink to a webpage,etc.., you could do this:

\documentclass[]{article}
\begin{document}

\usepackage[colorlinks=true,urlcolor=Navy]{hyperref}

    \begin{figure}[h!]
        \centering
        \includegraphics[width=\textwidth]{Technical 
        Illustrations/maxresdefault.jpg}
        \caption{Borderlands 2, Courtesy: \href{https://borderlands.com/en-US/} 
        {Borderlands 2}}
        \label{fig:borderlands}
    \end{figure}
\end{document}

Here, I am using MikTex integrated into VS Code with Latex Workshop and a few other extensions...

Clickable url-in-caption within VS Code's preview

PS: I was in the middle of a project while searching for an answer similar to this and hence, the weird naming scheme and the picture

You must log in to answer this question.

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