[Tex/LaTex] Subfigures, long caption side by side

subfloats

Hello I have really big problems with positioning my sub figures. I have long caption text and I think that is the reason why they don't fit side by side. What can I do for solving this problem. [t] didn't work.

\begin{figure}[t]
    \centering
    \begin{subfigure}[t]{.5\textwidth}
        \centering
        \includegraphics[width=12cm]{FIGURE1}
        \caption{Really long text over 2 lines}
        \label{fig:bestC1Sitting}
    \end{subfigure}% 

    \begin{subfigure}[t]{.5\textwidth}
        \centering
        \includegraphics[width=12cm]{FIGURE2}
        \caption{Really long text over 2 lines}
        \label{fig:bestC1Standing}
    \end{subfigure}

\end{figure}

I also don't get what's the point of \textwidth or linewidth? Are this relative positions? I would be really glad if somebody can help me.

Best Answer

You are using \includegraphics[width=12cm]{FIGURE2} where as your 0.5 text width may not be 12cm. You should be using width=\linewidth You can use width=\textwidth also as subfigure is actually a minipage and \textwidth refers to the width of text inside minipage. And don't leave a blank line in between subfigures as it would indicate a paragraph break. With this, we have

\documentclass{article}
\usepackage{subcaption,graphicx}
\begin{document}
  \begin{figure}[t]
    \centering
    \begin{subfigure}[t]{.5\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-a}
        \caption{Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines}
        \label{fig:bestC1Sitting}
    \end{subfigure}%
    %%%                                             Don't leave blank line
    \begin{subfigure}[t]{.5\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-b}
        \caption{Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines}
        \label{fig:bestC1Standing}
    \end{subfigure}

\end{figure}
\end{document}

enter image description here

Looking UGLY isn't it?. We need some space in between. So change \begin{subfigure}[t]{.5\textwidth} to \begin{subfigure}[t]{.45\textwidth} with a \hfill in between the subfigures.

\documentclass{article}
\usepackage{subcaption,graphicx}
\begin{document}
  \begin{figure}[t]
    \centering
    \begin{subfigure}[t]{.45\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-a}
        \caption{Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines}
        \label{fig:bestC1Sitting}
    \end{subfigure}%
    %%                          %   Don't leave blank line
    \hfill                      %%  <--- here
    \begin{subfigure}[t]{.45\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-b}
        \caption{Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines Really long text over 2 lines}
        \label{fig:bestC1Standing}
    \end{subfigure}

\end{figure}
\end{document}

enter image description here

I also don't get what's the point of \textwidth or linewidth? Are this relative positions?

\textwidth is generally the global width of the text area. The parameter \linewidth contains the line length inside a list (or derived) environment and it may change in a nested list (while \hsize, \textwidth and \columnwidth don't change).

See egreg's answer from which I borrowed above lines. Hope it will be clear.