# insert text RIGHT under image ABOVE caption

How do I place text RIGHT below an image (above the caption) within subfig? Here Is my code:

\documentclass{article}

\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\captionsetup[subfigure]{labelfont=bf,textfont=normalfont,singlelinecheck=off,justification=raggedright}
\captionsetup[figure]{singlelinecheck=off}

\begin{figure}
\subfloat[\textit{\textit{D. pulex}}
\newline \tiny \url{commons.wikimedia.org/wiki/File:Daphnia_pulex.png}
\newline \tiny Photos by Paul Hebert]{\label{dpulex}
\includegraphics[width=0.48\textwidth]{dpulex.png}
}
\end{figure}

\end{document}


Here is what it prints:

So I'd like those two lines written in tiny to appear below the image and above "(a) D. pulex". Any help will be appreciated.

Just include it below the image, rather than above the caption:

\documentclass{article}

\usepackage{graphicx,subfig}% http://ctan.org/pkg/{graphicx,subfig}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\captionsetup[subfigure]{labelfont=bf,textfont=normalfont,singlelinecheck=off,justification=raggedright}
\captionsetup[figure]{singlelinecheck=off}

\begin{document}

\begin{figure}
\subfloat[\textit{D.\ pulex}\label{dpulex}]{%
\centering\parbox{0.48\linewidth}{%
\includegraphics[width=\linewidth]{example-image-a} \\
{\tiny \url{commons.wikimedia.org/wiki/File:Daphnia_pulex.png} \\
Photos by Paul Hebert}%
}
}
\end{figure}

\end{document}


The skip between the URL and credits can be changed to suit your needs. For example, use \\[-.5\baselineskip] instead of \\, say):

I've used a \parbox purely to have a left-aligned block. However, you can modify this to your liking. The fundamental idea remains the same.

Also, hyperref should actually be loaded last in this instance. See Which packages should be loaded after hyperref instead of before?

• This would be great if only the space between lines wasn't so great. Is there any way i can resolve this (with or without the parbox) – Far Zin Apr 11 '13 at 2:26
• @FarZin: Just use \\[-.5\baselineskip] instead of the regular \\ I have. – Werner Apr 11 '13 at 2:43

If you're willing to use the subcaption package instead of the subfigure package (which, I believe, is deprecated), you could use something like the following method:

\documentclass{article}
\usepackage[demo]{graphicx} % omit [demo] in real version
\usepackage{subcaption}
\captionsetup[subfigure]{labelfont=bf,
singlelinecheck=off,
justification=raggedright}
\captionsetup[figure]{singlelinecheck=off}
\usepackage{hyperref}
\begin{document}
\begin{figure}

\begin{subfigure}{0.48\textwidth}
\includegraphics[width=\linewidth]{dpulex.png}

\tiny Photos by Paul Hebert

\url{commons.wikimedia.org/wiki/File:Daphnia_pulex.png}

\caption{\textit{D. pulex}}\label{dpulex}
\end{subfigure}
\end{figure}
\end{document}


• Why the reference to subfigure? The OP uses subfig. – Gonzalo Medina Apr 11 '13 at 2:18
• @GonzaloMedina - I've read in quite a few places that the subfig package is deprecated. I've actually never used that package in my own papers, and use only subcaption. – Mico Apr 11 '13 at 2:23
• it hasn't had updates lately, but please read this comment by Axel Sommerfeldt saying that it is perfectly usable. The obsolete package is subfigure, not subfig. – Gonzalo Medina Apr 11 '13 at 2:30
• @GonzaloMedina - Thanks for this, I appreciate it. – Mico Apr 11 '13 at 2:36