![]() |
#1 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 16
Karma: 472024
Join Date: Nov 2012
Device: Samsung Galaxy S3
|
Having trouble adding indents before paragraphs
Hi folks! I've converted a PDF to an EPUB, and spent quite a bit of time trying to straighten it out. For the most part it is pretty good now, but I'm still having an issue. The EPUB now has a blank line between every paragraph. Ideally, what I'd like is no blank lines and indents at the beginning of every paragraph. I cannot seem to do this with Calibre's conversion function however. In Conversion -> Look & Feel -> Layout, if I select 'Remove spacing between paragraphs', it will in fact remove them, but it will not indent the beginning of the paragraph, so I'm just left with a solid block of text. When I look at the HTML in Sigil, every paragraph of text ends in the tags <p></p> right next to each other. I suspect I'm having this issue because Calibre cannot identify the beginning of the paragraph with this formatting. Can anyone suggest a way I can get the paragraph beginnings to indent? Thanks for your thoughts!
|
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,615
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
It should be a simple tweak to the CSS file by adding the following code to the paragraph tag...
text-indent: 1em; If you post a screenshot of the code in the xhtml page, or even post the epub if it is not in copyright, we can tell you which tag to edit in the CSS file. Though the paragraph ending with <p></p> sounds wrong. Is there a <p> tag at the start of the paragraph? |
![]() |
![]() |
![]() |
#3 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,419
Karma: 169098492
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
So something like: Code:
<p>This is a paragraph</p><p></p> |
|
![]() |
![]() |
![]() |
#4 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#5 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,419
Karma: 169098492
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Hardly relevant since the OP is likely to pick an indent they prefer.
An alternative in the CSS stylesheet to indent all but first paragraphs might be: Code:
p { text-indent: 1.5em; } p:first-of-type { text-indent: 0; } Going off a vague memory, I took a quick look at the Layout options in conversion and there seems to be a setting to insert an indent when removing spacing between paragraphs. See the attached image. Last edited by DNSB; 01-17-2025 at 03:30 PM. |
![]() |
![]() |
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,615
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
We'll see if a screenshot is posted. |
|
![]() |
![]() |
![]() |
#7 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
h2 + p { text-indent; 0; } |
|
![]() |
![]() |
![]() |
#8 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I've seen plenty of cases were <p></p> does not cause a line space to be displayed. So it's not good to use that.
|
![]() |
![]() |
![]() |
#9 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,419
Karma: 169098492
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
![]() |
![]() |
![]() |
#10 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,419
Karma: 169098492
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Which would only work is there no other code between the </h2> and the <p>. Quite a few ebooks seem to place images, subheaders, etc. between the chapter header with the </hx> ending tag and the initial p.
|
![]() |
![]() |
![]() |
#11 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 16
Karma: 472024
Join Date: Nov 2012
Device: Samsung Galaxy S3
|
Hi again, and thanks so much for your comments! There actually isn't a <p> tag at the beginning of each paragraph, only a <p></p> at the end of each, which is why I'm surmising that Calibre can't locate the beginning of each paragraph. Screenshot attached.
It sounds like this is bad formatting. Unfortunately, Calibre itself did this when doing the initial conversion from Word DOCX format. This is why I'm wondering how I can correct this. Does that help? |
![]() |
![]() |
![]() |
#12 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,419
Karma: 169098492
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
That is a total mess. You might be able to clean up some of it by using calibre's ebook-editor to replace the <p></p> with a </p><p> basically reversing the two tags and then using the Beautify tool. Ditto for using Sigil as the editor except for using Mend and Prettify instead of Beautify. After this, you will still need to clean up the first paragraph and last paragraphs in each set.
|
![]() |
![]() |
![]() |
#13 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,752
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
The golden rule with DOCX is that you must format the document using the Styles feature of your word processor (MS Word, LO Writer, etc), if you treat your WP program as a glorified typewriter you'll get the sort of effects your seeing. BR |
|
![]() |
![]() |
![]() |
#14 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 16
Karma: 472024
Join Date: Nov 2012
Device: Samsung Galaxy S3
|
DNSB - I was thinking about how I could use the find\replace feature to change that, but that sounds like a more elegant solution than the one I had thought of. I'll give it a whirl. Thanks!
BetterRed, a book I really wanted to read was only available in a wretched image scan PDF. I tried to convert that directly in Calibre but no workie. My workaround was to manually delete the covers in Acrobat, then run it through k2pdfopt.exe with OCR turned on, then open that file in word, save it, and convert that in Calibre. Not sure how to format the Word file using the styles feature, but I'm new at this.... :-) |
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,615
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
What you should have done instead is exported it as an epub.
I don't have Word to see if that is an option, but LibreOffice certainly has that option. The benefit is that it adds the tags around the paragraphs already, then when it imports into Calibre, you just need to do a bit of tidying up, mainly removing the naked <span> tags that do nothing. But like others have said, you need to ensure you use Styles so all the styling for the various parts of the book are the same, otherwise you end up with a mess in the conversion with lots of different tags and css entries which becomes a nightmare to clean up, even trying to use regex. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add blank lines between paragraphs. | bn_el | KOReader | 5 | 11-02-2017 11:14 AM |
blank lines between paragraphs | franklekens | Kobo Reader | 71 | 01-26-2015 12:52 PM |
Blank lines between paragraphs? | ascherjim | OpenInkpot | 30 | 12-03-2009 12:19 AM |
Removing blank lines between paragraphs? | corroonb | Workshop | 3 | 08-13-2009 04:23 PM |
Insert Blank Lines Between Paragraphs | Timoleon | Calibre | 14 | 03-22-2009 02:43 PM |