Skip to content

LaTeX: a "[" after a line break or at the start of a list item stays text - #1099

Merged
echelon merged 2 commits into
storytold:mainfrom
webdevtodayjason:latex-leading-bracket
Oct 14, 2026
Merged

echelon merged 2 commits into
storytold:mainfrom
webdevtodayjason:latex-leading-bracket

Conversation

@webdevtodayjason

Copy link
Copy Markdown
Contributor

A list item whose text starts with "[" (for example "[x] Buy milk") exported as \item [x] Buy milk. LaTeX, and WordCraft's own LaTeX import, read "[x]" as the item's label, so the bullet became "x" and the brackets were lost. Text that starts with "[" after a line break exported as \\ followed by [1] b, which LaTeX reads as the line break's optional spacing argument: pdfLaTeX stops with "Illegal unit of measure" ("Missing number" for "[x]") and the bracketed text disappears.

escape_text now writes such a bracket as {[} when nothing visible comes before it on the line. Brackets after text are unchanged.

leading_brackets_stay_text fails on main and passes with the fix. cargo test -p wordcraft-formats, cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo xtask assets, layers and wasm pass. cargo xtask ci stops on three wordcraft-layout tests (deleted_text_adds_no_line_break_opportunity_without_markup, hidden_text_adds_no_line_break_opportunity_when_not_shown, tight_wrap_follows_an_ellipse) that fail the same way on unchanged main.

The first commit adds my entry to contributors/people.toml.

@echelon
echelon merged commit 4fe9891 into storytold:main Oct 14, 2026
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution, @webdevtodayjason! This has landed in main. If you haven't already, come join us on Discord: https://discord.gg/artcraft

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