1

I have the following code:

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

\begin{document}
\begin{figure}
  \vspace*{\fill}
  \centering
  \includegraphics[width=120mm]{image1}
  \subcaption{Lorem1}
  \label{asd:a}\par\vspace{5mm}
  \includegraphics[width=120mm]{image1}
  \subcaption{Lorem2}
  \label{asd:b}\par\vspace{5mm}
  \includegraphics[width=120mm]{image1}
  \subcaption{Lorem3}
  \label{asd:c}\par\vspace{5mm}
  \caption{ASD}
  \label{asd}
\end{figure}
\end{document}

And I get the following output:

enter image description here

The code delivers an output with 'ASD' subcaption. However, I want to get it as a caption in form Figure xx. How can I do that?

1

A look at the package documentation (p. 4) reveals:

Please note that the \subcaption command must be applied inside its own box or environment.

Thus, following the example from the documentation:

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

\begin{document}
\begin{figure}
  \vspace*{\fill}
  \centering
  \begin{minipage}{\textwidth}
  \includegraphics[width=120mm]{image1}
  \subcaption{Lorem1}
  \label{asd:a}
  \end{minipage}\par\vspace{5mm}
  \begin{minipage}{\textwidth}
  \includegraphics[width=120mm]{image1}
  \subcaption{Lorem2}
  \label{asd:b}
  \end{minipage}\par\vspace{5mm}
  \begin{minipage}{\textwidth}
  \includegraphics[width=120mm]{image1}
  \subcaption{Lorem3}
  \label{asd:c}
  \end{minipage}\par\vspace{5mm}
  \caption{ASD}
  \label{asd}
\end{figure}
\end{document}

Alternatively use the subfigure environment provided:

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

\begin{document}
\begin{figure}
  \vspace*{\fill}
  \centering
  \begin{subfigure}{\textwidth}
  \includegraphics[width=120mm]{image1}
  \caption{Lorem1}
  \label{asd:a}
  \end{subfigure}\par\vspace{5mm}
  \begin{subfigure}{\textwidth}
  \includegraphics[width=120mm]{image1}
  \caption{Lorem2}
  \label{asd:b}
  \end{subfigure}\par\vspace{5mm}
  \begin{subfigure}{\textwidth}
  \includegraphics[width=120mm]{image1}
  \caption{Lorem3}
  \label{asd:c}
  \end{subfigure}\par\vspace{5mm}
  \caption{ASD}
  \label{asd}
\end{figure}
\end{document}
  • Or a \begingroup...\endgroup pair should do also (untested, however!) – user31729 Sep 7 '14 at 23:32

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.