I am typesetting a document using tufte-book
as document class. In the document I have to put figures, both alone and side by side. As this is the case, I use the subfig
package to reach this goal, along with the optional [caption=false]
, as I read somewhere else:
\usepackage[caption=false]{subfig}
Now, I use the following code to insert a single figure:
\begin{figure}%
\centering%
\fbox{\includegraphics[width=0.4\linewidth]{img1}}%
\caption{Caption.}
\end{figure}
And I obtain the following:
Otherwise, to put two figures side by side, I use the following code:
\begin{figure}%
\hfill%
\subfloat{\fbox{\includegraphics[width=0.4\linewidth]{img1}}}%
\hfill%
\subfloat{\fbox{\includegraphics[width=0.4\linewidth]{img2}}}%
\hfill%
\caption[][1em]{Caption.}
\end{figure}
The result is the following:
As you may notice, the spacing between the text and the single figure is different from the vertical spacing between the text and the two figures. As a matter of fact, if I didn't specify [][1em]
before the \caption
command in the latter case, the caption would be in the correct position (namely, where it would be if there was only one figure), but totally misaligned.
It is as if the figure
environment begins in the correct place, but the two figures inside are shifted down on the page by 1em or so.
So my questions are: what causes this behaviour? How can I correct it?