Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-30-2022, 03:17 PM   #1
Kyriosity
Member
Kyriosity began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Mar 2020
Location: Moscow, Idaho
Device: Kindle Previewer, Kindle for PC, Kindle
Footnote numbers have gone AWOL

I work in InDesign, export to epub, tweak a thing or two in Sigil, and check in Kindle Previewer. I don't think I've changed anything in my settings or workflow, but suddenly the last couple of books I've worked on have started dropping my footnote (endnote) numbers (not the references in the text, but the numbers in the notes themselves). They show up fine in InDesign, but numberless in Previewer. This happens whether or not I make any changes in Sigil, so it's not Sigil causing the problem, but I'm wondering if it's something I could fix in Sigil...or of course if anybody has advice for InDesign or Calibre or whatever, I'd take that, too!

~Valerie
Kyriosity is offline   Reply With Quote
Old 05-30-2022, 03:47 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,757
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
There's not a lot we can do unless you post some sample code so we can see what you are dealing with.
JSWolf is online now   Reply With Quote
Advert
Old 05-30-2022, 03:53 PM   #3
Kyriosity
Member
Kyriosity began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Mar 2020
Location: Moscow, Idaho
Device: Kindle Previewer, Kindle for PC, Kindle
Can you tell me where in the code this would be? I just trust the automated processes for most things, so I don't know my way around very well.
Kyriosity is offline   Reply With Quote
Old 05-31-2022, 07:15 PM   #4
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,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Kyriosity View Post
Can you tell me where in the code this would be? I just trust the automated processes for most things, so I don't know my way around very well.
Open the EPUB in Sigil or Calibre's Editor.

You can then look at the exact HTML inside of the book.

So let's say your first few footnotes say something like this in your Print book:

Code:
1 This is the first footnote.
2 This is the second footnote.
You can open the EPUB and search for that text, it should lead you in the correct location.

In the HTML, you may see something like this:

Spoiler:
Code:
<div class="_idFootnotes">
	<div id="footnote-006" class="_idFootnote">
		<p class="Footnote-text"><span class="CharOverride-1"><a class="_idFootnoteAnchor _idGenColorInherit" href="../Text/Untitled-12.xhtml#footnote-006-backlink">1</a></span>This is the first footnote.</p>
	</div>
	<div id="footnote-005" class="_idFootnote">
		<p class="Footnote-text"><span class="CharOverride-1"><a class="_idFootnoteAnchor _idGenColorInherit" href="../Text/Untitled-12.xhtml#footnote-005-backlink">2</a></span>This is the second footnote.</p>
	</div>


and in the CSS, you can post the whole thing.

Side Note: Another thing is you can create a sample EPUB with you problem in it:

1. Delete a lot of the text, leaving just a paragraph + a few footnotes.
2. Attach it to your next post.

We could then easily take apart the EPUB and see what the heck is going on.

Quote:
Originally Posted by Kyriosity View Post
I work in InDesign, export to epub, tweak a thing or two in Sigil, and check in Kindle Previewer. [...] the last couple of books I've worked on have started dropping my footnote (endnote) numbers (not the references in the text, but the numbers in the notes themselves). They show up fine in InDesign, but numberless in Previewer.
What most likely happened is InDesign created very ugly code to auto-number the footnotes... (which is extremely unreliable across devices).

Need to see your exact HTML + CSS of your footnotes in order to make a determination though.

Side Note: If I'm going to take a quick guess, each footnote is probably buried in <ol> with lots of ugly CSS attached to it.

Last edited by Tex2002ans; 05-31-2022 at 07:24 PM.
Tex2002ans is offline   Reply With Quote
Old 06-02-2022, 05:26 PM   #5
Kyriosity
Member
Kyriosity began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Mar 2020
Location: Moscow, Idaho
Device: Kindle Previewer, Kindle for PC, Kindle
Thanks for the patient instruction!

Here's the bit with the first footnote reference:

Quote:
<p class="BODY">Owen Barfield, a friend of Lewis’s, once said that what Lewis believed about everything was contained within what he said about anything. It would be hard to find a better description of what worldview thinking should be like. Somewhere in <span class="italic">Screwtape</span>, Lewis describes an average modern man who is accustomed to having a dozen incompatible ideas bouncing around in his head.<span class="superscript _idGenCharOverride-2"><span id="footnote-025-backlink"><a class="_idFootnoteLink _idGenColorInherit" epub:type="noteref" href="Cultural_Mind_EPUB.xhtml#footnote-025">1</a></span></span> May we all come to learn the importance of not being like that.</p>
And here's the bit with the text of the note:

