![]() |
#1 |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
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. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,264
Karma: 23661992
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. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
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.
|
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,264
Karma: 23661992
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.
|
![]() |
![]() |
![]() |
#5 |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
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?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,264
Karma: 23661992
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. |
![]() |
![]() |
![]() |
#7 | |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,264
Karma: 23661992
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. |
![]() |
![]() |
![]() |
#9 |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
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.
|
![]() |
![]() |
![]() |
#10 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,686
Karma: 134319572
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
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.
|
![]() |
![]() |
![]() |
#11 | |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
Sorry, we cross-posted. What's the property inherited from?
Quote:
![]() |
|
![]() |
![]() |
![]() |
#12 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,264
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#13 | |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#14 |
Jeffrey A. Carver
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,355
Karma: 1107383
Join Date: Aug 2008
Location: Massachusetts, USA
Device: Lenovo Yoga Tab Plus, Droid phone, Nook HD+
|
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. |
![]() |
![]() |
![]() |
#15 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,264
Karma: 23661992
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> |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |