-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Footnote in footnote (markdown) #2053
Comments
Pandoc's markdown doesn't support footnotes inside footnotes (which are an abomination anyway!). |
For example ReText editor (use python-markups, python-markdown) has this functionality. I work with very complex scientific texts. Sometimes footnote inside footnote is important. For example translator's note inside author's note. Ofcourse in simple blogpost this is not necessary. |
BTW: MultiMarkdown inline footenotes does not work. |
+++ Ondřej Profant [Apr 05 15 15:04 ]:
Sigh. Looks like Fletcher added inline footnotes in 2013. Why couldn't he have used the same syntax as pandoc's inline footnotes, which we've had since 2007? Instead he uses a slightly different syntax, contributing to the mess of proliferating markdown syntaxes... |
+++ Ondřej Profant [Apr 05 15 14:25 ]:
Footnotes inside footnotes don't work well with many of the output So, I'm not inclined to support this. |
Not arguing that nested footnotes should be supported, but some manual 2015-04-06 1:59 GMT+03:00 John MacFarlane notifications@github.com:
|
Footnotes within footnotes? Who does that? Why do you even need it? The point of having a footnote is to get the note text out of the way when reading. If you're down in the footnote already, that functionality is unnecessary. I think all I've ever seen is something like an inline ref: "See n. 5." |
Footnotes within footnotes can be used to a comedic effect for literary 2015-04-06 21:00 GMT+03:00 John Muccigrosso notifications@github.com:
|
Interesting. Can you point me to something using it? |
For one, Sir Terry Pratchett extensively used nested footnotes in his 2015-04-06 21:52 GMT+03:00 John Muccigrosso notifications@github.com:
|
Googling a bit, most of what I find for nested footnote is on TeX pages (along with lots of "don't do it"). I didn't see anything for Chicago Manual, except for referring to one footnote within another, not creating a footnote within a footnote (which, again, I think is unnecessary, except for comic effect). And apparently we should have cited this right away: https://xkcd.com/1208/ |
There are, however, a sizeable amount of tutorials on how to achieve nested footnotes in LaTeX and/or Word, so I gather that creating footnote labyrinths is a somewhat popular pastime. Never felt the need to use them myself though. |
As I have said. For example you need translater footnotes (or endnotes) in translated text. You have regular author footnote and translator need to tell you something. Mentioned sir Terrry Pratchett using footnotes often and Czech tranlate contains many translator footnote in author footnote. (My experince) |
Danielewski's House of Leaves is another example from fiction of nested footnotes, but there they are not used for comic effect but are an indispensable structural component for telling a complicated story. The book is perhaps not a model of sensible typography, but it is very effective and was quite popular. I'm not sure I see the need for these examples, however. I'm quite willing to take @Kedrigern at his word, and will not try to convince him that he doesn't need nested notes, really, or that he ought not to use them; I trust him to be the judge of that ;-) With regards to what @jgm says about needing an external package for this, my impression is that this is true for most anything one does in latex. Looking at the default latex template for pandoc it seems several external packages are already relied upon ( I do use nested notes a fair bit in my research. When I study an article or book closely I often recreate it as markdown/latex/pdf files. The default series of footnotes are then taken up by the notes from the original. I critique or expand arguments in the original work within my own foot- and margin notes, and insert hypertext links to other articles that I have "imported" or to my own writings, and sometimes this means notes within notes. I would not be able to work this way without nesting. I am not necessarily pushing for support for nested notes in pandoc-markdown, however, if this seems complicated or undesirable for whatever reason–I can do what I want with latex commands in the markdown text. I'm quite content with nested notes being considered a marginal use case without any special support in pandoc-markdown. I do want to challenge the assumption that there is no meaningful use case for nested notes, and to suggest that it is possible already to achieve this with the |
@jjaderberg 👍 Thanks you, exactly what I thought. Or maybe we can consider support for endnotes. Footnote, endnote and citation are usual in research. |
The change may require additional work in pandoc's |
@tarleb, I don't see how nested footnotes could lead to infinite loops. Like, at all. And I'm reasonably familiar with Pandoc's code. So this argument doesn't seem valid. Besides, workaround only applies to LaTeX output, and won't work at all if one targets multiple output formats. Primary concern with nested footnotes isn't parsing, but output. While it's reasonably simple with some output formats, LaTeX and OOXML (docx) have quite a bit of quirks wrt nested footnotes (latter having trouble with footnotes as is). And while it's certainly possible to work around that, it would introduce a maintenance overhead, which isn't ideal. |
How to DoS pandoc using footnotes:
You are right that the workaround only works with LaTeX, maybe HTML. It's not ideal. But there are many other features for which this is true. Some of those features should be added, others might just be too much effort and create too much complexity. I believe this issue falls into the latter category. |
@tarleb, right, sorry. It's been a while and for some reason my memory insisted that Pandoc uses two-pass parser, while it, in fact, doesn't. That might be related to the fact that I'm using two-pass approach in pandoc-crossref and my mind somehow mixed up the two >_> Sorry again. That said, this highlights a bit of a problem with footnotes in general -- every reference duplicates definition. All fine and dandy if there's only one reference per footnote, and a horrible mess if there are several. Consider this for example:
Fixing that would likely require some changes to AST though, and it's arguable if it's necessary for footnotes (as opposed to endnotes, although depending on output format, difference can be blurry) |
One could argue that Pandoc's use of the I seem to remember some discussion regarding the footnote problem, talking about the exact issues you mention, though I cannot seem to find it atm. It's reasonable to interpret the issue at hand as merely a symptom of a deeper problem with the way footnotes are handled. Thanks for highlighting it. |
One thing I would note about recursive footnotes is that right now they are handled badly. They emit no warning, they drop footnotes unpredictably, and they generate, for HTML5 output, weird output with duplicate IDs (I am not sure if that is explicitly invalid HTML, but it's not good). An example defining four footnotes:
compiles to
Which HTML Tidy notes:
Since it's defined both in the body and in endtext where the first footnote is. The final rendered output shows that, surprisingly, the first footnote gets rendered, a superscript inside it gets rendered for footnote 2, but then it points to itself so it has a rendered ID/superscript but not valid link or body, while footnote 3 appears inline as a Markdown fragment ID (with no superscript, link, or body), and footnote 4 disappears entirely. Given that there doesn't seem to be any prospect of implementing recursive footnotes within footnotes and doing anything with footnotes inside footnotes leads to bad and confusing partial outputs, it seems like trying to render the footnotes is a bug, or at least perhaps it should be an error or warning? |
Yes, it would probably make sense to disable the |
I'd like to add another impact of footnote in footnote. If you have a footnote containing a link and you use links-as-notes variable. It creates a reference to a non-existing link. A paragraph with a reference[^reference] where the reference formatted content in footnotes is bad.
[^reference]: The [Pandoc](https://pandoc.org/MANUAL.html) website A paragraph with a reference\footnote{The
\href{https://pandoc.org/MANUAL.html}{Pandoc} website} where the
reference formatted content in footnotes is bad. However, it exists a good workaround for this case : Using link label equal to link target produce great output A paragraph with a reference[^reference] where the reference formatted content in footnotes is bad.
[^reference]: The [https://pandoc.org/MANUAL.html](https://pandoc.org/MANUAL.html) website |
@tarleb: In the example you provide, I find a cycle (the footnote refers directly to itself). Would the same operation terminate if the references had no cycles? Since the footnote definitions in the Markdown text appear in a list, we could require that each nested footnote reference appear earlier in the list than the definition of that footnote (the same as how footnote references in body text usually appear before the footnote definitions list). This constraint prevents any cycles. Then, can we avoid infinite loops, such as the one in your example? |
@brainchild0 you may not be aware of it, but the majority of pandoc's core developers are non-native speakers. The flowery language of your comments may be nice to read in a non-technical context; here however, it just makes our lives more difficult. Having to first wade through and decipher a wall of text makes my life harder and also makes it less likely for me to consider a comment. Please try to keep the comments short and to the point and avoid unnecessary contextualization (it is usually save to assume people to be able to do that themselves). |
@tarleb Sure I understand. I revised the comment into plain language. I hope the result is closer to what you and others prefer. I would be happy to further revise, clarify, simplify, or elaborate, however may be helpful. |
Hi, I have text like this:
and I would like to convert them into LaTeX.
I expect:
but I get:
Replace letter (A) by number does not help.
I try
markdown
,markdown_github
,markdown_mmd
,markdown_phpextra
,markdown_strict
.The text was updated successfully, but these errors were encountered: