-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
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
LaTeX: MathTeXEngine 0.5.0, Luxor version 3.5.0 #241
Comments
Ok, now I've found this issue. I'll try to check it during lunch. Have you already found any problems? |
I think the font selection code doesn’t find the NewComputerModern Italic easily, and defaults to Regular. |
Each TeXChar carry its own (FreeType) font, so it should be possible to add a binding in Cairo.jl that can access it direclty using https://www.cairographics.org/manual/cairo-FreeType-Fonts.html Similarly, now that MathTeXEngine use glyph indices directly, you would need https://www.cairographics.org/manual/cairo-text.html#cairo-show-glyphs that doesn't seem to be exported by Cairo.jl either right now. CairoMakie call into the C library directly so it doesn't have those problems. I could restore |
Thanks. Ideally better font routines would be added to Cairo rather than to all the packages that depend on Cairo. I think more investigations are needed. Thanks for the excellent help, @Kolaru! |
Work that needs to be done to support MathTeXEngine v0.5.0 correctly might include:
( Luxor.jl is showing its age - it predates GeometryBasics.jl by some years 😃; perhaps it should be rewritten to use JuliaGeometry packages...) I think this is a lot of work, so for now LaTex text setting is less than perfect. |
Hey, @cormullion . Why does MathTeXEngine v0.5.0 requires such significant changes? I mean, more specifically, why GeometryBasics.jl? |
I was looking at Julius' work here - https://github.com/JuliaPlots/Makie.jl/pull/2139/files# - it seems to need stuff from FreeType and GeometryBasics. MTXE now references the font glyphs directly, by index, rather than by Unicode. I'm no expert here, though! :) |
So, I took a look at the code to try to understand what was going on. Did the original fonts for the symbols change? In theory, the code I wrote for Luxor should work, as it get's the current font set by MathTeXEngine, and applies the |
The main thing I noticed (not being a Latex user) is that the italic fonts weren't found when the documentation job was run. I'm guessing that the use of FreeTypeAbstraction.jl finds/uses font names differently. Version 0.4 of MTXE returned, for
Version 0.5 of MTXE returned, for
The Cairo Toy Api's Perhaps we could use The other issue is the use of glyph indices rather than |
Yes, I switch from the Computer Modern family (non unicode, a bunch of fonts for math symbols, weird glyph info in the font) to the New Computer Modern family (unicode, all symbols in a single font, but alternate glyph for some math symbols, requiring the glyph index business). I don't think that GeometryBasics should be needed. The point type used for the position are from there, but that a mere detail I believe.
This is it in the compat PR in Makie. I think the simpler way is probably to add a similar function to Cairo.jl and then use it there. I am not familiar with |
|
I was not able to figure it out :( |
Thanks for looking anyway, @davibarreira ! It's difficult to get the right fonts on all platforms, and I'm seeing a strange vertical misalignment (eg i and π) which I can't currently explain. Also I broke the rotation... :( |
Can you share the code snippet to produce the image ? That way I'll be able to do quicker tests :) |
it's at http://juliagraphics.github.io/Luxor.jl/dev/howto/text/#Writing-LaTeX - |
I made some progress in #244, but some stuff are still unclear. |
That's great! Will follow the Cairo PR with great interest! |
How can I get variables written in italics as LaTeX? Currently the snipped produces non italics text. |
MathTeXEngine version 0.5 changed their LaTeX code, so please could Luxor-LaTeXers check and report any issues with Luxor 3.5.0? Thanks!
The text was updated successfully, but these errors were encountered: