Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 04-02-2022, 02:41 AM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
p+p indent flaky

I've see a few books using this CSS:

p{margin:0;text-align:justify;}
p+p{text-indent:1.4em;}


This idea being that the first para of a section after a heading was unindented, as it should be, the following indented.

And this works in epub readers. But when converted to AZW3 and loaded in a Kindle (PW3 with 5.10.3) I found it erratic. Every few pages a paragraph would be unindented. Checking the source, the paras were all <p>.

Also, if I changed the fontsize, reflowed the text, often the para in question would become indented.

So is this a bug in the AZW3 or is the Kindle renderer itself buggy? Has this been fixed in later versions?

In any case, I'm giving up using this "+" trick as unreliable.

Last edited by AlanHK; 04-02-2022 at 02:52 AM.
AlanHK is offline   Reply With Quote
Old 04-02-2022, 06:04 AM   #2
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,060
Karma: 89198465
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
I use two styles in the wordprocessor, a a flush first paragraph for after any centred item and an an indented style for all others. That works perfectly. I never have to edit HTML or CSS of books converted from docx to epub2.

If it's an existing ebook using same style for all paragraphs I copy that CSS and have one with indent and one without. Then for any centred styles I search for the close of centred style tag & the paragraph defualt tag/style and replace. Very quick.

Works on Amazon's conversion from epub2 to mobi, azw3 & KFX and also for epub2 conversion to Dual Mobi for Smashwords.
Quoth is offline   Reply With Quote
Advert
Old 04-03-2022, 02:06 AM   #3
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Quoth View Post
I use two styles in the wordprocessor, a a flush first paragraph for after any centred item and an an indented style for all others.
That's what I've always done.
But I came across a few books that use the p+p trick and thought it was useful and made a simpler code.

However, it just does not work reliably in Kindle, so I reverted to explicitly setting each para's style.

Code:
p {margin:0; text-indent:1.4em; text-align:justify;}
.first {margin-top:1.5em; text-indent:0;}
Putting the indent in the base style so the great majority of text is just <p>
all other p styles have to set indent to 0.
AlanHK is offline   Reply With Quote
Old 04-03-2022, 04:46 AM   #4
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: 75,307
Karma: 133361584
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
This is what I use. The hr is the section break marker. It works in ePub, KF8, Mobi, KePub, and KFX.

