Sunday, 18 August 2013

Put subfigure labels inside figures using subfig package

Put subfigure labels inside figures using subfig package

I'd like to put subfigure labels (a), (b), etc., at the top left corner of
subfigures like the following figure:

I know there are some workarounds like this post (with stackengine) or
this post (with subcaption). However, I don't want to use stackengine
unless there's really no way to do so, and REVTeX4 rules out the
subcaption option. I therefore wonder if there exists a workaround
specifically for subfig package (and potentially compatible with REVTeX4).
The following MWE provides an unsuccessful attempt to achieve the desired
effect:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\captionsetup[subfloat]{farskip=-10pt, position=top}
\begin{document}
\begin{figure}
\centering
\subfloat[][]{
\includegraphics[width=0.45\linewidth]{example-image-a}}
\subfloat[][]{
\includegraphics[width=0.45\linewidth]{example-image-b}}\\
\subfloat[][]{
\includegraphics[width=0.45\linewidth]{example-image-c}}
\subfloat[][]{
\includegraphics[width=0.45\linewidth]{example-image-a}}
\caption{abcd}
\end{figure}
\end{document}

No comments:

Post a Comment