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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-11-2011, 08:47 PM   #1
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Very disappointed with ePub to mobi conversion

This will be a longish post, so please bear with me.

The background to the questions that I'm going to ask is:
- I prepare all my ePub ebooks by hand from XHTML 1.1 strict files and an external stylesheet, and modify the content.opf and toc.ncx files accordingly. The XHTML and style sheet validate to W3C standards, and the ePubs validate with ePubCheck.
- I am working on a text-book for an academic. The book is quite complex with many long quotes and footnotes. Some of the quotes are nested - the author quotes himself quoting someone else.
- I have prepared an ePub version which I think looks good on my Sony PRS 650 - there are indented margins for the quotes and further indented margins for the nested quotes, and the footnote numbers are styled so that the numbers have a smaller font and they align with the top of the text.

But when I try to convert this ePub to mobi, and in the mobi version:
- The first level quotes are not indented at all.
- The nested quote left margin is indented too much, and the right margin is not indented from the right edge of the screen at all.
- The footnote numbers are not in a smaller size, and are made into superscripts - so they intrude into the line space above and force it to be wider. This looks bad enough when viewed with Kindle for PC, and awful when it is viewed on my ECO Reader (a Hanlon clone)
- Blocks of text which I have given wider margins for emphasis are flush with the left edge
- The ePub version has a sans-serif font, but the mobi version has a serif font.

Let me repeat that I know that the XHTML and ePub are valid and that the ePub looks good on my Sony. I haven't tried it on my Cybook - I should do that also.

So my questions are:
- Are there some settings for calibre conversions that I have missed which will fix these problems?
- In particular, is there a setting which will get calibre to use my stylesheet and not its own?
- Or are there problems with the mobi format which prevent it from from producing the effects that I (and the author) want? I understand for example that mobi won't indent text in blockquotes if the text is in <p></p> tags.
- And if this is so how on earth can I make a mobi version of the ebook and make it look like the ePub version and still meet W3C standards?

Regards, Alex
AlexBell is offline   Reply With Quote
Old 04-11-2011, 08:57 PM   #2
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Internally MOBI is using HTML. The MOBI HTML is based on HTML 3.2. Things like left and right margins are not supported by MOBI so calibe fakes them using block quotes.

There isn't a whole lot you can do in this case. You're using advanced formatting (margins, fonts...) not supported by MOBI.
user_none is offline   Reply With Quote
Old 04-11-2011, 10:08 PM   #3
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
User_none is correct, but in case the solution isn't clear to you, what you need to do in your epub is to use blockquotes for all the content you want indented in mobi. Nest the blockquotes for multi-level indents. Unfortunately amazon in their infinite wisdom has changed the amount of em margin one blockquote will create, on old school mobi renderers it's about 1.5em per nested quote, the original kindle still honors something around this amount, but modern kindles seem to use 2em or maybe a bit more.

Anyway the net is author your epubs using blockquote instead of div.
ldolse is offline   Reply With Quote
Old 04-12-2011, 12:10 AM   #4
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Quote:
Originally Posted by ldolse View Post
User_none is correct, but in case the solution isn't clear to you, what you need to do in your epub is to use blockquotes for all the content you want indented in mobi. Nest the blockquotes for multi-level indents. Unfortunately amazon in their infinite wisdom has changed the amount of em margin one blockquote will create, on old school mobi renderers it's about 1.5em per nested quote, the original kindle still honors something around this amount, but modern kindles seem to use 2em or maybe a bit more.

Anyway the net is author your epubs using blockquote instead of div.
Thanks, Idolse. I should have made it clear that I have indeed used blockquotes for the first level quotes, and within that blockquote have used a div for the nested quote. As I mentioned above there is no indentation for the first level quote on either side, probably because I've put the text within <p></p> tags.

Do you have any suggestions and the awful looking footnote numbers, or for the fact that the mobi file has a serif font though the ePub file has a sans-serif font?

I'm beginning to think that user_none is right, and it can't be done with mobi. I think I'll go over to the Kindle area and ask how they would do it, or if it can be done anyway.

Regards, Alex
AlexBell is offline   Reply With Quote
Old 04-12-2011, 02:05 AM   #5
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Div for the nested quote definitely won't work, the only way to get the second level quote indented is to also nest it within the blockquote. Multi-level indents are definitely supported in mobi, it's just you have no precise controls on the left margin, and zero controls on the right margin.

Check the second pic in this blog post, using multiple nested blockquotes:
http://kindleformatting.com/blog/200...ip-margins.php

Not sure why the first level didn't get indented though, perhaps you're suspicion about <p> tags is correct, you could try removing those. The only other possibility is that the conversion engine may have been changed recently, Kovid has implemented a number of changes in epub to mobi conversion due to a large number of users complaining about everything being indented based on the old logic of converting css margins to mobi blockquotes.

You might be able to get a better idea if this is some issue with Calibre if you convert your problematic mobi back to epub with a debug directory configured, then look in the input directory and there is a file called 'debug-raw.html'. Check this file and see what the code around your problem quotes is. You might want to post that section of code from the original epub and from the resultant mobi to epub debug back here, one of us may be able to provide some more input then.
ldolse is offline   Reply With Quote
Old 04-12-2011, 02:10 AM   #6
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Regarding footnote numbers I believe you need to use the <sub> or <sup> tags, which are now deprecated, but this is what mobi expects, and I believe it's still legal in epub even if it's deprecated.

For the font there is certainly a way to do it, but I'm no expert on how to get mobi to use a specific font. Someone may have an idea in the mobi sub-forum, there may also be some other detail on the kindleformatting link I posted before.
ldolse is offline   Reply With Quote
Old 04-12-2011, 04:36 AM   #7
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Thanks again, Idolse. I appreciate you taking the time to respond. But I'm afraid we are going to have to agree to disagree on your suggestions.

I used to dabble in website design, and have become quite rigid about the importance of having the HTML validate. It may well be that putting the text directly in a blockquote without paragraph tabs would make it indent for mobi ebooks. But it certainly wouldn't validate, and very likely would not work for ePubs anyway.

So far as the <sup> tags are concerned the whole point of my efforts in styling the footnote numbers was to make sure that they did not project above the other characters and force a wider line space. Even if <sup> is legal I didn't use it for that reason. My objection to what calibre did is that it over rode my styling, and imposed a style of its own whose result is ugly.

Similarly, I'm not that fussed about what what font appears in the book. But I am annoyed that calibre ignored what I went to some trouble to style. It may be that I am asking things of calibre which it isn't designed to do.

Your suggestion about the debug option is worth thinking about, but given that the HTML worked for ePub I'm reluctant to dumb it down just for mobi.

Thanks again for your help, Alex
AlexBell is offline   Reply With Quote
Old 04-12-2011, 05:19 AM   #8
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
I wasn't trying to suggest that you construct invalid html, more that the mobi format itself does a lot of things that are considered invalid in modern web coding. I wasn't actually aware that text inside a blockquote must be included inside it's own block level element to validate. I always use <p> tags within my blockquotes as well, but I don't focus on the mobi format aside from helping users out here.

If that's the case you may want to try using a combination of divs and blockquotes, e.g.:

Code:
<blockquote>
     <div>First level indent</div>
          <blockquote>
               <div>Second level indent</div>
          </blockquote>
</blockquote>
Edit: I just tried this and it doesn't work with the 'ignore margins' option. Calibre deletes all blockquotes if ignore margins is enabled. Without the ignore margins option it does work. The problem I foresee here is that Calibre might add css margins to the existing blockquotes, not sure - this might be why you saw an unacceptable level of indentation...

As far as the superscript goes, you're probably just running into another basic limitation of mobi authoring, I'm guessing if you go the debug route you'll find that Calibre already converted the css to <sup> inside the mobi.

The font serif issue is more than likely a bug/missing feature in mobi conversion. You should probably open a bug.

Unfortunately getting the best Mobi conversions often involves dumbing down the code... As mobi is still wildly popular because of the Kindle that conversion code is well maintained. However it's all reverse engineered since Amazon doesn't properly document the format or even follow html 3.2 standards; it's improved as specific suggestions are made. If you go the debug route and do further research on what mobi expects for some of these cases then those suggestions can be made and potentially implemented. For what it's worth, based on forum reports Calibre generally does a better job converting then Amazon's own Kindlegen.

Last edited by ldolse; 04-12-2011 at 05:55 AM.
ldolse is offline   Reply With Quote
Old 04-12-2011, 05:35 AM   #9
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Some further reading.
Superscripts:
https://www.mobileread.com/forums/sho...d.php?t=102455

Mobi Tags:
http://www.mobipocket.com/dev/articl...TagRef_OEB.htm

Based on the list of supported tags maybe you can use something like:
Code:
<a..><sup><small>1</small></sup></a>
Edit - tested this a bit too, <small> doesn't work but that epub linked below shows you a variety of different superscript styles, some convert to mobi better than others...

You can also apply your own styles to the <sup> tags in the epub to precisely control your styling in the epub, recognizing that it's not going to be quite as good in the mobi. Check this post:
https://www.mobileread.com/forums/sho...0&postcount=70

Last edited by ldolse; 04-12-2011 at 06:23 AM.
ldolse is offline   Reply With Quote
Old 04-12-2011, 06:42 AM   #10
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Since calibre is not a eBook publishing suite I think it might be best to create mobi books using tools and methods provided by Amazon. Here is a PDF of the Amazon Kindle Publishing Guidelines that I found on this page.

Converting mobi to ePub is most likely less problematic.
DoctorOhh is offline   Reply With Quote
Old 04-12-2011, 06:57 AM   #11
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
The problem is that epub is the standard for publishing these days, so I don't think Alex is wrong for using Calibre for the conversion, the fact of the matter is there is no perfect conversion tool for epub to mobi. A number of ebook creators that are publishing to Amazon report that Amazon's own Kindlegen is worse in most aspects compared to Calibre, and to get a decent conversion they use Calibre, then Mobiunpack, and then Mobipocket Creator to gen the final pub-ready version.

I've been doing some further digging since my last post - there seem to be some bugs in Calibre's handling of both font-size and vertical-align css handling for <sup> tags (or any tag using vertical-align:top for that matter). Fixing the vertical-align:top conversion was trivial, but need to do some more digging to figure out how to fix the font size.

Last edited by ldolse; 04-12-2011 at 07:23 AM.
ldolse is offline   Reply With Quote
Old 04-12-2011, 07:55 AM   #12
dwig
Wizard
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 1,613
Karma: 6718479
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Surface Go & Kindle 3 - Retired: DellV8p, Clie UX50, ...
Quote:
Originally Posted by AlexBell View Post
...
I used to dabble in website design, and have become quite rigid about the importance of having the HTML validate. ...
"but it was the very best butter"

Validating the HTML by browser standards is somewhat pointless when the issue is conversion to MOBI. You're not displaying this HTML in a browser, but using a tool to build a MOBI file. The HTML must be valid by the standards of the tool you choose to use for the conversion.
dwig is offline   Reply With Quote
Old 04-12-2011, 08:49 AM   #13
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by dwig View Post
Validating the HTML by browser standards is somewhat pointless when the issue is conversion to MOBI. You're not displaying this HTML in a browser, but using a tool to build a MOBI file. The HTML must be valid by the standards of the tool you choose to use for the conversion.
EPUB does have a standard and uses XHTML. To be a valid EPUB the HTML should be valid XHTML.

It sounds like the OP needs the file in both EPUB and MOBI. It is easier to start with XHTML which easily turns into EPUB then transform that into MOBI than the other way around.

As for displaying in a browser, Thats what many EPUB readers use for rendering.
user_none is offline   Reply With Quote
Old 04-13-2011, 01:42 AM   #14
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Thanks again to you all.

I'm not doing too well I'm afraid. I thought of bypassing the whole HTML issue by using Mobipocket Creator which accepts Word input, but I don't have Microsoft Office on my computer - I use Open Office, and the import fails.

And I thought of asking for advice on the Kindle forum, but the moderator moved my post here.

Regards, Alex
AlexBell is offline   Reply With Quote
Old 04-13-2011, 01:45 AM   #15
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by AlexBell View Post
And I thought of asking for advice on the Kindle forum, but the moderator moved my post here.
That explains how that second post appeared.
DoctorOhh 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
calbre conversion epub to mobi dragonflies Conversion 4 01-24-2011 12:17 AM
epub to mobi conversion hangs clittle Calibre 7 12-12-2010 09:32 AM
epub to mobi conversion problem. lutwey Calibre 0 09-18-2010 11:51 AM
ePub to Mobi Conversion Quality Logiedan Calibre 8 08-17-2010 04:02 PM
Epub to Mobi conversion MichaelGray Calibre 2 08-12-2010 01:08 PM


All times are GMT -4. The time now is 05:08 AM.


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