I am using the caption/subcaption packages and \fbox for the same float. This adds a little extra space on the left side of the images, relative to the caption. The extra space disappears after I remove the \fbox, as shown below. I could not work out why this is or how to fix it. Any ideas?
Many thanks,
Laura
PS Note that the example below is a "minimum quasi-working example": you need to replace "someImage" with the path to an image file that is on your system, obviously

Code: Select all
\documentclass[a4paper, 11pt, final]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[labelfont={rm,bf}, textfont=rm, font=small]{caption}
\usepackage[labelfont={rm,bf}, textfont=rm, font=small, list=true, listformat=subparens]{subcaption}
\captionsetup[table]{position=top}
\captionsetup[subtable]{position=top}
\title{Minimum (quasi-)working example}
\date{\today}
\begin{document}
\maketitle
\begin{figure}%
\centering%
\subcaptionbox{Some text.}%
{%
\setlength\fboxsep{0pt}
\setlength\fboxrule{0.5pt}
\fbox{\includegraphics[width=0.45\textwidth]{./someImage}}}%
\hfill%
\subcaptionbox{Some text.}%
{%
\setlength\fboxsep{0pt}
\setlength\fboxrule{0.5pt}
\fbox{\includegraphics[width=0.45\textwidth]{./someImage}}}%
\caption[]{Some text.}%
\label{fig:someFig}%
\end{figure}
\begin{figure}%
\centering%
\subcaptionbox{Some text.}%
{\includegraphics[width=0.45\textwidth]{./someImage}}%
\hfill%
\subcaptionbox{Some text.}%
{\includegraphics[width=0.45\textwidth]{./someImage}}%
\caption[]{Some text.}%
\label{fig:someFig}%
\end{figure}
\end{document}