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 03-06-2011, 11:54 PM   #1
fan of kovid
Member
fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.
 
Posts: 14
Karma: 304
Join Date: Nov 2010
Device: Sony PRS 900
Text Alignment Problem

I'm having problems with text alignment...

My preference in a book is to have the main text of the book justified - no spaces between paragraphs - first line indented (1.5 em is just fine). The options in the "Look and Feel" section of the Convert dialog does this beautifully.

However, I prefer to have titles, and other info centered and some text even Left Aligned (for Glossaries, etc.).

The problem is that Calibre also wants to indent the first line of centered and the Left Aligned text as well - not a good look!

At the moment, my work-around is to let Calibre process the book, then edit the .css in Wordpad to remove all the text-indent 1.5 em references in all the other styles.

My question is, am I doing something wrong? have I neglected to select something? - or is there a better way to do it?

Alternatively, is this a bug (hush my mouth!) or maybe I should request an enhancement?

Many thanks, (BIG) fan
fan of kovid is offline   Reply With Quote
Old 03-07-2011, 12:13 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Sigil (next Forum Down)
Makes editing CSS and touch-up easy.
Note: Your TOC (NCX) must be based upon H# (nested) tags or it will be overwritten
theducks is offline   Reply With Quote
Advert
Old 03-07-2011, 03:40 PM   #3
fan of kovid
Member
fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.
 
Posts: 14
Karma: 304
Join Date: Nov 2010
Device: Sony PRS 900
Text Alignment Problem

@ theducks

Thanks buddy - but I already knew that...

I already have the TOC based on nested H# tags - I do that by setting the chapter headers using MS Word "styles" - easy with search & replace.

If I open the epub with Sigil to edit the style sheet, then Sigil imposes its own TOC - overwriting the one already created with Calibre - I like the one created with calibre.

It's also easy to edit the style sheet with Wordpad... Right click on the epub file, open with WinZip, then right click the css file and open with Wordpad - edit as appropriate, save and update the archive with the saved file - too easy.

My problem is that I don't want Calibre to first-line indent centered and left-aligned text in the first place.

Any tips on how to achieve this would be much appreciated.

Maybe "Extra CSS" could be used to do this? Does anyone know how to code this? All I want is to end up with certain styles with text indent set to zero.

Many thanks - fan
fan of kovid is offline   Reply With Quote
Old 03-07-2011, 03:49 PM   #4
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Calibre would only be indenting text if you chose the 'remove spacing between paragraphs' option. If you don't like the way that option works then don't use it, the same thing can be accomplished with much more control using extra css. There have been numerous threads on this recently in both the Calibre and Sigil forums, just search for 'indents' and you'll get the info.
ldolse is offline   Reply With Quote
Old 03-07-2011, 04:23 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Don't bother with winzip and all that.
T for Tweak epub (in calibre):
Explode.

Now edit any part(s) you want,
Then click 'Rebuild'
theducks is offline   Reply With Quote
Advert
Old 03-07-2011, 09:01 PM   #6
fan of kovid
Member
fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.
 
Posts: 14
Karma: 304
Join Date: Nov 2010
Device: Sony PRS 900
@ ldolse

I like the general paragraph alignment settings given with the 'remove spacing between paragraphs' option.

My question was about how to create exceptions to that - so that for the few exceptions - i.e. titles, chapters, etc., which I don't want justified, I can stop the indenting process.

I had tried to find something about this problem, before bothering anyone, but for the life of me, I never thought to search for indents! Thanks for the pointer.

@ theducks

I never really saw the point of the tweak feature - it's easy enough to open and fiddle an epub without running Calibre at all - no need to explode or rebuild - just edit the thing within winzip...

However, on a different thread, you replied to another user with:

Quote:
most XHTML tags have defaults and need not be specified (if that meets your needs) . Not all devices implemented the defaults properly , leading to Stylesheets full of verbose entries and workarounds

p (in a CSS) applies to all <p> tags (contains NO dot)
.p is not the same (it is a class selector with a 'trip-you-up' name)

h1,h2,h3 {
text-align: center
}
(Notation), applies to all H1 H2 and H3 tags

Bottom line:
You are overriding a Default, which is why you don't see it in the CSS.
That could be an area to experiment with. Maybe I should try adding

Code:
h1,h2,h3 {
text-align: center
text-indent: 0
}
for the styles in question?

Thanks again guys, for the suggestions - like I said before - any tips or suggestions are gratefully appreciated
fan of kovid is offline   Reply With Quote
Old 03-07-2011, 09:25 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by fan of kovid View Post
That could be an area to experiment with. Maybe I should try adding

Code:
h1,h2,h3 {
text-align: center
text-indent: 0
}
for the styles in question?

Thanks again guys, for the suggestions - like I said before - any tips or suggestions are gratefully appreciated
Yes (that is what I do, but usually only h3, my chapter headings)
theducks is offline   Reply With Quote
Old 03-07-2011, 10:57 PM   #8
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Quote:
Originally Posted by fan of kovid View Post
@ ldolse

I like the general paragraph alignment settings given with the 'remove spacing between paragraphs' option.

My question was about how to create exceptions to that - so that for the few exceptions - i.e. titles, chapters, etc., which I don't want justified, I can stop the indenting process.
If you use 'remove spacing between paragraphs', it overrides all indent settings, in a way that's very difficult to override. That's why I suggested not using it. If you like how it handles spacing, you can do this yourself through extra css.

Code:
p {margin-top:.3em; margin-bottom:.3em}
Which will leave .3em of space between paragraphs. I prefer a 'small' amount of space, but if you want to mimic 'remove spacing between paragraphs' more closely you can use:
Code:
p {margin-top:0; margin-bottom:0}
Anyway the point of all those is they won't mess with indents, so your centered text won't be centered+indented. If your document isn't indented in the first place then you can judiciously add text-indent wherever you like in a number of ways.

This is all discussed ad-nauseam in those threads I mentioned before, I believe you've found them.

Last edited by ldolse; 03-07-2011 at 11:00 PM.
ldolse is offline   Reply With Quote
Old 03-07-2011, 10:57 PM   #9
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by fan of kovid View Post
I like the general paragraph alignment settings given with the 'remove spacing between paragraphs' option.
I too like this feature, but this feature is a all or nothing item that uses a large brush to paint the document with indents.

Quote:
Originally Posted by fan of kovid View Post
My question was about how to create exceptions to that - so that for the few exceptions - i.e. titles, chapters, etc., which I don't want justified, I can stop the indenting process.
I don't think you can create exceptions to this option. It might be easier to do the opposite. Don't use the 'remove spacing between paragraphs/ indent' option and attempt to use extra css to insert indents for paragraphs. Maybe someone here can help from this angle.

Last edited by DoctorOhh; 03-07-2011 at 11:00 PM.
DoctorOhh is offline   Reply With Quote
Old 03-08-2011, 03:05 PM   #10
fan of kovid
Member
fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.fan of kovid has a complete set of Star Wars action figures.
 
Posts: 14
Karma: 304
Join Date: Nov 2010
Device: Sony PRS 900
@ Idolse & @ dwanthny,

Finally, the penny has dropped

I hadn't appreciated the "all or nothing" nature of this option.

The other indents threads I found seemed to quickly drift away from the indent question (without really answering it) and get into paragraph spacing issues, or whether to use pixels, points or ems as the unit.

All or nothing is indeed a broad brush - and inappropriate for text that is centered - do you think the development team might be persuaded to change that?

Guys (Girls?), thanks for your patience - I am a bit slow on the uptake - but it's much appreciated!
fan of kovid is offline   Reply With Quote
Old 03-20-2011, 07:12 AM   #11
GMcG
Writer
GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.
 
GMcG's Avatar
 
Posts: 101
Karma: 590630
Join Date: Mar 2011
Location: Munich, Germany
Device: none
text indent

I have made it with <br> between <p> and text.
For instance:
<p style="text-indent:0pt"><br>Text</p>
and
<p style="text-align:center; text-indent:0pt"><br>Text</p>

It gives you an empty line, but it looks better than an indent where no one should be.
It works with epub but not with mobi. So have tried it with Mobipocket Creator too and it looks fine. I even got pagebreaks (each chapter a separate file), what seems not to be possible with Calibre.
George

I have found more about that at the Mobipocket Developer Center on
http://www.mobipocket.com/dev/articl...tification.htm
George

Last edited by GMcG; 03-27-2011 at 03:20 AM. Reason: update
GMcG is offline   Reply With Quote
Old 03-20-2011, 01:46 PM   #12
Algiedi
Overenthusiastic Noob
Algiedi has learned how to read e-booksAlgiedi has learned how to read e-booksAlgiedi has learned how to read e-booksAlgiedi has learned how to read e-booksAlgiedi has learned how to read e-booksAlgiedi has learned how to read e-booksAlgiedi has learned how to read e-books
 
