Skip to content
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

Small tweaks to make teximg interchangeable with text #63

Open
iagobaapellaniz opened this issue Nov 11, 2024 · 2 comments
Open

Small tweaks to make teximg interchangeable with text #63

iagobaapellaniz opened this issue Nov 11, 2024 · 2 comments

Comments

@iagobaapellaniz
Copy link

iagobaapellaniz commented Nov 11, 2024

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:

  • The vertical alignment is reversed.
  • For Makie, the default font size seems to be 14pt, whereas MakieTeX compiles the LaTeX string with 12pt. Can this be fixed easily?
  • Could the arguments of both methods be more similar? Could we have teximg(0,0, text = L"E = mc^2", align=(:left, :bottom)) instead of teximg(L"E = mc^2", position = (0,0) , align=(:left, :bottom))
  • Could the baseline of the image be inferred?
@asinghvi17
Copy link
Member

asinghvi17 commented Nov 11, 2024

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
Copy link
Author

iagobaapellaniz commented Nov 11, 2024

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants