Comments (7)
I also notice that YaoPlots.jl does not render correctly in today's presentation:
It is not related to MathTexEngine, all utf-8 code does not render (at least on Mac) I think.
I'd love to see a full latex support! It will be amazing.
from luxor.jl.
Hi! The first thing is to get the MathTeXEngine fonts installed correctly - then at least some of the characters will appear in the right font. I’ll try your example later today to see if it’s a Luxor or MathTeXEngine issue.
from luxor.jl.
I see. How do you check that the MathTeXEngine fonts are correctly installed? I ran the Luxor LaTeX documentation example (see below). Everything seems at the right place but, indeed, the font seems a little bit "bad" to me.
from luxor.jl.
On a linux machine, where the fonts of MathTeXEngine
have been copied to ~/.local/share/fonts
, I obtain the following result:
from luxor.jl.
That's the first step. :) Now, I wonder whether MathTeXEngine is going to do a large integral anyway. To debug it:
using MathTeXEngine
generate_tex_elements(L"\int_{\Gamma} \nabla f dA")
6-element Vector{Any}:
(TeXChar '∫' [index 5930 in NewComputerModern Math - Regular], [0.0, 0.0], 1.0)
(TeXChar 'Γ' [index 374 in NewComputerModern Math - Regular], [-0.014700007624924183, -1.36899995803833], 0.6)
(TeXChar '∇' [index 842 in NewComputerModern Math - Regular], [0.9990000128746033, 0.0], 1.0)
(TeXChar 'f' [index 71 in NewComputerModern - 10 Italic], [1.8320000171661377, 0.0], 1.0)
(TeXChar 'd' [index 69 in NewComputerModern - 10 Italic], [2.1389999389648438, 0.0], 1.0)
(TeXChar 'A' [index 34 in NewComputerModern - 10 Italic], [2.6500000953674316, 0.0], 1.0)
and it looks like that "∫" glyph is scaled at 1.0... :( But I might be wrong.
Is that expected behaviour?
Well, yes... Support for LaTeX is not really very good, partly because text handling in Luxor/Cairo generally isn't very good, and partly because Cairo.jl doesn't really have maintainers any more (eg JuliaGraphics/Cairo.jl#357).
To be honest, I'd suggest either:
-
saving LaTex as an SVG image and importing it
-
fiddling with
textplace()
(which is painful but sometimes it gets the job done):
d = @png begin
textplace(
"∫abΓ∇fda",
O - (200, 0),
[
(size=120, face="NewCMMath-Regular", advance=false), # ∫
(size=40, face="NewComputerModern10-Regular", shift = -70, kern=20), # a
(size=40, shift = 100, kern = 25), # b
(size=50, kern = 5), # Γ
(size=50, face="NewCMMath-Regular", kern=5), # ∇
(size=50, face="NewComputerModern10-Regular", ), # f
(size=50, ), # d
(size=50, ), # a
])
end 600 600 "mwe.png"
display(d)
![Screenshot 2024-05-27 at 17 37 19](https://private-user-images.githubusercontent.com/52289/334168336-5c573680-ce4f-472b-99d9-b800fa97b782.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzNjM0ODEsIm5iZiI6MTcxOTM2MzE4MSwicGF0aCI6Ii81MjI4OS8zMzQxNjgzMzYtNWM1NzM2ODAtY2U0Zi00NzJiLTk5ZDktYjgwMGZhOTdiNzgyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI2VDAwNTMwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRlZTBhMzBiZDFmNmQ4MTdkM2MzMjk5YzUwZDU1YWZmNDMzNjQyNzZlZDE3YWI1MzY3OGI1ZGVlYjlhMDM0YWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hOfR_FFrNg3l1dA8w55SYHVULFGZhlQJHZblOmrlhP0)
from luxor.jl.
Thank you for your answer. I chose the LaTeX svg in the present case. It would be nice to have a "fallback" extension where the LaTeX would be compiled on-the-fly (it would require a proper install) and rendered. I might take a look at it some day.
from luxor.jl.
Yes - would be good.
But full LaTeX support is probably out of scope for this “simple drawing package” 😂. Makie.jl is a possibility.
from luxor.jl.
Related Issues (20)
- Release 3.8.0 HOT 2
- MethodError: objects of type String are not callable HOT 3
- Update sethue() and setcolor() to accept Nothing arguement HOT 2
- Source code for how to create a graph for inclusion in Luxor Documentation HOT 7
- Drop dependencies like FFMPEG (in the long run)? HOT 6
- You can't just "Plot a pixel on the screen" HOT 3
- Remove dependency on Juno.jl HOT 3
- SVG with transparent background HOT 2
- transparency does not work for background color in svg HOT 2
- clip() using lines or boxes does not return an output HOT 2
- set_next_drawing_index` not defined HOT 3
- Time to release v4? HOT 5
- A 1x1 box is semi-transparent HOT 4
- Running @draw in a loop HOT 2
- Julia v1.11 internal changes HOT 2
- Add noindex and banner to older version documentations HOT 1
- Inconsistent behavior around tolerances in `isequal` and `isless` HOT 5
- Release 4.0 HOT 1
- Windows test failure because of Cairo_jll HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luxor.jl.