[Tex/LaTex] Subcaption: subfigure’s caption align to the right

captionssubcaption

Used package subcaption to insert 2 photos. How to align each subfigure's caption to the right?
The example code:

\documentclass[a4paper,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage[list=true]{subcaption}

\begin{document}

\section{TEST}
\lipsum[1]
\begin{figure}
\centering
\captionsetup[subfigure]{labelformat=empty}
\begin{subfigure}[t]{1.0\linewidth}
    \includegraphics[width=1.0\linewidth]{example-image-a}
    \caption{This is figure A.}
\end{subfigure}%

\vspace{15pt}
\lipsum[1]  
\vspace{15pt}   

\begin{subfigure}[b]{1.0\linewidth}
    \caption{This is Figure B.}
    \includegraphics[width=1.0\linewidth]{example-image-b}
\end{subfigure}
\end{figure}

\end{document}

Best Answer

Try

\captionsetup[sub]{labelformat=empty,justification=raggedleft,singlelinecheck=false}
\begin{subfigure}[t]{1.0\linewidth}
    \includegraphics[width=1.0\linewidth]{example-image-a}
    \caption{This is figure A.}
\end{subfigure}%

enter image description here

Related Question