emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leu Zhe <lzhes43@gmail.com>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: "emacs-orgmode@gnu.org" <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: Sat, 26 Apr 2014 00:23:11 +0900	[thread overview]
Message-ID: <CALjq+LYzkn224e_FLvRVtGphnWPWuSTQ8gZjT_eLUa_uVsxDMA@mail.gmail.com> (raw)
In-Reply-To: <CAJ51ETrK-z3NwQq6FMy=u+7iKDPH6cyxttQUuYZQGBnLGLrmmQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3050 bytes --]

Dear John,

Thanks very much for your help.

I have tried your code but nothing happened. However, I think it is close
to my remand.

I have some questions about your code:

1. When should this command be called?  Don't I need to call it before the

2. I use xelatex to render my .tex files. Because xelatex can not recognize
the boundingbox of both .png and .pdf,
   so I need to generate .ebb for them in seperate folders, which are PNG
and PDF folders respectively. so i think
  you did not mention them?

I am studying elisp now, but your code is really difficult for me, so can
you help me dig in?

Best regard!

On Fri, Apr 25, 2014 at 10:54 PM, John Kitchin <jkitchin@andrew.cmu.edu>wrote:

> 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.edu
> On 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
>> 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?

[-- Attachment #2: Type: text/html, Size: 8094 bytes --]

  reply	other threads:[~2014-04-25 15:23 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
2014-04-25 13:54 ` John Kitchin
2014-04-25 15:23   ` Leu Zhe [this message]
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:

  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=CALjq+LYzkn224e_FLvRVtGphnWPWuSTQ8gZjT_eLUa_uVsxDMA@mail.gmail.com \
    --to=lzhes43@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \


* 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


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).