Skip to content

Move to AngouriMath 2.0, which renamed Latexise to Latexize - #262

Open
Rafael-SOWNet wants to merge 1 commit into
verybadcat:masterfrom
Rafael-SOWNet:angourimath-2.0-latexize
Open

Move to AngouriMath 2.0, which renamed Latexise to Latexize#262
Rafael-SOWNet wants to merge 1 commit into
verybadcat:masterfrom
Rafael-SOWNet:angourimath-2.0-latexize

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown

Hello — I maintain AngouriMath, which CSharpMath.Evaluation builds on. AngouriMath 2.0 renames ILatexiseable.Latexise to ILatexizeable.Latexize, so this is advance notice with the work already done rather than a bug report after the fact.

Entirely your call whether to take it now or when 2.0 is final — the only thing that would need changing then is the version string.

CSharpMath's own public API does not change

This is the part I wanted to get right. MathItem implements the renamed interface explicitly, so MathItem.Latexise() stays exactly the name your callers know:

public abstract record MathItem : ILatexizeable {
  public abstract string Latexise();
  string ILatexizeable.Latexize() => Latexise();
}

PublicAPI.Unshipped.txt is untouched, and the public-API analyzer agrees — the build produces no RS warnings. Your consumers see nothing.

If you would rather follow the rename through to your own member for consistency, that is a two-line change and yours to make; I did not presume it.

What actually moves

Only what is on AngouriMath's side of the boundary. I let the compiler establish the list rather than grepping for the name — several sites that look affected are your own MathItem and are not:

file change
Evaluation.cs:45 MathItem : ILatexiseableILatexizeable
Evaluation.cs explicit ILatexizeable.Latexize() added
Evaluation.cs:54 Content.Latexise()Content.Latexize() (receiver is AngouriMath.Entity)
Interpret.cs:6,7 parameter type and call
CSharpMath.Evaluation.csproj AngouriMath 1.4.02.0.0-preview.2

Evaluation.cs:64, Evaluation.cs:76 and EvaluationTests.cs:809 call MathItem.Latexise() — your method — and are untouched.

One test expectation changes, and it is a real rendering change

InterpretTests: 1+\sqrt{2x} now expands to 1+\sqrt{2}\sqrt{x} rather than staying 1+\sqrt{2 x}. AngouriMath 2.0 splits a radical over a positive factor.

The identity √(2x) = √2·√x holds for all complex x when the factored-out constant is positive, so the output is sound — but it is a change in what your users will see rendered, so I have flagged it rather than quietly updated it. Only the Expanded line differs; Input, Simplified and Factorized are unchanged.

A bug of ours that your test suite found

Running your suite against 2.0.0-preview.1 failed two tests. The second was ours: \mathbb R+1 rendered as \mathrm{undefined}, because Expand turned RR + 1 into NaN — a 2.0 regression where collecting like terms wrote a factor back as base^1, which is an identity only where the power is defined at all.

Fixed in asc-community/AngouriMath#852 and released in 2.0.0-preview.2, which is what this PR references. Thank you — your tests caught something ours did not.

Measured

Against 2.0.0-preview.2:

CSharpMath.Evaluation.Tests  Total: 955, Errors: 0, Failed: 0, Skipped: 0

For reference, before this change: 955 green on AngouriMath 1.4.0, two red on 2.0.0-preview.1.

Happy to adjust anything here, or to close it and simply leave the heads-up if you would rather do the upgrade yourselves.

AngouriMath 2.0 renames ILatexiseable.Latexise to ILatexizeable.Latexize.

MathItem implements the new interface explicitly, so CSharpMath's own public
surface does not change: MathItem.Latexise stays the name callers know, and
PublicAPI.Unshipped.txt is untouched. The public-API analyzer confirms it --
no RS warnings.

Only two call sites are on AngouriMath's side of the boundary and move:
Content.Latexize() on an AngouriMath.Entity, and the ILatexizeable parameter
in Interpret.

One test expectation changes. 2.0 splits a radical over a positive factor, so
1+\sqrt{2x} expands to 1+\sqrt{2}\sqrt{x}. sqrt(2x) = sqrt(2)sqrt(x) holds for
all complex x when the factored constant is positive, so the new output is
sound; it is a rendering change rather than a correctness one.

955 of 955 tests pass.
@Happypig375

Copy link
Copy Markdown
Collaborator

@Rafael-SOWNet Can you also add the implementation and tests for the new forms of LaTeX that AngouriMath started to produce?

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.

2 participants