[NTG-context] Subfigures, referencing and resetting counter

Marco Patzer lists at homerow.info
Wed Nov 18 20:22:24 CET 2020


Hi!

I struggle with referencing subfigures. Combinations can't be
referenced to my knowledge, that's why I went with another float for
the inner subfigure. Example:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\useMPlibrary[dum]

\definefloat
  [subfigure]
  [subfigures]
  [figure]

\setupcaptions
  [subfigure]
  [numberconversion=characters,
   numberstopper=)]

\setuplabeltext
  [subfigure=]

\definecounter
  [subfigure]
  [way=bytext]

\starttext

\startplacefigure [title=First, reference=first]
  \startfloatcombination [nx=2, ny=1]
    \startplacesubfigure
      \externalfigure
    \stopplacesubfigure
    \startplacesubfigure [reference=fig:firstsub]
      \externalfigure
    \stopplacesubfigure
  \stopfloatcombination
\stopplacefigure

\startplacefigure [title=Second, reference=second]
  \startfloatcombination [nx=2, ny=1]
    \startplacesubfigure
      \externalfigure
    \stopplacesubfigure
    \startplacesubfigure [title=beta, reference=fig:secondsub]
      \externalfigure
    \stopplacesubfigure
  \stopfloatcombination
\stopplacefigure

See \in{figure}[first],
    \in{figure}[fig:firstsub] and
    \in{figure}[fig:secondsub].

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

How to reset the counter for the subfigure to start anew for each
new figure?

The second issue is the referencing of subfigures. The MWE shows
“figure b)” and “figure d)” rather than “figure 1b)” and “figure
2b)”. How to include the outer float counter in the reference?

Marco


More information about the ntg-context mailing list