Skip to content

Freeze maths inside list items so the delimiter checks pass - #86

Open
peterbjohnson wants to merge 4 commits into
devfrom
wb/t56
Open

peterbjohnson wants to merge 4 commits into
devfrom
wb/t56

Conversation

@peterbjohnson

Copy link
Copy Markdown
Member

Six of the nine PHYS40002 tex sheets fault on maths delimiters after t44, all in list items. Two causes, seen in the frozen markdown of a real sweep:

  1. A display maths that pandoc writes over several lines inside a list item - ... given by $$U = 5 \times 10^{-21} \left( ... \right) then a continuation line indented past the item's content column, ending \text{J},$$ where $r$ is ... - is left as written, because _verbatim_lines counts the continuation line (indented four or more past the item's column) as a code block and _display_maths_blocked then skips the match. A line inside an open $$ ... $$ is never code: track open display maths while walking the lines, and treat every line of the span as maths. The rewrite then puts the $$ on lines of their own, indented to the item, with the words before and after as their own paragraphs, as it does for a one-line match. Findings this removes: opening $$ must be followed by a newline, opening $$ must start its own line, closing $$ must start its own line.
  2. An inline $ ... $ whose author broke the line inside it - $\frac{1}{2} m v^2 = 576\,$ written over two lines in the .tex - freezes with the newline inside, and the checks report it as display $$ ... $$ closed with a single $ or newline inside an inline $ ... $. A newline inside inline maths carries nothing: join the lines of an inline $ ... $ span with a space at the freeze, in a paragraph or a list item, before the display-maths rewrite runs, so that the check sees one line. Do not touch $$ spans here.
    Fixtures: add both shapes to tests/fixtures/sources/display_maths/source.tex (a display maths over two lines inside an item with words either side; an inline maths broken over two lines) and re-freeze its expected.json; tests/test_source.py's delimiter assertion over every block then covers them. Done when the two shapes freeze to fields math_delimiter_checker passes, and the existing fixtures re-freeze unchanged except display_maths.

Workbench ticket t56.

This branch has not been deployed

No deployments
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.

1 participant