emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Multiple footnote references in included file
@ 2015-09-06  0:30 Leonard Randall
  2015-09-06 20:21 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Leonard Randall @ 2015-09-06  0:30 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3100 bytes --]

Hi org mode community,

I have my thesis divided into several chapters each with its own org file.
I was trying to use org's Include function to compile a pdf of the complete
draft using a master file. However, I found that if there was more than one
reference to the same footnote in one of my chapter files, the exporter
would complain that a footnote was undefined.

In my case this occurred because I keep old versions of chapter sections
under an archive heading, and at least up til now I did not change the
names of footnotes, when I copied material over from one draft to the next.
It seemed  strange that it would even register these older references,
because I exclude these headlines from export, but it seems to do so. The
problem also occurs if both references are in a headline that is supposed
to be exported.

I am using org version 8.3.1 from elpa, and I am running Emacs 25.0.50.1
compiled for Windows 64. The problem can be reproduced with the following
minimal examples.

Suppose this is the master file:

---- Begin Master.org ---
* Here is my master file
It has an include command.
#+INCLUDE: "./Included.org"
--- End Master.org ---

If I try to export this file it will throw up an error with either one of
the following include files.
--- begin Included.org ---
#+EXCLUDE_TAGS: noexp archive notes
#+ARCHIVE: ::* Archived
* This is a headline.

This is some text. [fn:dd1cd1f9]
* Archive                                                        :archive:
** This is a headline (draft 0)
Here is a previous version of the text to which I affixed the same
footnote. [fn:dd1cd1f9]
* Footnotes

[fn:dd1cd1f9] Here is the footnote

--- end Included.org ---

--- begin Included.org ---
* This is a headline.
This is some text. [fn:dd1cd1f9]

Here is some more text to which I wish to affix the same footnote.
[fn:dd1cd1f9]
* Footnotes

[fn:dd1cd1f9] Here is a footnote

--- end Included.org ---

