emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Removing horizontal space in latex fragments
@ 2019-12-05 19:03 Matt Huszagh
  2019-12-05 22:24 ` Fraga, Eric
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Huszagh @ 2019-12-05 19:03 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1580 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-15  9:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-05 19:03 Removing horizontal space in latex fragments Matt Huszagh
2019-12-05 22:24 ` Fraga, Eric
2019-12-06  7:42   ` Matt Huszagh
2019-12-06 13:24     ` Fraga, Eric
2019-12-14 14:57     ` Nicolas Goaziou
2019-12-15  3:48       ` Matt Huszagh
2019-12-15  9:04         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).