Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CSharpMath.Evaluation.Tests/InterpretTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class InterpretTests {
[InlineData(@"1+2", @"\underline\mathrm{Input}\\1+2\\\\\underline\mathrm{Simplified}\\3\\\\\underline\mathrm{Value\ (100\ digits)}\\3")]
[InlineData(@"1+\sqrt", @"\color{red}\text{Missing radicand}")]
[InlineData(@"1+\sqrt2", @"\underline\mathrm{Input}\\1+\sqrt{2}\\\\\underline\mathrm{Simplified}\\1+\sqrt{2}\\\\\underline\mathrm{Value\ (100\ digits)}\\2.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573")]
[InlineData(@"1+\sqrt{2x}", @"\underline\mathrm{Input}\\1+\sqrt{2 x}\\\\\underline\mathrm{Simplified}\\1+\sqrt{2 x}\\\\\underline\mathrm{Expanded}\\1+\sqrt{2 x}\\\\\underline\mathrm{Factorized}\\1+\sqrt{2 x}")]
[InlineData(@"1+\sqrt{2x}", @"\underline\mathrm{Input}\\1+\sqrt{2 x}\\\\\underline\mathrm{Simplified}\\1+\sqrt{2 x}\\\\\underline\mathrm{Expanded}\\1+\sqrt{2} \sqrt{x}\\\\\underline\mathrm{Factorized}\\1+\sqrt{2 x}")]
[InlineData(@"1+\sqrt{2xy}", @"\underline\mathrm{Input}\\1+\sqrt{2 x y}\\\\\underline\mathrm{Simplified}\\1+\sqrt{2 x y}\\\\\underline\mathrm{Expanded}\\1+\sqrt{2 x y}\\\\\underline\mathrm{Factorized}\\1+\sqrt{2 x y}")]
[InlineData(@"=1+\sqrt{2xy}", @"\color{red}\text{Missing left side of equation}")]
[InlineData(@"1+\sqrt{2xy}=", @"\color{red}\text{Missing right side of equation}")]
Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Evaluation/CSharpMath.Evaluation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<ProjectReference Include="..\CSharpMath\CSharpMath.csproj" />
<PackageReference Include="AngouriMath" Version="1.4.0" />
<PackageReference Include="AngouriMath" Version="2.0.0-preview.2" />
</ItemGroup>

</Project>
8 changes: 6 additions & 2 deletions CSharpMath.Evaluation/Evaluation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,20 @@ enum Precedence {
Postfix
// Highest
}
public abstract record MathItem : ILatexiseable {
public abstract record MathItem : ILatexizeable {
private protected MathItem() { }
public abstract string Latexise();
// AngouriMath 2.0 renamed ILatexiseable.Latexise to ILatexizeable.Latexize. Implementing
// it explicitly keeps MathItem.Latexise as the public name here, so this package's own
// surface is unchanged by their rename.
string ILatexizeable.Latexize() => Latexise();
public static implicit operator MathItem(AngouriMath.Entity content) => new Entity(content);
public static explicit operator AngouriMath.Entity(MathItem item) => ((Entity)item).Content;
/// <summary>A real number, complex number, variable, function call, vector, matrix, higher-dimensional tensor, or set</summary>
public sealed record Entity : MathItem {
public Entity(AngouriMath.Entity content) => Content = content;
public AngouriMath.Entity Content { get; }
public override string Latexise() => Content.Latexise();
public override string Latexise() => Content.Latexize();
}
/// <summary>A linked list of comma-delimited items</summary>
public sealed record Comma : MathItem, IEnumerable<MathItem> {
Expand Down
4 changes: 2 additions & 2 deletions CSharpMath.Evaluation/Interpret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

namespace CSharpMath {
static partial class Evaluation {
static StringBuilder AppendLaTeX(this StringBuilder sb, AngouriMath.Core.ILatexiseable latex) =>
sb.Append(latex.Latexise());
static StringBuilder AppendLaTeX(this StringBuilder sb, AngouriMath.Core.ILatexizeable latex) =>
sb.Append(latex.Latexize());
static StringBuilder AppendLaTeXHeader(this StringBuilder sb, string header, bool includeNewlineBefore = true) {
if (includeNewlineBefore) sb.Append(@"\\\\");
return sb.Append(@"\underline\mathrm{").Append(header).Append(@"}\\");
Expand Down
Loading