Skip to content

Referencing subfigure counters directly #37

@joschakrug

Description

@joschakrug

Hi,

a small feature that I think would be great (and similar to this issue) would be being able to refer to the subfigure counter of a figure directly. When using subfigures, what I do a lot is writing text like "As we can see in panel (a) of Figure 1, .... Conversely, panel (b) shows that ..."

Of course, the user can define a function to achieve this with only a few lines of code. But doing so does require going into the subpar source code to identify the correct counter. If there was a way to do this out of the box, this could be quite helpful, especially for beginners.

Quick and dirty, I was thinking of a function like this, although there surely are more elegant ways to implement this:

#let subref(label, numbering-sub: "(a)") = context {
  let count = counter("__subpar:sub-figure-counter").at(label).at(0) + 1
  link(label, numbering(numbering-sub, count))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions