emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Lawrence Mitchell <wence@gmx.li>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Crash with LaTeX exporter
Date: Tue, 24 May 2011 14:06:58 +0200	[thread overview]
Message-ID: <FD908386-E9F9-46A6-9469-5700F9E4F111@gmail.com> (raw)
In-Reply-To: <m339lvvj0y.fsf@gmx.li>


On Apr 6, 2011, at 11:14 AM, Lawrence Mitchell wrote:

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

I have now turned off Org-mode special character preprocessing
in table.el.  So the above table should now export OK.
However, note that table.el does not protect the ampersand,
so tables with that will still fail.

- Carsten

  reply	other threads:[~2011-05-24 12:07 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
2011-05-24 12:06   ` Carsten Dominik [this message]
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

  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=FD908386-E9F9-46A6-9469-5700F9E4F111@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wence@gmx.li \
    /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).