From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mukherjee, Rajat, LAUSANNE, Clinical Operations" Subject: Editing using emacs-lisp after export Date: Wed, 30 Nov 2011 16:03:21 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CCAF71.338A4D4E" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVlh7-0007B6-Jn for emacs-orgmode@gnu.org; Wed, 30 Nov 2011 10:03:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVlh1-0007XX-Hc for emacs-orgmode@gnu.org; Wed, 30 Nov 2011 10:03:33 -0500 Received: from eurmail8.nestle.com ([160.213.122.219]:50040 helo=nestle.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVlh0-0007Wu-Vp for emacs-orgmode@gnu.org; Wed, 30 Nov 2011 10:03:27 -0500 Content-class: urn:content-classes:message List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. ------_=_NextPart_001_01CCAF71.338A4D4E Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear Org-mode gurus, 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. Best regards, Rajat Mukherjee, Biostatistician =20 ------_=_NextPart_001_01CCAF71.338A4D4E Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Dear Org-mode gurus,

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.

Best regards,

Rajat Mukherjee,<= /span>
Bi= ostatistician

 

------_=_NextPart_001_01CCAF71.338A4D4E-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Rakestraw Subject: Re: Editing using emacs-lisp after export Date: Wed, 30 Nov 2011 15:48:14 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:44176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVr3K-00026l-NA for emacs-orgmode@gnu.org; Wed, 30 Nov 2011 15:46:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVr3J-0005Ao-6H for emacs-orgmode@gnu.org; Wed, 30 Nov 2011 15:46:50 -0500 Received: from uis-ipmx-1.pdc.uis.georgetown.edu ([141.161.2.135]:6475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVr3I-0005AX-QZ for emacs-orgmode@gnu.org; Wed, 30 Nov 2011 15:46:48 -0500 In-Reply-To: (Rajat Mukherjee's message of "Wed, 30 Nov 2011 16:03:21 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Mukherjee, Rajat, LAUSANNE, Clinical Operations" Cc: emacs-orgmode@gnu.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Rakestraw Subject: Re: Editing using emacs-lisp after export Date: Fri, 02 Dec 2011 10:57:47 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWVTH-0005gy-QI for emacs-orgmode@gnu.org; Fri, 02 Dec 2011 10:56:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWVTG-0000LT-Nu for emacs-orgmode@gnu.org; Fri, 02 Dec 2011 10:56:19 -0500 Received: from uis-ipmx-2.pdc.uis.georgetown.edu ([141.161.2.141]:4665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWVTG-0000LK-Lq for emacs-orgmode@gnu.org; Fri, 02 Dec 2011 10:56:18 -0500 In-Reply-To: (Rajat Mukherjee's message of "Fri, 2 Dec 2011 15:39:35 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Mukherjee, Rajat, LAUSANNE, Clinical Operations" Cc: emacs-orgmode Hi, Rajat -- -----Original Message----- > > From: John Rakestraw [mailto:lists@johnrakestraw.com] > > Sent: mercredi 30 novembre 2011 21:48 > > To: Mukherjee,Rajat,LAUSANNE,Clinical Operations > > Cc: emacs-orgmode@gnu.org > > Subject: Re: [O] Editing using emacs-lisp after export > > 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. > > (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)) > Hi John, > Many thanks for the hint. I tried something similar, it works when I > export (using L) to temporary buffer but not when I use the usual [l] or > [d] export options. Is there a different hook that needs to be used > here? Many thanks. My set-up works when I export to pdf (using the [d] export option). Perhaps you could post your adaptation and someone can figure out why your function doesn't work. --John -- John Rakestraw