'Align Text Centre' button in the Text editor is overridden by paragraph indents in the compiler when publishing as-is

User avatar
ighulme
Posts: 75
Joined: Sat Oct 25, 2014 12:55 pm
Platform: Mac + Windows
Contact:

Fri Dec 01, 2017 2:16 pm Post

Hi,

I was just wondering if this behaviour was intended or a glitch?

When I use the 'Align text centre' button in the toolbar of the text editor and then compile 'As-is' the paragraph comes out wonky in Kindle, as my default text in the compiler has paragraph indents which are pushing the text about:

Image
I have to select the 'Centred Text' paragraph style, and then everything lines up:

Image
Is this the expected behaviour?
Should the 'Align text centre' button in the toolbar create paragraphs without indents that can't be overridden when compiling as-is, or do I always have to use paragraph styles for correctly-centred text?

I'm just mentioning it because it took me days to track down why my centred text was wonky, and then it was only that I happened to stumble across the answer in the forums.

All the best,
Ian
I G HULME
The Heavenfield: http://www.heavenfield.com

User avatar
thomasalmy
Posts: 13
Joined: Tue Nov 21, 2017 11:50 pm
Platform: Mac
Location: Oregon, USA
Contact:

Fri Dec 01, 2017 7:04 pm Post

I've found that "as-is" and "Preserve Formatting" claims for KF8 and Epub3 output, but not for the older formats, to be bogus. I don't use first line indents because I was having issues. I looked at your example and can see the problem. No link but otherwise the text is yours. Here is the HTML output for those lines (KF8 output):

Code: Select all

<p style="text-align: center; text-indent: 0em">Thank you for purchasing and reading this book.</p>
<p class="br"><br /></p>
<p style="text-align: center; text-indent: 0em">If you enjoyed it then please, leave me a review on Amazon, and browse my</p>
<p style="text-align: center">Other stories</p>
<p class="br"><br /></p>
<p style="text-align: center; text-indent: 0em">Many thanks,</p>
<p style="text-align: center">I G</p>

You can see that all the lines specify text-indent of 0 except for the two lines that end up displaying wrong. They take the text-indent (which for you is non-zero) from the stylesheet.css file. If you use the Centered Text style instead the HTML is:

Code: Select all

<p class="centered-text" style="text-indent: 0em">Thank you for purchasing and reading this book.</p>
<p class="centered-text"><br /></p>
<p class="centered-text" style="text-indent: 0em">If you enjoyed it then please, leave me a review on Amazon, and browse my</p>
<p class="centered-text">Other stories</p>
<p class="centered-text"><br /></p>
<p class="centered-text" style="text-indent: 0em">Many thanks,</p>
<p class="centered-text">I G</p>

Now every line uses the centered-text class which is defined in the stylesheet.css to have no text-indent, or explicitly says no text-indent.

I've concluded that styles must be used for KF8 or Epub3 output. Be aware that the style definition for the editor is not the same as that for the compiler. You need to use the Compile Style Editor (and create a new style since you can't edit the defaults) to make changes to the compiler output.

User avatar
ighulme
Posts: 75
Joined: Sat Oct 25, 2014 12:55 pm
Platform: Mac + Windows
Contact:

Sun Dec 03, 2017 2:16 pm Post

Thanks for your reply - that's all good information to know. :)

Be aware that the style definition for the editor is not the same as that for the compiler. You need to use the Compile Style Editor (and create a new style since you can't edit the defaults) to make changes to the compiler output.


I'm still finding myself a bit confused by 'Styles', and how there seem to be Editor styles, Paragraph styles, and Compiler styles all vying for supremacy!

I thought the 'Paragraph styles' override the 'Compile styles' (as in my example in the first post, where the 'Centred Text' paragraph style overrides the default compile style). Or do you just mean that changing the formatting in the editor toolbar will not change the compiler output?
I G HULME
The Heavenfield: http://www.heavenfield.com

User avatar
KB
Site Admin
Posts: 19198
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Sun Dec 03, 2017 2:58 pm Post

I've fixed this for the next update - centred text will all use 0 indents.

As for styles:

- Use "No Style" for most text.
- Just use styles in the editor for text you want to be different.
- You don't *have* to use styles at all when writing, it's up to you.

I'm not sure what you mean about editor styles vs paragraph styles. Paragraph styles are just at type of style. You can have character styles (which just affect any range of text and affect things such as italics etc, but do not affect line spacing and paragraph formatting), paragraph styles (which just affect line spacing, indents and other paragraph spacing) or para+char styles that do both.

Compile styles just override editor styles, just as Compile formatting overrides editor formatting. So, suppose you have a "Block Quote" style in your text. If you define a "Block Quote" style in Compile, that will override the "Block Quote" style in the exported text. So you have a lot more control over what gets overridden. Compile styles are just overrides, the same as everything else in Compile, nothing more.

All the best,
Keith
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

User avatar
ighulme
Posts: 75
Joined: Sat Oct 25, 2014 12:55 pm
Platform: Mac + Windows
Contact:

Sun Dec 03, 2017 3:48 pm Post

I've fixed this for the next update - centred text will all use 0 indents.

Ah that's great Keith, thanks for your reply.

I'm not sure what you mean about editor styles vs paragraph styles.

I think this is where I was getting confused: because the 'Align text centre' button was behaving differently to using the 'Centred Text' paragraph style I was thinking that they were two separate styling systems.

Hearing that paragraph styles are just types of styles clears everything up. Cheers! :)
Ian
I G HULME
The Heavenfield: http://www.heavenfield.com