Skip to content

fix latex enumerate counter level inside bullet lists - #636

Merged
jgm merged 1 commit into
commonmark:masterfrom
zayeem06:latex-enum-level
Oct 10, 2026
Merged

jgm merged 1 commit into
commonmark:masterfrom
zayeem06:latex-enum-level

Conversation

@zayeem06

@zayeem06 zayeem06 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Wrong enumerate counter level for ordered lists nested in bullet lists

S_get_enumlevel walks the ancestor chain but tests cmark_node_get_list_type(node) (the starting node) on every iteration instead of tmp, the ancestor it is actually looking at. When the ordered list sits inside a bullet list, the enclosing itemize levels get counted too, so a list with start > 1 emits \setcounter{enumii} rather than \setcounter{enumi} and the counter it sets is not the one LaTeX uses, leaving the list numbered from 1.

The fix queries the type of tmp so only ordered-list ancestors raise the level. Added an api_test that parses - outer / 5. five and checks the LaTeX output uses enumi; worth confirming the expected string matches on your end.

@jgm
jgm merged commit 327914a into commonmark:master Oct 10, 2026
15 checks passed
@jgm

jgm commented Oct 10, 2026

Copy link
Copy Markdown
Member

great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants