emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Editing using emacs-lisp after export


From: John Rakestraw
Subject: Re: [O] Editing using emacs-lisp after export
Date: Wed, 30 Nov 2011 15:48:14 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi, Rajat --

> I use org-mode to generate documents with latex and R codes. I also use
> some R function (package: Hmisc) to generate latex tables. One of the
> functions produces a blank line with-in the table environment which
> causes a fatal error in the .tex file. Is there a way that I can use
> emacs-lisp commands like "replace-string" from within the .org file to
> act on the .tex file that is exported or other "#+options:"  for export
> that will do this edit without having to open the .tex file? Thank you
> for your help.

I definitely don't consider myself a guru, but I had a similar problem. I
built a function that finds and removes the empty line and then added this
via add-hook to org-export-latex-final-hook. I suspect one of the real
gurus can suggest a better way to do this, but this works for me.

Here's my code that you can adapt as necessary.

--8<---------------cut here---------------start------------->8---
(defun remove-line-from-exam.tex ()

(if (search-forward-regexp "\\documentclass\[[0-9]+pt]{exam}" nil t nil)
    (while (re-search-forward "\\\\question\n\n" nil t)
      (replace-match "\\\\question\n"))))
      
(add-hook 'org-export-latex-final-hook (function remove-line-from-exam.tex))
--8<---------------cut here---------------end--------------->8---

-- 
John Rakestraw



reply via email to

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