Thorsten Grothe <i...@th-grothe.de> 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