I get the following backtrace:
---  ---
Debugger entered--Lisp error: (error "Definition not found for footnote
fn:dd1cd1f9 in file c:/Users/leotr/G/P/Tests/Included.org")
  signal(error ("Definition not found for footnote fn:dd1cd1f9 in file
c:/Users/leotr/G/P/Tests/Included.org"))
  error("Definition not found for footnote %s in file %s" "fn:dd1cd1f9"
"c:/Users/leotr/G/P/Tests/Included.org")
  org-export--prepare-file-contents("c:/Users/leotr/G/P/Tests/Included.org"
nil 0 2 1 #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold
0.8 data ( ...)))
  org-export-expand-include-keyword()
  org-export-as(latex nil nil nil (:output-file "./Main.tex"))
  org-export-to-file(latex "./Main.tex" nil nil nil nil nil)
  org-latex-export-to-latex(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  #<subr call-interactively>(org-export-dispatch nil nil)
  ad-Advice-call-interactively(#<subr call-interactively>
org-export-dispatch nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively>
(org-export-dispatch nil nil))
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)
---  ---

[-- Attachment #2: Type: text/html, Size: 3723 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Multiple footnote references in included file
  2015-09-06  0:30 Multiple footnote references in included file Leonard Randall
@ 2015-09-06 20:21 ` Nicolas Goaziou
  2015-09-07 14:54   ` Leonard Randall
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2015-09-06 20:21 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hello,

Leonard Randall <leonard.a.randall@gmail.com> writes:

> I have my thesis divided into several chapters each with its own org file.
> I was trying to use org's Include function to compile a pdf of the complete
> draft using a master file. However, I found that if there was more than one
> reference to the same footnote in one of my chapter files, the exporter
> would complain that a footnote was undefined.
>

[...]

> Suppose this is the master file:
>
> ---- Begin Master.org ---
> * Here is my master file
> It has an include command.
> #+INCLUDE: "./Included.org"
> --- End Master.org ---
>
> If I try to export this file it will throw up an error with either one of
> the following include files.
> --- begin Included.org ---
> #+EXCLUDE_TAGS: noexp archive notes
> #+ARCHIVE: ::* Archived
> * This is a headline.
>
> This is some text. [fn:dd1cd1f9]
> * Archive                                                        :archive:
> ** This is a headline (draft 0)
> Here is a previous version of the text to which I affixed the same
> footnote. [fn:dd1cd1f9]
> * Footnotes
>
> [fn:dd1cd1f9] Here is the footnote

Fixed. Thank you.

> --- begin Included.org ---
> * This is a headline.
> This is some text. [fn:dd1cd1f9]
>
> Here is some more text to which I wish to affix the same footnote.
> [fn:dd1cd1f9]

This is a footnote /definition/ since it starts at column 0.

> * Footnotes
>
> [fn:dd1cd1f9] Here is a footnote

This is a second footnote definition for the same label. Syntax is too
much faulty for a clean export.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Multiple footnote references in included file
  2015-09-06 20:21 ` Nicolas Goaziou
@ 2015-09-07 14:54   ` Leonard Randall
  2015-09-07 18:58     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Leonard Randall @ 2015-09-07 14:54 UTC (permalink / raw)
  To: Leonard Randall, emacs-orgmode, mail

[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]

Thanks so much! It works.

One issue that I noticed, however, is that the exporter will still give an
error for an undefined footnote if a footnote is undefined in a heading
that is excluded from export via the exclude tags function. For example if
I have tagged a heading 'noexp' in one of my included files, and list noexp
on the excluded tags line of the header of my master file the exporter will
still complain if there is an undefined footnote under this header.
If I export a master file with this code:
---
#+EXCLUDE_TAGS: noexp archive notes tasks ARCHIVE
#+INCLUDE: "./1WorkingDraft.org"
---
It will complain if there is any undefined footnote reference in
1WorkingDraft.org , regardless if it is under a heading marked with one of
the excluded tags.

It will not complain about this, however, if I explicitly limit the range
of the include function to the headings that I wish to export using a
custom id.
---
#+INCLUDE: "./1WorkingDraft.org::#Chapter1"
---
This problem is not a big issue insofar as it is relatively easy to work
around, and I probably should not have undefined footnote references
hanging around in my org files anyway, but I figure that you should know
about the behaviour, as I do not think that it is intended.

All best,
Leonard

On 6 September 2015 at 21:21, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Leonard Randall <leonard.a.randall@gmail.com> writes:
>
> > I have my thesis divided into several chapters each with its own org
> file.
> > I was trying to use org's Include function to compile a pdf of the
> complete
> > draft using a master file. However, I found that if there was more than
> one
> > reference to the same footnote in one of my chapter files, the exporter
> > would complain that a footnote was undefined.
> >
>
> [...]
>
> > Suppose this is the master file:
> >
> > ---- Begin Master.org ---
> > * Here is my master file
> > It has an include command.
> > #+INCLUDE: "./Included.org"
> > --- End Master.org ---
> >
> > If I try to export this file it will throw up an error with either one of
> > the following include files.
> > --- begin Included.org ---
> > #+EXCLUDE_TAGS: noexp archive notes
> > #+ARCHIVE: ::* Archived
> > * This is a headline.
> >
> > This is some text. [fn:dd1cd1f9]
> > * Archive
> :archive:
> > ** This is a headline (draft 0)
> > Here is a previous version of the text to which I affixed the same
> > footnote. [fn:dd1cd1f9]
> > * Footnotes
> >
> > [fn:dd1cd1f9] Here is the footnote
>
> Fixed. Thank you.
>
> > --- begin Included.org ---
> > * This is a headline.
> > This is some text. [fn:dd1cd1f9]
> >
> > Here is some more text to which I wish to affix the same footnote.
> > [fn:dd1cd1f9]
>
> This is a footnote /definition/ since it starts at column 0.
>
> > * Footnotes
> >
> > [fn:dd1cd1f9] Here is a footnote
>
> This is a second footnote definition for the same label. Syntax is too
> much faulty for a clean export.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 4282 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Multiple footnote references in included file
  2015-09-07 14:54   ` Leonard Randall
@ 2015-09-07 18:58     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2015-09-07 18:58 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Leonard Randall <leonard.a.randall@gmail.com> writes:

> One issue that I noticed, however, is that the exporter will still give an
> error for an undefined footnote if a footnote is undefined in a heading
> that is excluded from export via the exclude tags function. For example if
> I have tagged a heading 'noexp' in one of my included files, and list noexp
> on the excluded tags line of the header of my master file the exporter will
> still complain if there is an undefined footnote under this header.

This is because expanding INCLUDE keywords happens very early in the
export process, before exported areas are known.

In any case, I agree this is an annoying behaviour. I changed the
algorithm so it shouldn't throw an error during this phase.

Thank you.


Regards,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-07 18:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-06  0:30 Multiple footnote references in included file Leonard Randall
2015-09-06 20:21 ` Nicolas Goaziou
2015-09-07 14:54   ` Leonard Randall
2015-09-07 18:58     ` Nicolas Goaziou

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).