Skip to content

Fix TOC number overflow and deep list nesting in LaTeX template#99

Merged
asluk merged 15 commits into
aousd:mainfrom
OleksiyPuzikov:fix/latex-toc-width-and-list-depth
Jun 24, 2026
Merged

Fix TOC number overflow and deep list nesting in LaTeX template#99
asluk merged 15 commits into
aousd:mainfrom
OleksiyPuzikov:fix/latex-toc-width-and-list-depth

Conversation

@OleksiyPuzikov

@OleksiyPuzikov OleksiyPuzikov commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Replace fixed-width TOC number columns with a dynamic \numberline that measures each section number and adds 0.5em padding, so single-digit and multi-digit numbers (e.g. "12.2.1") both get exactly the space they need. Unnumbered entries (foreword, annexes) skip the number box entirely.

Add enumitem package with \renewlist to support up to 9 levels of nested itemize and enumerate lists, fixing the "Too deeply nested" LaTeX error that occurred at level 5+.

Closes #97 and #98

Verified with core spec (as I do not have access to the geom spec yet).

OleksiyPuzikov and others added 15 commits June 8, 2026 14:27
Implement heading-case tooling per ISO/IEC Directives, Part 2, 11.4
(clause titles in sentence case) as both a linter and a build-time
Pandoc filter. Proper nouns are preserved via heuristics (camelCase,
ALL_CAPS, alphanumeric mix) and an extensible YAML allowlist.

Wire the existing bold-table-header filter into the build pipeline
with an opt-in --bold-table-headers flag, and add documentation
comments throughout.

All three ISO features are off by default on the build subcommand:
  --heading-case-lint     (pre-build check, prints violations)
  --heading-case-filter   (rewrites headings in output)
  --bold-table-headers    (bolds table header cells in output)

The heading_case_lint standalone subcommand is also available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove filter_heading_case from the build pipeline and add in-place
editing (--fix) to iso_heading_case_lint.py, matching the pattern
already used by bold_table_lint.py. Add heading_case_fix and
bold_table_lint/bold_table_fix DocBuilder subcommands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These ISO formatting concerns are now handled by source-level lint/fix
tools (iso_heading_case_lint.py, bold_table_lint.py) instead of Pandoc
AST filters applied during PDF/HTML/DOCX production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consistent naming with iso_heading_case_lint.py and iso_clause_lint.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract _collect_md_files, _get_sourcepos, _unwrap_sourcepos_spans,
  and DEFAULT_WORKERS into iso_lint_utils.py (was duplicated across all
  three linters).
- All linters now accept a single .md file path in addition to
  directories.
- Add iso_lint_all subcommand (runs all three linters).
- Add iso_fix_all subcommand (fixes heading case and bold tables, then
  lints clause structure).
- Rename iso_lint subcommand to iso_clause_lint for consistency with the
  module name and sibling subcommands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract stringify import and run_parallel_check() into iso_lint_utils
- Add display_path param to Violation.format() instead of cloning objects
- Remove dead _SEPARATOR_RE/_is_separator_line from bold table linter
- Remove duplicate `import re` from heading case linter
- Use set.isdisjoint() for O(1) protected-range checks in heading fixer
- Simplify fix_file() newline handling with rstrip('\n')
- Have main() --fix call fix_spec() instead of reimplementing it
- Refactor iso_lint_all/iso_fix_all into data-driven loops
- Remove clause lint from iso_fix_all (belongs in iso_lint_all only)
- Fix stale iso_clause_lint_all references in docs (actual name: iso_lint_all)
- Add partial-bold edge case comment to _bold_header_row

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…orts

- Move format_report() logic into iso_lint_utils parameterised by label
- Each linter keeps a thin wrapper preserving its public API
- Remove unused imports from iso_bold_table_lint (re, Set, field)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- fix_spec() accepts optional pre-computed violations list, skipping
  the redundant check_spec() call when the caller already has results
- All call sites (main --fix, doc_builder fix methods, iso_fix_all)
  now pass violations through
- Make Violation.format() keyword-only across all three linters
- Remove commented-out code from iso_clause_lint Violation.format()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The argparse namespaces always have these attributes defined by their
respective parsers, so getattr with a fallback is unnecessary.  Add
--context to the iso_lint_all parser so it's explicitly declared
rather than silently defaulted via getattr.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The build parser defines all five attributes (heading_case_lint,
heading_proper_nouns, iso_xrefs, keep_pdf_latex), so the argparse
namespace always has them — getattr with a fallback was unnecessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
build_docs() is called from test scripts that build args via
types.SimpleNamespace without all build-parser attributes.  The
getattr fallbacks are necessary here, unlike the ISO subcommand
methods which are only ever invoked through their own parsers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the missing build-parser attributes (heading_case_lint,
heading_proper_nouns, iso_xrefs) to the SimpleNamespace in
build_diff.py so build_docs() can use direct attribute access
consistently. Future build flags that are missing from test
callers will fail with a clear AttributeError instead of
silently falling back to a default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace fixed-width TOC number columns with a dynamic \numberline that
measures each section number and adds 0.5em padding, so single-digit and
multi-digit numbers (e.g. "12.2.1") both get exactly the space they need.
Unnumbered entries (foreword, annexes) skip the number box entirely.

Add enumitem package with \renewlist to support up to 9 levels of nested
itemize and enumerate lists, fixing the "Too deeply nested" LaTeX error
that occurred at level 5+.

Closes aousd#97, closes aousd#98.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@asluk

asluk commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

verified in geom spec too #97 (comment) -- merging

@asluk
asluk merged commit c918081 into aousd:main Jun 24, 2026
1 check passed
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.

TOC section-number column too narrow — multi-digit section numbers collide with titles

3 participants