View Full Version : Indents and lines between paragraphs


James_Wilde
12-12-2010, 05:39 PM
Has anyone else experienced strange handling of indents of the first line of a paragraph and/or insertion of a line between paragraphs on different ereaders?

I have an epub file which, as far as I can read from the css file, should display paragraphs with a 1.5em indentation, and no empty line between paragraphs. This is what I intend. It is formatted thus in OpenOffice. Both Calibre and Sigil display it this way. So does Stanza, which is probably the crappiest program for displaying an epub file, and makes a mess of everything else.

Adobe DME displays it instead with an empty line between paragraphs and no indentation. For some reason B&N ereader program refuses to open it.

Of ereaders that I have had it tested on - not a large range yet - the Iriver displays it with a blank line and no indent. So does the Sony 950. The Aluratek Libre Pro displays it with indents and no blank line.

Does anyone know whether some ereaders are hard-coded to present paragraphs in this way, irrespective of the coding in the file?

Adjust
12-12-2010, 05:44 PM
I had this happen a while ago...and the advise I got from this site was it was a problem in the CSS file. It turned out to be the font declaration was missing "". Check your CSS here for any errors...
http://jigsaw.w3.org/css-validator/#validate_by_input+with_options

James_Wilde
12-14-2010, 02:59 AM
Check your CSS here for any errors...
http://jigsaw.w3.org/css-validator/#validate_by_input+with_options

Thanks, Adjust. Checked it and found no mistakes - well, something insignificant about namespace h, and a missing semi-colon which wasn't missing...

