01-10-2012, 11:34 AM | #1 |
Enthusiast
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
|
Help with removing indents from beginning paragraphs
I'm pretty compulsive about having the first paragraph of a chapter -- or beginning paragraphs of a book, where appropriate -- begin with no indent.
Most or all of the Gutenberg ebooks and virtually all of the ones on Mobilread all begin chapters with indents, unlike most commercial ebooks. My solution so far has been to create an extra parameter in the .css stylesheet...for example: .calibre9 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; text-align: justify; text-indent: 15px } Added style: .calibre91 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; text-align: justify; text-indent: 0; Following that, I go to the code view and add a "1" to the "<p class="calibre9">" to each beginning paragraph for which I wish to remove the indent. For books with up to 125 - 150 chapters, this becomes very tedious. Especially when many books also contain primitive " " to create indents. Removing these universally with regex removes them for all paragraphs in the book. So it's been all manual. Is there a regex script I can use for these situations? Anybody?? Thanks! |
01-10-2012, 11:39 AM | #2 |
♫
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
You mean something like
search for <body><class="calibre9"> replace with <body><class="calibre91"> ? |
Advert | |
|
01-10-2012, 11:44 AM | #3 |
Enthusiast
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
|
No, because that would remove them for ALL the book's paragraphs. I only want to remove indents for the first paragraph of each chapter -- and chapter breaks, where appropriate -- which is why I have to create the "1" addition to the body class and insert it manually.
|
01-10-2012, 11:58 AM | #4 |
♫
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
Yes, that's why the body part is there. Just before the first paragraph is a body element (for each file), all other <p class="calibre9"> will have a </p> in front of them
|
01-10-2012, 12:48 PM | #5 |
Grand Sorcerer
Posts: 27,553
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
If the first paragraph of a chapter/section always follows something consistent; hr, h3, or p class="something"... then you can combine css classes to account for those first paragraphs.
I use something like: Code:
.calibre9 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; text-align: justify; text-indent: 15px } h3 + p.calibre9 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; text-align: justify; text-indent: 0; } Just be warned that if you want to subsequently use the same epub to create a mobi file, only calibre (that I know of for sure) will "recognize" (and honor) that css combining method when converting to mobi. I know for a fact that kindlegen will ignore it. But it works great if you're just fixing up epubs for your own use. Last edited by DiapDealer; 01-10-2012 at 12:57 PM. |
Advert | |
|
01-10-2012, 01:09 PM | #6 | |
Enthusiast
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
|
Quote:
Yes! After posting my query, I experimented with just what you suggested and it works!! I didn't have to reach as far back as the paragraph tags, just a unique preceding line such as: <p class="calibre8"> </p> -- combined with -- <div class="calibre9"> in regex. Calibre converts to perfect mobis with this method...no problem there. I've just subtracted hours & hours of tedium from my editing -- currently tweaking Anthony Trollope's novels...many of which I obtained here at Mobileread. I only wish future creators would follow the "no-indent" rule for first chapters and paragraph breaks, where needed. |
|
01-10-2012, 04:34 PM | #7 |
Grand Sorcerer
Posts: 5,886
Karma: 464403178
Join Date: Feb 2010
Location: 33.9388° N, 117.2716° W
Device: Kindles K-2, K-KB, PW 1 & 2, Voyage, Fire 2, 5 & HD 8, Surface 3, iPad
|
grin...
Your query made me smile because I'm exactly of the opposite opinion. I can't stand the initial paragraph of each chapter being non-indented.
|
01-10-2012, 04:50 PM | #8 | |
Well trained by Cats
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
I want by books to be consistent within a series. All should have their own personality otherwise. Drop Caps, Big caps, First line all Caps, Indented, No Indent. One thing I am fairly consistent on, is always space between paragraphs. More if no indent. I love to play with Chapter Heading presentation OK 1 other thing I do : I don't like to see 50% white space at a chapter start. 10% top/bottom margins at tops |
|
01-10-2012, 05:05 PM | #9 |
Zealot
Posts: 128
Karma: 238654
Join Date: Aug 2009
Device: Kobo Mini (4GB), Nook Classic wi-fi, iPod Touch (Bluefire Reader)
|
I have to say, with books that are in the public domain (those you would get from Project Gutenberg, or here at Mobileread), it's entirely consistent with publishing standards at the time for chapters to open with an indented first paragraph. After quick perusal of my p-book library, it seems to be fairly recent when US publishers consistently started formating books with non-indented opening paragraphs.
That being said I have to agree with theducks, I also like variety. I also like the look of old style typography (too many modern books are too plain and sparse, most especially e-books), so I like playing around with the formatting to see what I can make. Last edited by Keroberos; 01-10-2012 at 05:26 PM. |
01-11-2012, 02:32 AM | #10 |
Wizard
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
I prefer no indents at chapter start - but if they are too much hassle to fix, I let them be.
e.g. sometimes there's header line, then some more spacing, then start of chapter which makes for a hard to detect combo. I also prefer to see no top margin ( =wasted e-reader screen space) above the chapter header, & for the chapter header to be centered, and not huge - 1em is usually sufficient. May I ask - the h3 + p.calibre9 construct will apply css to only a <p class - ... line which immediately follows the END of a h3 line ? where can I find more documentation on building compound css definitions such as this please |
01-11-2012, 02:45 AM | #11 |
♫
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
cybmole, they are called silbling selectors, sometimes also called child selectors.
Here's a bit: http://www.w3.org/TR/CSS2/selector.h...cent-selectors |
01-11-2012, 04:17 AM | #12 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Note that styles are cumulative, so you could just add to your stylesheet:
Code:
.noindent { text-indent: 0 } Code:
<p class="calibre8">...</p> Code:
<p class="calibre8 noindent">...</p> |
01-11-2012, 09:04 AM | #13 |
Grand Sorcerer
Posts: 27,553
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That will certainly work, but I was under the impression that the OP was looking for a shortcut.
The method I described would allow one to achieve the desired effect without ever having to touch the html of the document itself. Just add a css statement or two to the stylesheet and be done. I highly recommend your method when building your own epub, but I prefer the "less work is best" approach when simply tweaking someone else's epub for my own personal reading enjoyment. |
01-14-2012, 05:33 PM | #14 | |
Enthusiast
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
|
Quote:
|
|
01-20-2012, 05:03 PM | #15 |
Resident Curmudgeon
Posts: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
[code].noindent {
display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; text-align: justify; text-indent: 1.2em } There you go. That's all you need and when you look at your XmL code, you can see which paragraphs have no indents. Personally, I prefer no indent at the first paragraph of a chapter and the first paragraph after a section break. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Paragraph spaces in ePub to Mobi conversion disrupts indent formatting | markpearl | Conversion | 34 | 09-21-2011 02:42 PM |
indent control | cybmole | Conversion | 18 | 02-18-2011 11:12 AM |
hanging indent | Oldpilot | Sigil | 2 | 11-13-2010 06:20 AM |
Too much left indent! | Barty | Amazon Kindle | 12 | 11-09-2010 02:43 PM |
Paragraphs and indent | mrmikel | Calibre | 33 | 01-10-2009 05:37 PM |