visual-studio-codeinteractivec#-interactivedotnet-interactive.net-interactive

vscode .net interactive notebooks to display latex


I have been looking for a way to display latex in vscode .Net interactive notebooks, but I've had no luck.

on my C# .Net interactive Code Cell I have

#r "nuget: AngouriMath.Interactive, 1.3.0"
using AngouriMath.Interactive;
using AngouriMath;
Entity entity= "X^2+1";
var latexText = entity.Latexise();
display(latextText,"text/latex") //<< this will not work because "text/latex" mimetype is not valid.

I found this for image https://stackoverflow.com/a/70850956/7197556 where the bitmap image is converted to base64string before being passed to the display() function. Is there a way to do this for latex? or are there any other straightforward solutions?

side-note: I'd like to avoid writing javascript/html code cells as much as possible.


Solution

  • Using visualization for AngouriMath

    You should be able to do it without display. In Notebooks you can visualize any expression just by running a cell with it, see the screenshot

    enter image description here

    By the way, there's still some problem with support of F# in .NET Interactive extensions, so the kernel might fail to load. In case it fails, you can either activate it manually:

    AngouriMath.InteractiveExtension.KernelExtension.applyMagic()
    

    Or install the last preview version:

    #i "https://www.myget.org/F/angourimath/api/v3/index.json"
    #r "nuget:AngouriMath.Interactive, 0.0.0-*"
    

    Using Interactive LaTeX visualization

    If you want to display LaTeX without AngouriMath, you can use MathString. Just create an instance of it, and it will be displayed for you:

    enter image description here