[Tex/LaTex] Subfloat Caption left aligned

floatslncssubfig

I would like to create a figure with a left-aligned subfloat caption as the following:

\documentclass{llncs}

\usepackage{todonotes}
\usepackage{floatflt}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}
\begin{figure}[t!]
    \centering
    \subfloat[Resource Owner Password \hspace{\textwidth}Credential Grant]{
        \missingfigure[figwidth=0.5\textwidth]{Testing a long text string}
        \label{fig:pwd_grant}
    }
    \subfloat[Client Credential Grant]{
        \missingfigure[figwidth=0.5\textwidth]{Testing a long text string}
        \label{fig:client_grant}
    }
    \caption{grants}
    \label{fig:auth_impl_grant}
\end{figure}
\end{document}

(if you compile now the example you will see the actual problem with the caption and why I would wish to have it left aligned)

using the subfig package with documenttype lncs
currently the caption is in block mode – means tex spreads it over the complete available distance. This looks pretty crappy to me…

Thank you very much in advance.

@Peiffap
Thanks to your suggestion I was able to create an example that worked for me with left aligned caption, but also in height aligned caption, it looks as follows:

\documentclass{llncs}
\usepackage{todonotes}
\usepackage{floatflt}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{compatibility=false}

\begin{document}
\begin{figure}[t!]
    \makebox[\linewidth][c]{
        \subcaptionbox{Resource Owner Password\\ Credential Grant}[.47\linewidth]{
            \missingfigure[figwidth=\textwidth]{Testing a text string}
            \label{fig:auth_grant}
        }
        \hspace*{2cm}
        \subcaptionbox{Client Credential Grant}[.47\linewidth]{
            \centering
            \missingfigure[figwidth=\textwidth]{Testing a text string}
            \label{fig:impl_grant}
        }
    }
    \caption{Caption}
    \label{fig:auth_impl_grant}
\end{figure}


\end{document}

for some odd reason, when I put this into overleaf with the missing figure placeholder it looks odd, still locally it works totally fine.

Best Answer

Using the subcaption package, I could make the following.

This is the code I used to generate that (admittedly, I didn't have the llncs package installed, so I changed that out for article).

\documentclass{article}
\usepackage{todonotes}
\usepackage{floatflt}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}[t!]
    \centering
    \begin{subfigure}[t]{0.47\textwidth}
        \centering
        \missingfigure[figwidth=\textwidth]{Testing a long text string}
        \caption{Resource Owner Password \\ Credential Grant}
        \label{fig:pwd_grant}
    \end{subfigure}\hfill
    \begin{subfigure}[t]{0.47\textwidth}
        \centering
        \missingfigure[figwidth=\textwidth]{Testing a long text string}
        \caption{Client Credential Grant}
        \label{fig:client_grant}
    \end{subfigure}
    \caption{grants}
    \label{fig:auth_impl_grant}
\end{figure}

\end{document}

Do note however that subcaption and subfig are not compatible! For what it's worth though, subfig was getting pretty obsolete last time I checked, while subcaption fixes some of its flaws (compatibility with hyperref being a big one).

Edit

After some more work, OP went with the following code.

\documentclass{llncs}
\usepackage{todonotes}
\usepackage{floatflt}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{compatibility=false}

\begin{document}
\begin{figure}[t!]
    \makebox[\linewidth][c]{
        \subcaptionbox{Resource Owner Password\\ Credential Grant}[.47\linewidth]{
            \missingfigure[figwidth=\textwidth]{Testing a text string}
            \label{fig:auth_grant}
        }
        \hspace*{2cm}
        \subcaptionbox{Client Credential Grant}[.47\linewidth]{
            \centering
            \missingfigure[figwidth=\textwidth]{Testing a text string}
            \label{fig:impl_grant}
        }
    }
    \caption{Caption}
    \label{fig:auth_impl_grant}
\end{figure}

\end{document}
Related Question