Algiedi's Avatar
 
Posts: 69
Karma: 896
Join Date: Feb 2011
Location: France
Device: Kindle 3
I might have misunderstood the issue but if I didn't, then I guess you could scrap the p {...} bit from the css, and give classes to ALL your paragraphs, with the "regular" text as p.indent, and notes/index/glossary whatever as p.noindent.

That should take a few seconds and you'll have absolute control over everything.

Or am I going about this in a weird way?
Algiedi is offline   Reply With Quote
Old 03-20-2011, 03:09 PM   #13
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,167
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by Algiedi View Post
I might have misunderstood the issue but if I didn't, then I guess you could scrap the p {...} bit from the css, and give classes to ALL your paragraphs, with the "regular" text as p.indent, and notes/index/glossary whatever as p.noindent.

That should take a few seconds and you'll have absolute control over everything.

Or am I going about this in a weird way?
I don't think you're weird. This is how I do it. maybe we're both weird
jackie_w is offline   Reply With Quote
Old 03-20-2011, 03:28 PM   #14
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Algiedi View Post
I might have misunderstood the issue but if I didn't, then I guess you could scrap the p {...} bit from the css, and give classes to ALL your paragraphs, with the "regular" text as p.indent, and notes/index/glossary whatever as p.noindent.

That should take a few seconds and you'll have absolute control over everything.

Or am I going about this in a weird way?
K.I.S.S.
Give the <Body>, the basic paragraph style ( default class)

Give separate classes to the exceptions ONLY.

<p class="noindent"> blah blah with indent at Zero</p>
<p> more blahs, with the normal indent</p>
theducks is offline   Reply With Quote
Old 03-20-2011, 04:51 PM   #15
GMcG
Writer
GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.
 
GMcG's Avatar
 
Posts: 101
Karma: 590630
Join Date: Mar 2011
Location: Munich, Germany
Device: none
text indent

I had made a proposal in ticket 8667 (enhancement) for new p classes in stylesheet.css and was said to make it by myself in Look and Feel (Layout) / Extra CSS.
So I had defined new classes as addition to the existing classes (with ni = non indent).
It works with epub, but at that time I had done it already with the proposal mentioned above.
George

.calibre2ni {
border-bottom: 0;
border-top: 0;
display: block;
margin-bottom: 0.5em;
margin-left: 0;
margin-right: 0;
margin-top: 0.5em;
padding-bottom: 0;
padding-top: 0;
text-indent: 0em
}
.calibre5ni {
border-bottom: 0;
border-top: 0;
display: block;
margin-bottom: 0.5em;
margin-left: 0;
margin-right: 0;
margin-top: 0.5em;
padding-bottom: 0;
padding-top: 0;
text-align: justify;
text-indent: 0em
}
.calibre6ni {
border-bottom: 0;
border-top: 0;
display: block;
margin-bottom: 0.5em;
margin-left: 0;
margin-right: 0;
margin-top: 0.5em;
padding-bottom: 0;
padding-top: 0;
text-align: center;
text-indent: 0em
}

Calibre should (!) add the Extra CSS to the stylesheet.css file. If it doesn't, you have to do it.
Open the epub container by right click and edit epub. Open stylesheet.css with your editor and add the new p classes at the end of the file (copy from Extra CSS and paste). Save it.
Look for an html file, in which you want lines/paragraphs with no indent. Open it with your editor. Look for the line/paragraph, which should have no indent. If it begins with
<p class="calibre2">Your text.......
add ni (=no indent) to the class like
<p class="calibre2ni">Your text...
The same is with other new classes that you have defined in stylesheet.css before.
Save the html file.
You can format italic fonts (font-style: italic (<== this is ; and )) the same way in stylesheet.css.
When leaving the epub container you have to save the changements (new packing).
George

Last edited by GMcG; 03-26-2011 at 02:23 AM. Reason: update
GMcG is offline   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
Please help with RSS feed text alignment / justification zoilom Recipes 0 01-09-2011 12:23 PM
Text alignment James_Wilde iRiver Story 0 10-25-2010 04:22 AM
left alignment speakingtohe Calibre 2 08-13-2010 10:39 AM
Vertical Alignment gardefjord ePub 2 05-25-2010 09:59 PM
Text Editor Problem crutledge Sigil 2 08-10-2009 10:12 AM


All times are GMT -4. The time now is 12:32 AM.


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