latex subfigures not centered

Koen picture Koen · Sep 5, 2018 · Viewed 9k times · Source

This latex code:

\begin{figure}[H]
 \setlength{\figW}{5cm} % determines the width of the images
      \begin{subfigure}[b]{0.5\textwidth}
           \input{images/eigw_kegel_0.5.tex}
           \caption{}
      \end{subfigure}
      \begin{subfigure}[b]{0.5\textwidth}
           \input{images/eigw_kegel_0.05.tex}
           \caption{}
      \end{subfigure} \\
      \begin{subfigure}[b]{0.5\textwidth}
           \input{images/eigv_norm_kegel_0.5.tex}
           \caption{}
      \end{subfigure}
      \begin{subfigure}[b]{0.5\textwidth}
           \input{images/eigv_norm_kegel_0.05.tex}
           \caption{}
      \end{subfigure}
  \caption{(a) and (b): $\lambda_1(\VM{\omega})$ and 
  $\lambda_2(\VM{\omega})$ with $\omega_1 = 0.5$ (left) and $\omega_1 = 
  0.05$ (right), (c) and (d): norm of $\pderiv{\VM{x}_1(\VM{\omega})} 
   {\omega_2}$  with $\omega_1= 0.5$ (left) and $\omega_1= 0.05$ (right)}
  \end{figure}

gives me the following output:

I would like to have the following output (made it using paint). How to adapt the latex-code so that I get this result?

enter image description here

Answer

Koen picture Koen · Sep 12, 2018

I fixed this issue myself. You just need to add \hspace{0.8cm} to move the figures to the right.

\begin{figure}[H]
 \setlength{\figW}{5cm} % determines the width of the images
      \begin{subfigure}[b]{0.5\textwidth}
           \hspace{0.8cm}
           \input{images/eigw_kegel_0.5.tex}
           \caption{}
      \end{subfigure}
      \begin{subfigure}[b]{0.5\textwidth}
           \hspace{0.7cm}
           \input{images/eigw_kegel_0.05.tex}
           \caption{}
      \end{subfigure} \\
      \begin{subfigure}[b]{0.5\textwidth}
           \input{images/eigv_norm_kegel_0.5.tex}
           \caption{}
      \end{subfigure}
      \begin{subfigure}[b]{0.5\textwidth}
           \input{images/eigv_norm_kegel_0.05.tex}
           \caption{}
      \end{subfigure}
  \caption{(a) and (b): $\lambda_1(\VM{\omega})$ and 
  $\lambda_2(\VM{\omega})$ with $\omega_1 = 0.5$ (left) and $\omega_1 = 
  0.05$ (right), (c) and (d): norm of $\pderiv{\VM{x}_1(\VM{\omega})} 
   {\omega_2}$  with $\omega_1= 0.5$ (left) and $\omega_1= 0.05$ (right)}
  \end{figure}