3

This question led to a new feature in a package:
sepfootnotes

I'm using a "mix" of sepfootnotes, endnotes and subfiles in an arrangement like that of the MWE below. The actual project is eleven chapters by now (so a few files) and I'd like to keep the note content i the chapter-/subfiles.

I would like to declare the \sepfootnotecontent in the top of each chapter like the \sepfootnotecontent{a}{In subfile.} in the subfile. Unfortunately, this doesn't work and I get a message 'a' has not been assigned a content on input line 4..

In the resulting PDF, the footnote content of foot note no one is (obciously) empty whereas note no 2 and 3 look as expected.

I've been reading the sepfootnotes.sty file but I'm not getting it. The subfilespackage is simply inputing the subfile so what is the actual difference between the first and third note with respect to sepfootnotes.

I'm wondering why this is and whether there's a solution.

subfiles-sepfootnotes.tex

\documentclass{article}
\usepackage{subfiles,sepfootnotes}
\usepackage{endnotes}
\let\footnote\endnote
\begin{document}

\sepfootnotecontent{b}{In main file.}
\subfile{child}

\theendnotes
\end{document}

child.tex

\documentclass[subfiles-sepfootnotes.tex]{subfiles}
\begin{document}

\sepfootnotecontent{a}{In subfile.}

Some text with footnotes in
subfile\sepfootnote{a}, with
endnote\endnote{In endnote.}
and in parent
file\sepfootnote{b}.

\end{document}
  • It dawns on me, could it be that sepfootnotes gathers content before subfiles includes the subfiles? Would that be circumventable? – Mats May 20 '16 at 15:51
  • 1
    On a side note, notice that the sepfootnotes package also provides endnotes. – eduardo.tex Jul 12 '16 at 19:30
1

This is due to scope: notes defined in a subfile are not available to the main document because in the subfile they must be defined within a document environment, and are thus restricted to it.

In order to circumvent this, you may insert \global right before \@namedef (not \sep@namedef) at lines 134 and 145 in sepfootnote.sty (v0.3b) to give your note definitions global scope. But I can't guarantee anything in other contexts.

  • Ahh. So, If I use end notes, then the \theendnotes command want access to the locally "def'ed names" and since they're def'ed in local scopes it doesn't work? – Mats Jul 13 '16 at 16:33
  • Sweet! Works like a charm. are you Eduardo, the maintainer of sepfootnotes? Is this an issue and a solution you might consider to incorporate in future releases or is the scope considered a wanted feature? – Mats Jul 13 '16 at 17:21
  • 1
    Yep, that's me. I'm not sure about incorporating it to the package. There is a trade-off here between making sepfootnotes compatible with subfiles, but then making it impossible for users to have notes defined locally. I have think about it. At any rate, thanks for drawing my attention to this issue! – eduardo.tex Jul 14 '16 at 5:31
  • Using an option, scoped? only since you know the solution. sepfootnotes is a gem. Having a unruly mind I'm using tons of notes. TeX code is kind of tiresome to decipher with notes all over the place. Thanks for making my life easier. – Mats Jul 17 '16 at 8:07
  • 1
    Nice. Thanks for the feedback. I've already uploaded version 0.3c to CTAN. It should be available for update within 24 hours. – eduardo.tex Jul 19 '16 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.