Code:
hr {
  margin-top: 1em;
  margin-right: 40%;
  margin-bottom: 0.9em;
  margin-left: 40%;
  border-top: 2px solid;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
.noindent {
  text-indent: 0
}
Code:
<p>Last line of the section</p>
<hr/>
<p class="noindent">This is the first line of a new section</p>
JSWolf is online now   Reply With Quote
Old 04-05-2022, 12:16 PM   #5
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by AlanHK View Post
That's what I've always done.
But I came across a few books that use the p+p trick and thought it was useful and made a simpler code.

However, it just does not work reliably in Kindle, so I reverted to explicitly setting each para's style.

Code:
p {margin:0; text-indent:1.4em; text-align:justify;}
.first {margin-top:1.5em; text-indent:0;}
Putting the indent in the base style so the great majority of text is just <p>
all other p styles have to set indent to 0.
Well, to be accurate, you mean, it doesn't work in AZW3, from Calibre. Right? After all, there are several places in that workflow where things could go wonky.

What happens when you take an ePUB that has that working and drop it on KP3, instead?, Then export that as MOBI, and sideload it to your Paperwhite?

Hitch
Hitch is offline   Reply With Quote
Advert
Old 04-05-2022, 03:55 PM   #6
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by AlanHK View Post
I've see a few books using this CSS:

p{margin:0;text-align:justify;}
p+p{text-indent:1.4em;}
I was using that but it's too big of a hammer, even for me. There are times when I want an indent but the previous thing isn't a p, for example, a figure, or a div around whatever, or a blockquote. So now I use
Code:
dl + p,
hr + p,
header + p,
p:first-child {
    margin-top: 1.0em;
    text-indent: 0em;
 }

body p {
    margin: 0;
    padding: 0;
    text-indent: 2em;
}
(I like big fat indents.)

In other words, only specify where you don't want an indent. Also, the logic this way is clearer; saying "no indent for p, but then indent a p when it's after a p" can be confusing for someone looking at your css. With coding/programming it's usually better to make things clear and avoid clever tricks that could be misunderstood or hard to understand.

Last edited by hobnail; 04-05-2022 at 04:01 PM.
hobnail is offline   Reply With Quote
Old 04-05-2022, 04:12 PM   #7
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by hobnail View Post
I was using that but it's too big of a hammer, even for me. There are times when I want an indent but the previous thing isn't a p, for example, a figure, or a div around whatever, or a blockquote. So now I use
Code:
dl + p,
hr + p,
header + p,
p:first-child {
    margin-top: 1.0em;
    text-indent: 0em;
 }

body p {
    margin: 0;
    padding: 0;
    text-indent: 2em;
}
(I like big fat indents.)
OMG, you surely do.

Quote:
(snippage here) With coding/programming it's usually better to make things clear and avoid clever tricks that could be misunderstood or hard to understand.
That's why God, in her infinite wisdom, made CSS commenting.

Hitch
Hitch is offline   Reply With Quote
Old 04-06-2022, 12:04 AM   #8
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by Hitch View Post
That's why God, in her infinite wisdom, made CSS commenting.

Hitch
Yes, that's true. But when the code changes only in an idealized world does everyone keep their comments up to date to match the code. So developing a habit to write clear code without clever tricks is a good strategy for when the comments don't match the code, or if they forget to write comments.
hobnail is offline   Reply With Quote
Old 04-06-2022, 12:14 AM   #9
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by hobnail View Post
Yes, that's true. But when the code changes only in an idealized world does everyone keep their comments up to date to match the code. So developing a habit to write clear code without clever tricks is a good strategy for when the comments don't match the code, or if they forget to write comments.
Sure, but I love me some comments.

Hitch
Hitch is offline   Reply With Quote
Old 04-06-2022, 01:03 AM   #10
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by Hitch View Post
Sure, but I love me some comments.

Hitch
Sure, we all do. I just don't like hacky, clever code, with or without comments. I don't want to have trouble figuring out what the code does and then wonder if it doesn't match the comment.

Last edited by hobnail; 04-06-2022 at 01:12 AM.
hobnail is offline   Reply With Quote
Old 04-06-2022, 09:58 AM   #11
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: 75,307
Karma: 133361584
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 hobnail View Post
I was using that but it's too big of a hammer, even for me. There are times when I want an indent but the previous thing isn't a p, for example, a figure, or a div around whatever, or a blockquote. So now I use
Code:
dl + p,
hr + p,
header + p,
p:first-child {
    margin-top: 1.0em;
    text-indent: 0em;
 }

body p {
    margin: 0;
    padding: 0;
    text-indent: 2em;
}
(I like big fat indents.)

In other words, only specify where you don't want an indent. Also, the logic this way is clearer; saying "no indent for p, but then indent a p when it's after a p" can be confusing for someone looking at your css. With coding/programming it's usually better to make things clear and avoid clever tricks that could be misunderstood or hard to understand.
IMHO, it's easier to do the following...
Code:
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
.noindent {
  text-indent: 0;
}
Then you don't have to figure out all the stuff that can come before an indented p as all you'll need is <p class="noindent">. Problem solved. Plus, it's easier to read the HTML code.
JSWolf is online now   Reply With Quote
Old 04-06-2022, 01:34 PM   #12
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by JSWolf View Post
IMHO, it's easier to do the following...
Code:
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
.noindent {
  text-indent: 0;
 }
Then you don't have to figure out all the stuff that can come before an indented p as all you'll need is <p class="noindent">. Problem solved. Plus, it's easier to read the HTML code.
True, but I still like to have some clever stuff. Plus, I know I'd forget to use that class every now and again.

Last edited by hobnail; 04-06-2022 at 01:36 PM.
hobnail is offline   Reply With Quote
Old 04-06-2022, 01:51 PM   #13
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: 75,307
Karma: 133361584
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 hobnail View Post
True, but I still like to have some clever stuff. Plus, I know I'd forget to use that class every now and again.
You'd get used to it and the CSS is simpler, Keep your code as simple as possible.
JSWolf is online now   Reply With Quote
Old 04-06-2022, 04:48 PM   #14
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,060
Karma: 89198465
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
If you are using styles in Word or LO Writer and convert a docx to epub in Calibre and then the epub to anything else, it works on everything and the CSS & HTML isn't much different to JSWOLF's suggestion.
Quoth is offline   Reply With Quote
Old 04-06-2022, 05:44 PM   #15
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Quoth View Post
If you are using styles in Word or LO Writer and convert a docx to epub in Calibre and then the epub to anything else, it works on everything and the CSS & HTML isn't much different to JSWOLF's suggestion.
Yes, that is true, but it's simple CSS--with styles for block-style (first) paragraphs and then the body paragraph. it won't/doesn't do p+p or the like, sadly.

Although, having said that, you can sorta do it by setting the "next paragraph" in the style of the block-style paragraph so that the next paragraph is body text, and all the ensuing paragraphs are body text, until you get to the first para of the next chapter, whereupon you use the block style and then lather-rinse-repeat. It is almost as good as using p+p. In some ways, better.

You can even do it by setting the heading style for the chapter header to have "next paragraph" be the block-style, and then the block-style has the next paragraph as body, (and proceed from there, like I said above), and do it that way.

(I do this in my Word "template" documents, which I use to show a customer what a given layout in a given font might look like. I have all the headings and styles with dependencies, so if someone thinks that they want, for example, Bookman Old Style, I can change ONE thing, ONE style in the Word doc and the change dominoes (cascades) through the entire file. Export a PDF and give them an idea of what they might be looking at. It's the same thing, really, as we're discussing with p+p.)

Hitch
Hitch is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Aura ONE Battery Woes, and flaky tech support richrock Kobo Reader 2 10-26-2019 08:28 AM
Flaky Wi-Fi Hopefully Fixed Richwood Lounge 2 02-13-2018 11:14 AM
Glo HD USB port flaky madhg Kobo Reader 3 09-24-2016 08:48 PM
Touch touch is flaky Mellobob Barnes & Noble NOOK 5 06-22-2011 12:20 PM
PRS-600 Flaky Reader Behaviour ChristopherTD Sony Reader 2 02-15-2010 02:09 AM


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


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