* [BUG] LaTeX export inserts "ORG-LIST-END-MARKER"
@ 2011-03-29 13:09 Rainer M Krug
2011-03-29 14:20 ` [PATCH] org-latex: Don't append newline to end of footnote Lawrence Mitchell
0 siblings, 1 reply; 7+ messages in thread
From: Rainer M Krug @ 2011-03-29 13:09 UTC (permalink / raw)
To: emacs-orgmode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
if I export the fiollowing snippet
* Project Participants
- - Rainer M Krug :: [fn::My email]
My address
I get the following LaTeX code:
################################################
% Created 2011-03-29 Tue 15:06
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\usepackage{color}
\usepackage{listings}
\providecommand{\alert}[1]{\textbf{#1}}
\title{test}
\author{Rainer M. Krug}
\date{\today}
\begin{document}
\maketitle
\setcounter{tocdepth}{3}
\tableofcontents
\vspace*{1cm}
\section{Project Participants}
\label{sec-1}
\begin{description}
\item[Rainer M Krug] \footnote{My email
\end{description}
}
ORG-LIST-END-MARKER
My address
\end{document}
################################################
Please look at the "ORG-LIST-END-MARKER" which is not in the original
snippet.
Org-mode version 7.5 (release_7.5.115.g00134)
GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
Cheers,
Rainer
- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Tel: +33 - (0)9 53 10 27 44
Cell: +27 - (0)8 39 47 90 42
Fax (SA): +27 - (0)8 65 16 27 82
Fax (D) : +49 - (0)3 21 21 25 22 44
Fax (FR): +33 - (0)9 58 10 27 44
email: Rainer@krugs.de
Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk2R2hIACgkQoYgNqgF2egoBpgCeK7BesBCzayI/STcjKJM+99wG
l+oAn2iLgf6J1ir9rWgWQxQkpQtOwAgB
=Y/8z
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] org-latex: Don't append newline to end of footnote
2011-03-29 13:09 [BUG] LaTeX export inserts "ORG-LIST-END-MARKER" Rainer M Krug
@ 2011-03-29 14:20 ` Lawrence Mitchell
2011-03-29 17:38 ` Nicolas
0 siblings, 1 reply; 7+ messages in thread
From: Lawrence Mitchell @ 2011-03-29 14:20 UTC (permalink / raw)
To: emacs-orgmode
* lisp/org-latex.el (org-export-latex-preprocess): Don't add a newline
character to a processed footnote.
The extra newline before the closing } character in a footnote
confuses the list parsing code. The } appears at the beginning of a
line, so it looks like the end of the list. LaTeX gobbles the space
anyway, so don't add it.
---
> Hi
> if I export the fiollowing snippet
> * Project Participants
> - Rainer M Krug :: [fn::My email]
> My address
The list is closed incorrectly. This appears to be a problem in
the interaction between the list parsing and footnote processing
code. When exporting footnotes, we add a newline at the end, so
in the above example the intermediate file seen by the list
processing code is:
| * Project Participants
| - Rainer M Krug :: \footnote{My email
| }
| ORG-LIST-END-MARKER
| My address
The } at the beginning of the line below the list entry is
considered to end the list, so we get:
| * Project Participants
| \begin{description}
| \item[Rainer M Krug] \footnote{My email
| \end{description}
| }
| ORG-LIST-END-MARKER
| My address
Note how the description list is ended /inside/ the footnote
command.
Since LaTeX gobbles the trailing space in the footnote anyway, it
makes sense not to insert it in the first place, which this patch
does. Your test case now exports correctly.
Cheers,
Lawrence
lisp/org-latex.el | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 0460a84..3eb54b2 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2432,9 +2432,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(let ((end (save-excursion
(if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
(match-beginning 0) (point-max)))))
- (setq footnote (concat (org-trim (buffer-substring (point) end))
- ; last } won't be part of a link or list.
- "\n"))
+ (setq footnote (org-trim (buffer-substring (point) end)))
(delete-region (point) end))
(goto-char foot-beg)
(delete-region foot-beg foot-end)
--
1.7.4.rc2.18.gb20e9
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] org-latex: Don't append newline to end of footnote
2011-03-29 14:20 ` [PATCH] org-latex: Don't append newline to end of footnote Lawrence Mitchell
@ 2011-03-29 17:38 ` Nicolas
2011-03-30 7:49 ` Rainer M Krug
2011-03-30 9:14 ` Lawrence Mitchell
0 siblings, 2 replies; 7+ messages in thread
From: Nicolas @ 2011-03-29 17:38 UTC (permalink / raw)
To: Lawrence Mitchell; +Cc: emacs-orgmode
Hello,
Lawrence Mitchell <wence@gmx.li> writes:
> * lisp/org-latex.el (org-export-latex-preprocess): Don't add a newline
> character to a processed footnote.
>
> The extra newline before the closing } character in a footnote
> confuses the list parsing code. The } appears at the beginning of a
> line, so it looks like the end of the list. LaTeX gobbles the space
> anyway, so don't add it.
> ---
>> Hi
>
>> if I export the fiollowing snippet
>
>> * Project Participants
>> - Rainer M Krug :: [fn::My email]
>> My address
>
> The list is closed incorrectly. This appears to be a problem in
> the interaction between the list parsing and footnote processing
> code. When exporting footnotes, we add a newline at the end, so
> in the above example the intermediate file seen by the list
> processing code is:
>
> | * Project Participants
> | - Rainer M Krug :: \footnote{My email
> | }
> | ORG-LIST-END-MARKER
> | My address
>
> The } at the beginning of the line below the list entry is
> considered to end the list, so we get:
>
> | * Project Participants
> | \begin{description}
> | \item[Rainer M Krug] \footnote{My email
> | \end{description}
> | }
> | ORG-LIST-END-MARKER
> | My address
>
> Note how the description list is ended /inside/ the footnote
> command.
>
> Since LaTeX gobbles the trailing space in the footnote anyway, it
> makes sense not to insert it in the first place, which this patch
> does. Your test case now exports correctly.
The analysis is good, but unfortunately the patch has a flaw.
In fact, your patch work in that particular situation, but not if
a footnote definition ends with a list, nor if it ends with a link. To
solve the latter, you need to insert a white-space before the closing
bracket. To solve the former, I thought adding a newline instead of the
white-space was enough, but it now appears it was a bad idea.
Thus, the solution lies elsewhere.
Regards,
--
Nicolas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH] org-latex: Don't append newline to end of footnote
2011-03-29 17:38 ` Nicolas
@ 2011-03-30 7:49 ` Rainer M Krug
2011-03-30 9:14 ` Lawrence Mitchell
1 sibling, 0 replies; 7+ messages in thread
From: Rainer M Krug @ 2011-03-30 7:49 UTC (permalink / raw)
To: Lawrence Mitchell, emacs-orgmode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 29/03/11 19:38, Nicolas wrote:
> Hello,
>
> Lawrence Mitchell <wence@gmx.li> writes:
>
>> * lisp/org-latex.el (org-export-latex-preprocess): Don't add a newline
>> character to a processed footnote.
>>
>> The extra newline before the closing } character in a footnote
>> confuses the list parsing code. The } appears at the beginning of a
>> line, so it looks like the end of the list. LaTeX gobbles the space
>> anyway, so don't add it.
>> ---
>>> Hi
>>
>>> if I export the fiollowing snippet
>>
>>> * Project Participants
>>> - Rainer M Krug :: [fn::My email]
>>> My address
>>
>> The list is closed incorrectly. This appears to be a problem in
>> the interaction between the list parsing and footnote processing
>> code. When exporting footnotes, we add a newline at the end, so
>> in the above example the intermediate file seen by the list
>> processing code is:
>>
>> | * Project Participants
>> | - Rainer M Krug :: \footnote{My email
>> | }
>> | ORG-LIST-END-MARKER
>> | My address
>>
>> The } at the beginning of the line below the list entry is
>> considered to end the list, so we get:
>>
>> | * Project Participants
>> | \begin{description}
>> | \item[Rainer M Krug] \footnote{My email
>> | \end{description}
>> | }
>> | ORG-LIST-END-MARKER
>> | My address
>>
>> Note how the description list is ended /inside/ the footnote
>> command.
>>
>> Since LaTeX gobbles the trailing space in the footnote anyway, it
>> makes sense not to insert it in the first place, which this patch
>> does. Your test case now exports correctly.
>
> The analysis is good, but unfortunately the patch has a flaw.
>
> In fact, your patch work in that particular situation, but not if
> a footnote definition ends with a list, nor if it ends with a link. To
> solve the latter, you need to insert a white-space before the closing
> bracket. To solve the former, I thought adding a newline instead of the
> white-space was enough, but it now appears it was a bad idea.
>
> Thus, the solution lies elsewhere.
May I just add to my initial report, that it worked on the 22 February
this year? So the problem has creeped in in an update in between.
Rainer
>
> Regards,
>
- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Tel: +33 - (0)9 53 10 27 44
Cell: +27 - (0)8 39 47 90 42
Fax (SA): +27 - (0)8 65 16 27 82
Fax (D) : +49 - (0)3 21 21 25 22 44
Fax (FR): +33 - (0)9 58 10 27 44
email: Rainer@krugs.de
Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk2S4H8ACgkQoYgNqgF2egoE+ACdF/oUaZxPhTnuB3eBEM4dHSwH
y9MAn3h6xNQ886Olc33QKgkMkBntxKW1
=Nu2m
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] org-latex: Don't append newline to end of footnote
2011-03-29 17:38 ` Nicolas
2011-03-30 7:49 ` Rainer M Krug
@ 2011-03-30 9:14 ` Lawrence Mitchell
2011-03-30 14:46 ` Rainer M Krug
1 sibling, 1 reply; 7+ messages in thread
From: Lawrence Mitchell @ 2011-03-30 9:14 UTC (permalink / raw)
To: emacs-orgmode
Nicolas wrote:
> Hello,
> Lawrence Mitchell <wence@gmx.li> writes:
[...]
> The analysis is good, but unfortunately the patch has a flaw.
> In fact, your patch work in that particular situation, but not if
> a footnote definition ends with a list, nor if it ends with a link. To
> solve the latter, you need to insert a white-space before the closing
> bracket. To solve the former, I thought adding a newline instead of the
> white-space was enough, but it now appears it was a bad idea.
> Thus, the solution lies elsewhere.
Ugh, indeed. I wonder whether it would be enough to add the
correct list indent to the beginning of the line with the closing
brace.
ALthough I notice without my patch, the export of a footnote
containing a list which is in a list also does not work:
- Hello [fn:1]
* Footnotes
[fn:1] Goodbye
- an item
No idea how to fix this though, sorry.
Lawrence
--
Lawrence Mitchell <wence@gmx.li>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH] org-latex: Don't append newline to end of footnote
2011-03-30 9:14 ` Lawrence Mitchell
@ 2011-03-30 14:46 ` Rainer M Krug
2011-03-30 22:06 ` Nicolas
0 siblings, 1 reply; 7+ messages in thread
From: Rainer M Krug @ 2011-03-30 14:46 UTC (permalink / raw)
To: Lawrence Mitchell; +Cc: n.goaziou, emacs-orgmode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Additional information: I changed to 7.5 (released version) and it works
there as expected.
Rainer
On 30/03/11 11:14, Lawrence Mitchell wrote:
> Nicolas wrote:
>> Hello,
>
>> Lawrence Mitchell <wence@gmx.li> writes:
>
>
> [...]
>
>> The analysis is good, but unfortunately the patch has a flaw.
>
>> In fact, your patch work in that particular situation, but not if
>> a footnote definition ends with a list, nor if it ends with a link. To
>> solve the latter, you need to insert a white-space before the closing
>> bracket. To solve the former, I thought adding a newline instead of the
>> white-space was enough, but it now appears it was a bad idea.
>
>> Thus, the solution lies elsewhere.
>
> Ugh, indeed. I wonder whether it would be enough to add the
> correct list indent to the beginning of the line with the closing
> brace.
>
> ALthough I notice without my patch, the export of a footnote
> containing a list which is in a list also does not work:
>
> - Hello [fn:1]
>
> * Footnotes
>
> [fn:1] Goodbye
> - an item
>
> No idea how to fix this though, sorry.
>
> Lawrence
>
- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Tel: +33 - (0)9 53 10 27 44
Cell: +27 - (0)8 39 47 90 42
Fax (SA): +27 - (0)8 65 16 27 82
Fax (D) : +49 - (0)3 21 21 25 22 44
Fax (FR): +33 - (0)9 58 10 27 44
email: Rainer@krugs.de
Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk2TQkkACgkQoYgNqgF2egq+5QCfTwNa+7H/mDa59SJOo65OdtHN
7EsAn3U9Rk8dpDq69BxInxlEZHS6o1Ec
=ObWr
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] org-latex: Don't append newline to end of footnote
2011-03-30 14:46 ` Rainer M Krug
@ 2011-03-30 22:06 ` Nicolas
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas @ 2011-03-30 22:06 UTC (permalink / raw)
To: Rainer M Krug; +Cc: Lawrence Mitchell, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]
Hello,
Rainer M Krug <r.m.krug@gmail.com> writes:
> Additional information: I changed to 7.5 (released version) and it works
> there as expected.
>
> Rainer
>
>
> On 30/03/11 11:14, Lawrence Mitchell wrote:
>> Nicolas wrote:
>>> Hello,
>>
>>> Lawrence Mitchell <wence@gmx.li> writes:
>>
>>
>> [...]
>>
>>> The analysis is good, but unfortunately the patch has a flaw.
>>
>>> In fact, your patch work in that particular situation, but not if
>>> a footnote definition ends with a list, nor if it ends with a link. To
>>> solve the latter, you need to insert a white-space before the closing
>>> bracket. To solve the former, I thought adding a newline instead of the
>>> white-space was enough, but it now appears it was a bad idea.
>>
>>> Thus, the solution lies elsewhere.
>>
>> Ugh, indeed. I wonder whether it would be enough to add the
>> correct list indent to the beginning of the line with the closing
>> brace.
>>
>> ALthough I notice without my patch, the export of a footnote
>> containing a list which is in a list also does not work:
>>
>> - Hello [fn:1]
>>
>> * Footnotes
>>
>> [fn:1] Goodbye
>> - an item
>>
>> No idea how to fix this though, sorry.
Would the attached patch work ? I've tested it successfully on the
following buffer:
--8<---------------cut here---------------start------------->8---
#+title: Test footnotes
* Titre
Text [fn:1] and a list
- [fn:2]
- three
Another try [fn:3]
* Footnotes
[fn:1] A definition with
- a list
- of two elements
[fn:2] Test
[fn:3] [[file:~/.bashrc][bashrc]]
--8<---------------cut here---------------end--------------->8---
Regards,
--
Nicolas
[-- Attachment #2: footnote patch --]
[-- Type: text/plain, Size: 1607 bytes --]
From ccba9a10dddffb805635ecc10e760e92bf6ca8d2 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Wed, 30 Mar 2011 23:52:33 +0200
Subject: [PATCH] org-latex: fix footnotes wrt lists and links
* lisp/org-latex.el: pay attention to end of footnote. Before closing
the command, ensure that list is properly closed or that last link
is separated from the curly brace.
---
lisp/org-latex.el | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index e42b64d..47fdfa7 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2418,12 +2418,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(replace-match (org-export-latex-protect-string
(concat "$^{" (match-string 1) "}$")))
(replace-match "")
- (let ((end (save-excursion
- (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
- (match-beginning 0) (point-max)))))
- (setq footnote (concat (org-trim (buffer-substring (point) end))
- ; last } won't be part of a link or list.
- "\n"))
+ (let* ((end (save-excursion
+ (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
+ (match-beginning 0) (point-max))))
+ (body (org-trim (buffer-substring (point) end))))
+ ;; Fix for footnotes ending on a link or a list.
+ (setq footnote
+ (concat body
+ (if (string-match "ORG-LIST-END-MARKER\\'" body)
+ "\n" " ")))
(delete-region (point) end))
(goto-char foot-beg)
(delete-region foot-beg foot-end)
--
1.7.4.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-30 22:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 13:09 [BUG] LaTeX export inserts "ORG-LIST-END-MARKER" Rainer M Krug
2011-03-29 14:20 ` [PATCH] org-latex: Don't append newline to end of footnote Lawrence Mitchell
2011-03-29 17:38 ` Nicolas
2011-03-30 7:49 ` Rainer M Krug
2011-03-30 9:14 ` Lawrence Mitchell
2011-03-30 14:46 ` Rainer M Krug
2011-03-30 22:06 ` Nicolas
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).