From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Mitchell Subject: Re: [BUG] Crash with LaTeX exporter Date: Wed, 06 Apr 2011 10:14:21 +0100 Message-ID: References: <811v1ght4d.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=46113 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7Oow-00082r-Nr for emacs-orgmode@gnu.org; Wed, 06 Apr 2011 05:14:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7Oou-0001H0-Co for emacs-orgmode@gnu.org; Wed, 06 Apr 2011 05:14:37 -0400 Received: from lo.gmane.org ([80.91.229.12]:57767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7Oot-0001GB-Vv for emacs-orgmode@gnu.org; Wed, 06 Apr 2011 05:14:36 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q7Oos-00057x-E6 for emacs-orgmode@gnu.org; Wed, 06 Apr 2011 11:14:34 +0200 Received: from e4300lm.epcc.ed.ac.uk ([129.215.63.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Apr 2011 11:14:34 +0200 Received: from wence by e4300lm.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Apr 2011 11:14:34 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Jambunathan K wrote: > [1. text/plain] > Exporting the below table to LaTeX throws an error. Let me know if you > need any additional info. > [2. text/x-verbatim] > *** Table.el Table with no Spanning > +---------------+---------------+ > |Term |Percentage | > +---------------+---------------+ > |Quarter |25% | > |One-Fourth | | > +---------------+---------------+ > |Half |50% | > |One-by-Two | | > +---------------+---------------+ > |Three-Quarters |75% | > |Three-Fourths | | > +---------------+---------------+ > |Full |100% | > |Whole | | > +---------------+---------------+ > [3. text/plain] A more minimal table demonstrating the problem is: +---+---+ |foo|bar| +---+---+ |baz|33%| +---+---+ This is because the percent signs are escaped in the table that table.el sees, but the column width is not updated appropriately. The export process converts "%" into "\%" so that table.el sees the following table: +---+---+ |foo|bar| +---+---+ |baz|33\%| +---+---+ And so column/row calculations are incorrect. Since table.el's export correctly deals with escaping of percent signs, one could just remove the escapes from the table. It's possible that something like the below would fix things. diff --git a/lisp/org-latex.el b/lisp/org-latex.el index b8be87a..d591358 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1963,6 +1963,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." floatp (or label caption)) (and (get-buffer "*org-export-table*") (kill-buffer (get-buffer "*org-export-table*"))) + (save-excursion + (while (search-forward "\\%" nil t) + (replace-match "%" nil t))) (table-generate-source 'latex "*org-export-table*" "caption") (setq tbl (with-current-buffer "*org-export-table*" (buffer-string))) Patchwork maintainers, please don't pick this up, it's a horrible fix :P. Lawrence -- Lawrence Mitchell