Render tex (text and math) in the app #32
Draft
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.
This is a work in progress, little fun experiment, of rendering document written in tex in the web app.
There's
notes/notex.tex
file with some complex equations. First I usedpandoc
to convert tex to markdown:Then I replaced home page content with the generated
web/src/content/en/Notes.md
.I use
remark-math
andrehype-katex
plugins for the@next/mdx
renderer. I had to also add global CSS fromkatex
so that formulas look a bit prettier.I had to remove
%
comment from the formula in the tex file, because it was confusing the parser it seems and it generated red unformatted text past the%
sign .The document has hard line breaks at char 80, and this unfortunately translates into line breaks in the final render too, even though I'd expect it not to. This might be configurable (by i.e. using GitHub flavor of markdown rendering). Otherwise we could tell doc authors to remove the hard breaks and use soft-wrap in the editor instead.
Some styling will be needed, but otherwise it seems to be working very well. This feature might allow to: