emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string


From: Feng Shu
Subject: Re: [O] 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
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3.50 (gnu/linux)

Leu Zhe <address@hidden> 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

-- 




reply via email to

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