MakieOrg / MakieTeX.jl

TeX integration in Makie
http://makieorg.github.io/MakieTeX.jl/
MIT License
92 stars 13 forks source link

Small tweaks to make `teximg` interchangeable with `text` #63

Open iagobaapellaniz opened 4 days ago

iagobaapellaniz commented 4 days ago

It would be nice to make teximg and text more similar. This way one can start using text as a first approach and then later change to teximg if needed so.

For comparison

f = text(0,0, text = L"E = mc^2", align=(:left, :bottom))
teximg!(L"E = mc^2", position = (0,0) , align=(:left, :bottom))
teximg!(L"E = mc^2", position = (0,0) , align=(:right, :bottom), scale=14/12)
teximg!(L"E = mc^2", position = (0,0) , align=(:right, :top), scale=14/12)
f

produces Image

Note the following issues:

asinghvi17 commented 4 days ago

That sounds like a great idea, thanks for proposing it! I don't currently have the time to solve this but will hopefully be a bit more free in December.

The alignment issue is a bit strange, we should definitely correct that. The default font size is from an earlier version of Makie, that can also be changed.

Inferring the baseline of the image is unfortunately not really feasible through the PDF, unless TeX can pass us some info through the command line somehow?

iagobaapellaniz commented 4 days ago

That sounds great! If I can help somehow, I would try to do it so in my spare time.

For the record, I found this discussion about the baseline and other related issues such as the weird "clipping" MakieTeX.jl also experiences (for the moment), https://mactextoolbox.sourceforge.net/articles/baseline.html.

See the clipping occuring this time from below.

It seems that it could be solved with something like

\geometry{margin=1pt}