* Footnote attributes
@ 2016-01-15 14:52 Thomas S. Dye
2016-01-16 14:03 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2016-01-15 14:52 UTC (permalink / raw)
To: emacs-orgmode
Aloha all,
I'm trying to hijack Org footnotes to export \sidenotes with an
optional offset parameter to LaTeX. I can't figure out how to specify
and access the offset parameter for a footnote.
I have an attr_latex line in front of the footnote-definition and
footnote-reference, but I can't figure out how to retrieve it. Is this
possible? If so, how?
I have this, but offset is always the empty string:
(let* ((def (org-export-get-footnote-definition footnote-reference info))
(attr (org-export-read-attribute :attr_latex footnote-reference))
(offs (plist-get attr :offset))
(offset (if offs (format "[%s]" offs) "")))
(concat
(format "\\sidenote%s{%s}" offset (org-trim (org-export-data def info)))
;; Retrieve all footnote references within the footnote and
;; add their definition after it, since LaTeX doesn't support
;; them inside.
(org-latex--delayed-footnotes-definitions def info)))
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Footnote attributes
2016-01-15 14:52 Footnote attributes Thomas S. Dye
@ 2016-01-16 14:03 ` Nicolas Goaziou
2016-01-19 3:45 ` Thomas S. Dye
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-01-16 14:03 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode
Hello,
Thomas S. Dye <tsd@tsdye.com> writes:
> I'm trying to hijack Org footnotes to export \sidenotes with an
> optional offset parameter to LaTeX. I can't figure out how to specify
> and access the offset parameter for a footnote.
>
> I have an attr_latex line in front of the footnote-definition and
> footnote-reference, but I can't figure out how to retrieve it. Is this
> possible? If so, how?
>
> I have this, but offset is always the empty string:
>
> (let* ((def (org-export-get-footnote-definition footnote-reference info))
> (attr (org-export-read-attribute :attr_latex footnote-reference))
> (offs (plist-get attr :offset))
> (offset (if offs (format "[%s]" offs) "")))
`org-export-get-footnote-definition' doesn't return a full footnote
definition objects, but only contents. Attributes are lost.
You need to retrieve the definition within the parse tree, using
`org-element-map', then extract the information you need. See for
example `org-export-get-footnote-definition'.
Note that there is no guarantee that there is a matching definition in
the parse tree: the reference could as well be inline, or referencing an
inline footnote reference.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Footnote attributes
2016-01-16 14:03 ` Nicolas Goaziou
@ 2016-01-19 3:45 ` Thomas S. Dye
0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2016-01-19 3:45 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Aloha Nicolas,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Thomas S. Dye <tsd@tsdye.com> writes:
>
>> I'm trying to hijack Org footnotes to export \sidenotes with an
>> optional offset parameter to LaTeX. I can't figure out how to specify
>> and access the offset parameter for a footnote.
>>
>> I have an attr_latex line in front of the footnote-definition and
>> footnote-reference, but I can't figure out how to retrieve it. Is this
>> possible? If so, how?
>>
>> I have this, but offset is always the empty string:
>>
>> (let* ((def (org-export-get-footnote-definition footnote-reference info))
>> (attr (org-export-read-attribute :attr_latex footnote-reference))
>> (offs (plist-get attr :offset))
>> (offset (if offs (format "[%s]" offs) "")))
>
> `org-export-get-footnote-definition' doesn't return a full footnote
> definition objects, but only contents. Attributes are lost.
>
> You need to retrieve the definition within the parse tree, using
> `org-element-map', then extract the information you need. See for
> example `org-export-get-footnote-definition'.
>
> Note that there is no guarantee that there is a matching definition in
> the parse tree: the reference could as well be inline, or referencing an
> inline footnote reference.
Thanks. That worked easily.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Footnote attributes
@ 2016-01-14 1:20 Thomas S. Dye
2016-01-14 8:42 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2016-01-14 1:20 UTC (permalink / raw)
To: emacs-orgmode
Aloha all,
The following ECM yields a blank footnote in LaTeX export.
,--------------------------
| * Footnote test
|
| This is text.[fn:1]
|
| * Footnotes
| #+attr_latex: :offset 0in
| [fn:1] A footnote.
`--------------------------
If I remove the attr_latex line, all is well. I expect the footnote to
work, regardless of the attr_latex line.
More generally, is there a way to attach attributes to a Footnote
Definition in Org mode?
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Footnote attributes
2016-01-14 1:20 Thomas S. Dye
@ 2016-01-14 8:42 ` Nicolas Goaziou
2016-01-14 17:09 ` Thomas S. Dye
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-01-14 8:42 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode
Hello,
Thomas S. Dye <tsd@tsdye.com> writes:
> The following ECM yields a blank footnote in LaTeX export.
>
> ,--------------------------
> | * Footnote test
> |
> | This is text.[fn:1]
> |
> | * Footnotes
> | #+attr_latex: :offset 0in
> | [fn:1] A footnote.
> `--------------------------
>
> If I remove the attr_latex line, all is well. I expect the footnote to
> work, regardless of the attr_latex line.
Fixed. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Footnote attributes
2016-01-14 8:42 ` Nicolas Goaziou
@ 2016-01-14 17:09 ` Thomas S. Dye
0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2016-01-14 17:09 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Aloha Nicolas,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Thomas S. Dye <tsd@tsdye.com> writes:
>
>> The following ECM yields a blank footnote in LaTeX export.
>>
>> ,--------------------------
>> | * Footnote test
>> |
>> | This is text.[fn:1]
>> |
>> | * Footnotes
>> | #+attr_latex: :offset 0in
>> | [fn:1] A footnote.
>> `--------------------------
>>
>> If I remove the attr_latex line, all is well. I expect the footnote to
>> work, regardless of the attr_latex line.
>
> Fixed. Thank you.
Works now. Thanks!
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-19 3:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15 14:52 Footnote attributes Thomas S. Dye
2016-01-16 14:03 ` Nicolas Goaziou
2016-01-19 3:45 ` Thomas S. Dye
-- strict thread matches above, loose matches on Subject: below --
2016-01-14 1:20 Thomas S. Dye
2016-01-14 8:42 ` Nicolas Goaziou
2016-01-14 17:09 ` Thomas S. Dye
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).