View Single Post
Old 11-22-2018, 12:04 PM   #5
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Alcuin7 View Post
For instance in the file index_split_006.html there is a primary (first-level) footnote (endnote) 31 with two explanatory secondary (second-level) footnotes (endnotes) numbered 32 and 33. The existing code in index_split_006.html reads (with line-breaks added to make it more legible),
If you could attach a sample DOCX/EPUB, that would be helpful.

Quote:
Originally Posted by Alcuin7 View Post
If I understand what you have written, what I have observed in the code, and the behavior of the EPUB document, when asked to return to the calling point for note 32, the code searches (sequentially?) for “index_split_052.html”, and not finding it in its expected place following index_split_051.html, returns the reader either to that point (the marker for note 31) or to index_split_053.html (the marker for note 33).
Let me color code. That may make it easier to understand.

If you understand the basics of HTML, you should be able to parse each chunk.

Clean/Minimalist Footnote

In the text:

Quote:
<p>External commerce consists of the supply of the home market with foreign, and of foreign markets with home products.<a href="#fn1" id="ft1">[1]</a></p>
Footnote (within the same file):

Quote:
<p class="footnote">This is an example footnote.<a href="#ft1" id="fn1">[1]</a></p>
The code for a link back/forth is equal and opposite.

Text: id = ft1, points to fn1.
Footnote: id = fn1, points to ft1.

Endnote

Since you have to point to a completely different file, the code gets a little hairier, but the logic is the same.

In the text:

Quote:
<p>External commerce consists of the supply of the home market with foreign, and of foreign markets with home products.<a href="Endnotes.xhtml#fnCh1.1" id="ftCh1.1">[1]</a></p>
Endnote (in a completely separate file):

Quote:
<p class="endnote">This is an example endnote.<a href="Chapter01.xhtml#ftCh1.1" id="fnCh1.1">[1]</a></p>
Now you have to specify which file the link points to:

Text: id = ftCh1.1, points to Endnotes.xhtml file + looks for fnCh1.1.
Endnote: id = fnCh1.1, points to Chapter01.xhtml file + looks for ftCh1.1.

Note: Calibre conversions create a hideous spaghetti nest of code.

First thing I would do is start renaming files from the unintelligible index_split_000.html -> Chapter01.html. That will make the code much easier to read. You'll then be able to more easily see what's pointing to what.

Quote:
Originally Posted by Alcuin7 View Post
You built this with Sigil rather than Calibre? Making the footnote-in-footnote changes manually? Do I need to switch to Sigil? (I don’t want to do that if I can help it.)
Sigil or Calibre's Editor is perfectly fine. You can use either one for editing EPUBs.

(I personally just prefer Sigil 95% of the time.)

Quote:
Originally Posted by Alcuin7 View Post
Since I know you are also familiar with MOBI, can I straightforwardly convert the EPUB (once I have it) into MOBI without further manipulation?
Yes, EPUB->MOBI works fine.

As long as the EPUB code works perfectly, you should be able to input the EPUB into KindleGen/Kindle Previewer, and get a working MOBI.

Quote:
Originally Posted by Alcuin7 View Post
And how do I prevent MOBI from justifying the text, but keep it aligned left?
You could just not specify alignment in your CSS.

You can leave it up to the device/user to choose which alignment they like to read.

Note: Again, Calibre conversion creates a nest of "calibre##" CSS classes. You'll have to figure out which calibre## effect which parts of your book.

Quote:
Originally Posted by Alcuin7 View Post
Are you saying that I need to use another format of endnote markers, say {a, b, c, …}, to identify my second-order notes, [...] This isn’t a problem, but if the tertiary (third level) are numerous – I haven’t counted how many there are – I could be running into four or five asterisks and daggers unless the symbols have their own specified order in Calibre.
I think thiago.eec hit the nail on the head.

You are saying there's 3 levels of footnotes, but I don't know if you're just numbering them 1-999 due to Word's limitations... or if your book would be better served with 3 distinct sets of footnotes!

Your book may be completely different, and it's hard to tell without seeing the DOCX firsthand.

Note: I was just specifying the code that my example PDF->EPUB used. 3 distinct sets of footnotes:

- Author
- Translator
- Editor

Nowadays, I went with a simpler: [1] + [T1] + [E1]. (You can see my 2018 remake here.)

For ebooks, I highly recommend against using the print-style symbols (*, †, ‡).

Alphabetical [a]-[z] is fine, but you have to watch out that you don't have more than 26 of a type of footnote in a chapter. (I once thought that would work for a book, but there was one chapter that had 50+, so [aa]-style becomes unwieldy.)

Your book might be different, but I highly recommend them all being in some sort of sequential order... and be human-understandable. :P

Even thiago.ecc's example of 31-a works fine for secondary footnotes.

Tertiary footnotes could potentially be 31-a-a... but at this point, I would probably recommend rethinking your document... since this becomes a hideous spaghetti nest and becomes too hard to follow/read. Books are ultimately meant to be read by humans. :P

Quote:
Originally Posted by Alcuin7 View Post
You misunderstand. There is no way to embed footnotes into footnotes in Microsoft Word. It is accomplished by entering separate footnotes, formatting and cross-linking them so that they appear to be footnotes to footnotes, then hiding the real footnote markers.
If you're working on such a complicated document in the future, probably better to go to more advanced programs that can handle multiple sets of footnotes.

LaTeX has many packages that handle multiple sets of footnotes (bigfoot, manyfoot).

Quote:
Originally Posted by Alcuin7 View Post
I assume I must also renumber “index_split_nnn.html” sequentially throughout the document so that they are in their correct order. [...] Is there some way to access them all? because if there is, then this becomes a fairly standard search-and-replace hack with external code.
The first thing I do is follow my Note above. Always rename the gibberish filenames to logical ones. It will make things SO MUCH easier to understand.

Then I also merge all files that need to be merged.

For example, your Endnotes file might be split into 100 "index_split_459" pieces. I merge them all into a single one and call it Endnotes.xhtml. Again, this makes the code so much easier to read/manipulate (and you can always split it in the future).

Quote:
Originally Posted by thiago.eec View Post
To see this in action, look at the file attached.
I would say a sample DOCX/EPUB speaks a thousand words. :P

Last edited by Tex2002ans; 11-22-2018 at 12:08 PM.
Tex2002ans is offline   Reply With Quote