I've modified the behavior of `org-create-formula-image' so that
`\definecolor' etc do not create unnecessary whitespace in the output PDF.
Here's the relevant change:

```
...
        ;; remove tex \par at end of line
        (if (string= (substring string -1 nil) "\n")
            (aset string (- (length string) 1) ?%)
          (setq string (concat string "%")))
        (with-temp-file texfile
          (insert latex-header)
          (insert "\n\\begin{document}\n"
         "\\definecolor{fg}{rgb}{" fg "}%\n"
         "\\definecolor{bg}{rgb}{" bg "}%\n"
         "\n\\pagecolor{bg}%\n"
         "\n{\\color{fg}\n"
         string
         "\n}\n"
         "\n\\end{document}\n"))
...
```

This is useful if you (like me) have replaced the default document class
with standalone and are using dvisvgm. The change removes leading left and
right space, which is especially useful when using inline math mixed with
normal text. It shouldn't make a difference if using Imagemagick's convert
as a backend since that can get rid of whitespace boundaries.

Is anyone else interested in this modification? Should I submit it as a
patch?

Matt

Reply via email to