Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-27-2010, 05:14 AM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
From ODT to EPUB with love

I open a new thread because I will probably have some questions to ask about this topic.

I enjoy producing ebooks with OpenOffice. I usually upload some of them to MobileRead in PDF and ODT formats and I am considering using EPUB as well.

These books have a basic structure: Title with heading 1, Part with heading 2, Chapter with heading 3 . I usually insert a TOC with hyperlinks. I use no more than these three hierarchical levels.

Question

I want to obtain a TOC in my output EPUB file which will represent these three hierarchical levels.

Which XPath or whatever mysterious text must I write here? (see joint photo). Please provide me with the full line of text to insert in this place.

Are there any basic recommendations to prepare my ODT file for EPUB output ?
Attached Thumbnails
Click image for larger version

Name:	X.png
Views:	589
Size:	14.9 KB
ID:	46608  
roger64 is offline   Reply With Quote
Old 02-27-2010, 10:39 PM   #2
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Well, I went back to read the fine calibre usermanual about this fine expression (see photo above).

The full comment is here:

"This expression is rather complex, because it tries to handle a number of common cases simulataneously (simultaneously?). What it means is that calibre will assume chapters start at either <h1> or <h2> tags that have any of the words (chapter, book, section or part) in them or that have the class=”chapter” attribute.

Comment

As OO accepts usually one line for "Title", to get undertandable TOCs, I usually skips "chapter" names, (for me "chapitre"). This is one thing.

Question

So I would ask, how to insert some "class="chapter" attributes in my ODT file?
What's that? Is it dangerous?
roger64 is offline   Reply With Quote
Advert
Old 02-28-2010, 08:29 AM   #3
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
I follow on my studying (sorry I go slowly), still looking for a nice TOC generation in EPUB.

I tested some conversions from ODT to EPUB with test files.
I can generate a TOC (all have the same level) from heading + a name like chapter. Well, this way I get a basic TOC. We can do better.

The surprising thing is that the footnotes are all sent at the end of the book and have an hyperlink. This is NICE, if somewhat surprising.

Later, I will ask how to center my images...

Question
I have read that in the xhtml that calibre use as input, there is a possibility to insert some options like:
Level 1 TOC : //h:h1
Level 2 TOC : //h:h2
Level 3 TOC : //h:h2
As I do not see this xhtml file, I would like to know how and where to let calibre know I would like to use these options. I tried to write this in the calibre GUI to no avail.
roger64 is offline   Reply With Quote
Old 02-28-2010, 09:10 AM   #4
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Well, if there is a newbie who wants to know, after some fiddling I finally found how to generate a hierarchical TOC in EPUB from a ODT file using calibre.

Just see photo in attachment. It's working. This damned //h:h2

Wish you goodnight.

Solution
Attached Thumbnails
Click image for larger version

Name:	toc.png
Views:	750
Size:	26.6 KB
ID:	46774  

Last edited by roger64; 02-28-2010 at 09:14 AM.
roger64 is offline   Reply With Quote
Old 03-01-2010, 06:32 AM   #5
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Though I did not receive too many answers up to now, it may happen..
Guru, where are you?

I am quite busy creating epub from odt files thru calibre.
I just discovered thru w3school the magic world of CSS and extra.css.
I used these rules with good effect
.endnote {font-size:10px;}
p {line-height:1.4;}


question

I would like to use an extra.css rule to get centered images.
Now the images are set on the left side.

Thank you for any reply.
roger64 is offline   Reply With Quote
Advert
Old 03-01-2010, 06:45 AM   #6
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
Quote:
Originally Posted by roger64 View Post
Though I did not receive too many answers up to now, it may happen..
Guru, where are you?

I am quite busy creating epub from odt files thru calibre.
I just discovered thru w3school the magic world of CSS and extra.css.
I used these rules with good effect
.endnote {font-size:10px;}
p {line-height:1.4;}


question

I would like to use an extra.css rule to get centered images.
Now the images are set on the left side.

Thank you for any reply.
hi roger, i guess all the guru were away for the weekend.

for centered images, you can try this css code :

.center {text-align : center;}

however you will have to add it to the images within the code, like this :

<div class="center"><img alt="" src="../images/img0002.jpg" /></div>

i don't know if there is a way to automatise this in calibre... (gurus ??) but you can use sigil to edit your epub files and modify the code as you like.
zelda_pinwheel is offline   Reply With Quote
Old 03-01-2010, 07:14 AM   #7
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Thanks Zelda. You are indeed a guru.

Too bad, there seems to be no clear cut solution lile adding another basic extra.css rule just to do it.

I am not considering at that time to use another editor for this. I am already off limits.
Processing manually the code is also already beyond my today abilities.

When googling, I found an "old" recommendation from Kovid about it that I did not understand: to insert somewhere

<div style="text-align:center">
<img>
</div>


I tried to use it as a extra css rule but it did not work.
roger64 is offline   Reply With Quote
Old 03-01-2010, 02:26 PM   #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,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you center the image in openoffice it should be centered in the resulting EPUB as well. Is that not the case?
kovidgoyal is offline   Reply With Quote
Old 03-02-2010, 09:03 AM   #9
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by kovidgoyal View Post
If you center the image in openoffice it should be centered in the resulting EPUB as well. Is that not the case?
No. On my Sony they are stuck on the left side.

I send you my test file -could be smaller- with two images plus one cover.
Attached Files
File Type: epub Revue Hispanique - Marion.epub (81.1 KB, 360 views)
File Type: zip Revue Hispanique - Marion.odt.zip (89.2 KB, 336 views)

Last edited by roger64; 03-02-2010 at 09:11 AM. Reason: sending odt file as well
roger64 is offline   Reply With Quote
Old 03-02-2010, 12:09 PM   #10
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,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Open a ticket and attach the files, I can't keep track of forum posts.
kovidgoyal is offline   Reply With Quote
Old 03-02-2010, 07:44 PM   #11
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
OK Thanks I'll do that.
roger64 is offline   Reply With Quote
Old 03-04-2010, 04:15 AM   #12
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
First I need to apologize, I sent my ticket, I messed horribly and sent, all in all, four tickets. It was my first ticket but a good one....

I have time to study the little quirks encountered while converting odt to epub. Here are the main remaining ones.

Images
I already spoke about the small non centered images.
Another visualization defect is the following: I send one image which takes all the width of the screen but only half of the height.
What I get is only a central part of this image, full screen and with an -of course- bad resolution.
Is this normal?? Am I missing something

serif Font
I wish to obtain Times New Roman, serif on my epub
I get it on a small file (80 kb) but NOT on a big one (1.5 MB)
TNR is of course part of the original odt file.
I use the following extra.css rule with calibre
body {font-family:"Times New Roman", Times, serif;}
Any tip?

Numbering
Strange results, but better leave it for now.

Somebody has any info how to solve these questions?
roger64 is offline   Reply With Quote
Old 03-04-2010, 06:52 AM   #13
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
About the serif font.

I renamed my epub file to zip, opened it, and had a look a the stylesheet.css file with a text editor (gedit with Linux). It was a pretty long one but I quickly realized that close to Times New Roman there was always written sans-serif.

I searched and replaced 22 occurences of sans-serif with serif, saved and made a new epub.

But when I opened the file on my PRS-505? it was declared "invalid file"...

Had a good dinner then.
Except dinner, any idea?
roger64 is offline   Reply With Quote
Old 03-04-2010, 11:27 PM   #14
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
About the serif font

I think there is a mistake in the converting process of calibre.

Opening the stylesheet.css in my epub, I found 22 occurences of font-family, Times New Roman, sans-serif.

sans-serif provokes in fact a change of police.

I used tweak_epub.exe (works with Wine; info for Linux users) to search and replace all occurences of sans-serif with serif, and this time it worked well (this is tricky). I got a real TNR with serif on my epub file.

question

can somebody give me the extra.css rule for increasing the space between the lines of text? I get nothing with line-height...
roger64 is offline   Reply With Quote
Old 03-05-2010, 12:58 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 roger64 View Post
question

can somebody give me the extra.css rule for increasing the space between the lines of text? I get nothing with line-height...
I have used line height on my prs-505 with success.

Code:
p {
line-height: 110%
}

div {
line-height: 110%
}
This though isn't with extra css it is with my style.css file controlling the fontin fonts I installed on my machine for epubs using the PRS+ hack.
DoctorOhh is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The problem of ODT in ePub Linwood Calibre 0 08-24-2010 09:08 AM
Odt to ePub chapter link errors Chrysanthemum Calibre 8 07-15-2010 09:24 PM
.odt 2 .epub renareto Calibre 4 02-11-2010 03:26 PM
Converting ODT to EPUB/LRF banjomike Calibre 2 10-03-2009 04:32 PM


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


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