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 08-18-2012, 02:42 AM   #1
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Centered lines and conversion to epub

I've used Calibre to format quite a few books (exporting from Word as filtered html and importing the html into Calibre). I've finally locked horns with a problem I've kind of been ignoring for a while: centered lines often do not display correctly in epubs direct from Calibre. The problem is the reading software treating the centered lines as though they are indented, so that the centered text is a little to the right of center. I first noticed it on the Nook, and in Aldiko on Android. I believe I've seen it in ADE, as well.

The problem starts with Word's export, which (even if you're very careful in defining your Word styles) does not specify "text-indent: 0" in centered styles. The solution, as I've learned, is to add that line to every style in the CSS stylesheet that's centered. I've started doing that with Sigil, after converting to epub. It's a picky job, prone to error, and maddeningly time consuming--especially if you have to go through repeated iterations as you discover errors to fix. It also seems like it should be unnecessary.

Some reading software is smart enough to center text when the style says align center. But since a lot aren't smart enough, I wonder if Calibre could be, instead.

Would it be possible to incorporate in the conversion a check for centered styles, and the addition of the "text-indent: 0" line in all styles that call for center alignment? It would save a heap of fiddly work afterward, and make the books look better.
starrigger is offline   Reply With Quote
Old 08-18-2012, 02:54 AM   #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: 25,619
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's certainly possible to do this, but I'm not sure its a good idea. Doing it would be making calibre insist that any element which is aligned center have no text indent. That is not always correct. text-indent applies to only the first line of an element. So someone could, for some reason want to affect the indentation of the first line in a centered block. I cant think of a reason why they would want to do this, but experience has taught me that someone, somewhere will

It should be relatively simple to create a plugin (or add an option to the modify epub plugin) to do this to an existing epub witha couple of clicks.
kovidgoyal is online now   Reply With Quote
Old 08-18-2012, 03:12 AM   #3
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Thanks, Kovid. I guess I assumed it would be the kind of thing one could select with a check box, much as one now can check to add an indentation. So those wild and crazy guys who want their centered text off-center for some reason could opt out.
starrigger is offline   Reply With Quote
Old 08-18-2012, 03:48 AM   #4
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: 25,619
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This is the kind of specialist tweak that I dont want to start adding options to the calibre conversion for. I try to keep the options in the conversion dialog as generally applicable as possible.
kovidgoyal is online now   Reply With Quote
Old 08-18-2012, 10:13 AM   #5
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
I understand. In that case, it seems to me that far more people are likely to want their centered text to actually appear centered, than not, yes?
starrigger is offline   Reply With Quote
Old 08-18-2012, 11:53 AM   #6
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: 25,619
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Then they should center their text in the input document, without an indent.

What you are asking for is that calibre make a destructive change to the document during conversion. Therefore that change needs an option to turn it on. And that option is only relevant to people whose input documents specify a text-indent for centered paragraphs where they are not wanted. Adding options for every little tweak like this is not a sustainable strategy.
kovidgoyal is online now   Reply With Quote
Old 08-18-2012, 01:24 PM   #7
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Quote:
Originally Posted by kovidgoyal View Post
Then they should center their text in the input document, without an indent.

What you are asking for is that calibre make a destructive change to the document during conversion. Therefore that change needs an option to turn it on. And that option is only relevant to people whose input documents specify a text-indent for centered paragraphs where they are not wanted. Adding options for every little tweak like this is not a sustainable strategy.
No, that's not it. The text exported from Word is created without an indent. Explicitly designed that way in the Word style: text-indent: 0. But the Word-generated html is silent on the indent (in the CSS), despite calling for centered text. The Word export algorithm apparently assumes that centered implies no indent, and so does not say so explicitly. It's a deficiency, but understandable: a reasonable default for centered text in the CSS, is centered across the width of the page, not with the first line weirdly indented.

Calibre leaves it that way, silent on the indentation--and some software (like the more recent ibooks app) is smart enough to assume, in absence of an actual indent command, that the text should be truly centered. Other software, like Nook and Aldiko, assume that every first line should be indented, regardless of alignment, unless explicitly told otherwise. That, to me, is dumb--but that's the way they seem to work. And I've seen many books in Nook and Aldiko with faulty centering.

I'm asking that Calibre make allowance for that particular design deficiency by making explicit what can reasonably be assumed to be implied by the term center aligned.
starrigger is offline   Reply With Quote
Old 08-18-2012, 03:03 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: 25,619
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Unfortunately, the text-indent property is inherited, which means that the assumption that word makes that not setting a text-indent on an individual element is equivalent to text-indent:0 is not actually true. And if calibre enforced that, then it could potentially break the layout in a document produced by someone who, correctly (unlike Word), assumes that not setting text-indent does not imply that text-indent is zero.

