We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MathPainter generates an image that cuts off the right side of the equation.
Compiled on Ubuntu 24.04.1 .NET 8.0.405
CSProj contents:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <SelfContained>true</SelfContained> <PublishSingleFile>true</PublishSingleFile> <PublishTrimmed>true</PublishTrimmed> <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> <DebugType>embedded</DebugType> <ReadyToRun>true</ReadyToRun> </PropertyGroup> <ItemGroup> <PackageReference Include="CSharpMath.SkiaSharp" Version="0.5.1" /> <PackageReference Include="SkiaSharp" Version="3.116.1" /> <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.116.1" /> </ItemGroup> </Project>
main.cs contents:
using CSharpMath.SkiaSharp; using SkiaSharp; // Render LaTeX to PNG var painter = new MathPainter { LaTeX = @"\begin{aligned} \nabla \cdot \vec{\bf E} & = \frac {\rho} {\varepsilon_0} \\ \nabla \cdot \vec{\bf B} & = 0 \\ \nabla \times \vec{\bf E} &= - \frac{\partial\vec{\bf B}}{\partial t} \\ \nabla \times \vec{\bf B} & = \mu_0\vec{\bf J} + \mu_0\varepsilon_0 \frac{\partial\vec{\bf E}}{\partial t} \end{aligned}", AntiAlias = true, TextColor = SKColors.Green, FontSize = 48, PaintStyle = CSharpMath.Rendering.FrontEnd.PaintStyle.Fill, GlyphBoxColor = (SKColors.Red, SKColors.Azure), }; using var png = painter.DrawAsStream(format: SKEncodedImageFormat.Png, quality: 100); if (png == null) { throw new InvalidOperationException("Failed to create PNG stream."); } using var file = File.OpenWrite("equation.png"); png.CopyTo(file);
Compile, execute, and open the resulting equation.png and you can see the image of the equation.
equation.png
The canvas is not wide enough for the generated latex image.
Width of canvas should be as large as the latex image.
See attached image result.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
MathPainter generates an image that cuts off the right side of the equation.
To Reproduce
Compiled on Ubuntu 24.04.1
.NET 8.0.405
CSProj contents:
main.cs contents:
Compile, execute, and open the resulting
equation.png
and you can see the image of the equation.The canvas is not wide enough for the generated latex image.
Expected behavior
Width of canvas should be as large as the latex image.
Environment (please complete the following information):
Additional context
See attached image result.
The text was updated successfully, but these errors were encountered: