[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BUG] Crash with LaTeX exporter
From: |
Carsten Dominik |
Subject: |
Re: [O] [BUG] Crash with LaTeX exporter |
Date: |
Tue, 24 May 2011 14:06:58 +0200 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [O] [BUG] Crash with LaTeX exporter,
Carsten Dominik <=