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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-25-2010, 08:53 AM   #1
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
How to do centering

I have RTF files with book and chapter heads centered. When converting with calibre they change to flush left. Is there a way to do centering in my options or should I learn to like left justified titles?
sjohnson717 is offline   Reply With Quote
Old 02-25-2010, 03:12 PM   #2
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,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use extra css
kovidgoyal is offline   Reply With Quote
Advert
Old 02-26-2010, 08:32 AM   #3
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
OK, I hear you but...

I'm using Microsoft Word to create an RTF file like this:
Test heading 1 (this is style Heading 1 in Word)
Test heading 2
paragraph text text text
(The heading 1 & 2 are formatted centered).

I added this CSS to the converter:
H1 { text-align: center }
H2 { text-align: center }

The text formatting comes through but the text is still left aligned.

What am I doing wrong? I suspect that Word is the culprit but I can't see how they internally encode styles.
sjohnson717 is offline   Reply With Quote
Old 02-26-2010, 08:38 AM   #4
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
When I save the RTF file as HTM, this is what results:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Author" content="Steve Johnson">
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.25">
<style type="text/css">
p.p1 {margin: 12.0px 0.0px 3.0px 0.0px; text-align: center; font: 16.0px 'Times New Roman'}
p.p2 {margin: 12.0px 0.0px 3.0px 0.0px; text-align: center; font: 14.0px 'Times New Roman'}
p.p3 {margin: 0.0px 0.0px 10.0px 0.0px; font: 12.0px Cambria}
</style>

</head>
<body>
<p class="p1"><b>Test heading 1</b></p>
<p class="p1"><b>Part 1</b></p>
<p class="p2"><b><i>Test heading 2</i></b></p>
<p class="p2"><b><i>Chapter 2</i></b></p>
<p class="p3">Test text text text<span class="Apple-converted-space"> </span></p>
</body>
</html>


Thoughts?
sjohnson717 is offline   Reply With Quote
Old 02-26-2010, 12:51 PM   #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,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
So convert the HTML and you should be fine.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-26-2010, 07:37 PM   #6
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,198
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
@sjohnson

I use Word all the time to create my HTML files for Calibre.

If you style your headings with the built-in styles "Heading 1", "Heading 2", etc your output HTML should be translated to

<h1>...</h1> where you used "Heading 1"
<h2>...</h2> where you used "Heading 2" ... and so on

<p class=MsoNormal>...</p> where you used "Normal"
<p>...</p> where you used "Normal(Web)"

You can then reference h1, h2, p and p.MsoNormal in your Calibre Extra CSS during conversion if you need to.

Also make sure you save as Web-filtered to avoid much of the MS excess baggage tags.
jackie_w is offline   Reply With Quote
Old 02-27-2010, 07:59 AM   #7
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
Thanks. That worked. Saving the RTF as a HTM file puts the correct H1 H2 settings and now headings are centered.

But Jackie, how do I now manage my files? I have an RTF (source) saved as a HTM (copy) which I manually add to Calibre, which converts it to a Zip. When I edit the file (eg, for typos) must I edit the RTF, delete the HTM and ZIP and manually re-add them?
sjohnson717 is offline   Reply With Quote
Old 02-27-2010, 12:58 PM   #8
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,198
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by sjohnson717 View Post
But Jackie, how do I now manage my files? I have an RTF (source) saved as a HTM (copy) which I manually add to Calibre, which converts it to a Zip. When I edit the file (eg, for typos) must I edit the RTF, delete the HTM and ZIP and manually re-add them?
It depends. Personally, I keep a backup source (away from calibre) for all my books. For any book I've needed/wanted to edit, which started life as RTF, DOC, TXT (and sometimes PDF, LIT) I keep only my updated HTML.
  1. If you think you will only need to make minor changes from now on, I would throw away the RTF and keep the HTML as the backup source. If you need to do minor re-edits (e.g.typos) it's easy enough to load the HTML file into a text editor to make the changes. Or, if you prefer you can reload the HTML into MSWord then re-save as Web(filtered) when you're done. Then re-import the new HTML into calibre.
  2. However, if you know you may still have a lot of edits to do then I would save the file, firstly as DOC (rather than RTF), and secondly as HTML Web(filtered). Then proceed as in 1. If you need to do more edits, edit the DOC file then re-save as HTML. You can store this intermediate DOC file in calibre as an extra format for the same book if you wish to store it there.

So I suppose I'm saying, once I've decided to edit the RTF it serves no further purpose.

