[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Re: [BUG] Crash with LaTeX exporter
From: |
Lawrence Mitchell |
Subject: |
[O] Re: [BUG] Crash with LaTeX exporter |
Date: |
Wed, 06 Apr 2011 10:14:21 +0100 |
User-agent: |
Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) |
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 <address@hidden>