[Tex/LaTex] Subfigure widths in two-column layout

subcaptionsubfloatstwo-columnwidth

I want both figures side by side in one column of a two-column LaTeX document, but the result is both the figures are one below another.

\begin{figure}[H]
  \begin{subfigure}[b]{0.4\textwidth}
    \includegraphics[width=\textwidth]{cure.png}
    \caption{Picture 1}
    \label{fig:1}
  \end{subfigure}
  \hfill %%
  \begin{subfigure}[b]{0.4\textwidth}
    \includegraphics[width=\textwidth]{cluto.png}
    \caption{Picture 2}
    \label{fig:2}
  \end{subfigure}
\end{figure}

Best Answer

In general \textwidth is the total width of the text area, so you shouldn't specify figure widths in twocolumn layout in terms of this width (only for figure* environments).

If you want the figure to only span one column in a twocolumn document, use \columnwidth (see egreg's answer here for the reason why) instead.

So in short:

\documentclass[twocolumn]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}

\lipsum[1-3]

\begin{figure}
  \begin{subfigure}[b]{0.4\columnwidth}
    \includegraphics[width=\linewidth]{example-image-a}
    \caption{Picture 1}
    \label{fig:1}
  \end{subfigure}
  \hfill %%
  \begin{subfigure}[b]{0.4\columnwidth}
    \includegraphics[width=\linewidth]{example-image-b}
    \caption{Picture 2}
    \label{fig:2}
  \end{subfigure}
\end{figure}

\lipsum[4]

\end{document}

This will produce the following:

Output