# How can I make a subcaptionbox label appear in front of an image?

This MWE:

\documentclass{article}
\usepackage[labelfont=bf,size=Large,position=top, skip=-10pt, justification=raggedright, singlelinecheck=false]{subcaption}
\usepackage{graphicx}

\begin{document}
\begin{figure}
\centering
\subcaptionbox{}{\includegraphics[width=0.5\linewidth]{example-image-a}}
\subcaptionbox{}{\includegraphics[width=0.5\linewidth]{example-image-b}}

\caption{Some caption}
\end{figure}

\end{document}


Produces the following output:

In which the labels (a) and (b) are being occluded due to the "skip" option to subcaption. I really want the label to be more to the right than the default, but I do not know how to make subcaption put the label in front of the image. Moreover, I do not understand why the text is placed behind the image in the first place.

How can I put the labels (a) and (b) in front of the text? There does not seem to be any option in caption controlling the "depth" of things. My endgame is to have a figure as in the image above but with the text in front for each sub figure. The caption must be there where it is now as well.

BTW, the documentclass I have to use (achemso) wont let me use floatrow.

## 1 Answer

I got around it using the accepted answer here:

Put subfigure labels inside figures using subfig package

Here is a MWE:

\documentclass{article}
\usepackage{graphicx}

\newcommand{\subfigimg}[3][,]{%
\setbox1=\hbox{\includegraphics[#1]{#3}}% Store image in box
\leavevmode\rlap{\usebox1}% Print image
\rlap{\hspace*{10pt}\raisebox{\dimexpr\ht1-1.2\baselineskip}{\large\textbf{#2}}}% Print label
\phantom{\usebox1}% Insert appropriate spcing
}

\begin{document}
\begin{figure}
\centering
\begin{tabular}{@{}p{0.5\linewidth}@{\quad}p{0.5\linewidth}@{}}
\subfigimg[width=\linewidth]{A)}{example-image-a} \\
\subfigimg[width=\linewidth]{B)}{example-image-b}
\end{tabular}
\caption{A caption}
\end{figure}
\end{document}


Which produces the desired output:

However this feels kind of hacky and I still neither know how to do it with subcaption nor understand why the text is placed behind the image there. So if anyone knows I will accept the answer.