Skip to content

FYI: Adding labels/IDs to tables since Pandoc 3.8.2 has changed #15

Description

@somelinguist

I just wanted to document this in case it's helpful for anyone else.

I have been using pandoc-crossref to have labels/IDs to tables in order to cross-reference them. Before Pandoc 3.8.2, I did this by adding the the label after the caption as below, following the documentation for pandoc-crossref, and it worked fine.

See @tbl:example.

:::list-table
   Markup languages {#tbl:example}

   * - Name
     - Initial release

   * - Markdown
     - 2004

   * - reStructuredText
     - 2002
:::

However, this no longer works with the list-table filter as of Pandoc 3.8.2. For some reason the {#tbl:example} after the caption ends up getting escaped to \{#tbl:example\}.

But it does work to add the ID/label in the attributes for the div used for the list table, as below:

See @tbl:example.

::: {#tbl:example .list-table}
   Markup languages

   * - Name
     - Initial release

   * - Markdown
     - 2004

   * - reStructuredText
     - 2002
:::

In LaTeX/PDF output at least, \label{tbl:example} correctly gets placed after the table caption.

I'm not sure if this is just how it actually worked before, or if this is new since Pandoc 3.8.2, which added support for table attributes after the caption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions