From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Shu Subject: Re: To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export Date: Fri, 25 Apr 2014 20:29:29 +0800 Message-ID: <87ha5h1tjq.fsf@news.tumashu-localhost.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WdfMK-00027R-LW for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 08:36:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WdfME-00087e-A5 for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 08:36:04 -0400 Received: from plane.gmane.org ([80.91.229.3]:54983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WdfME-00087a-3N for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 08:35:58 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WdfM9-0003F9-GA for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 14:35:53 +0200 Received: from 101.22.62.64 ([101.22.62.64]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Apr 2014 14:35:53 +0200 Received: from tumashu by 101.22.62.64 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Apr 2014 14:35:53 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Leu Zhe writes: > 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 > use org-latex-pdf-process to render it to pdf file. What I want is > that before or in org-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? I use R, Maybe this can help you ... #+begin_src R :exports results :results output drawer :var backend=(symbol-name org-export-current-backend) require("ascii") plot.org <- function (x, caption) { pngfile <- paste(caption, ".png", sep="") pdffile <- paste(caption, ".pdf", sep="") print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org") if (backend != "latex"){ png(pngfile) plot(x) dev.off() print(paragraph(paste("[[./", pngfile, "]]", sep=""),new=FALSE),type="org") }else{ pdf(pdffile) plot(x) dev.off() print(paragraph(paste("[[./", pdffile, "]]", sep=""),new=FALSE),type="org") } } plot.org(rnorm(100),"test") #+end_src --