0

I don't know whether the two are related each other but I cannot figure out a way to achieve both. What I try to do is basically

  • Put a custom caption below the figure
  • Subfigures automatically captioned as (a), (b), ....
  • List of figures showing only main figure captions.

The closest I got is the below code but this:

  • Lists subfigures too in the LoF
  • Subfigures are captioned as ((A)), ((B))
  • The references are fine, i.e. Figure 2.1(a)

\usepackage{graphicx}
\usepackage{caption}
\usepackage{subfig}
\usepackage{subfloat}
\usepackage{tabularx} 
\begin{figure}[t]
\begin{center}
\begin{tabular}{ccccc}
\subfloat[]{\label{Fig:Fig21A}\includegraphics[width=0.15\linewidth]{FileA}}
& \subfloat[]{\label{Fig:Fig21B}\includegraphics[width=0.15\linewidth]{FileB}}
& \subfloat[]{\label{Fig:Fig21C}\includegraphics[width=0.15\linewidth]{FileC}}
& \subfloat[]{\label{Fig:Fig21D}\includegraphics[width=0.15\linewidth]{FileD}}
& \subfloat[]{\label{Fig:Fig21E}\includegraphics[width=0.15\linewidth]{FileE}}
\end{tabular}
\caption{Main Caption.}
\label{Fig:MainFigure}
\end{center} 
\end{figure}
  • Please, turn the code into a complete compilable example. – egreg Aug 11 '15 at 8:29
1

Use the more modern package subcaption for this.

% arara: pdflatex
% arara: pdflatex

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

\begin{document}
\listoffigures
\begin{figure}
    \centering
    \begin{subfigure}[b]{.15\textwidth}\includegraphics[width=\linewidth]{FileA}\caption{}\label{Fig:Fig21A}\end{subfigure}\hfil
    \begin{subfigure}[b]{.15\textwidth}\includegraphics[width=\linewidth]{FileB}\caption{}\label{Fig:Fig21B}\end{subfigure}\hfil
    \begin{subfigure}[b]{.15\textwidth}\includegraphics[width=\linewidth]{FileC}\caption{}\label{Fig:Fig21C}\end{subfigure}\hfil
    \begin{subfigure}[b]{.15\textwidth}\includegraphics[width=\linewidth]{FileD}\caption{}\label{Fig:Fig21D}\end{subfigure}\hfil
    \begin{subfigure}[b]{.15\textwidth}\includegraphics[width=\linewidth]{FileE}\caption{}\label{Fig:Fig21E}\end{subfigure}%
    \caption{Main Caption.}
    \label{Fig:MainFigure}
\end{figure}
\section{Test}
See Figures \ref{Fig:Fig21A}, \ref{Fig:Fig21B}, \ref{Fig:Fig21C}, \ref{Fig:Fig21D}, and \ref{Fig:Fig21E} or just \ref{Fig:MainFigure}!
\end{document}

enter image description here

  • unfortunately no; this yields separate captions and numbers under each figure and lof: i.imgur.com/iZnwcA7.jpg I am using ecsthesis.cls on users.ecs.soton.ac.uk/srg/softwaretools/document/templates – paul simmons Aug 11 '15 at 3:42
  • @paulsimmons I do not open external links here. Please add all information to your question. How should I have known about your none standard documentclass? Please always provide an MWE in order to reduce the helping time for the volunteers. – LaRiFaRi Aug 11 '15 at 7:25
  • ecsthesis.cls uses the obsolete packages caption2 and subfigure. caption and subfig resp. subcaption are (incompatible!) successors of them. (So you should get errors when compiling your document, please take notice of them.) You could try edit the file ecsthesis.cls so caption and subcaption are used instead, save it as myecsthesis.cls and try to use it instead of ecsthesis.cls. As an alternative you could try to build a solution using caption2 and subfigure. -- However, for detailed help we need a fully functional MWE (and not just code snippets) from you. – Axel Sommerfeldt Sep 15 '15 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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