The reason I keep my HTML as a backup source is that I think calibre makes changes to it during the import/zip process (someone correct me if I'm wrong). I choose not to apply my re-edits to the ZIP (although I suppose you could edit typos easily enough). I don't think any changes (other than file rename) are made to other filetypes (e.g. LIT, PDF, TXT, EPUB, DOC, RTF etc).

Anyway there's some things for you to consider. There is no "right" way.

P.S. I should have added to my first post, in case you don't know already. Once you have the h1, h2 etc headings in your calibre HTML/ZIP you can use them in your conversion process for Chapter detection and to create a nice TOC in your EPUB.
jackie_w is offline   Reply With Quote
Old 02-27-2010, 03:02 PM   #9
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
Thanks for your reply. I guess I was thinking that I'd like to have one editable source file. I'd be willing for it to be doc, rtf, htm but none alone seems to do the job. So I'll take your suggestion and keep the HTML. Alas, I'll need to delete the Zip file containing the HTML, edit, the re-add the HTML file manually each time.
sjohnson717 is offline   Reply With Quote
Old 02-27-2010, 03:29 PM   #10
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by sjohnson717 View Post
Alas, I'll need to delete the Zip file containing the HTML, edit, the re-add the HTML file manually each time.
I have some new code that may solve your "Alas." I'll be sending it in this weekend.

Basically, it uses the author and title from any book you try to add, searches the Calibre database to find that book, and if it exists, adds the format of the new book to the existing record (or creates a new record if it does not).

It's intended to deal with bulk adding of ebooks, but it's perfect for keeping a copy that you edit and improve. Just drag and drop the improved copy and it will find the matching ebook record and replace the old copy of the same format.

You could even keep a whole folder of books, work on some of them whenever you felt like it, then drag/drop all of them whenever you felt like it (or use any of the other Add books tools).
Starson17 is offline   Reply With Quote
Old 02-27-2010, 03:38 PM   #11
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
That may be the ideal solution. Look forward to downloading a new version of this excellent program. Thanks for all your efforts.
sjohnson717 is offline   Reply With Quote
Old 02-27-2010, 04:01 PM   #12
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by sjohnson717 View Post
That may be the ideal solution. Look forward to downloading a new version of this excellent program. Thanks for all your efforts.
Thanks really go to Kovid, not me. I've just tried to add a bit to this wonderful program in repayment. Mostly I've copied Kovid's existing code, making tiny tweaks to the logic. With luck, some of those tweaks prove useful to others.

I'm in the last half of a very long project to import my ebook collection from the last 20 years. This has given me a pretty good feel for the problems encountered in adding books and metadata to Calibre. Everything I've written has been to address a problem I've personally encountered multiple times. Although it's taken me a long time to learn the rudiments of Python and explore the Calibre codebase, in the long run, the changes I've made have sped things up for me, even with all the time I've spent on coding.

Now I'm back to entering ebooks.
Starson17 is offline   Reply With Quote
Old 02-27-2010, 09:39 PM   #13
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,757
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by sjohnson717 View Post
Thanks for your reply. I guess I was thinking that I'd like to have one editable source file. I'd be willing for it to be doc, rtf, htm but none alone seems to do the job. So I'll take your suggestion and keep the HTML. Alas, I'll need to delete the Zip file containing the HTML, edit, the re-add the HTML file manually each time.
I was thinking that it would be nice to be able to Mark a format in the Meta data editor (or option the first single format imported) as "Master".
Then watch for ( file time-stamp) changes and ask at reader upload time, if you want to sync the other (to be uploaded) format.
(a Master format icon would get a Star or something to mark it visually)
theducks is online now   Reply With Quote
Old 02-28-2010, 07:57 AM   #14
sjohnson717
Member
sjohnson717 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2008
Device: Amazon Kindle, Apple iPad
Let's look at a use scenario: I have 200+ books in RTF format. When reading the book on Kindle I find a typo. Because I'm anal, I want to fix the typo. I'd like to go into Calibre, open the source file, change the typos, save, and rebuild the epub output.

Today I have to open in Word, save the RTF, then save as HTML, then manually add the HTM to calibre which converts it to a Zip file, and then convert to ePub or Mobi.

I'd be willing to use another source file format (such as HTML) but I still have the Zip problem.

If I convert the RTF file, I don't get centering. If I convert to HTML, I get centering but now I have added a file management problem with a source file, plus a couple of interim files (HTM and ZIP), before I get to an output file.
sjohnson717 is offline   Reply With Quote
Old 02-28-2010, 08:30 AM   #15
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: 73,841
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by sjohnson717 View Post
Let's look at a use scenario: I have 200+ books in RTF format. When reading the book on Kindle I find a typo. Because I'm anal, I want to fix the typo. I'd like to go into Calibre, open the source file, change the typos, save, and rebuild the epub output.

Today I have to open in Word, save the RTF, then save as HTML, then manually add the HTM to calibre which converts it to a Zip file, and then convert to ePub or Mobi.

I'd be willing to use another source file format (such as HTML) but I still have the Zip problem.

If I convert the RTF file, I don't get centering. If I convert to HTML, I get centering but now I have added a file management problem with a source file, plus a couple of interim files (HTM and ZIP), before I get to an output file.
Seems like the best solution is to convert the RTF to ePub, clean up the ePub and then convert the ePub to Mobipocket. Then if you do find any errors, you can go into the ePub and fix them very easily and convert once again back to Mobipocket. It's all quite easily done with Calibre.
JSWolf 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
Centering blockquotes ghostyjack ePub 6 07-17-2014 06:07 AM
Centering PDF nguirado Amazon Kindle 5 10-04-2010 08:45 PM
Centering and adjusting the width of a block Jellby ePub 3 04-09-2009 12:38 PM
centering images with css override? Amalthia Calibre 2 03-30-2009 01:53 PM
Bookdesigner - Centering Title Author... davers Workshop 7 01-12-2009 04:21 PM


All times are GMT -4. The time now is 11:06 AM.


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