I would like to reduce the space between two figure that are side by side. I am using the following code but I don't know how to do that.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{caption}
\begin{document}
\begin{figure}
\begin{subfigure}[tbp]{0.3\textwidth}
\includegraphics[width=\textwidth]{img1}
\caption{traditional.}
\label{fig:atzeni_trad}
\end{subfigure}
%
\begin{subfigure}[tbp]{0.4\textwidth}
\includegraphics[width=\textwidth]{img2}
\caption{SLS}
\label{fig:atzeni_sls}
\end{subfigure}
\caption[.]{Fluoriscent lamp holder. Traditional on left-side, CAD redesigned centered, and SLS manufactured on right-side}
\label{fig:lamp}
\end{figure}
\end{document}
Moreover, do you know how to have the caption of each of the figure at the same hight?
Best Answer
A negative
\hskip
in between reduces the space. Shifting from[tbp]
to[b]
aligns the subfigures entirely at their bottoms, including aligning the captions at the bottom. But this also aligns the images at their bottoms; I don't know if you mind this or not.Here's the modified source; you can change
-2ex
to whatever distance you want.If you want to align captions without aligning the pictures, I think you want
\subcaptionbox
. Here's an example:In this case, I've moved the second image up with
\vspace*{}
, but of course you can move it however you prefer. Note as well that\textwidth
is not redefined inside asubcaptionbox
, so thewidth
argument to\includegraphics
has changed.