Quote:
<div class="_idFootnotes">
<aside id="footnote-025" class="_idFootnote">
<p class="Footnotes"><a class="_idFootnoteAnchor _idGenColorInherit" href="Cultural_Mind_EPUB.xhtml#footnote-025-backlink"></a>C.S. Lewis, <span class="italic">The Screwtape Letters</span> (London: Geoffrey Bles, 1942), Letter 1.</p>
</aside>
</div>
Is that sufficient?
Kyriosity is offline   Reply With Quote
Advert
Old 06-02-2022, 06:19 PM   #6
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
Do the numbers reset to 1 at every chapter? Not asking because that'd have caused the problem, but because the solution might be more complicated if they don't.

What's supposed to have happened is: the number should have appeared in that <a> at the front for the backlink, but it's empty. You can wrangle a fix by shoving that <a> to the end via regex and filling it with e.g. an arrow or something. That way, people have something to click on to get back, since the numbers are missing. Then you can do something semi-similar to transform the notes section into an <ol> to get the numbers regenerated. Those new numbers won't be linkable though, which is why you need that arrow at the end too.

But that won't work well if the numbers don't reset at every chapter, because e.g. <ol start="11"> doesn't work reliably for ebook. I can probably whip up an example for what I'm describing above, or maybe others will have better ideas.

In InDesign, you might doublecheck that Numbers: Map to Ordered Lists is set under the Text section of the epub export options. Or if it is, see what happens if it's not. It's worth a check since it's relatively quick and I guess it could cause something like this.

Last edited by phillipgessert; 06-02-2022 at 06:32 PM.
phillipgessert is offline   Reply With Quote
Old 06-02-2022, 06:23 PM   #7
Kyriosity
Member
Kyriosity began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Mar 2020
Location: Moscow, Idaho
Device: Kindle Previewer, Kindle for PC, Kindle
Yes, they are supposed to reset to 1 every chapter. The puzzling thing for me is that I've exported dozens of epubs with pretty much the exact same settings (I always pull up a previous file to build the next book so things behave the same way) and never run into this before. Really the only thing I usually change from book to book is the fonts.
Kyriosity is offline   Reply With Quote
Old 06-02-2022, 06:45 PM   #8
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
It’d be tough to diagnose it in terms of what went wrong in InDesign, odds are it choked on something or other in the Paragraph Styles involved, because InDesign’s approach to semantics and styles don’t map very well to HTML/CSS.

Sometime tomorrow I may be able to post up some find/replace examples for what I described above, but hopefully between now and then someone else will have already posted up something less cumbersome that I hadn’t thought of.

Last edited by phillipgessert; 06-02-2022 at 06:52 PM.
phillipgessert is offline   Reply With Quote
Old 06-02-2022, 06:46 PM   #9
Kyriosity
Member
Kyriosity began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Mar 2020
Location: Moscow, Idaho
Device: Kindle Previewer, Kindle for PC, Kindle
I appreciate anybody taking any sort of stab at it that they can! :-)
Kyriosity is offline   Reply With Quote
Old 06-03-2022, 02:02 PM   #10
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,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Kyriosity View Post
Thanks for the patient instruction!

Here's the bit with the first footnote reference:

[...]

Is that sufficient?
Can you post the CSS as well?

You see where it says:
  • <p class="Footnotes"

In Sigil, you can Right-Click on the word "Footnotes" > Go To Link Or Style.

Can you also do this for:
  • <div class="_idFootnotes">
  • <aside id="footnote-025" class="_idFootnote">
  • <a class="_idFootnoteAnchor

* * *

Side Note: If "Go To Link Or Style" just leads you to something generic like:

Code:
body, div, dl, dt, dd, h1, h2, h3, h4, h5, h6, p, pre, code, blockquote {
	margin:0;
	padding:0;
	border-width:0;
}
you don't have to post them.

Only post if it leads you to something specific like:

Spoiler:
Code:
p.Footnote-text {
	color:#000000;
	font-family:"Minion Pro Medium", sans-serif;
	font-size:0.75em;
	font-style:normal;
	font-variant:normal;
	font-weight:normal;
	line-height:1.2;
	margin-bottom:0;
	margin-left:0;
	margin-right:0;
	margin-top:0;
	orphans:1;
	page-break-after:auto;
	page-break-before:auto;
	text-align:justify;
	text-decoration:none;
	text-indent:0;
	text-transform:none;
	widows:1;
}


Quote:
Originally Posted by phillipgessert View Post
What's supposed to have happened is: the number should have appeared in that <a> at the front for the backlink, but it's empty. You can wrangle a fix by shoving that <a> to the end via regex and filling it [...]

But that won't work well if the numbers don't reset at every chapter, because e.g. <ol start="11"> doesn't work reliably for ebook. I can probably whip up an example for what I'm describing above, or maybe others will have better ideas.
Yeah, I noticed the empty <a> as well.

This is why I was suspecting it'll be complicated numbering via CSS (counters (?)).

Usually, in these cases, I see some really ugly nested <ol> instead—similar to Calibre's footnote/endnote code. (But I don't see that here.)

Quote:
Originally Posted by Kyriosity View Post
Yes, they are supposed to reset to 1 every chapter. The puzzling thing for me is that I've exported dozens of epubs with pretty much the exact same settings (I always pull up a previous file to build the next book so things behave the same way) and never run into this before.
If you want, you could send me the problematic EPUB:
  • Upload EPUB to Dropbox (or similar filesharing website)
  • Click my Username to the left of my post
  • Scroll to bottom of page. There's a "Send a private message to Tex2002ans" link. Click it.
  • Send me a Private Message + send me the URL to the file.

I'll be able to take an exact look and figure out what the heck is going on.

* * *

Side Note: Ultimately, what you want for footnotes is actual numbers baked into the text itself.

So having a:

Code:
<p class="footnote"><a href="#ft2" id="fn2">[2]</a> Herbert Spencer, <i>Principles of Sociology</i>, 2d ed. (New York: D. Appleton Co., 1916), vol. 2, pp. 378–79.</p>
which would appear as "[2]".

Instead of having something like yours:

Code:
<a href="#ft2" id="fn2"></a>
where some auto-numbering mumbo jumbo is happening. :P

Quote:
Originally Posted by phillipgessert View Post
In InDesign, you might doublecheck that Numbers: Map to Ordered Lists is set under the Text section of the epub export options. Or if it is, see what happens if it's not. It's worth a check since it's relatively quick and I guess it could cause something like this.
Also seems like there may be an option:
  • Convert to Text
    • Convert numbered lists into paragraphs that begin with the paragraph’s current number as text.

which may help.

Quote:
Originally Posted by phillipgessert View Post
It’d be tough to diagnose it in terms of what went wrong in InDesign, odds are it choked on something or other in the Paragraph Styles involved,[...]
Yeah... I'm not familiar enough with messing with the bells/whistles inside of InDesign itself.

But I am familiar with the kind of messes it spits out. :P

Looks like this is EPUB3 as well, so maybe that threw a wrench in things. (It probably decided to spit out more complicated CSS3... because "Well, it'll show up fine in iBooks!!!")

Last edited by Tex2002ans; 06-03-2022 at 02:07 PM.
Tex2002ans is offline   Reply With Quote
Old 06-03-2022, 04:53 PM   #11
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
I'm very sure Tex'll have a much better solution than this one, but I figured I'd come back anyway since I said I would. If you try any of this, please save a copy first in case something breaks.

Leaving the body text part alone, since that part seemed ok, I'd try this in that footnotes section. I'd first fix the broken backlink with this regex search:

