From: Aaron Ecay <aaronecay@gmail.com>
To: mcg <giepen.m@googlemail.com>, emacs-orgmode@gnu.org
Subject: Re: Help with fixing an org-mode multicolumn implementation - LaTeX special characters
Date: Mon, 22 Feb 2016 15:48:41 +0000 [thread overview]
Message-ID: <87h9h0hhk6.fsf@gmail.com> (raw)
In-Reply-To: <56C9915D.7080408@gmail.com>
Hi mcg,
2016ko otsailak 21an, mcg-ek idatzi zuen:
>
> I found a very nice implementation of LaTeX multicolumn functionality in
> this thread:
> https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg00736.html
[...]
> However, using any of the characters of the left column of my example
> table in the merged <2colc> column, I get:
> "setq: Invalid use of `\' in replacement text"
I think the function should be written (untested):
(defun my-latex-multicolumn-filter (row backend info)
(when (org-export-derived-backend-p backend 'latex)
(while (string-match "\\(<\\([0-9]+\\)col\\([lrc]\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
(let ((columns (string-to-number (match-string 2 row)))
(start (match-end 0))
(contents (replace-regexp-in-string "[[:blank:]]*$" "" (match-string 4 row)))
(algn (or (match-string 3 row) "l")))
(setq row (replace-match
(format "\\multicolumn{%d}{%s}{%s}" columns algn contents)
nil t row 1))
(while (and (> columns 1) (string-match "&" row start))
(setq row (replace-match "" nil nil row))
(decf columns))))
row))
The change is setting the third argument (‘literal’) to ‘replace-match’
to t, and deleting an extra backslash in the "\\multicolumn..." string.
>
>
> Questions:
> - How to escape the special characters in the left column properly to be
> able to use them? (tried everything I could think of)
> or
> - How to modify the code above so that it allows for such characters.
>
> - If anyone likes the implementation and is more capable than I am, then
> the same for multirow would be really nice...
Unfortunately I think that’s more complicated, since it would necessitate
examining/modifying the whole table in one go, rather than operating one
row at a time.
--
Aaron Ecay
next prev parent reply other threads:[~2016-02-22 15:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-21 10:28 Help with fixing an org-mode multicolumn implementation - LaTeX special characters mcg
2016-02-22 15:48 ` Aaron Ecay [this message]
2016-02-25 11:33 ` mcg
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h9h0hhk6.fsf@gmail.com \
--to=aaronecay@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=giepen.m@googlemail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).