Fix: Jupyter notebook LaTeX math tests #444
Open
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.
Description
This fixes and improves the tests used in
test_ipynb_to_pdf
to confirm valid PDF rendering of LaTeX math in jupyter notebooks. Thepdf-reader
incorrectly parses a valid render of the inline math asBMI: bmi = weigh2
instead ofweight
.I extended the LaTeX to ensure full words like
weight
andheight
are parsed correctly, though(kg)
is still incorrectly parsed as(2g)
(see below). Now, tests confirm a valid PDF render by checking forweight
andheight
without needing to check for newlines or other notation.I also used
text{hei}text{ght}
to separate the words to guarantee a reliable unit test pass if the words are detected. Below is a before/after of the inline LaTeX, the PDF render, and the output ofpdf-reader
.Before
Inline math LaTeX:
$\text{bmi}=\frac{\text{weight}}{\text{height}^2}$
PDF Render
pdf-reader
outputAfter
Inline math LaTeX:
$\text{bmi}=\frac{\text{weig}\text{ht (kg)}}{\text{hei} \text{ght (m)}^2}$
PDF Render
pdf-reader
outputTests used to confirm math latex rendered correctly
Type of change
How Has This Been Tested?
rake test
Checklist: