Answers.Body: <p>First, I don't think footnotes translate easily to HTML.  Endnotes are way easier and more appropriate. </p>
  
  <p>The problem here is that HTML isn't semantically rich enough to do these things automatically. You need to manually do the numbering. </p>
  
  <p>I use docbook XML to create citations and endnotes. Very easy to do. Then I use docbook XSLT to output everything in clean HTML. That is a powerful solution, especially if you are comfortable using XSLT. <a href="http://www.sagehill.net/docbookxsl/Footnotes.html" rel="nofollow noreferrer">http://www.sagehill.net/docbookxsl/Footnotes.html</a></p>
  
  <p>Another out of the box solution is to edit source in Markdown language and then convert everything to HTML. I see that Pandoc has a footnote solution <a href="http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html#footnotes" rel="nofollow noreferrer">http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html#footnotes</a></p>
  
  <p>It would be worth looking into what capabilities Adobe Indesign has for creating footnotes/endnotes. They have an Export-to-epub capability, and maybe the output renders the footnotes/endnotes in a  nonsucky way. </p>
  
  <p>Failing that, regular expressions are the way to go. But you might look into this: <a href="https://www.w3.org/TR/html5/common-idioms.html#footnotes" rel="nofollow noreferrer">https://www.w3.org/TR/html5/common-idioms.html#footnotes</a></p>
  
  <p>At the risk of trying to simplify your need, a lot can be said for just doing it manually rather than trying to change your production process. This is true especially if you already know the number for each footnote -- like, are you just reproducing the footnote number from a public domain work? Maintaining under 100 citations manually might be less trouble than you think. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T16:51:56.087Z
Answers.Text: Actually, I have over a thousand citations to manage. Still, I think you're right - it might be easiest in the long run to just do it manually and get it right. Your other tips are awesome; they give me a lot of possibilities to explore.
Answers.UserDisplayName: WordBear
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T17:11:57.930Z
Answers.Text: I didn't look into all the variations of markdown; it might be worthwhile for you  to do so. It's hard to do proper numbering if you have each chapter as an html file. I bet though that the latest versions of CSS let you continue numbering at an arbitrary number . Aha, I'm right. http://www.w3schools.com/css/css_counters.asp (very useful!) Not sure if it's supported on epub and mobi though.
Answers.UserDisplayName: idiotprogrammer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T17:13:06.747Z
Answers.Text: I now am  liking  the idea of using css counters to auto-increment numbering on footnotes/endnotes for a chapter.
Answers.UserDisplayName: idiotprogrammer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T17:36:36.583Z
Answers.Text: I should have mentioned that my first ebook is going to simply be a revision of a classic reference that's in the public domain. The first chapter has over 300 superscripts (beginning with 1) referencing footnotes at the bottom of each page. The other chapters have anywhere from a couple dozen to 200-300 superscripts, each one beginning with one. I'd like to make the ebook similar to the original, except that I want to group all the footnotes together at the end of the book.
Answers.UserDisplayName: WordBear
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T12:26:26.227Z
Answers.LastActivityDate: 2017-01-26T12:26:26.227Z
Answers.UserDisplayName: idiotprogrammer
Body: <p>I'm working with Dreamweaver, InDesign and BBEdit, so a solution that works with any of these programs would be great.</p>
  
  <p>I'm converting a book that's in the public domain to an ebook. Each chapter has a series of superscript numbers that reference footnotes at the bottom of each page. I'm going to move all the footnotes to an appendix at the end of the book, then hyperlink the superscripts to the appropriate location.</p>
  
  <p>Each chapter's footnotes begin with 1, 2, 3, etc. So I'll probably need to distinguish between chapters by linking to something like #1-1 and #2-1 for the first footnote in chapters 1 and 2, for example.</p>
  
  <p>Anyway, I'd like to know if there's a way to automate the hyperlinking process. Some typical text would look like this:</p>
  
  <pre><code>&lt;p&gt;Some authorities reported greater casualties &lt;sup&gt;4&lt;/sup&gt;, while at least one reported fewer &lt;sup&gt;5&lt;/sup&gt;.&lt;/p&gt;
  </code></pre>
  
  <p>After I finish linking to my footnotes, that text would probably look something like this:</p>
  
  <pre><code>&lt;p&gt;Some authorities reported greater casualties &lt;sup&gt;&lt;a href="#1-4" title="1-4"&gt;4&lt;/a&gt;&lt;/sup&gt;, while at least one reported fewer &lt;sup&gt;&lt;a href="#1-5" title="1-5"&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
  </code></pre>
  
  <p>I just wondered if anyone knows of a way to automate the linking process, using regular expressions, or one of the software programs I'm using. Each chapter is in a separate HTML file, and I can process one chapter at a time. I should also note that some footnotes are irregular, including letters (e.g. 14, 14a, 14b).</p>
  
Tags: <footnotes>
Title: Automating Footnote Links
UserDisplayName: WordBear
ThreadText: # Automating Footnote Links
  
  (Asked by: username_0 on 2017-01-25)
  
  I'm working with Dreamweaver, InDesign and BBEdit, so a solution that works with any of these programs would be great.
  I'm converting a book that's in the public domain to an ebook. Each chapter has a series of superscript numbers that reference footnotes at the bottom of each page. I'm going to move all the footnotes to an appendix at the end of the book, then hyperlink the superscripts to the appropriate location.
  Each chapter's footnotes begin with 1, 2, 3, etc. So I'll probably need to distinguish between chapters by linking to something like #1-1 and #2-1 for the first footnote in chapters 1 and 2, for example.
  Anyway, I'd like to know if there's a way to automate the hyperlinking process. Some typical text would look like this:
  Some authorities reported greater casualties 4, while at least one reported fewer 5.
  
  After I finish linking to my footnotes, that text would probably look something like this:
  Some authorities reported greater casualties 4, while at least one reported fewer 5.
  
  I just wondered if anyone knows of a way to automate the linking process, using regular expressions, or one of the software programs I'm using. Each chapter is in a separate HTML file, and I can process one chapter at a time. I should also note that some footnotes are irregular, including letters (e.g. 14, 14a, 14b).
  
  **Tags:** footnotes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-26. Score: 3 | Accepted answer
  
  First, I don't think footnotes translate easily to HTML. Endnotes are way easier and more appropriate.
  
  The problem here is that HTML isn't semantically rich enough to do these things automatically. You need to manually do the numbering.
  
  I use docbook XML to create citations and endnotes. Very easy to do. Then I use docbook XSLT to output everything in clean HTML. That is a powerful solution, especially if you are comfortable using XSLT. <http://www.sagehill.net/docbookxsl/Footnotes.html>
  
  Another out of the box solution is to edit source in Markdown language and then convert everything to HTML. I see that Pandoc has a footnote solution <http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html#footnotes>
  
  It would be worth looking into what capabilities Adobe Indesign has for creating footnotes/endnotes. They have an Export-to-epub capability, and maybe the output renders the footnotes/endnotes in a nonsucky way.
  
  Failing that, regular expressions are the way to go. But you might look into this: <https://www.w3.org/TR/html5/common-idioms.html#footnotes>
  
  At the risk of trying to simplify your need, a lot can be said for just doing it manually rather than trying to change your production process. This is true especially if you already know the number for each footnote -- like, are you just reproducing the footnote number from a public domain work? Maintaining under 100 citations manually might be less trouble than you think.
  
  > **Comments:**
  > **username_0**: Actually, I have over a thousand citations to manage. Still, I think you're right - it might be easiest in the long run to just do it manually and get it right. Your other tips are awesome; they give me a lot of possibilities to explore.  
  > **username_1**: I didn't look into all the variations of markdown; it might be worthwhile for you  to do so. It's hard to do proper numbering if you have each chapter as an html file. I bet though that the latest versions of CSS let you continue numbering at an arbitrary number . Aha, I'm right. http://www.w3schools.com/css/css_counters.asp (very useful!) Not sure if it's supported on epub and mobi though.  
  > **username_1**: I now am  liking  the idea of using css counters to auto-increment numbering on footnotes/endnotes for a chapter.  
  > **username_0**: I should have mentioned that my first ebook is going to simply be a revision of a classic reference that's in the public domain. The first chapter has over 300 superscripts (beginning with 1) referencing footnotes at the bottom of each page. The other chapters have anywhere from a couple dozen to 200-300 superscripts, each one beginning with one. I'd like to make the ebook similar to the original, except that I want to group all the footnotes together at the end of the book.  
  
  ---
  
  