emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] how to replace includegraphics?


From: edgar
Subject: [O] how to replace includegraphics?
Date: Wed, 31 May 2017 03:37:52 +0000
User-agent: Roundcube Webmail/1.2.4

Hello dear list,

* Summary
I want to know if someone could tell me how to replace (the macro, function, string) includegraphics for something else when exporting to LaTeX. In my case, simplesvg.

* Why
I have my own version of the svg package (I only extracted bits and pieces from it long time ago), and I want to make clear for others who may use my files that I'm not using includesvg (I could just change the definition of simplesvg to includesvg).

* What I have tried
** Stealing from the webz
This does not work. I think that the list doesn't exist in org-mode anymore:
#+BEGIN_SRC emacs-lisp
  ;; Export svg (does not work)
;; https://lists.gnu.org/archive/html/emacs-orgmode/2013-08/msg00221.html ;; https://github.com/tsdye/tufte-org-mode/blob/master/ox-tufte-latex.el
  (defun my-svg-graphics (contents backend info)
    (when (eq backend 'latex)
(replace-regexp-in-string "\\`\\\\includegraphics.+\\({.+\.svg}\\)"
                                "\\\\simplesvg\1" contents))
    )
  (add-to-list 'org-export-filter-link-functions 'my-svg-graphics)
#+END_SRC

** Looking into org (ox-latex.el)
I found this (around line 2375 in ox-latex.el):
#+BEGIN_SRC emacs-lisp
(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
                                             nil t)))
#+END_SRC

I could just change the code here (simplesvg instead of includesvg), but before f\#\#cking up my system, I would like to know if there is another alternative.

Thanks, as always :D !

-------------------------------------------------

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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]