TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following minimal example meant to illustrate a single figure with a subfigure using the memoir documentclass:

\newsubfloat{figure}% Allow for subfloats (subfigures) within figure environment
  \caption{This is a caption}

The caption of the subfigure is empty so that it only displays the subfigure counter - '(a)' in this case:

Figure with subfigure in memoir class

However, the subfigure label is not perfectly centered the way I had hoped with an empty caption. Changing the subfigure definition (using some negative spacing via $\!\!$) to

\newsubfloat{figure}% Allow for subfloats (subfigures) within figure environment
  \caption{This is a caption}

instead produces a more acceptable empty subfigure caption, however minuscule the difference:

Figure with subfigure in memoir class

Is this a known bug, or at least fixable?

share|improve this question
that is the space between (a) and the caption. Seems like a bug because memoir already tests if the contents of [] is empty. – Herbert Jul 14 '11 at 7:51
@Herbert Actually it doesn't test for emptyness, but it tests whether the contents is \@empty, which happens if there is no optional argument. – egreg Jul 14 '11 at 18:06
up vote 5 down vote accepted

The label leaves a space before the subcaption; it's necessary to kill it if there's no subcaption.

  \@ifnextchar [%
    {\@memsubfloat{sub\@captype}[\@empty #1][#1\unskip]}}

Some explanations

The complete syntax of \subbottom is

\subbottom[A][B]{<figure code>}

where A is the entry for the list of figures (tables) and B is the subcaption (they may be different just like captions for figures and tables). When B is not expressed, it's assumed to be the same as A. If also A is missing, no subcaption is set, not even the letter.

The control is actually passed to some other macros and eventually \@memsubfig is called when A is present (it will be substituted for #1 in the code). This macro checks if there is another optional argument. If there is, then


will be evaluated, otherwise LaTeX will be confronted with

\@memsubfloat{subfigure}[\@empty A][A]

(Note: we assume to be dealing with a figure; for a table, \@captype would be table.) This in the original definition. With my definition we'll have

\@memsubfloat{subfigure}[\@empty A][A\unskip]

The \@empty is there for technical reasons, it's not important since that is what will be written in the auxiliary file. The task of \@memsubfloat is also to typeset the subcaption and it basically does

(a)\space A\unskip

where "a" is the "number" (the \unskip isn't there with memoir's definition); if now A is empty, as in your case, the \unskip will kill the \space, otherwise it will do nothing. Bingo!

Of course, if you have captionless subfigures, you won't put subcaptions in the list of figures.

share|improve this answer
If and when you have the time and patience, could you annotate that? I appreciate among experts it's probably obvious, but for us noobs an annotation would be a useful learning resource. If you don't have the time, of course I understand. – Brent.Longborough Jul 14 '11 at 21:42
Thank you. Excellent explanation. – Brent.Longborough Jul 15 '11 at 11:53
suggested fix will be added in the next release – daleif Jul 21 '11 at 8:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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