No change. :(

Toxaris
12-14-2010, 07:41 AM
Could you post an example of your code? I use indents all the time, but no problems on my reader (PRS-300). The CSS code and (part) of the xhtml code would be nice to see if we can find the issue.

theducks
12-14-2010, 10:26 AM
Has anyone else experienced strange handling of indents of the first line of a paragraph and/or insertion of a line between paragraphs on different ereaders?

I have an epub file which, as far as I can read from the css file, should display paragraphs with a 1.5em indentation, and no empty line between paragraphs. This is what I intend. It is formatted thus in OpenOffice. Both Calibre and Sigil display it this way. So does Stanza, which is probably the crappiest program for displaying an epub file, and makes a mess of everything else.

Adobe DME displays it instead with an empty line between paragraphs and no indentation. For some reason B&N ereader program refuses to open it.

Of ereaders that I have had it tested on - not a large range yet - the Iriver displays it with a blank line and no indent. So does the Sony 950. The Aluratek Libre Pro displays it with indents and no blank line.

Does anyone know whether some ereaders are hard-coded to present paragraphs in this way, irrespective of the coding in the file?

Are the any /* comments in */ your style sheet?
any mis-spelled key words and ADE ignores the style completely. Like
font-wait: bold; will kill it, dead
Calibre and Sigil render all the other style attributes... Not ADE

Jellby
12-14-2010, 11:07 AM
any mis-spelled key words and ADE ignores the style completely. Like
font-wait: bold; will kill it, dead

Really? The CSS spec says that any unknown/unsupported keyword should be ignored, but not the whole stylesheet. I know ADE ignores the whole lot if there is some syntax error like a missing semicolon, or a comma instead of decimal point... but a misspelt keyword should be different.

theducks
12-14-2010, 12:42 PM
Really? The CSS spec says that any unknown/unsupported keyword should be ignored, but not the whole stylesheet. I know ADE ignores the whole lot if there is some syntax error like a missing semicolon, or a comma instead of decimal point... but a misspelt keyword should be different.

happens consistently on my device. fix the typo and style now works.

The Spec is not reality :smack:

James_Wilde
12-15-2010, 09:01 AM
Could you post an example of your code? I use indents all the time, but no problems on my reader (PRS-300). The CSS code and (part) of the xhtml code would be nice to see if we can find the issue.

Thanks Toxaris:

I'll dig out the css file and post relevant bits (the font declaration is missing from this example, btw).

@namespace h "http://www.w3.org/1999/xhtml";
.G-fr {
background-color: white;
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
left: 0;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
position: relative;
text-indent: 1.5em
}
.G-fr1 {
background-color: white;
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
text-indent: 1.5em
}
.P-Chapter-header {
background-color: white;
border-bottom: 0;
border-top: 0;
display: block;
font-family: "Times New Roman", serif;
font-size: 1.29167em;
line-height: 100%;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 3.0cm;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
page-break-after: auto;
page-break-before: auto;
text-align: center;
text-indent: 1.5em
}
.P-P {
background-color: white;
border-bottom: 0;
border-top: 0;
display: block;
font-family: "Times New Roman", serif;
font-size: 1em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
text-indent: 1.5em
}
.P-P1 {
background-color: white;
border-bottom: 0;
border-top: 0;
display: block;
font-family: "Times New Roman", serif;
font-size: 2em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
text-indent: 1.5em
}
.P-P10 {
background-color: white;
border-bottom: 0;
border-top: 0;
display: block;
font-family: "Times New Roman", serif;
font-size: 1em;
line-height: 100%;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
text-indent: 1.5em
}

more of the same...

.S-T {
background-color: white;
color: #000;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0
}
.S-T1 {
background-color: white;
font-family: "Times New Roman", serif;
font-size: 1.54839em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0
}
.S-T10 {
background-color: white;
color: #000;
font-size: 1em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0
}
.S-T11 {
background-color: white;
color: #000;
font-size: 1em;
font-weight: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0
}

more of the same...

.calibre {
background-color: white;
display: block;
font-size: 1em;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
page-break-before: always
}
.calibre1 {
background-color: white;
display: table-row;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
vertical-align: middle
width: 10.0cm
}
.calibre2 {
background-color: white;
display: table-cell;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 1px;
padding-left: 1px;
padding-right: 1px;
padding-top: 1px;
text-align: inherit;
vertical-align: inherit
}
.calibre3 {
background-color: white;
display: block;
height: auto;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
width: auto
}


One thing I notice is that the last line in each paragraph is missing the semi-colon, but since it is the last line, I assume that the closing bracket does the trick.

And a bit of a chapter file so you can see how they are used:

<body class="calibre">
<p class="P-Chapter-header" id="calibre_pb_4">Chapter 1</p>

<p class="P-P10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lennart Persson was not a typical Swede. He was not 185 centimetres tall, or six foot one, as the English still call it, in spite of forty years of war with the metric system. He was not blond haired although he was blue eyed. Nor was he much interested in athletic activities. For him walking was something you did to get somewhere you couldn't drive, and jogging was something you did to catch a bus. And his interests were for the most part intellectual, which did nothing for his figure.</p>

<p class="P-P10">&nbsp;&nbsp;&nbsp;Not that he was fat. But he was perhaps a little more stockily built than was compatible with his 172 centimetres, or five foot eight and a bit, as his English colleagues would say. His body was very nearly cylindrical, with only his belt to give him a waistline. Notwithstanding his general disdain for athletic activities, he did work out occasionally with his workmates, and he played squash on the company squash ladder, where he occupied a satisfactory place in the lower half, known as 'wimps and women', but with no hope, and not even a serious dream of making the top half, called 'mucho macho'.</p>

<p class="P-P10">&nbsp;&nbsp;&nbsp;In one sense, he was quite typically Swedish. He ate well. Not “well” in the sense of being a good trencherman, who groaned when he stood up from the table, but “well” in the sense of avoiding white bread and sugar, and almost never eating at McDonald's. He was a great fan of sushi, as, surprisingly, were most of his colleagues.</p>


Incidentally I've taken out all the &nbsp; statements from all files. They were put in gratuitously by Open Office, and made a ragged column of indents.

Another thing, all statements in the css file ask for indents which are 1.5 em, but I was getting 1.5 cm.

I think that's all, but I've probably forgotten something... :o

Toxaris
12-15-2010, 01:58 PM
Get rid of the &nbsp; stuff. Further more there is a lot of redundant stuff in your css. Make it more simple. Put the following in the css:

p.indent
{
text-indent: 15pt;
line-height: normal;
margin: 0;
}

And then you're paragraph like:

<p class="indent">Text to see if there is an indent</p>

If everything is as it should, the test text is indented. If you want to have it for all the paragraphs, remove the .indent in the CSS and the class="indent" in the xhtml.

If you need more in the CSS, add it part by part.

James_Wilde
12-16-2010, 04:50 AM
Thanks, Toxaris:

Don't blame me for the complicated css. Blame calibre. There are more P definitions than a dog's got fleas. Although actually, thinking about the gratuitous &nbsp; that Open Office added, maybe it's at that stage that things look ugly, and calibre just try's to make sense of the nonsense.

I have to take up the gratuitous &nbsp; entries with OOo later.

frabjous
12-16-2010, 10:39 AM
Thanks, Toxaris:

Don't blame me for the complicated css. Blame calibre.

I blame the evils of WYSIWYG -- I think you'd end up with fewer CSS categories if Styles were used more consistently in OOo rather than direct formatting commands, before converting to calibre, but that's very difficult to do well with a WYSIWYG word processor. (One reason I don't use 'em if I can possibly help it.)

I'm curious what happens if you just remove the entire CSS file from the ePub. How does it look then?

I'm not suggesting that as a long term solution -- more as a diagnostic to help you figure out where the problem is.

Toxaris
12-17-2010, 05:08 PM
I agree, that same problem arises when you export via Word. You end up with a lot of CSS-stuff which is totally obsolete. Long live regexp to remove the stuff.

James_Wilde
12-17-2010, 06:21 PM
I'm curious what happens if you just remove the entire CSS file from the ePub. How does it look then?

I'm not suggesting that as a long term solution -- more as a diagnostic to help you figure out where the problem is.

Sounds interesting - in the Chinese sense. Maybe I'll try it when I'm finished formatting my book.

The idea of using styles more consistently sounds good. Too many of my problems have their source in bits I cut and pasted, and got the wrong style as a result.