2

I'm preparing a manuscript for a journal where they tend to have the caption over-print on the image for subfigures to really squeeze out all the whitespace in these panels (Here's an example document, please look at the PDF: https://elifesciences.org/articles/39777).

So, I've been trying to remove whitespaces around my subfigures too. I used a negative skip in the subcaption set up which brings the subcaption nearer to the image. However, when using this "hack", in a majority of cases, the image prints over the label. Is it possible to do it the other way around: get the subcaption label to over-print on the image?

MWE:

\documentclass[12pt]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{mwe}
\captionsetup[subfigure]{labelfont={bf},labelsep=space,labelformat=simple,font=Large,margin=0pt,skip=-8pt,position=top}

\begin{document}
\begin{figure}[!t]
  \centering
  \begin{subfigure}[b]{\textwidth}
      \caption{}\label{fig:ex-1}%
      \includegraphics[width=\textwidth]{example-image-a}
  \end{subfigure}
  \begin{subfigure}[b]{\textwidth}
      \caption{}\label{fig:ex-2}%
      \includegraphics[width=\textwidth]{example-image-b}
  \end{subfigure}
  \caption{Example figures with negative skip but images over-printing the labels}\label{fig:test-mwe}
\end{figure}

\end{document}

MEW screenshot

  • 1
  • Related, rather. I already thought about hardcoding labels using tikz on to the images, but that is a very tedious way of going about it. I was really hoping that there'd be a simpler way using the provided captioning commands. Edit: A lot of the figures are epslatex outputs from Gnuplot, which will make using the Tikz method even more complex. I could just hardcode the labels in the Gnuplot generated .tex files here if that is the way to go. – FranciscoD Mar 26 at 15:18
1

Put the subcaption after the \includegraphics with a negative skip and add a positive skip automatically at the end of subfigure environment with \AtEndEnvironment by etoolbox.

In the MWE the float is still too long for the page, but you will adjust it with your actual images.

\documentclass[12pt]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{mwe}
\captionsetup[subfigure]{labelfont={bf},labelsep=space,labelformat=simple,font=Large,margin=0pt,skip=-55ex,position=bottom}
\usepackage{etoolbox}
\AtEndEnvironment{subfigure}{\vspace{50ex}}

\begin{document}
\begin{figure}[!t]
  \centering
  \begin{subfigure}[b]{\textwidth}
      \includegraphics[width=\textwidth]{example-image-a}
      \caption{}\label{fig:ex-1}%
  \end{subfigure}
  \begin{subfigure}[b]{\textwidth}
      \includegraphics[width=\textwidth]{example-image-b}
      \caption{}\label{fig:ex-2}%
  \end{subfigure}
  \caption{Example figures with negative skip but images over-printing the labels}\label{fig:test-mwe}
\end{figure}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.