Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 01-10-2012, 12:34 PM   #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: 37
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, 12:39 PM   #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: 622
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
 
Advertisement
Old 01-10-2012, 12:44 PM   #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: 37
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, 12:58 PM   #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: 622
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, 01: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: 14,799
Karma: 81353584
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 01:57 PM.
DiapDealer is offline   Reply With Quote
Old 01-10-2012, 02: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: 37
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, 05: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,355
Karma: 391052462
Join Date: Feb 2010
Location: 33.9388° N, 117.2716° W
Device: Kindles K-2, K-KB, PW 1 & 2, Voyage, Fire 2 & 5, iPad mini, Surface 3
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, 05: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: 19,817
Karma: 19044584
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Astak Pocket Pro, K4NT,Galaxy Tab 2
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, 06:05 PM   #9
Keroberos
Zealot
Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.Keroberos can program the VCR without an owner's manual.
 
Keroberos's Avatar
 
Posts: 127
Karma: 194002
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 06:26 PM.
Keroberos is offline   Reply With Quote
Old 01-11-2012, 03: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, 03: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: 622
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, 05: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: 6,998
Karma: 8796439
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, 10: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: 14,799
Karma: 81353584
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, 06: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: 37
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, 06: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: 45,428
Karma: 32620990
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
[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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:42 PM
indent control cybmole Conversion 18 02-18-2011 12:12 PM
hanging indent Oldpilot Sigil 2 11-13-2010 07:20 AM
Too much left indent! Barty Amazon Kindle 12 11-09-2010 03:43 PM
Paragraphs and indent mrmikel Calibre 33 01-10-2009 06:37 PM


All times are GMT -4. The time now is 05:27 AM.


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