Skip to content

Register the notebook LaTeX formatters by reflection, and drop polyfill.io - #2111

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
read-the-latex-extension-without-a-reference
Oct 24, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
read-the-latex-extension-without-a-reference

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Fixes #2109.

The C# compile error at the top of every F# notebook. AngouriMath's extension.dib, the C# script NuGet loads with the package, began with using AngouriMath;. An F# notebook loads it into the C# kernel, which has no reference to AngouriMath, so the notebook's first output was CS0246. The script now finds ILatexizeable, EDecimal, EInteger and ERational among the loaded assemblies and registers its formatters on those types, which works from either kernel.

Measured in the binder/Dockerfile image, with the three packages packed locally at 2.6.1-dev.7:

kernel first cell then
F#, #r "nuget:AngouriMath.Interactive" Extensions for LaTeX loaded!, where 2.6.0 printed CS0246 derivative "x" "x^3" is 3 {x}^{2} in LaTeX
C#, #r "nuget:AngouriMath" Extensions for LaTeX loaded! "x^2/3".ToEntity() and an ERational render in LaTeX, as before

polyfill.io. This script and AngouriMath.Interactive's F# extension both put <script src='https://polyfill.io/v3/polyfill.min.js?features=es6'> into every HTML output. That domain was taken over in 2024 and used to serve malicious code. MathJax 3 needs no polyfill in a current browser, so the line is gone from both, and from the expected HTML in InteractiveWrapperUnitTests, which passes (18 of 18, 1 skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…ll.io

AngouriMath's extension.dib, the C# script NuGet loads with the package, began
`using AngouriMath;`. An F# notebook loads it into the C# kernel, which has no
reference to AngouriMath, so the first output of every F# notebook was
CS0246. It now finds ILatexizeable, EDecimal, EInteger and ERational among the
loaded assemblies and registers its formatters on those types, which works
from either kernel. Measured in the binder/Dockerfile image with the packages
packed locally: from F#, the script loads and says so, and derivative "x" "x^3"
is 3 x^2 in LaTeX; from C#, an entity and an ERational render as before.

And both this script and AngouriMath.Interactive's F# extension put
<script src='https://polyfill.io/...'> into every HTML output, a domain taken
over in 2024 and used to serve malicious code. MathJax 3 needs no polyfill in
a current browser; the line is gone, from the tests' expected HTML too.

Fixes #2109.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 24, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit fe5be21 into master Oct 24, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Oct 24, 2026
Rafael-SOWNet added a commit that referenced this pull request Oct 24, 2026
…namespaces in a C# notebook (#2112)

AngouriMath.FSharp and AngouriMath.Interactive were built against the SDK's FSharp.Core,
10.1, and a notebook host runs its own: dotnet-interactive 1.0.712001 carries 10.0. A C#
kernel never finished loading the kernel extension, and an F# kernel failed its first call
into the wrappers unless the extension had loaded first. Both now ask for 8.0.403, which is
Plotly.NET's floor. Measured in the Binder image: a C# kernel loads AngouriMath.Interactive
in 12 s where the same build at 10.1 times out, and the F# kernel renders LaTeX and Plotly
charts. A test fails when a wrapper asks for a newer FSharp.Core than the F# kernel is
built against.

extension.dib opened AngouriMath and AngouriMath.Extensions in 2.6.0, and C# notebooks
rely on it; #2111 dropped the usings because they do not compile in an F# notebook. A
second cell defers them to the C# kernel's next submission when its references include
AngouriMath, so they are opened exactly when the C# kernel loaded the package. Both sample
notebooks run with no error against a local build, the C# one with either package.

Fixes #2108


Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

AngouriMath's notebook extension prints a C# compile error when loaded from an F# kernel

1 participant