Repository navigation
fix(latex): read \paragraph and \part titles as headings - #5188
Fahmid-Arman wants to merge 1 commit into
Conversation
Signed-off-by: Fahmid Arman <[email protected]>
|
✅ DCO Check Passed Thanks @Fahmid-Arman, all your commits are properly signed off. 🎉 |
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The PR adds Topic labels added: CI safety: no concern found. A maintainer must still approve CI. Reference data changes
Assessment: expected. The The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 13d1c46199. It read the code and did not run it.
I found no defect. The new MacroSpec entries make \part and \paragraph reach the existing heading handler, which already maps them to levels 1 and 4.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
I checked this on 27 arXiv papers along with #5190 and #5192. The full results are in #5192 (comment). For this PR: all papers converted without errors. The 171 |
maxmnemonic
left a comment
There was a problem hiding this comment.
Let's keep the heading fix, but preserve document-defined versions of \paragraph and \part
The new parser specs consume their arguments before the custom macro expander can read them. For example:
\renewcommand{\paragraph}[1]{#1}
\paragraph{Keep me} Body.
The base produces Keep me Body.
but this PR produces #1 Body.
Please adjust parsing or argument expansion so custom definitions retain their arguments. Add regression tests for both commands, and keep the normal, starred, and optional-title heading behavior working.
Issue resolved by this Pull Request:
Resolves #5187
pylatexenc's default macro specs misspell
\paragraphaspagagraphand have no\part, so neither macro got its{title}argument and the LaTeX backend read the title as body text, glued to the next paragraph.LATEX_CONTEXT_DBnow declares both with the same spec pylatexenc uses for the other sectioning commands (*[{), so their titles reach the existing heading handler, which already mapspartto level 1 andparagraphto level 4.Checklist:
Review evidence:
\part{Background}BackgroundBackground\paragraph{Contributions.} We propose...Contributions. We propose...Contributions., then textWe propose...\subparagraph{Details.} More text.test_latex_subparagraph_heading(tests/test_latex/test_macros_more.py) now checks the levels of both\paragraphand\subparagraph, andtest_latex_heading_levels(tests/test_latex/test_macros.py) checks the exact headings, including\part. Both fail onmainand pass with the change.1706.03762and2412.19437, the two sources that use\paragraph, is regenerated. The diff turns titles likeEncoder:The encoder is composed of...andResidual Dropout We apply dropout...into headings followed by their text. The.jsonfiles keep the picture images frommain: this environment has no renderer for the LaTeX figures, so I regenerated the files and restored onlypictures[*].image. Apart from those images, the converted documents match the new.jsonfiles exactly. No other groundtruth file changes.pytest tests/test_latex: all pass excepttest_e2e_latex_conversions, which fails onmainhere as well, withpredicted image is Nonefor the figures. Its Markdown, indented text, DocLang and LaTeX comparisons pass with the new groundtruth.ruff formatandruff check(v0.17.2) are clean on the changed files.