From: John Kitchin <jkitchin@andrew.cmu.edu>
To: edgar@openmail.cc
Cc: emacs-orgmode@gnu.org
Subject: Re: filter for svg latex-export
Date: Mon, 08 Jan 2018 22:34:06 -0500 [thread overview]
Message-ID: <m2mv1nogcx.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <f6b41f3cdcc5010070e7d21e4a0e4698@openmail.cc>
If all you are doing is replacing includesvg with simplesvg, then you
might try this:
#+BEGIN_SRC emacs-lisp
(let ((org-export-filter-link-functions '((lambda (txt _ _)
(replace-regexp-in-string "includesvg" "simplesvg" txt)))))
(org-latex-export-as-latex))
#+END_SRC
If you are doing more than that (it looks like you are adding options?)
then one alternative option is just put a copy of your modified function
in your init file after you load org, and then it will shadow the
ox-latex function and you might not have to change anything when you
update as long as no incompatible changes are in the update. I know,
that is hacky, but it works in cases like this.
edgar@openmail.cc writes:
> Hello,
>
> I once tried to create a filter (is that the name?) to modify the
> function which exports SVG files. Verdict: I suck! Thus, I keep
> modifying the ox-latex.el every time that I upgrade (see attached).
> Would someone please tell me what is the right way to achieve that
> (without modifying the code, please? Thanks!
>
> -------------------------------------------------
>
> ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
> $24.95 ONETIME Lifetime accounts with Privacy Features!
> 15GB disk! No bandwidth quotas!
> Commercial and Bulk Mail Options! *** org-20180103/ox-latex.el 2018-01-07 16:53:43.477464348 -0700
> --- plugins/ox-latex.el 2018-01-07 16:39:52.117462098 -0700
> ***************
> *** 2425,2434 ****
> (t (format "[%s]" options)))
> path))
> (when (equal filetype "svg")
> ! (setq image-code (replace-regexp-in-string "^\\\\includegraphics"
> ! "\\includesvg"
> ! image-code
> ! nil t))
> (setq image-code (replace-regexp-in-string "\\.svg}"
> "}"
> image-code
> --- 2425,2437 ----
> (t (format "[%s]" options)))
> path))
> (when (equal filetype "svg")
> ! (setq image-code
> ! (format "\\simplesvg%s{%s}"
> ! (cond ((not (org-string-nw-p options)) "")
> ! ((string-prefix-p "," options)
> ! (format "{%s}" (substring options 1)))
> ! (t (format "{%s}" options)))
> ! path))
> (setq image-code (replace-regexp-in-string "\\.svg}"
> "}"
> image-code
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
next prev parent reply other threads:[~2018-01-09 3:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-08 0:10 filter for svg latex-export edgar
2018-01-09 3:34 ` John Kitchin [this message]
2018-01-09 3:47 ` edgar
2018-09-07 1:22 ` edgar
-- strict thread matches above, loose matches on Subject: below --
2018-09-09 20:03 Falk Hanisch
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=m2mv1nogcx.fsf@andrew.cmu.edu \
--to=jkitchin@andrew.cmu.edu \
--cc=edgar@openmail.cc \
--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.