all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Huszagh <huszaghmatt@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Removing horizontal space in latex fragments
Date: Thu, 5 Dec 2019 11:03:01 -0800	[thread overview]
Message-ID: <CA+X8ke5h4SBBLmdHTso_N8_TjOaxU9ir+t2SvFoPr9bYhyR07A@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2019-12-05 19:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 19:03 Matt Huszagh [this message]
2019-12-05 22:24 ` Removing horizontal space in latex fragments 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+X8ke5h4SBBLmdHTso_N8_TjOaxU9ir+t2SvFoPr9bYhyR07A@mail.gmail.com \
    --to=huszaghmatt@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.