Fix line breaks appearing after inline images in compiled PDF - #52
Merged
cycomachead merged 2 commits intoAug 7, 2026
Merged
Conversation
The myst-to-tex serializer unconditionally appends a blank line after image nodes, which LaTeX interprets as a paragraph break (\par). This caused inline images to force a new line in the compiled PDF. This change introduces a LaTeX shim that brackets inline images with custom TeX commands (\snapinlineopen and \snapinlineclose). These commands locally redefine \par to be inert, ensuring that the serializer's trailing blank line does not break the flow of text. - Added \snapinlineopen and \snapinlineclose to the LaTeX template - Updated latex-shims plugin to wrap inline image nodes with raw TeX markers - Ensured HTML builds and image caching remain unaffected Co-authored-by: Claude Code <noreply@anthropic.com>
Updated the CI workflow to TeX Live 2026 to match the current CTAN repository. This fixes a build failure caused by the 2025 rollover, specifically renaming `pdfmanagement-testphase` to `pdfmanagement` and `sourceserifpro` to `sourceserif`. Co-authored-by: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix line breaks appearing after inline images in compiled PDF
Inline images in the compiled PDF were forcing paragraph breaks mid-sentence due to
myst-to-texunconditionally appending a blank line after every image node (which LaTeX interprets as\par). This fix defuses that forced paragraph break for inline images without forking the upstream serializer.Changes
_latex-template/template.tex: Defines two new TeX commands,\snapinlineopenand\snapinlineclose, which bracket inline images in a group where\paris redefined as a no-op.\unskipin the closing command removes stray inter-word glue from the serializer's trailing newline. Real paragraph breaks (serialized after the closing marker) continue to work normally._support/plugins/latex-shims.mjs: Adds a new transform step that walks the AST and wraps inline image nodes with raw TeX siblings (\snapinlineopen{}/\snapinlineclose{}). Nodes are tagged to prevent double-wrapping across multiple PDF export pipelines. HTML builds and image caching are unaffected.Visual Changes
Before this fix, inline color-swatch images would break their surrounding sentence onto a new line. After the fix, they flow inline with the text:
Superconductor Ticket Implementation | Guided Review