2

how to add a subtitle to my figure which consists of two separate figures? I want the subtitle to be under each of the two figures. many thanks for your help in advance!

\begin{figure}[ht]
 \caption{XX}
 \centering
    \subfloat[XXX1]{\includegraphics[width=0.5\textwidth]{Figure1a.jpg}\label{fig:f1}}
  \hfill
  \subfloat[XXX2]{\includegraphics[width=0.5\textwidth]{Figure1b.jpg}\label{fig:f2}}
\end{figure}
2
  • Welcome to TeX SX! What do you mean exactly with a ‘subtitle’? You already have subcaptions.
    – Bernard
    Feb 25, 2017 at 22:29
  • Hi Bernard, many thanks for your reply! I want the title of each figure on top of it and want to write "Source: xyz" underneath each figure.
    – Helena
    Feb 25, 2017 at 22:40

1 Answer 1

2

Like this?

enter image description here

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:

enter image description here

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

enter image description here

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

enter image description here

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}
6
  • +1 for the use of copyrightbox. Note the O.P. has subfigures, I think.
    – Bernard
    Feb 25, 2017 at 23:52
  • @Bernard, in the first place I thing the same (MWE indicate this), but, where is than if figure caption? I have problems with understanding of question.
    – Zarko
    Feb 26, 2017 at 0:00
  • There aren't many details, I know. Personally, I would have placed the subcaptions as they are, and the global caption at the bottom.
    – Bernard
    Feb 26, 2017 at 0:18
  • This change should be easy, OP only need to move \caption{...} below of sub figures (till before \end{figure}). Well, this is well known to you :-)
    – Zarko
    Feb 26, 2017 at 0:36
  • Thanks a lot! I chose your last version, but the Source is not centered underneath the figure. Is there a chance to put each source in the middle of the related figure?
    – Helena
    Feb 26, 2017 at 8:56

You must log in to answer this question.

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