# Add text at a particular location inside a figure?

I want to add text, such as (a), at a particular location, in the northeast corner, inside a figure with a subfigure environment. I am using the \subcaption package.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\begin{center}
\begin{subfigure}{.48\textwidth}
\centering
\includegraphics[width=1\textwidth]{figure1}
\caption{}
\label{fig:capa}
\end{subfigure}
\begin{subfigure}{.48\textwidth}
\centering
\includegraphics[width=1\textwidth]{figure2}
\caption{}
\label{fig:capb}
\end{subfigure}
\caption{(a) My first figure, (b) my second figure.}
\label{fig:caption}
\end{center}
\end{figure}
\end{document}

• You can do that with the overpic package or using tikz. Unrelated: you shoudl not be using the center environment to center stuff inside a figure. Use \centering instead of \begin{center} and remove \end{center}. Reason: figure adds space above and below the image, as does the center env so figure+center gives excessive vertical space. – daleif Oct 1 '20 at 10:34
• Related to what @daleif said, you can refer to this question for a quick introduction to overpic`: tex.stackexchange.com/questions/20792/… – John Oct 1 '20 at 12:39
• Thanks, @daleif, The overpic is a little helpful for placing text inside a single figure. Can you explain if it can be used in the subfigure environment? – sudipkd Oct 3 '20 at 16:32
• Just use it to replace your includegraphics in your example – daleif Oct 3 '20 at 17:02