What I'm saying is that adding text-indent:0 to an elements style changes that style in a potentially destructive fashion, even in the presence of text-align:center. That change may well be desired in a majority of cases, but it should not be applied automatically. And as I said before I'm not willing to create a new option for this.
kovidgoyal is online now   Reply With Quote
Old 08-18-2012, 03:05 PM   #9
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Come to think of it, when I looked at the original CSS in the epub, the only styles that had lines specifying text-indent were the ones that actually wanted an indent. So if Calibre looked for a centered style, and added the text-indent: 0 line only where no other indent specification was given, it wouldn't affect the style in a case where someone actually requested a first-line indent.
starrigger is offline   Reply With Quote
Old 08-18-2012, 03:20 PM   #10
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: 36,464
Karma: 17660776
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
If you look at your ePub under the hood, you will find a lot of mess. Use Sigil (after first turning off Tidy) to fix up the mess Word made of your ePub.
JSWolf is offline   Reply With Quote
Old 08-18-2012, 03:21 PM   #11
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Quote:
Originally Posted by kovidgoyal View Post
Unfortunately, the text-indent property is inherited,
Sorry, we cross-posted. What's the property inherited from?

Quote:
Originally Posted by kovidgoyal View Post
And as I said before I'm not willing to create a new option for this.
Well, it's your program, obviously. And I know (now) how to fix it after the fact. But I do think it would add to the usefulness of the program, if you ever change your mind. Because a lot of people use Calibre who are not necessarily comfortable with going in and messing with the CSS of a finished ebook. And to me, it seems like a noticeable deficiency--not in Calibre, but in the Word/Calibre/reading-software system. Any one of the three could address the deficiency, but I don't have a good way to ask the developers of Word or the reading software.
starrigger is offline   Reply With Quote
Old 08-18-2012, 03:39 PM   #12
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: 25,619
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by starrigger View Post
Sorry, we cross-posted. What's the property inherited from?
Any ancestor of the element.
kovidgoyal is online now   Reply With Quote
Old 08-18-2012, 03:44 PM   #13
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Quote:
Originally Posted by JSWolf View Post
If you look at your ePub under the hood, you will find a lot of mess. Use Sigil (after first turning off Tidy) to fix up the mess Word made of your ePub.
I don't know what Tidy is, but it's in Sigil that I've made these fixes. (Just learning it.) And to be honest, I don't see that much mess from Word. Most of it's fairly clean, if you export to filtered html. And the results, overall, are pretty good.

Here's the thing. In my experience, making an ebook, even with good help, involves repeated iterations of building, finding things to fix, and rebuilding. If you have to go in and re-re-retweak everything after each build, it's just not worth the hassle.

My point in bringing up this particular issue is that it seems (to me) like one place where repeated retweaking should not be required.
starrigger is offline   Reply With Quote
Old 08-18-2012, 03:50 PM   #14
starrigger
Jeffrey A. Carver
starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.starrigger ought to be getting tired of karma fortunes by now.
 
starrigger's Avatar
 
Posts: 1,352
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Galaxy Tab 10.1, Nook HD+, and Windows Phone
Quote:
Originally Posted by kovidgoyal View Post
Any ancestor of the element.
You mean, say, a centered style based on Normal? Or a centered style based on "Normal No Indent"? I can't see in the attributes where the ancestor is indicated. Here's one:

.Scenebreak {
display: block;
font-family: "Times New Roman", "serif";
font-size: 1em;
line-height: 1.2;
margin-bottom: 3pt;
margin-left: 0;
margin-right: 0;
margin-top: 6pt;
text-align: center;
text-indent: 0
}

(I added the indent 0 line.) I know, in Word, that it's based on Normal, with certain other elements defined, such as no indent, centering, and spacing above and below. But I can't tell that from looking at this part of the CSS.
starrigger is offline   Reply With Quote
Old 08-18-2012, 03:54 PM   #15
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: 25,619
Karma: 4998447
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I mean any ancestor of the tag that the style is being applied to.

<div style="text-indent:2em">
<div>
<p style="text-align:center">This para will also have text-indent</p>
</div>
</div>
kovidgoyal is online now   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
How to adjust table spacing/lines in Calibre conversion? mischko Calibre 5 03-02-2012 09:43 AM
Blank Lines in MOBI-Conversion ulrichbi Conversion 3 01-19-2012 04:50 AM
Empty lines in epub without apparent reason sinusLog Conversion 6 09-30-2011 01:19 AM
Lines became paragraphs after .lit to .mobi conversion Piper_ Calibre 11 09-19-2010 05:11 PM
.epub hyperlinks, centered and non indented text. Xabache ePub 2 09-13-2010 01:11 PM


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


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