emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Feng Shu <tumashu@gmail.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87ha5h1tjq.fsf@news.tumashu-localhost.org> (raw)
In-Reply-To: CALjq+La90wufEwkTj9T_UPBZBsOAyXEwG-6qnvNKXNk6wkNVKg@mail.gmail.com

Leu Zhe <lzhes43@gmail.com> 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	other threads:[~2014-04-25 12:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24 12:46 To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export Leu Zhe
2014-04-25 12:29 ` Feng Shu [this message]
2014-04-25 13:54 ` John Kitchin
2014-04-25 15:23   ` Leu Zhe
2014-04-25 16:56     ` John Kitchin
2014-04-26  6:06       ` Kyutech
2014-04-25 17:06     ` Nick Dokos
2014-04-25 23:17       ` John Kitchin
  -- strict thread matches above, loose matches on Subject: below --
2014-04-25 15:28 Leu Zhe

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ha5h1tjq.fsf@news.tumashu-localhost.org \
    --to=tumashu@gmail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).