* [bug, ox-latex] footnotes with math in narrowed buffer
@ 2015-04-24 16:04 Rasmus
2015-04-24 16:28 ` Rasmus
2015-04-24 19:09 ` Nicolas Goaziou
0 siblings, 2 replies; 10+ messages in thread
From: Rasmus @ 2015-04-24 16:04 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
Hi,
Consider the following example:
* h1
foo[fn:1]
* Footnotes
[fn:1] if \alpha $\beta$ \(\gamma\)
Narrow it to h1 and export the buffer. Something like this is exported:
foo\footnote{if \alpha \beta \gamma}
Somehow org-export-get-footnote-definition "knows about" math-blocks for
footnotes that are within the buffer view, but not outside. The patch
fixes the above example, but I doubt it's the Right Wayᵀᴹ to fix this
(i.e. there could be a more fundamental bug).
—Rasmus
--
Bang bang
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-latex-Fix-footnote-bug-when-narrowed-buffer.patch --]
[-- Type: text/x-diff, Size: 1042 bytes --]
From ce22e0e6d92b79cfec41c1a2295f8e0a21cc3775 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Fri, 24 Apr 2015 18:00:30 +0200
Subject: [PATCH 2/2] ox-latex: Fix footnote bug when narrowed buffer
* ox-latex.el (org-latex-footnote-reference): Support math in outside
footnotes when narrowed.
---
lisp/ox-latex.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 2d7ffe5..3b71bfb 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1554,7 +1554,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"\\footnotemark")
;; Otherwise, define it with \footnote command.
(t
- (let ((def (org-export-get-footnote-definition footnote-reference info)))
+ (let ((def (org-latex--wrap-latex-math-block
+ (org-export-get-footnote-definition footnote-reference info) info)))
(concat
(format "\\footnote{%s}" (org-trim (org-export-data def info)))
;; Retrieve all footnote references within the footnote and
--
2.3.6
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 16:04 [bug, ox-latex] footnotes with math in narrowed buffer Rasmus
@ 2015-04-24 16:28 ` Rasmus
2015-04-24 16:33 ` Rasmus
2015-04-24 19:36 ` Nicolas Goaziou
2015-04-24 19:09 ` Nicolas Goaziou
1 sibling, 2 replies; 10+ messages in thread
From: Rasmus @ 2015-04-24 16:28 UTC (permalink / raw
To: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> * h1
> foo[fn:1]
>
> * Footnotes
> [fn:1] if \alpha $\beta$ \(\gamma\)
>
> Narrow it to h1 and export the buffer. Something like this is exported:
This also does not seem to work correctly when exporting with ox-html.
But there the problem is that the parse-tree does not recognize any
latex-fragments. So org-html--build-mathjax-config returns nil rather
than the appropriate mathjax setup.
BTW: While it's nice to try to make a sensible decision on whether to load
mathjax, this rest of pretty fragile assumptions. I could INCLUDE a html
file with math.
—Rasmus
--
Enough with the bla bla!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 16:28 ` Rasmus
@ 2015-04-24 16:33 ` Rasmus
2015-04-24 19:28 ` Nicolas Goaziou
2015-04-24 19:36 ` Nicolas Goaziou
1 sibling, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-04-24 16:33 UTC (permalink / raw
To: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> * h1
>> foo[fn:1]
>>
>> * Footnotes
>> [fn:1] if \alpha $\beta$ \(\gamma\)
>>
>> Narrow it to h1 and export the buffer. Something like this is exported:
>
> This also does not seem to work correctly when exporting with ox-html.
> But there the problem is that the parse-tree does not recognize any
> latex-fragments. So org-html--build-mathjax-config returns nil rather
> than the appropriate mathjax setup.
Add to this that the class of p is missing when including footnotes
from outside of the narrowed region. E.g.
<p> bar </p>
(ugly) vs (not ugly):
<p class="footpara"> bar </p>
—Rasmus
--
The right to be left alone is a human right
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 16:04 [bug, ox-latex] footnotes with math in narrowed buffer Rasmus
2015-04-24 16:28 ` Rasmus
@ 2015-04-24 19:09 ` Nicolas Goaziou
2015-04-24 20:37 ` Rasmus
1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-04-24 19:09 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Consider the following example:
>
> * h1
> foo[fn:1]
>
> * Footnotes
> [fn:1] if \alpha $\beta$ \(\gamma\)
>
> Narrow it to h1 and export the buffer. Something like this is exported:
>
> foo\footnote{if \alpha \beta \gamma}
>
> Somehow org-export-get-footnote-definition "knows about" math-blocks for
> footnotes that are within the buffer view, but not outside. The patch
> fixes the above example, but I doubt it's the Right Wayᵀᴹ to fix this
> (i.e. there could be a more fundamental bug).
It looks good. You can push it. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 16:33 ` Rasmus
@ 2015-04-24 19:28 ` Nicolas Goaziou
0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2015-04-24 19:28 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> Rasmus <rasmus@gmx.us> writes:
>>
>>> * h1
>>> foo[fn:1]
>>>
>>> * Footnotes
>>> [fn:1] if \alpha $\beta$ \(\gamma\)
>>>
>>> Narrow it to h1 and export the buffer. Something like this is exported:
[...]
> Add to this that the class of p is missing when including footnotes
> from outside of the narrowed region. E.g.
> <p> bar </p>
> (ugly) vs (not ugly):
> <p class="footpara"> bar </p>
This should be fixed. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 16:28 ` Rasmus
2015-04-24 16:33 ` Rasmus
@ 2015-04-24 19:36 ` Nicolas Goaziou
2015-04-24 20:41 ` Rasmus
1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-04-24 19:36 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> * h1
>> foo[fn:1]
>>
>> * Footnotes
>> [fn:1] if \alpha $\beta$ \(\gamma\)
>>
>> Narrow it to h1 and export the buffer. Something like this is exported:
>
> This also does not seem to work correctly when exporting with ox-html.
> But there the problem is that the parse-tree does not recognize any
> latex-fragments. So org-html--build-mathjax-config returns nil rather
> than the appropriate mathjax setup.
`org-html--build-mathjax-config' needs to check, in addition to parse
tree, cdr of all associations in (plist-get
info :footnote-definition-alist), and values of all parsed keywords.
> BTW: While it's nice to try to make a sensible decision on whether to load
> mathjax, this rest of pretty fragile assumptions. I could INCLUDE a html
> file with math.
What do you suggest instead? Load mathjax every time?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 19:09 ` Nicolas Goaziou
@ 2015-04-24 20:37 ` Rasmus
0 siblings, 0 replies; 10+ messages in thread
From: Rasmus @ 2015-04-24 20:37 UTC (permalink / raw
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Rasmus <rasmus@gmx.us> writes:
>
>> Consider the following example:
>>
>> * h1
>> foo[fn:1]
>>
>> * Footnotes
>> [fn:1] if \alpha $\beta$ \(\gamma\)
>>
>> Narrow it to h1 and export the buffer. Something like this is exported:
>>
>> foo\footnote{if \alpha \beta \gamma}
>>
>> Somehow org-export-get-footnote-definition "knows about" math-blocks for
>> footnotes that are within the buffer view, but not outside. The patch
>> fixes the above example, but I doubt it's the Right Wayᵀᴹ to fix this
>> (i.e. there could be a more fundamental bug).
>
> It looks good. You can push it. Thank you.
Pushed.
--
This message is brought to you by the department of redundant departments
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 19:36 ` Nicolas Goaziou
@ 2015-04-24 20:41 ` Rasmus
2015-04-25 10:22 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-04-24 20:41 UTC (permalink / raw
To: emacs-orgmode
Hi,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>> * h1
>>> foo[fn:1]
>>>
>>> * Footnotes
>>> [fn:1] if \alpha $\beta$ \(\gamma\)
>>>
>>> Narrow it to h1 and export the buffer. Something like this is exported:
>>
>> This also does not seem to work correctly when exporting with ox-html.
>> But there the problem is that the parse-tree does not recognize any
>> latex-fragments. So org-html--build-mathjax-config returns nil rather
>> than the appropriate mathjax setup.
>
> `org-html--build-mathjax-config' needs to check, in addition to parse
> tree, cdr of all associations in (plist-get
> info :footnote-definition-alist), and values of all parsed keywords.
It seems you did not do this. I will add this over the weekend.
>> BTW: While it's nice to try to make a sensible decision on whether to load
>> mathjax, this rest of pretty fragile assumptions. I could INCLUDE a html
>> file with math.
>
> What do you suggest instead? Load mathjax every time?
Perhaps. It's a tough call. On the one hand the current behavior very
much seems like the famous "smart" can of worms. On the other hand,
unnecessary JS should be avoided at very high costs.
Perhaps it's enough to check is mathjax or latex math has been explicitly
set for these corner cases.
—Rasmus
--
Hvor meget poesi tror De kommer ud af et glas isvand?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-24 20:41 ` Rasmus
@ 2015-04-25 10:22 ` Nicolas Goaziou
2015-04-25 10:42 ` Rasmus
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-04-25 10:22 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>
>> `org-html--build-mathjax-config' needs to check, in addition to parse
>> tree, cdr of all associations in (plist-get
>> info :footnote-definition-alist), and values of all parsed keywords.
>
> It seems you did not do this. I will add this over the weekend.
Actually, it isn't a very good idea because we cannot assume all parsed
keywords and all footnote definitions will actually be used to create
the document. This can introduce false positives.
What about inserting a :with-mathjax option (default value
`org-html-with-mathjax'). If nil, no template, if t, template, if
`auto', current behaviour (i.e. template if some math snippet /in
body/)?
`auto' is a decent default value for `org-html-with-mathjax' and it can
be overridden per document with :with-mathjax.
Regards,
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug, ox-latex] footnotes with math in narrowed buffer
2015-04-25 10:22 ` Nicolas Goaziou
@ 2015-04-25 10:42 ` Rasmus
0 siblings, 0 replies; 10+ messages in thread
From: Rasmus @ 2015-04-25 10:42 UTC (permalink / raw
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>>
>>> `org-html--build-mathjax-config' needs to check, in addition to parse
>>> tree, cdr of all associations in (plist-get
>>> info :footnote-definition-alist), and values of all parsed keywords.
>>
>> It seems you did not do this. I will add this over the weekend.
>
> Actually, it isn't a very good idea because we cannot assume all parsed
> keywords and all footnote definitions will actually be used to create
> the document. This can introduce false positives.
OK.
> What about inserting a :with-mathjax option (default value
> `org-html-with-mathjax'). If nil, no template, if t, template, if
> `auto', current behafviour (i.e. template if some math snippet /in
> body/)?
OK.
> `auto' is a decent default value for `org-html-with-mathjax' and it can
> be overridden per document with :with-mathjax.
I guess the example I showed is a limitation that we can live with. Also
it's pretty unlikely that you /only/ have math in footnotes.
—Rasmus
--
With monopolies the cake is a lie!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-04-25 10:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24 16:04 [bug, ox-latex] footnotes with math in narrowed buffer Rasmus
2015-04-24 16:28 ` Rasmus
2015-04-24 16:33 ` Rasmus
2015-04-24 19:28 ` Nicolas Goaziou
2015-04-24 19:36 ` Nicolas Goaziou
2015-04-24 20:41 ` Rasmus
2015-04-25 10:22 ` Nicolas Goaziou
2015-04-25 10:42 ` Rasmus
2015-04-24 19:09 ` Nicolas Goaziou
2015-04-24 20:37 ` Rasmus
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.