Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2020, 11:43 PM   #1
123iamking
Junior Member
123iamking began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Sep 2020
Device: Kindle Paperwhite (2nd gen)
Writing inline footnotes for html to mobi conversion using calibre

Hi,
I'm using Calibre 4.9.1. I was so close archiving footnote, but there is still bug that prevent me from having the perfect footnote, here is what I've done so far:
Quote:


I've figured it out. To make the inline footnote works, must put the footnotes in the "Footnotes" section. Here is the example:

I have the file: "HDN is the best.html"

Code:
<html>
<head>
    <title>HDN is the best</title>
</head>

<body>
<h1>Best of HDN</h1>
<p><sup><a id='fs-1' href='#ft-1'>[1]</a></sup> HDN is the best</p>
<p><sup><a id='fs-2' href='#ft-2'>[2]</a></sup> HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>

<h1>Footnotes</h1><br>
<sup><a id='ft-1' href='#fs-1'>[1]</a></sup> It's true.<br>
<sup><a id='ft-2' href='#fs-2'>[2]</a></sup> It's double true.<br>

</body>
</html>
There, just convert the file "HDN is the best.html" and see for yourself.

Now here is the tip: when you convert this file "HDN is the best.html" to mobi file, Calibre may count footnotes as chapters, that'd be a mess for your table of content. So you need to prevent Calibre from doing this by using the cmd (using the option --toc-threshold 0) instead of using UI, here is the cmd:

Code:
ebook-convert.exe "E:\temp\TempMisc\HDN is the best.html" "E:\temp\TempMisc\HDN is the best.mobi" --toc-threshold 0
location of ebook-convert.exe is .\[Your installed Calibre folder]\Calibre\ebook-convert.exe

Note: this tested and work on my Kindle Paperwhite (second generation), but doesn't work on Kindle app for my iPhone. But it's good enough for me because I read mainly on Kindle Paperwhite.
So here is my problem:
1. On my iPhone: These inline footnotes don't work on Kindle app for my iPhone. It treats all my footnotes as links (doesn't popup but take me to footnotes)
2. On my Kindle Paperwhite: There are links that aren't footnotes, but my Kindle Paperwhite treats them at footnotes. For example, I have this html code:
Code:
<h1>Genesis</h1>

<a href='../toc.html#toc'>(return to table of contents)</a>
<br>
<a href='#c-0'>1</a> • <a href='#c-1'>2</a> • <a href='#c-2'>3</a> • <a href='#c-3'>4</a> • <a href='#c-4'>5</a> • <a href='#c-5'>6</a> • <a href='#c-6'>7</a> • <a href='#c-7'>8</a> • <a href='#c-8'>9</a> • <a href='#c-9'>10</a> • <a href='#c-10'>11</a> • <a href='#c-11'>12</a> • <a href='#c-12'>13</a> • <a href='#c-13'>14</a> • <a href='#c-14'>15</a> • <a href='#c-15'>16</a> • <a href='#c-16'>17</a> • <a href='#c-17'>18</a> • <a href='#c-18'>19</a> • <a href='#c-19'>20</a> • <a href='#c-20'>21</a> • <a href='#c-21'>22</a> • <a href='#c-22'>23</a> • <a href='#c-23'>24</a> • <a href='#c-24'>25</a> • <a href='#c-25'>26</a> • <a href='#c-26'>27</a> • <a href='#c-27'>28</a> • <a href='#c-28'>29</a> • <a href='#c-29'>30</a> • <a href='#c-30'>31</a> • <a href='#c-31'>32</a> • <a href='#c-32'>33</a> • <a href='#c-33'>34</a> • <a href='#c-34'>35</a> • <a href='#c-35'>36</a> • <a href='#c-36'>37</a> • <a href='#c-37'>38</a> • <a href='#c-38'>39</a> • <a href='#c-39'>40</a> • <a href='#c-40'>41</a> • <a href='#c-41'>42</a> • <a href='#c-42'>43</a> • <a href='#c-43'>44</a> • <a href='#c-44'>45</a> • <a href='#c-45'>46</a> • <a href='#c-46'>47</a> • <a href='#c-47'>48</a> • <a href='#c-48'>49</a> • <a href='#c-49'>50</a>
<h1 id='c-0'><a href='#'>Genesis 1</a></h1>
When convert to mobi file, my Kindle treats the links: "1 • 2 • 3 • 4 • 5 • 6 • 7 • 8 • 9 • 10 •" as footnotes, in my Kindle Paperwhite, I see these number is right below the text "(return to table of contents)".
So I really want to know how to properly make inline footnotes for html to mobi conversion using calibre, maybe there is a special id for footnotes?
Thanks for reading.
123iamking is offline   Reply With Quote
Old 09-20-2020, 12:19 AM   #2
123iamking
Junior Member
123iamking began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Sep 2020
Device: Kindle Paperwhite (2nd gen)
According to Amazon Text Guidelines
Quote:
Footnote Guidelines

Amazon strongly recommends marking footnotes with the HTML5 aside element, together with the epub:type attribute. This allows accessible reading systems to ignore the footnotes except when followed by their referents and allows any reading system to handle them more intelligently (e.g., as popups). This usage ensures that even if the EPUB semantic is not recognized, the notes will still be treated as secondary content due the nature of the HTML5 aside element.

Regardless of whether the aside element is used, Amazon requires formatting footnotes with bidirectional hyperlinks (the text is linked to the footnote and the footnote is linked back to the text). This makes it easier for customers to return to the text after viewing the footnote. On some Kindle devices, such as Kindle Paperwhite, footnotes with bi-directional hyperlinks are displayed in a pop-up.

For a better reading experience, Amazon strongly recommends placing the footnote text at the end of the chapter or book.

Define footnotes using either of the following methods:

Method 1 (preferred):
Code:
<p>This footnote example uses the aside element with the epub:type attribute and bi-directional hyperlinks.<sup><a id="source" href="#ft-1-1" epub:type="noteref">1</a></sup></p>

...

<aside id="ft-1-1" epub:type="footnote">

<p><a epub:type="noteref" href="#source">1.</a> This is the footnote text, which should be placed at the end of the chapter or book.</p>

</aside>
Method 2:
Code:
<p>This footnote example uses bi-directional hyperlinks only. <sup><a href=>footnotes.html#fn1" id="r1">[2]</a></sup></p>
...
<p id="fn1"><a href="chapter01.html#r1">2.</a> This is the footnote text, which should be placed at the end of the chapter or book.</p>
If your book includes footnotes or endnotes without numbers or symbols, Amazon recommends creating a single link from the note to the relevant text in the book.

Example:
Code:
<p>This example describes an <a id="fn1"/>event that happened.</p>
...
<p><a href="chapter01.html#fn1">event that happened</a> This is the endnote text, which provides a reference for the details of the event.</p>
I follow the Method 1, then convert to mobi file, but still not working on Kindle app for iPhone? What am I missing?
123iamking is offline   Reply With Quote
Old 09-20-2020, 12:35 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Convert to azw3 not mobi
kovidgoyal is offline   Reply With Quote
Old 09-20-2020, 03:24 AM   #4
123iamking
Junior Member
123iamking began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Sep 2020
Device: Kindle Paperwhite (2nd gen)
Quote:
Originally Posted by kovidgoyal View Post
Convert to azw3 not mobi
I tried to send azw3 file to Kindle app on iPhone, but I can't:
According to Send to Kindle by E-mail:
Quote:
Supported File Types:

Microsoft Word (.DOC, .DOCX)
HTML (.HTML, .HTM)
RTF (.RTF)
JPEG (.JPEG, .JPG)
Kindle Format (.MOBI, .AZW)
GIF (.GIF)
PNG (.PNG)
BMP (.BMP)
PDF (.PDF)
PDFs can be converted to the Kindle format so you can take advantage of functionality such as variable font size, annotations, and Whispersync. To have a document converted to Kindle format (.azw), the subject line should be "convert" when e-mailing a personal document to your Send-to-Kindle address.
Maybe I can send the AZW file, but Calibre can't convert to AZW.

and about
Quote:
Originally Posted by 123iamking View Post
...
2. On my Kindle Paperwhite: There are links that aren't footnotes, but my Kindle Paperwhite treats them at footnotes.
...
Is there any way I can tell my Kindle Paperwhite that those links are not footnotes? I tried many things (eg. I changed "1 • 2 " to "Genesis 1 • Genesis 2 ", but it doesn't work).
123iamking is offline   Reply With Quote
Old 09-20-2020, 04:14 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use a USB cable to send files to the kindle, or convert to joint mobi which will contain the azw3 and the old style mobi in it.
kovidgoyal is offline   Reply With Quote
Old 09-20-2020, 04:51 AM   #6
123iamking
Junior Member
123iamking began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Sep 2020
Device: Kindle Paperwhite (2nd gen)
Quote:
Originally Posted by 123iamking View Post
...
2. On my Kindle Paperwhite: There are links that aren't footnotes, but my Kindle Paperwhite treats them at footnotes. For example, I have this html code:
Code:
<h1>Genesis</h1>

<a href='../toc.html#toc'>(return to table of contents)</a>
<br>
<a href='#c-0'>1</a> • <a href='#c-1'>2</a> • <a href='#c-2'>3</a> • <a href='#c-3'>4</a> • <a href='#c-4'>5</a> • <a href='#c-5'>6</a> • <a href='#c-6'>7</a> • <a href='#c-7'>8</a> • <a href='#c-8'>9</a> • <a href='#c-9'>10</a> • <a href='#c-10'>11</a> • <a href='#c-11'>12</a> • <a href='#c-12'>13</a> • <a href='#c-13'>14</a> • <a href='#c-14'>15</a> • <a href='#c-15'>16</a> • <a href='#c-16'>17</a> • <a href='#c-17'>18</a> • <a href='#c-18'>19</a> • <a href='#c-19'>20</a> • <a href='#c-20'>21</a> • <a href='#c-21'>22</a> • <a href='#c-22'>23</a> • <a href='#c-23'>24</a> • <a href='#c-24'>25</a> • <a href='#c-25'>26</a> • <a href='#c-26'>27</a> • <a href='#c-27'>28</a> • <a href='#c-28'>29</a> • <a href='#c-29'>30</a> • <a href='#c-30'>31</a> • <a href='#c-31'>32</a> • <a href='#c-32'>33</a> • <a href='#c-33'>34</a> • <a href='#c-34'>35</a> • <a href='#c-35'>36</a> • <a href='#c-36'>37</a> • <a href='#c-37'>38</a> • <a href='#c-38'>39</a> • <a href='#c-39'>40</a> • <a href='#c-40'>41</a> • <a href='#c-41'>42</a> • <a href='#c-42'>43</a> • <a href='#c-43'>44</a> • <a href='#c-44'>45</a> • <a href='#c-45'>46</a> • <a href='#c-46'>47</a> • <a href='#c-47'>48</a> • <a href='#c-48'>49</a> • <a href='#c-49'>50</a>
<h1 id='c-0'><a href='#'>Genesis 1</a></h1>
When convert to mobi file, my Kindle treats the links: "1 • 2 • 3 • 4 • 5 • 6 • 7 • 8 • 9 • 10 •" as footnotes, in my Kindle Paperwhite, I see these number is right below the text "(return to table of contents)".
...
I figured it out, the reason why my Kindle Paperwhite treats "1 • " as footnotes because the code
Code:
<a href='#c-0'>1</a> •
Code:
<h1 id='c-0'><a href='#'>Genesis 1</a></h1>
As you can see, "1 • " links to "Genesis 1", and "Genesis 1" links back to "1 • ", so my stupid Kindle Paperwhite thinks "1 • " is footnotes. If I remove link of "Genesis 1" like this:
Code:
<h1 id='c-0'>Genesis 1</h1>
then the link of "1 • " works as it should be.
123iamking is offline   Reply With Quote
Old 09-20-2020, 05:03 AM   #7
123iamking
Junior Member
123iamking began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Sep 2020
Device: Kindle Paperwhite (2nd gen)
Quote:
Originally Posted by kovidgoyal View Post
Use a USB cable to send files to the kindle,
I don't know if iPhone allow USB cable to copy books into Kindle app.

Quote:
Originally Posted by kovidgoyal View Post
or convert to joint mobi which will contain the azw3 and the old style mobi in it.
I prefer this solution, but what is "joint mobi"?
Code:
ebook-convert.exe "E:\HDN.html" "E:\HDN.joint-mobi???" --toc-threshold 0
I see your Faq has list of supported formats:
Quote:
Input Formats: AZW, AZW3, AZW4, CBZ, CBR, CBC, CHM, DJVU, DOCX, EPUB, FB2, FBZ, HTML, HTMLZ, LIT, LRF, MOBI, ODT, PDF, PRC, PDB, PML, RB, RTF, SNB, TCR, TXT, TXTZ

Output Formats: AZW3, EPUB, DOCX, FB2, HTMLZ, OEB, LIT, LRF, MOBI, PDB, PMLZ, RB, PDF, RTF, SNB, TCR, TXT, TXTZ, ZIP
123iamking is offline   Reply With Quote
Old 09-20-2020, 06:31 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://manual.calibre-ebook.com/gen...mobi-file-type
kovidgoyal is offline   Reply With Quote
Old 09-21-2020, 12:16 AM   #9
123iamking
Junior Member
123iamking began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Sep 2020
Device: Kindle Paperwhite (2nd gen)
Ok, here is my test (failed though)
I have the file "HDN.html"
Code:
<html>
<head>
    <title>HDN is the best</title>
</head>

<body>
<h1>Best of HDN</h1>
<p>This footnote example uses the aside element with the epub:type attribute and bi-directional hyperlinks.<sup><a id="source" href="#ft-1-1" epub:type="noteref">1</a></sup></p>

<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>
<p>HDN is the best</p>

<h1>Footnotes</h1><br>
<aside id="ft-1-1" epub:type="footnote">
<p><a epub:type="noteref" href="#source">1.</a> This is the footnote text, which should be placed at the end of the chapter or book.</p>
</aside>

</body>
</html>
I use the convert cmd:
Code:
ebook-convert.exe "E:\HDN.html" "E:\HDN.mobi" --toc-threshold 0 --mobi-file-type both
I can't use "--mobi-file-type new", because "Send to Kindle" will reject my mobi file if I use "new", I have to use "both".
But in the end, this won't help, the Kindle app on iPhone still not recognize the inline footnote, but still treats it as link.
Well, I guess I have to accept it, at least I can make it work on my Kindle Paperwhite.
123iamking is offline   Reply With Quote
Old 09-21-2020, 07:34 AM   #10
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by 123iamking View Post
I can't use "--mobi-file-type new", because "Send to Kindle" will reject my mobi file if I use "new", I have to use "both".
But in the end, this won't help, the Kindle app on iPhone still not recognize the inline footnote, but still treats it as link.
The Kindle for iOS app does not support KF8 (azw3) format so even if you create a file that has both old and new formats, the old MOBI format part of it will be used on iOS devices.
jhowell is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub to mobi conversion - no footnotes Percivale Conversion 5 10-21-2015 07:31 PM
Inline footnotes - solved? Kamikuza Kindle Formats 64 09-19-2014 10:21 AM
Right-to-left writing, conversion to mobi problem. alexandrelm Conversion 1 10-25-2012 12:08 PM
Problem with html -> Mobi conversion - html tags visible. khromov Calibre 9 08-06-2011 11:25 AM
clean HTML or PDF before mobi conversion in Calibre mark235 Calibre 9 12-25-2010 09:37 PM


All times are GMT -4. The time now is 04:18 AM.


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