all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] Crash with LaTeX exporter
Date: Wed, 06 Apr 2011 10:14:21 +0100	[thread overview]
Message-ID: <m339lvvj0y.fsf@gmx.li> (raw)
In-Reply-To: 811v1ght4d.fsf@gmail.com

Jambunathan K wrote:
> [1. text/plain]


> Exporting the below table to LaTeX throws an error. Let me know if you
> need any additional info.

> [2. text/x-verbatim]


> *** 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]

A more minimal table demonstrating the problem is:

+---+---+
|foo|bar|
+---+---+
|baz|33%|
+---+---+

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:

+---+---+
|foo|bar|
+---+---+
|baz|33\%|
+---+---+

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.

It's possible that something like the below would fix things.

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)))

Patchwork maintainers, please don't pick this up, it's a horrible
fix :P.

Lawrence

-- 
Lawrence Mitchell <wence@gmx.li>

  reply	other threads:[~2011-04-06  9:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06  5:00 [BUG] Crash with LaTeX exporter Jambunathan K
2011-04-06  9:14 ` Lawrence Mitchell [this message]
2011-05-24 12:06   ` Carsten Dominik
2011-04-06  9:27 ` Giovanni Ridolfi

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=m339lvvj0y.fsf@gmx.li \
    --to=wence@gmx.li \
    --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.