From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: orgtbl export to latex :fmt() fails Date: Thu, 17 Jul 2014 17:12:01 -0400 Message-ID: <87oawn4rmm.fsf@alphaville.bos.redhat.com> References: <20140717214645.78f5b484@rudi> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7syW-0004bB-R3 for emacs-orgmode@gnu.org; Thu, 17 Jul 2014 17:12:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7syP-0004y7-Jt for emacs-orgmode@gnu.org; Thu, 17 Jul 2014 17:12:24 -0400 Received: from plane.gmane.org ([80.91.229.3]:57753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7syP-0004xX-Bj for emacs-orgmode@gnu.org; Thu, 17 Jul 2014 17:12:17 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X7syN-0000St-Kz for emacs-orgmode@gnu.org; Thu, 17 Jul 2014 23:12:15 +0200 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Jul 2014 23:12:15 +0200 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Jul 2014 23:12:15 +0200 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 Thorsten Grothe writes: > Hi List, > > I have a problem with a orgtbl which I would like to export with certain > options to latex. > > The table looks like this: > > #+TBLNAME: test > #+ORGTBL: SEND test orgtbl-to-latex :skip 2 :splice t :fmt (4"\\num{%s}") > > | Soll | | | Haben | > |------+---+--+-------| > | | | | 39000 | > > I would like to export the 4 column of the table with the latex \num{} tag, > see :fmt (4"\\num{%s}"), I got this from the manual. > > this works fine but *only* if the first column is *not* empty like so: > > | Soll | | | Haben | > |------+---+--+-------| > | 0 | | | 39000 | > > Result: > % BEGIN RECEIVE ORGTBL test > 0 & & & \num{39000} \\ > % END RECEIVE ORGTBL test > > > if the first column is *empty* the result looks like this: > > | Soll | | | Haben | > |------+---+--+-------| > | | | | 39000 | > > Result: > % BEGIN RECEIVE ORGTBL test > & & 39000 \\ > % END RECEIVE ORGTBL test > > the \num{} tag is not exported and one "&" in the table is missing. > > I don't know what I'm doing wrong??? > Nothing - there is a bug in org-table.el:org-table-clean-before-export where the regexp that matches special chars in the first column (see (info "(org)Advanced features") for the details) inadvertently matches "| | | | 3900|" and deletes the first column. The regexp is set like this: --8<---------------cut here---------------start------------->8--- (let ((special (if maybe-quoted "^[ \t]*| *\\\\?[\#!$*_^/ ] *|" "^[ \t]*| *[\#!$*_^/ ] *|")) --8<---------------cut here---------------end--------------->8--- and in each case I think that the space inside the second [...] is spurious. So try this patch: --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org-table.el b/lisp/org-table.el index d7ef615..864493e 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -447,8 +447,8 @@ available parameters." "Check if the table has a marking column. If yes remove the column and the special lines." (let ((special (if maybe-quoted - "^[ \t]*| *\\\\?[\#!$*_^/ ] *|" - "^[ \t]*| *[\#!$*_^/ ] *|")) + "^[ \t]*| *\\\\?[\#!$*_^/] *|" + "^[ \t]*| *[\#!$*_^/] *|")) (ignore (if maybe-quoted "^[ \t]*| *\\\\?[!$_^/] *|" "^[ \t]*| *[!$_^/] *|"))) --8<---------------cut here---------------end--------------->8--- I think it's OK for the non-quoted case, but I'm not sure about the quoted case (maybe-quotes is t). If there are no objections, I'll push it later on tonight. Just to be sure: this is a bug, so it should be committed to the maint branch and then a merge should be done onto master - correct? Nick