Skip to content

Instantly share code, notes, and snippets.

@jdtsmith
Last active November 30, 2023 20:54
Show Gist options
  • Save jdtsmith/de34aac901fc9f96f1a88a1b1b67d46e to your computer and use it in GitHub Desktop.
Save jdtsmith/de34aac901fc9f96f1a88a1b1b67d46e to your computer and use it in GitHub Desktop.
LaTeX Preview with SVG

This is normal text. $ω(t) = \sqrt[16]{t}$ Nam a sapien. $ρ(y) = exp\left(\sqrt{log(y)}\right)$ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. $υ(x) = exp\left(\sqrt{exp(x)}\right)$ Aliquam posuere.

@jdtsmith
Copy link
Author

jdtsmith commented Nov 30, 2023

In Emacs, previews can be generated as SVG images with org-latex-create-formula-image-program = 'dvisvgm then C-u C-u C-c C-x C-l in the org document above. Enable visual-line-mode in this org buffer, show the previews, and change the width of the frame. On various image and text locations, check (window-text-pixel-size nil (cons (point) -1) (point) nil nil nil t) (via M-:); you'll see different values. Sometimes 0, sometimes too high, sometimes low, depending on what it grabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment