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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-18-2012, 09:48 PM   #1
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
Strange Bug in Kindle Formatting - pls help

My epub file that was created in Sigil validated and I successfully uploaded it to Amazon for the Kindle.

However, after purchasing the Kindle book to view it, I noticed that there was some formatting problem:

On the page the eBook opens up to when you click on the book title, there's this code at the top:
justify">Part I: Overview

I have no idea what that -- justify>" is doing there. It shows up in 2 different Kindle readers I have and when I checked it on my iPad, the "justify>" isn't there, but the Part I: Overview is in normal
size font when it has a header tag. It also is in normal font in the Kindle, despite there being a header tag there.

The strange thing is when you click on "Part I: Overview" from the TOC, it shows up normally - normal header font size and no -- justify">

Also, if you go to the preceding page or the page after Part I: Overview, then go back to the Part I: Overview page, it appears normal. It only shows the bug when you open the book and when you click 'go to beginning'.

This bug didn't show up on the original upload to Kindle. It only did when I re-uploaded it after the changes were made.

Any idea what may be causing this and what I can do about? Unfortunately, the problem doesn't show up in the Kindle Previewer that you can download to your computer. And oddly, even though the book is supposed to open to the TOC page (as it does in the Kindle Previewer), in the actual Kindle book that has the bug, it opens to that Part I: Overview page.

Any help would greatly be appreciated. I have my header tags from
the stye.css file in the epub file below.

Thanks!

h1, h2 , h3, h4, h5 {
text-align:justify;
text-indent:0;
margin-top:0;
font-style: normal;
}
traveler212 is offline   Reply With Quote
Old 06-19-2012, 02:34 AM   #2
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 3,476
Karma: 9127314
Join Date: Dec 2010
Device: Kindle PW2
This is a known issue. See DiapDealer's answer in this thread.
Doitsu is offline   Reply With Quote
Old 06-19-2012, 11:27 AM   #3
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
Thanks, but it's not the same problem as the other poster. Similar, but different.

Here's the tag for the part that is showing the -- justify">Part I: Overview

<h2 id="pI">Part I: Overview</h2>

But, the same html tags are not causing a problem anywhere else in the book. It's just on this page that the book opens to. And if you click on the Part I: Overview from the TOC, the header tag displays normally (bold and large font size). It's only when you open the book and when you click "go to beginning."

Any other ideas anyone?
traveler212 is offline   Reply With Quote
Old 06-19-2012, 12:57 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 14,776
Karma: 81353584
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by traveler212 View Post
But, the same html tags are not causing a problem anywhere else in the book. It's just on this page that the book opens to. And if you click on the Part I: Overview from the TOC, the header tag displays normally (bold and large font size). It's only when you open the book and when you click "go to beginning."
The "Go To Beginning" functionality is achieved by having either a Text or Start reference item in the guide section of the ePub's OPF file. If that reference item contains something like "href='somefile.html#pI'"... then it could very easily be the same issue as all other cases of "there's bits of html code showing up in my mobi when I navigate." You just can't have hrefs pointing to anchors that are IDs inside of html block elements. It will get you in trouble with MOBI files every time (they're perfectly fine in ePubs that will never be turned into MOBIs).

Also... I would highly recommend doing the conversion to MOBI yourself and uploading that to Amazon... rather than hoping their conversion of your ePub will result in an error-free MOBI.

Last edited by DiapDealer; 06-19-2012 at 01:33 PM.
DiapDealer is offline   Reply With Quote
Old 06-19-2012, 02:12 PM   #5
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
Here's what's in the content.opf file:

<guide>
<reference href="Text/cover.xhtml" title="Cover" type="cover" />
<reference href="Text/toc.xhtml" title="Table Of Contents" type="toc" />
<reference href="Text/toc.xhtml" title="Start" type="text" />
<reference href="Text/author.xhtml" title="Text" type="text" />
</guide>

Ironically, in the Kindle Previewer that you download to your computer, my eBook opens to the TOC page (which is what it's coded to do). And in the Kindle Previewer, this error doesn't show up.

However, on a real Kindle when the book is purchased and downloaded, the book opens up to the Part I: Overview page. Not sure why.

Here's the html code on the Part I: Overview page:

<body>
<h2 id="pI">Part I: Overview</h2>

the header tags are used the same throughout the eBook without any other problems (Part II, Part III, etc.). It's just that Part I: Overview page that has the bit of html code:
justify">Part I: Overview

And, if I access that Part I: Overview page from the TOC, it displays without any errors. And if I page forward or page back to that Part I: Overview page, it also doesn't display any errors.

When viewing it on the iPad (Kindle app), the html code doesn't show. However, the Part I: Overview is in regular font size and isn't bolded, when it should be in <h2> size. However, as when viewing it on a regular Kindle reader, when you access the Part I: Overview page from the TOC on an iPad, it displays normally. Same as when you page forward or page back to the Part I: Overview page.
traveler212 is offline   Reply With Quote
Old 06-19-2012, 02:35 PM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 14,776
Karma: 81353584
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
My guess is there's some confusion over the guide items that Kindlegen is having trouble resolving satisfactorily. I've never tried building a MOBI where the "toc" reference item and the "start" reference item pointed to the same html page (probably not an issue though). In addition, Kindlegen uses the "start" OR the "text" item to create the point that a book opens to when first being read. There's never any need to have both a "start" AND a "text" item in a MOBI source ePub. There can be only one start point, after all.

I would be tempted to get rid of the "<reference href="Text/author.xhtml" title="Text" type="text" />" line and see if that solves the problem. Either that, or I would create a one page frontmatter/title page that the "start/text" item (just one not both) pointed to that's then followed immediately by the TOC page that the "toc" reference item points to (in addition to removing the extraneous "text" entry).

Also note that Kindlegen doesn't recognize/use the "Cover" reference item (it will usually strip a cover xhtml page, in fact). So I'd shoot for a guide section that looks something like:
Code:
<guide>
  <reference href="Text/fmatter.xhtml" title="Start" type="start" />
  <reference href="Text/toc.xhtml" title="Table Of Contents" type="toc" />
</guide>

Last edited by DiapDealer; 06-19-2012 at 03:11 PM.
DiapDealer is offline   Reply With Quote
Old 06-19-2012, 06:18 PM   #7
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
Forgot to mention that the html code that shows (justify">) is not even anywhere in my epub file. That html code doesn't exist, which adds to the mystery.

The other strange thing is why the Kindle book opens to the Part I: Overview page to begin with given the TOC page is the start page. In the Kindle Previewer, it correctly opens to the TOC page.
traveler212 is offline   Reply With Quote
Old 06-19-2012, 06:28 PM   #8
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
Here's the sequence of the start of the book:
Cover
Copyright Page
TOC
Message from the Author page
Part I: Overview

Here's what's in the content.opf file:

<guide>
<reference href="Text/cover.xhtml" title="Cover" type="cover" />
<reference href="Text/toc.xhtml" title="Table Of Contents" type="toc" />
<reference href="Text/toc.xhtml" title="Start" type="text" />
<reference href="Text/author.xhtml" title="Text" type="text" />
</guide>

I wonder why it would skip to starting at the Part I: Overview page - perhaps this is all tied together - maybe it has a problem with the TOC listed as the start page and the author page listed underneath it as the 'Text' page...? And then for some reason it skips to the Part I: Overview page as the start page...but what the (justify">) is doing there is hard to figure.

And if it has a problem with the start page, you would think it would show the same issue in the Kindle Previewer...
traveler212 is offline   Reply With Quote
Old 06-19-2012, 06:41 PM   #9
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 3,476
Karma: 9127314
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by traveler212 View Post
Forgot to mention that the html code that shows (justify">) is not even anywhere in my epub file. That html code doesn't exist, which adds to the mystery.
KindleGen hard-codes stylesheet definitions. I.e. text-align:justify; in the css becomes <h1 align="justify">.
(If you want to see the source code of the compiled .mobi file, install DiapDealer's mobiunpack Calibre plugin and unpack your compiled .mobi file with Calibre.)

Quote:
Originally Posted by traveler212 View Post
The other strange thing is why the Kindle book opens to the Part I: Overview page to begin with given the TOC page is the start page. In the Kindle Previewer, it correctly opens to the TOC page.
That most likely happened because you defined your TOC both as "toc" and "text" and you also defined the author page as "text." Usually, only the first page of the first chapter is defined as "text" (or "start").
For more information on recommended guide items see this article.
Doitsu is offline   Reply With Quote
Old 06-19-2012, 06:55 PM   #10
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 14,776
Karma: 81353584
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by traveler212 View Post
Forgot to mention that the html code that shows (justify">) is not even anywhere in my epub file. That html code doesn't exist, which adds to the mystery.
It's not a mystery at all. The "justify" code is coming from the style that you have assigned to all h2 tags with the following CSS (like Doitsu posted while I was typing ):

Code:
h1, h2 , h3, h4, h5 {
text-align:justify;
text-indent:0;
margin-top:0;
font-style: normal;
}
The MOBI format doesn't support CSS at all. So when your epub is being converted into MOBI, the CSS gets translated (as best it can) into HTML 3.2-like attributes.

So after your ePub's html gets run through Kindlegen, your '<h2 id="pI">Part I: Overview</h2>' (styled with the above CSS) becomes something like:

Code:
<p height="0pt" width="0pt" align="justify"><font size="6"><b>Part I: Overview</b></font></p>
in the actual internal MOBI markup code.

Quote:
And if it has a problem with the start page, you would think it would show the same issue in the Kindle Previewer...
It's not all that strange that a software emulator might render a few things slightly different than the actual devices/apps do.

Like I said; if you don't like surprises... don't upload ePubs to Amazon and rely on their conversion to be flawless. Upload MOBIs that you've built and verified yourself before-hand.

Last edited by DiapDealer; 06-19-2012 at 07:19 PM.
DiapDealer is offline   Reply With Quote
Old 06-19-2012, 07:29 PM   #11
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
OK, thanks guys.

Tomorrow, I will try it with these changes to the guide section and see if this fixes it:

<guide>
<reference href="Text/cover.xhtml" title="Cover" type="cover" />
<reference href="Text/toc.xhtml" title="Table Of Contents" type="toc" />
<reference href="Text/author.xhtml" title="Text" type="text" />
</guide>

So the book should open to the 'author' page, correct?

Can I have both title="Text" and type="text" in the author reference line?

Last edited by traveler212; 06-19-2012 at 07:44 PM. Reason: typo
traveler212 is offline   Reply With Quote
Old 06-19-2012, 08:28 PM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 14,776
Karma: 81353584
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by traveler212 View Post
So the book should open to the 'author' page, correct?
It should, yes.
You don't really need the "Cover" reference item either (Kindlegen will ignore it anyway—and likely strip the xhtml file it refers to). That's not what the Kindle (or the apps) uses for its "Go to Cover" functionality. It uses the meta-tag entry and the image itself for that. But it shouldn't hurt anything if you leave it in.
DiapDealer is offline   Reply With Quote
Old 06-20-2012, 10:08 PM   #13
traveler212
Junior Member
traveler212 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2012
Device: Kindle
Those changes to the <guide> section fixed the problem.

Huge thanks, guys! That was bugging me for a week.
traveler212 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
Strange bug in Recipe Highlights Dereks Recipes 2 03-23-2011 11:33 AM
Strange formatting in the viewer paulfiera Calibre 2 12-21-2010 03:22 AM
Firmware Update Found a strange bug in 2.5.3 Pokesomi Amazon Kindle 4 06-21-2010 06:39 PM
Strange formatting on ebook Salinger Sony Reader 2 12-22-2009 06:46 AM
Strange problem with formatting daesdaemar Workshop 9 01-29-2009 06:11 PM


All times are GMT -4. The time now is 01:41 AM.


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