5

When using the inline latex preview in org-mode, I have discovered that it seems the size of the preview images is dependent on the display size.

While at work, I have my laptop connected to a dock, with an external display. I have then configured the preview with the :scale property in my init.el file. The scale is set to 1.2.

As I got home, I continued work on my laptop, and when I wrote a new expression in latex and toggled the preview of the expression, the size was significantly larger (see image).

Size different

Is there a simple way I can fix this and get the size to be equivalent (relative to my text) on all screens?

4
  • 5
    Instead of setting the scale to a number (1.2), you can set it to a function (i.e., preview-scale-from-face). That should cause the preview to be scaled to match preview-reference-face, and you can customize that face to set it to a relative size. I can't test that at the moment, but it sounds like it should be a portable solution.
    – Tyler
    Aug 15, 2018 at 15:58
  • @Tyler: I hope you can test that and make it an answer. I'll certainly upvote it!
    – NickD
    Aug 15, 2018 at 16:28
  • Any updates on this? Jul 12, 2019 at 22:17
  • 1
    Probably related: emacs.stackexchange.com/a/58591/5422
    – koddo
    May 19, 2020 at 11:40

1 Answer 1

0

Solutions in How to enlarge latex fragments in org mode at the same time as the buffer text? can help improve this, but I came up with the following (very hacky) solution:

(plist-put org-format-latex-options :scale (if (> (display-pixel-width) 3000) 0.8 1.5))

I'm not sure if this is robust to things like plugging in new monitors after emacs has started (I don't believe this will work). In that case you should also include some advice around org-latex-preview, something like (advice-add 'org-latex-preview :around #'my-scaling-function-here).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.