0

Hello I am trying to change the positioning of the character designatd to each sublot. Right now I have three subplots wihich are next to each other:

\begin{figure}[h!]
 \centering
\begin{subfigure}[b]{0.31\textwidth}
     \centering
     \includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm},clip,width=\textwidth]{My_first_subplot}
     \caption{}
     \label{My first subplot label}
 \end{subfigure}
 \hfill
 \begin{subfigure}[b]{0.31\textwidth}
     \centering
     \includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm},clip,width=\textwidth]{my second subplot}
     \caption{}
     \label{my second subplot label}
 \end{subfigure}
 \hfill
 \begin{subfigure}[b]{0.31\textwidth}
     \centering
     \includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm},clip,width=\textwidth]{my third subplot}
     \caption{}
     \label{My third subplot label}
 \end{subfigure}
    \caption{Caption of all tree plots}
    \label{label of all three plots}
\end{figure}

Unfortunatelly I have a lot of plots like this one already in my document so I hope it is possible to make a slight adjusment to my code. But if I have to make it new, so be it:)

As one can see this code results in three Subplots with (A), (B), (C) below them. I would want the character on the left upper corner of each subplot, without the brackets.

like this

I hope my question is clear and someone can help me, since I am quite new to latex.

Thank you!

  • Possibler duplicate of https://tex.stackexchange.com/questions/621260/position-subcaption-within-subfigure-at-the-top-inset – John Kormylo Oct 22 '22 at 14:40

1 Answers1

1
\documentclass{article}
\usepackage[labelformat=simple, singlelinecheck=off]{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h!]
\centering
\begin{subfigure}[b]{0.31\textwidth}
\centering
\caption{}
\includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm}, clip, width=\textwidth]{example-image-a}
\label{My first subplot label}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.31\textwidth}
\centering
\caption{}
\includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm}, clip, width=\textwidth]{example-image-b}
\label{my second subplot label}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.31\textwidth}
\centering
\caption{}
\includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm}, clip, width=\textwidth]{example-image-c}
\label{My third subplot label}
\end{subfigure}
\caption{Caption of all tree plots}
\label{label of all three plots}
\end{figure}
\end{document}

Three images with sub caption in upper left corner

Edit: Caption inside the picture with stackengine

\documentclass{article}
\usepackage{stackengine}
\usepackage[labelformat=simple, singlelinecheck=off]{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h!]
\centering
\begin{subfigure}[b]{0.31\textwidth}
\centering
\phantomcaption
\stackinset{l}{2pt}{t}{2pt}{\captiontext*}
{\includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm}, clip, width=\textwidth]{example-image-a}}
\label{My first subplot label}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.31\textwidth}
\centering
\phantomcaption
\stackinset{l}{2pt}{t}{2pt}{\captiontext*}
{\includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm}, clip, width=\textwidth]{example-image-b}}
\label{my second subplot label}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.31\textwidth}
\centering
\phantomcaption
\stackinset{l}{2pt}{t}{2pt}{\captiontext*}
{\includegraphics[trim={4,2cm 3,1cm 4,2cm 3,1cm}, clip, width=\textwidth]{example-image-c}}
\label{My third subplot label}
\end{subfigure}
\caption{Caption of all tree plots}
\label{label of all three plots}
\end{figure}
\end{document}

Three images with caption inside top left corner