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: John Kitchin
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 19:17:01 -0400

Thanks Nick, for the more helpful explanation than mine ;)

The function I provided is part of this file: https://github.com/jkitchin/jmax/blob/master/ox-manuscript.el

which I have been working on for publishing scientific manuscripts. This file provides a new export menu option that not only removes the extensions in the latex file, but also replaces the \bibliography{} line with the contents of the .bbl file so that you have a single, standalone tex file for submission. There is even an export and mail option for a pdf ;)

With this library installed, you can just type: C-c C-e j m
to build your latex file with extensions removed, bibliography replaced, and open the pdf through the regular org-mode export menu. This may be more helpful than trying to do the steps manually as I described.

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 Fri, Apr 25, 2014 at 1:06 PM, Nick Dokos <address@hidden> wrote:
Leu Zhe <address@hidden> writes:

> 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 org-latex-pdf-process?
>

As it says in the comment:

"Run this from an org-buffer after you have exported it to a LaTeX file"

The function assumes that you have already produced a .tex file from
your .org file (e.g. with C-c C-e l l). Then, in your org file buffer
you call it:

    M-x ox-manuscript-remove-image-extensions RET

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

What the function does is get the filename for the current buffer
(i.e. the name of your org file), derive the name of the produced
tex file, get the contents of the tex file assigned (as a string)
to tex-contents, do a search-and-replace operation on tex-contents
and write the result back into the tex file. The search-and-replace
operation searches for strings that look like this:

          \includegraphics[...]{foo.png}

and replaces each occurrence with

          \includegraphics[...]{foo}

Nick





reply via email to

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