3

I want the same thing as those guys:

But with one minor difference: I don't like the idea to write manually (a) instead of using \subcaption{}. Why? Because by arranging the figures differently later on, I could forget to change the labels accordingly.

Now I did like the idea of using the stackengine with its \stackinset-command. However, it does not accept \subcaption{} as an argument.

So my minimum non-working example is as follows (the non-working part is the \subcaption{} command at its current location):

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption,subcaption}
\usepackage{stackengine}

\begin{document}
\begin{figure}
    \begin{subfigure}{.96\textwidth}
        \stackinset{l}{1in}{b}{1in}{\subcaption{}}{\includegraphics[width=5in]{example-image-a}}
        \label{fig:test}
    \end{subfigure}
\end{figure}
\end{document}
4

Since it's not so easy to get rid of the skips, rules, and boxes the \caption command would use, I would use \phantomcaption instead (for managing the counter and label) and typeset the sub-caption on my own, e.g.:

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption,subcaption}
\usepackage{stackengine}

\begin{document}
\begin{figure}
    \begin{subfigure}{.96\textwidth}
        \phantomcaption
        \stackinset{l}{1in}{b}{1in}{(\thesubfigure) Text}{\includegraphics[width=5in]{example-image-a}}
        \label{fig:test}
    \end{subfigure}
\end{figure}
\end{document}

Or if you want to take over the basic formatting options used by the caption package:

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[labelfont=bf,textfont=it,labelsep=endash]{subcaption} % ugly setting, just for demonstration
\usepackage{stackengine}

\makeatletter
\newcommand\makesimplesubcaption{\caption@@@make{\caption@fnum{sub\@captype}}}
\makeatother

\begin{document}
\begin{figure}
    \begin{subfigure}{.96\textwidth}
        \phantomcaption
        \stackinset{l}{1in}{b}{1in}{\makesimplesubcaption{Text}}{\includegraphics[width=5in]{example-image-a}}
        \label{fig:test}
    \end{subfigure}
\end{figure}
\end{document}
  • Thank you, works indeed as expected. Another way I found doing it is by just referencing using \subref within the \stackinset. – AnatraIlDuck Feb 3 '16 at 8:55

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.