Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 01-10-2012, 11:34 AM   #1
markpearl
Enthusiast
markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.
 
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 "&nbsp;&nbsp;" 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!
markpearl is offline   Reply With Quote
Old 01-10-2012, 11:39 AM   #2
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
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">
?
WS64 is offline   Reply With Quote
Advert
Old 01-10-2012, 11:44 AM   #3
markpearl
Enthusiast
markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.
 
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by WS64 View Post
You mean something like
search for
<body><class="calibre9">
replace with
<body><class="calibre91">
?
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.
markpearl is offline   Reply With Quote
Old 01-10-2012, 11:58 AM   #4
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
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
WS64 is offline   Reply With Quote
Old 01-10-2012, 12:48 PM   #5
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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;
}
That way, all paragraphs will be indented except those that immediately follow an h3 tag (or whatever tag.class consistently precedes the first paragraph in your document). That way you don't have to walk through the document and change the css class of each first paragraph manually. You'll still have to manually remove any &nbsp;'s that are being used for indentation purposes, but that's not that difficult.

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.
DiapDealer is offline   Reply With Quote
Advert
Old 01-10-2012, 01:09 PM   #6
markpearl
Enthusiast
markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.
 
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by DiapDealer View Post
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;
}
That way, all paragraphs will be indented except those that immediately follow an h3 tag (or whatever tag.class consistently precedes the first paragraph in your document). That way you don't have to walk through the document and change the css class of each first paragraph manually. You'll still have to manually remove any &nbsp;'s that are being used for indentation purposes, but that's not that difficult.

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.

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">&nbsp;</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.
markpearl is offline   Reply With Quote
Old 01-10-2012, 04:34 PM   #7
alansplace
Grand Sorcerer
alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.
 
alansplace's Avatar
 
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
Cool grin...

Quote:
Originally Posted by markpearl View Post
I'm pretty compulsive about having the first paragraph of a chapter -- or beginning paragraphs of a book, where appropriate -- begin with no indent.
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.
alansplace is offline   Reply With Quote
Old 01-10-2012, 04:50 PM   #8
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,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:
Originally Posted by alansplace View Post
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.
I like variety
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
theducks is offline   Reply With Quote
Old 01-10-2012, 05:05 PM   #9
Keroberos
Zealot
Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.Keroberos ought to be getting tired of karma fortunes by now.
 
Keroberos's Avatar
 
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.
Keroberos is offline   Reply With Quote
Old 01-11-2012, 02:32 AM   #10
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
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
cybmole is offline   Reply With Quote
Old 01-11-2012, 02:45 AM   #11
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
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
WS64 is offline   Reply With Quote
Old 01-11-2012, 04:17 AM   #12
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
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 }
And then modify the desired paragraphs so that

Code:
<p class="calibre8">...</p>
becomes

Code:
<p class="calibre8 noindent">...</p>
(i.e., just add "noindent" to whatever class the paragraph has)
Jellby is offline   Reply With Quote
Old 01-11-2012, 09:04 AM   #13
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is offline   Reply With Quote
Old 01-14-2012, 05:33 PM   #14
markpearl
Enthusiast
markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.markpearl ought to be getting tired of karma fortunes by now.
 
Posts: 43
Karma: 576732
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by DiapDealer View Post
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.
Yes, if my objective was to build my own epubs, it's a good method. But as DiapDealer commented, I was looking for a shortcut...which works most of the time when the epub on which I'm working wasn't originally built with archaic (so to speak) software in the "pre-sigil" days...
markpearl is offline   Reply With Quote
Old 01-20-2012, 05:03 PM   #15
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: 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.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 06:09 PM.


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