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

xenops-increase-size changes forgotten after reveal #66

Open
JoeyEremondi opened this issue May 15, 2023 · 2 comments
Open

xenops-increase-size changes forgotten after reveal #66

JoeyEremondi opened this issue May 15, 2023 · 2 comments

Comments

@JoeyEremondi
Copy link

Currently, I can use xenops-increase-size to make the size of the rendered TeX bigger, and it works quite well. The problem is, if I enter a snippet and reveal it to reveal the math command, when it renders again it goes back to the default size, not the increased size. I have to do "xenops-increase-size" followed by "xenops-decrease-size" to restore all the snippets back to their usual size.

Is this a known bug? Is something just configured wrong for revealing?

@dandavison
Copy link
Owner

dandavison commented May 15, 2023

Hi @JoeyEremondi. As a meta comment -- I'd love to do more work on Xenops but recently I haven't been writing any maths (I made it for myself when I was taking time out to study) -- and so it has been a bit hard to justify the time.

If I remember correctly, this was a known bug. Basically here

xenops/lisp/xenops-math.el

Lines 356 to 366 in 4d75c1c

(defun xenops-math-image-change-size (element factor)
"Change ELEMENT image size by multiplicative FACTOR."
(-if-let* ((image (xenops-element-get-image element)))
(when (eq (image-property image :type) 'svg)
(image-flush image)
(let* ((data (or (eval (image-property image :data))
(and (f-exists? (image-property image :file))
(prog1 (f-read-text (image-property image :file))
(setf (image-property image :file) nil))))))
(if data
(setf (image-property image :data) (xenops-util-svg-resize data factor)))))))

this function takes in the factor by which to change size, but I think what was needed was some sort of global/default factor which would be honored on each render automatically; and then the xenops-increase-size function would mutate the global factor variable, or something along those lines. So this would give a uniform multiplicative display scaling of all images over and above whatever the default size would be based on the latex source.

If you have the slightest temptation to look into fixing it, that would be fantastic, and I can offer you my claim that the code is fairly clean and that it's fun to do xenops development, and obviously that I'd be happy to discuss it.

@dandavison
Copy link
Owner

Or perhaps the problem is the image caching? That when we change size, we need to invalidate the entries in emacs's image cache so that they are re-rendered with the new size.

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