In case you installed TeX Live from the packages of a Linux distro: Most distros split less-used LaTeX-packages into separate (Linux-distro)-packages. From the link in your question I assume that you are running Arch Linux. In this case you need to install the texlive-latexextra
package which contains subfigure.sty. If you are using a different distro, the necessary package might be named differently (e.g. texlive-latex-extra
in Debian/Ubuntu).
Also, as Peter notes, the subfigure
package is depreciated.
Like this?
it is obtained by use of package stackengine
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{stackengine}% for put note about sorce below image
\usepackage{graphicx}
\usepackage[font=small]{caption}
\usepackage{url}
\usepackage{tabularx}
\begin{document}
\begin{figure}[hb]
\centering
\def\stackalignment{r}
\begin{tabularx}{\hsize}{*2{>{\centering\arraybackslash}X}}
\caption{Left figure}
\label{fig:left}
\stackunder{\includegraphics[width=\linewidth]{example-image-a}}%
{\scriptsize%
Source: \url{http://tex.stackexchange.com/}}
&
\caption{Right figure}
\label{fig:right}
\stackunder{\includegraphics[width=\linewidth]{example-image-b}}%
{\scriptsize%
Source: \url{http://tex.stackexchange.com/}}
\end{tabularx}
\end{figure}
\end{document}
Or with use of package \copyrightbox
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[font=small]{caption}
\usepackage{copyrightbox}
\usepackage{url}
\usepackage{tabularx}
\begin{document}
\begin{figure}[hb]
\centering
\begin{tabularx}{\hsize}{*2{>{\centering\arraybackslash}X}}
\caption{Left figure}
\label{fig:left}
\copyrightbox[b]{\includegraphics[width=\linewidth]{example-image-a}}%
{Source: \url{http://tex.stackexchange.com/}}
&
\caption{Right figure}
\label{fig:right}
\copyrightbox[b]{\includegraphics[width=\linewidth]{example-image-b}}%
{Source: \url{http://tex.stackexchange.com/}}
\end{tabularx}
\end{figure}
\end{document}
Addedndum:
in case that image has two sub-figures. With use of \copyrightbox[b]{...}{...}
and option position=top
for subfig
package:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[font=small]{caption}
\usepackage{copyrightbox}
\usepackage{url}
\usepackage[position=top]{subfig}
\begin{document}
\begin{figure}[hb]
\centering
\caption{Figure caption}
\subfloat[Left sub-figure \label{fig:left}]{
\copyrightbox[b]{\includegraphics[width=0.45\linewidth]{example-image-a}}%
{Source: \url{http://tex.stackexchange.com/}}
}
\hfil
\subfloat[Right sub-figure \label{fig:right}]{
\copyrightbox[b]{\includegraphics[width=0.45\linewidth]{example-image-b}}%
{Source: \url{http://tex.stackexchange.com/}}
}
\end{figure}
\end{document}
Addedndum (2):
it seems that package \copyrightbox
not enable to center text with source information below the image. Use of stackengine
haven't this limitation. An example with it and option position=top
for subfig
package is below:
The right image has text below image in gray color (for comparison only). MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\usepackage{stackengine}% for put note about sorce below image
\usepackage[font=small]{caption}
\usepackage[position=top]{subfig}
\usepackage{url}
\begin{document}
\begin{figure}[hb]
\centering
\def\stackalignment{c}% <-- define alignment of stack
\caption{Figure caption}
\subfloat[Left sub-figure \label{fig:left}]{
\stackunder{\includegraphics[width=0.45\linewidth]{example-image-a}}%
{\scriptsize%
Source: \url{http://tex.stackexchange.com/}}
}
\hfil
\subfloat[Right sub-figure \label{fig:right}]{
\stackunder{\includegraphics[width=0.45\linewidth]{example-image-b}}%
{\scriptsize\color{gray}% <-- if you prefer to have text in gray
Source: \url{http://tex.stackexchange.com/}}
}
\end{figure}
\end{document}
Best Answer
Your two
minipage
s with little modifications can do the job (I additionally suppressed some spurious blank spaces)The
demo
option forgraphicx
simply replaces actual figures with black rectangles; do not use that option in your actual document.