42

The two pictures are too similar to have right next to each other, therefore additional spacing is preferred. The code is as follows:

\begin{figure}
   \centering
   \begin{subfigure}[b]{0.35\textwidth}
       \includegraphics[width=\textwidth]{1_0.png}
       \caption{1}
       \label{fig:table2}
   \end{subfigure}
   \begin{subfigure}[b]{0.35\textwidth}
       \includegraphics[width=\textwidth]{1_4.png}
       \caption{2}
       \label{fig:table2}
    \end{subfigure}
    \caption{Tabels}\label{fig:animals}
\end{figure}
2
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Tobi
    Commented Oct 4, 2016 at 14:51
  • What package was this compiled with? I can’t get it to build.
    – Roly
    Commented May 21, 2021 at 17:54

2 Answers 2

53

Use \hspace{amount} or \hfill if you want the right subfigure get shifted to the right margin between the two subfigures:

\begin{figure}
   \centering
   \begin{subfigure}[b]{0.35\textwidth}
       \includegraphics[width=\textwidth]{1_0.png}
       \caption{1}
       \label{fig:table2}
   \end{subfigure}\hfill% or \hspace{5mm} or \hspace{0.3\textwidth}
   \begin{subfigure}[b]{0.35\textwidth}
       \includegraphics[width=\textwidth]{1_4.png}
       \caption{2}
       \label{fig:table2}
    \end{subfigure}
    \caption{Tabels}\label{fig:animals}
\end{figure}

Note that \hspace{x} must be followed by a %char immediately to prevent extra spaces.

0

Depending on the space, you can also use \hspace*{\fill}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .