From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: orgtbl export to latex :fmt() fails
Date: Thu, 17 Jul 2014 17:12:01 -0400 [thread overview]
Message-ID: <87oawn4rmm.fsf@alphaville.bos.redhat.com> (raw)
In-Reply-To: 20140717214645.78f5b484@rudi
Thorsten Grothe <info@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
next prev parent reply other threads:[~2014-07-17 21:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 19:46 orgtbl export to latex :fmt() fails Thorsten Grothe
2014-07-17 21:12 ` Nick Dokos [this message]
2014-07-17 21:54 ` Thorsten Grothe
2014-07-17 22:35 ` Nick Dokos
2014-07-18 9:46 ` Thorsten Grothe
2014-07-18 13:22 ` Nick Dokos
2014-07-18 18:59 ` Thorsten Grothe
2014-07-18 4:11 ` Nick Dokos
2014-07-19 4:09 ` Nick Dokos
2014-07-27 13:18 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oawn4rmm.fsf@alphaville.bos.redhat.com \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.