Find
Code:
(<a class="_idFootnoteAnchor.*?>)(</a>)(.*?)(</p>)
Replace
Code:
\3\1↩\2\4
Basically moving the note contents ahead of the empty <a>, and filling the <a>with a back arrow. Then, to get the numbers back, I'd start with something like:

Find
Code:
<div class="_idFootnotes">
Replace
Code:
<ol class="_idFootnotes">
Find
Code:
</aside>\n</div></body>
Replace
Code:
</aside>\n</ol></body>
That'd change the parent <div> to an <ol>. Note that you'll have to also adjust this in CSS, because InDesign will likely have it in there as div._idFootnotes. If so, you'll have to edit it to ol._idFootnotes, or probably just ._idFootnotes.

After that, I'd do this:

Find
Code:
<aside (id="footnote-\d{1,}")
Replace
Code:
<li \1
Find
Code:
↩</a></p>\n</aside>
Replace
Code:
↩</a></p>\n</li>
You'll have to go back into the CSS again with that to change aside._idFootnote to li._idFootnote, or just ._idFootnote. I attached the basic result, note that I did not bother setting any CSS up here. Again, I wouldn't do it this way unless you can't find a better solution, and I'm sure there is one.
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2022-06-03 at 3.47.23 PM.png
Views:	263
Size:	59.8 KB
ID:	194117  
phillipgessert is offline   Reply With Quote
Old 06-03-2022, 10:27 PM   #12
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,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by phillipgessert View Post
I'm very sure Tex'll have a much better solution than this one, but I figured I'd come back anyway since I said I would.
Thanks for the steps.

I'll hold off until I see the actual EPUB.

... buttttttt, if I had to do something quickly:

Rough Solution #1: ... If it was me, I'd probably pull the numbers out of the:

Code:
#footnote-025-backlink"></a>
but that all depends if the numbers in those IDs match the actual number in the text itself.

If it does, great, it's easier.

If it doesn't, things get a little trickier.

- - - - - -

Side Note: Most likely, the ID numbers InDesign generates are off-by-one or more:
  • "#footnote-025" in the HTML = the actual footnote 24

- - - - - -

Rough Solution #2: You could use Doitsu's "Incremental IDs" plugin.

1. Renumber all the IDs to match whatever ## the book displays.

2. Get those numbers into the text itself.

Quote:
Originally Posted by phillipgessert View Post
That'd change the parent <div> to an <ol>. Note that you'll have to also adjust this in CSS, because InDesign will likely have it in there as div._idFootnotes. If so, you'll have to edit it to ol._idFootnotes, or probably just ._idFootnotes.
I can't recall seeing much thorough testing on <ol> footnotes.

Does anyone know how well this works across devices? (Especially older ones?)

In EPUBs, I always avoided <ol> for lists because of:
  • All the auto-numbering issues.
    • Starting from non-1 numbers.
    • Different alphabets.
    • What happens when you get a '*' footnote?
  • Not being able to handle complicated numbering/formatting schemes.

A lot of that stuff may work on the web, where you have many more updated browsers... but in the land of ebooks, that kind of complicated code would be... extremely unreliable.

This why people like me + Hitch always recommend inserting the numbers into the text itself. It's the only reliable way to get it working 100% across all devices/formats.

For more info, see lots of the discussion in:

where I picked apart Google Docs's <ol> footnote abominations.

Side Note #2: If you want even more fun with complicated footnotes/endnotes, see the discussion where I broke down a Winston Churchill ebook:

The beast had ~5000 endnotes and ~300 footnotes.

Endnotes were displayed as "1" and footnotes were displayed as "fn1".

It's definitely one of those complicated examples where Print book numbering ≠ Ebook.

Side Note #2.1: I also wonder how <ol> would handle that when it starts reaching 5000!!! lol.

Quote:
Originally Posted by phillipgessert View Post
note that I did not bother setting any CSS up here. Again, I wouldn't do it this way unless you can't find a better solution, and I'm sure there is one.
Yep, probably just some fiddly setting in InDesign.

That's where I would look first.

One of those checkboxes we mentioned may fix this numbering oddity.

Side Note: Personally, for my footnotes, I just throw away all the InDesign crap and redo everything to human-readable, clean stuff. :P

Last edited by Tex2002ans; 06-03-2022 at 10:37 PM.
Tex2002ans is offline   Reply With Quote
Old 06-08-2022, 09:25 PM   #13
Kyriosity
Member
Kyriosity began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Mar 2020
Location: Moscow, Idaho
Device: Kindle Previewer, Kindle for PC, Kindle
Thank you all so much! Turned out to be a corrupted file, so I was able to just rebuild it in a new file and that solved the problem!
Kyriosity is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pop-up footnotes in sideloaded kepubs gone AWOL in fw 4.0.7523 jackie_w Kobo Developer's Corner 6 09-25-2016 12:48 PM
[AWOL] Context menu: Alter title text case Sabardeyn Calibre 8 06-26-2014 12:04 AM
False Refuge: AWOL Crime Noir Steve Anderson Self-Promotions by Authors and Publishers 11 05-26-2011 05:29 PM
Is there a hack for displaying page numbers rather than location numbers? nesler Kindle Developer's Corner 16 02-15-2011 12:00 AM
Book Designer: Make LRF Option is AWOL JEMelby Sony Reader 6 07-28-2007 12:20 PM


All times are GMT -4. The time now is 10:15 AM.


MobileRead.com is a privately owned, operated and funded community.