Skip to content

Add support for latex output in VSCode Jupyter notebook#136

Open
rstanuwijaya wants to merge 5 commits intoWolframResearch:masterfrom
rstanuwijaya:latex-mimetype
Open

Add support for latex output in VSCode Jupyter notebook#136
rstanuwijaya wants to merge 5 commits intoWolframResearch:masterfrom
rstanuwijaya:latex-mimetype

Conversation

@rstanuwijaya
Copy link
Copy Markdown

Background

While jupyterlab and jupyter notebook able to detect the latex output automatically, VSCode Jupyter could not do the same. VSCode Jupyter will only render latex equation if the output mimetype is text/latex, whereas the current version only supports text/html and text/plain as a fallback

I added changes such that it will enable text/latex mimetype output when the evaluation result allows. On my changes, I added toTeX method, which will wrap the result with $$ to allow proper rendering from VSCode.

Comparison

image
image

@BinaryQuantumSoul
Copy link
Copy Markdown

This is awesome.
It works perfectly for one line results.
It also works nice for simple results one above each other.

A little caveat I saw though,
If you print the outputs from inside a single function call,
it will give only one output which is composed of two different TeXForm, therefore it's not detected and not formatted. What I wanted to try is to use CellPrint[ExpressionCell[expr//TeXForm]] instead of print. However, CellPrint doesn't work inside vscode jupyter.

Another question is how could we automatically add TeXForm to math equations to not have to write it on each cell.

@jbRothschild
Copy link
Copy Markdown

Saw that this PR was a bit stalled and wanted to weigh in that I tested the contents of the PR and it works great! Thought I'd leave a comment, because I think a lot of people would benefit from this QOL update.

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.

4 participants