Repository navigation
fix(latex): keep braces and spaces inside \verb - #5190
Conversation
Signed-off-by: Fahmid Arman <[email protected]>
|
✅ DCO Check Passed Thanks @Fahmid-Arman, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. 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 fixes LaTeX Topic labels added: CI safety: no concern found. A maintainer must still approve CI. The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 0eb8acacd9. It read the code and did not run it.
I found no defect. The change in docling/backend/latex/handlers/macros.py:820 and docling/backend/latex/utils/text.py:359 is narrow: only a LatexCharsNode argument skips the strip, and other argument types behave as before. The regression test checks both the heading case and the body-text case. I could not read the installed pylatexenc source, so I could not confirm that it returns \verb content as a LatexCharsNode. The fix and the test depend on that claim.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
I checked this on 27 arXiv papers along with #5188 and #5192. The full results are in #5192 (comment). For this PR: all papers converted without errors, and no output changed. The 4 |
Issue resolved by this Pull Request:
Resolves #5189
The generic macro argument code turned every non-group argument into text with
arg.latex_verbatim().strip("{} "). pylatexenc passes\verb|...|content as aLatexCharsNode, which has no delimiters to strip, so the strip removed the content's own braces and spaces. Both copies of that code,_extract_all_macro_args_inlineinhandlers/macros.py(body text) and the loop inutils/text.py(headings and other arguments), now use a characters argument'scharsas is and keep the strip for other arguments.Checklist:
Review evidence:
\section{The \verb|{x}| key}The x keyThe {x} key... \verb|\section{Intro}| and ... as \verb|{}|.... \section{Intro and ... as .... \section{Intro} and ... as {}.test_latex_verb_keeps_braces_and_spacesintests/test_latex/test_macros.pycovers both cases. It fails onmainand passes with the change.tests/data/latexgives the same documents as the groundtruth.jsonfiles.pytest tests/test_latex: all pass excepttest_e2e_latex_conversions, which fails onmainhere as well because this environment has no renderer for the LaTeX figures (predicted image is None); its Markdown, indented text, DocLang and LaTeX comparisons pass.ruff formatandruff check(v0.17.2) are clean on the changed files.