This is how I do what I think you are describing. I just take off the extension, and let (pdf)latex pick the extension it wants.(defun ox-manuscript-remove-image-extensions ()"Removes .png extensions from \includegraphics directives in an exported latex file.Run this from an org-buffer after you have exported it to a LaTeX file"(interactive)(let* ((org-file (file-name-nondirectory (buffer-file-name)))(tex-file (replace-regexp-in-string "org$" "tex" org-file))(tex-contents (with-temp-buffer (insert-file-contents tex-file) (buffer-string))))(message tex-file)(with-temp-file tex-file (insert (replace-regexp-in-string(concat "\\(\\includegraphics""\\(\[?[^\].*\]?\\)?\\)" ;; match optional [stuff]"{\\([^}].*\\)\.\\(png\\)}")"\\1{\\3}" tex-contents)))))John
-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.eduOn Thu, Apr 24, 2014 at 8:46 AM, Leu Zhe <lzhes43@gmail.com> wrote:
I am using org-mode to write some article now. Org-mode is really a great tool to outline a article with great table and image support.
Org-mode can display inline .png image but not .pdf file. Because now org-mode can not control the width or height of shown inline image, so i use matplotlib to produce low dpi .png image in PNG folder for inline display and higher dpi pdf image in PDF folder for finally article export.
In .org file, the image link is like
[[file:PNG\*.png]]
and\includegraphics{PNG\*.png}
in the produced .tex file. Then emacs will useorg-latex-pdf-process
to render it to pdf file. What I want is that before or inorg-latex-pdf-process
, a regexp replace function is added to replace the\includegraphics{PDF\*.pdf}
, and then produce the final pdf file.Can anyone give a hand?