Trying to use space on a page more economically, I developed the idea to arrange graphics as a table being part of a figure. As I still wanted to refer to individual graphics, I also wanted to have captions for each such sub-graphic.

(Only after I had problems, I realized that there does exist a similar mechanism, also named subfigure and subcaption)

(I'm no TeX expert, I only know LaTeX a bit)

The code shown below outputs the references as Text... 1 (1.2) ... 1 ... Text... 1 (1.3) ... 1, so the sub-caption numbers are wrong, while the main caption number is correct. The intended output is Text... 1.2a (1.2) ... 1.2b ... Text... 1.3a (1.3) ... 1.3b.

The captions for the example code read (numbers are correct there):

Abbildung 1.1: Caption0

Abb. 1.2a: Caption1a    Abb. 1.2b: Caption1b
Abbildung 1.2: Caption1

Abb. 1.3a: Caption2a    Abb. 1.3b: Caption2b
Abbildung 1.3: Caption2

So here's the input for this example (use any placeholder graphic for Platzhalter.pdf):

{\small Abb.~\thesubfigureX: #1}%
\ref{label1a} (\ref{label1}) ... \ref{label1b} ...


\ref{label2a} (\ref{label2}) ... \ref{label2b}

(Originally I had named my counter subfigure also, but then I discovered that a counter with such a name already exists, so I appended the X).

Preferably the answer contains an explanation why my code does not work (everything that is wrong), how to do it correctly, and (as an extra) how I could achieve the same effect using the stock subfigure and subcaption mechanisms.

  • Off-topic: The german package is obsolete. Don't load it. Instead, run \usepackage[german]{babel} or, better still, \usepackage[ngerman]{babel}.
    – Mico
    Mar 31, 2019 at 0:13
  • @Mico: You are right (I remembered the command incorrectly): Using \refstepcounter fixes the complaint, but still it does not fix the problem that the references show the wrong number. On the German package: Will do once the rest works (Thanks!).
    – U. Windl
    Mar 31, 2019 at 1:42

1 Answer 1


As nobody had an answer so far, I tried myself:

Replacing \stepcounter{figure} with \refstepcounter{figure} and replacing \gLab\subcaption{#3} with \subcaption{#3}\gLab seemed to fix the problem. The only problem remaining is that in a list of figures the captions are out-of-order (I asked a different question for a possible solution).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .