From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [BUG] Crash with LaTeX exporter Date: Tue, 24 May 2011 14:06:58 +0200 Message-ID: References: <811v1ght4d.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOqO7-0005KQ-E7 for emacs-orgmode@gnu.org; Tue, 24 May 2011 08:07:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOqO6-0000hD-7r for emacs-orgmode@gnu.org; Tue, 24 May 2011 08:07:03 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:56026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOqO6-0000h8-2E for emacs-orgmode@gnu.org; Tue, 24 May 2011 08:07:02 -0400 Received: by eyd9 with SMTP id 9so2464731eyd.0 for ; Tue, 24 May 2011 05:07:01 -0700 (PDT) In-Reply-To: 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: Lawrence Mitchell Cc: emacs-orgmode@gnu.org On Apr 6, 2011, at 11:14 AM, Lawrence Mitchell wrote: > Jambunathan K wrote: >> [1. text/plain] >=20 >=20 >> Exporting the below table to LaTeX throws an error. Let me know if = you >> need any additional info. >=20 >> [2. text/x-verbatim] >=20 >=20 >> *** 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] >=20 > A more minimal table demonstrating the problem is: >=20 > +---+---+ > |foo|bar| > +---+---+ > |baz|33%| > +---+---+ >=20 > 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: >=20 > +---+---+ > |foo|bar| > +---+---+ > |baz|33\%| > +---+---+ >=20 > 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. >=20 > It's possible that something like the below would fix things. >=20 > 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))) >=20 > Patchwork maintainers, please don't pick this up, it's a horrible > fix :P. I have now turned off Org-mode special character preprocessing in table.el. So the above table should now export OK. However, note that table.el does not protect the ampersand, so tables with that will still fail. - Carsten