Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-17-2010, 01:48 PM   #16
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,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
For anyone wanting to edit their RTFs in MSWord and having problems getting the EPUB line spacing retained, this is another approach which requires only MSWord and Calibre. MSWord to create/edit the RTF, Calibre to do a simple RTF to EPUB conversion. I don't claim it as 'the One True Way'.

I have attached 2 images. the first is how the sample RTF looks in Word, the second is how the EPUB looks in the Calibre Viewer. As you can see the line spacing appearance has been correctly retained. If the first image is what you're aiming for -- read on.

  1. The main thing which needs to be done when editing the RTF in Word is NOT to add blank paragraphs where you want to see some vertcal whitespace. Instead you create a second Word paragraph-style (I've called it Para1, based on the Normal paragraph-style) which has a large top margin (using Format - paragraph - Space before) and a zero bottom margin (Format - paragraph - Space after=zero). I also set indents to zero for the Para1 style - but that's optional.

    Wherever you want to add extra vertical whitespace e.g. Chapter starts, scene breaks, you apply the Para1 style to the first paragraph. All other body text paragraphs can be left as Normal style. See image 1.

  2. Make sure you have the following Convert - Look&Feel settings when you do the Calibre RTF to EPUB conversion:
    Code:
    Remove spacing between paragraphs: unchecked
    Insert blank line: unchecked
    Extra CSS : p {margin-top: 0; margin-bottom: 0}
    This gives you an EPUB which looks like image 2.

I've also attached the source sample RTF for anyone who wants to try it out. Hope it helps someone
Attached Thumbnails
Click image for larger version

Name:	wordrtf.jpg
Views:	319
Size:	105.9 KB
ID:	61361   Click image for larger version

Name:	rtftoepub.jpg
Views:	327
Size:	78.4 KB
ID:	61362  
Attached Files
File Type: rtf LineSpacing.rtf (11.1 KB, 219 views)
jackie_w is offline   Reply With Quote
Old 11-18-2010, 06:07 AM   #17
GreenMonkey
DRM hater
GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.
 
GreenMonkey's Avatar
 
Posts: 945
Karma: 2066176
Join Date: Jun 2010
Location: Michigan
Device: Nook ST glow, Kindle Voyage
Quote:
Originally Posted by jackie_w View Post
For anyone wanting to edit their RTFs in MSWord and having problems getting the EPUB line spacing retained, this is another approach which requires only MSWord and Calibre. MSWord to create/edit the RTF, Calibre to do a simple RTF to EPUB conversion. I don't claim it as 'the One True Way'.
...

Hmm. Thanks. That seems like a lot of work unless you could devise it into a macro that substituted it in somehow. Seems like the best way to create new epubs though from RTF.

I'll try the conversion to ODT prior as a workaround. Didn't realize Calibre did ODT. Have to go install openoffice somewhere.
GreenMonkey is offline   Reply With Quote
Old 11-18-2010, 10:59 AM   #18
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,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by GreenMonkey View Post
Hmm. Thanks. That seems like a lot of work unless you could devise it into a macro that substituted it in somehow. Seems like the best way to create new epubs though from RTF.

I'll try the conversion to ODT prior as a workaround. Didn't realize Calibre did ODT. Have to go install openoffice somewhere.
Depending on your macro abilities, you certainly could macroise it as long as there's a way to recognise the 'right places', e.g. 2 or more consecutive end-of-paragraph markers.

However, on the whole I've found that saving the RTF as HTML webpage-filtered and importing the HTML to Calibre instead, is likely to retain more of the formating. It will certainly retain blank lines, which (at least on my ancient version of Word) gets saved as:
Code:
<p>&nbsp;</p>
or
<p class=MsoNormal>&nbsp;</p>
depending on whether my RTF body text uses the Normal(Web) style or the Normal style respectively. A Calibre conversion does not remove these HTML blank lines.

Last edited by jackie_w; 11-18-2010 at 11:03 AM.
jackie_w is offline   Reply With Quote
Old 11-18-2010, 08:04 PM   #19
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
Another option is to fix it after the fact in Sigil - I was digging into this more, and the blank line is actually preserved as an extra line feed in the converted document created by Calibre - so anywhere there was a soft break (using blank lines) the resultant file has 2 or more empty lines/line feeds.

So a regex like this:
(?<=\n)\n{2}

Replaced with this:
<p>&nbsp;</p>

Would re-insert the soft-breaks for epub.

I'm not really familiar enough with the rtf code to figure out where to fix it there, but this would also be easy enough to include in the optional preprocess code.

Edit - I was wrong about the extra line feeds being preserved - they aren't preserved unless a variable gets tweaked in the source code.

Last edited by ldolse; 11-19-2010 at 02:46 AM.
ldolse is offline   Reply With Quote
Old 11-19-2010, 03:29 PM   #20
MikeFromHC
Zealot
MikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-books
 
Posts: 143
Karma: 880
Join Date: Jun 2010
Device: Pandigital Novel
Quote:
Originally Posted by jackie_w View Post
Depending on your macro abilities, you certainly could macroise it as long as there's a way to recognise the 'right places', e.g. 2 or more consecutive end-of-paragraph markers.
More than two paragraph markers are a problem but here is an old trick using just Word or any text editor withour regular expressions.
1. USE A COPY.
2. USE A COPY.
3. Search and replace all "^P^P" with an unused character. The pipe symbol is almost always safe. "|"
4. Search and replace all single "^P" with a space.
5. Search and replace all "|" with ^P or what ever you want to see.

This works well in any case where a single delimiter is used for one thing and two of them for something else as in converting multi line lists to a comma delimited flat file.

One and two above are the most important because if you do #4 before #3 you have a "bit" of work ahead.
Signed: Been there, done that.
MikeFromHC is offline   Reply With Quote
Old 11-19-2010, 04:58 PM   #21
edbro
Banned
edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.
 
Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
Those have to be lowercase p's. ^p.

I do the same but instead of replacing ^p with a space I replace it with nothing.
edbro is offline   Reply With Quote
Old 11-19-2010, 09:43 PM   #22
MikeFromHC
Zealot
MikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-booksMikeFromHC has learned how to read e-books
 
Posts: 143
Karma: 880
Join Date: Jun 2010
Device: Pandigital Novel
Quote:
Originally Posted by edbro View Post
Those have to be lowercase p's. ^p.

I do the same but instead of replacing ^p with a space I replace it with nothing.
Replacing with nothing usually runs two words together.
This line^p
and this line

become "This lineand this line"
MikeFromHC is offline   Reply With Quote
Old 11-19-2010, 09:59 PM   #23
edbro
Banned
edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.edbro is fluent in JavaScript as well as Klingon.
 
Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
You're right, I don't know what I was thinking.

I have a macro that replaces ^p^p with ^p. Then it goes through and checks for incorrect line breaks. The macro searches for "^pa" and replaces with " a". Match case on. It does this for each letter in the alphabet.
edbro is offline   Reply With Quote
Old 11-19-2010, 10:57 PM   #24
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,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
@Mike,
I think we are at cross-purposes here. You appear to be detailing how to correctly reconstruct paragraphs from a file where every line has an end-of-paragraph. My original contribution was about trying to retain the extra whitespace between "scenes", in RTF to EPUB conversions, whilst removing extra whitespace between standard paragraphs, because RTF to EPUB currently removes blank lines.

Quote:
Originally Posted by MikeFromHC View Post
More than two paragraph markers are a problem...
By the way, this doesn't need to be a problem in MSWord, as long as you switch on the 'Wildcards' option in Find/Replace. Using your example Step 3, this should replace 2 or more end-of-paras with the pipe char:
Code:
Find: ^13{2,} (with the Wildcards box checked)
Replace: |
jackie_w is offline   Reply With Quote
Old 11-21-2010, 12:59 PM   #25
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
FYI, this issue will be fixed in the next release of Calibre, extra line feeds in rtf files will be preserved as empty html paragraphs with a non-breaking space.

If your rtf file has garbage blank lines that you want to get rid of this can still be achieved by enabling the "remove spacing between paragraphs" option under Look & Feel.

Last edited by ldolse; 11-21-2010 at 01:01 PM.
ldolse is offline   Reply With Quote
Old 11-21-2010, 02:51 PM   #26
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,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by ldolse View Post
FYI, this issue will be fixed in the next release of Calibre, extra line feeds in rtf files will be preserved as empty html paragraphs with a non-breaking space.
Thank you, Idolse, that should be much easier and faster for RTF fans.
jackie_w is offline   Reply With Quote
Old 11-22-2010, 08:41 PM   #27
speakingtohe
Wizard
speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.
 
Posts: 4,812
Karma: 26912940
Join Date: Apr 2010
Device: sony PRS-T1 and T3, Kobo Mini and Aura HD, Tablet
did you try changing the default line spacing in word or relpacing ^p^p with ^p (should do twice)
Helen
speakingtohe is offline   Reply With Quote
Old 11-23-2010, 12:41 AM   #28
GreenMonkey
DRM hater
GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.
 
GreenMonkey's Avatar
 
Posts: 945
Karma: 2066176
Join Date: Jun 2010
Location: Michigan
Device: Nook ST glow, Kindle Voyage
Quote:
Originally Posted by ldolse View Post
FYI, this issue will be fixed in the next release of Calibre, extra line feeds in rtf files will be preserved as empty html paragraphs with a non-breaking space.

If your rtf file has garbage blank lines that you want to get rid of this can still be achieved by enabling the "remove spacing between paragraphs" option under Look & Feel.
Yay, good to hear. Thanks!!
GreenMonkey is offline   Reply With Quote
Old 12-16-2010, 02:52 AM   #29
GreenMonkey
DRM hater
GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.GreenMonkey ought to be getting tired of karma fortunes by now.
 
GreenMonkey's Avatar
 
Posts: 945
Karma: 2066176
Join Date: Jun 2010
Location: Michigan
Device: Nook ST glow, Kindle Voyage
Quote:
Originally Posted by ldolse View Post
FYI, this issue will be fixed in the next release of Calibre, extra line feeds in rtf files will be preserved as empty html paragraphs with a non-breaking space.

If your rtf file has garbage blank lines that you want to get rid of this can still be achieved by enabling the "remove spacing between paragraphs" option under Look & Feel.
I dunno if anything has changed in the last mini update or two, but I'm still getting extra blank lines.

Every paragraph mark is still being turned into a blank line by default.

Any update? Should I enter a bug report when I get home? (Calibre site blocked at work)
GreenMonkey is offline   Reply With Quote
Old 12-16-2010, 10:25 AM   #30
BookJunkieLI
Evangelist
BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.
 
BookJunkieLI's Avatar
 
Posts: 435
Karma: 572984
Join Date: Jan 2010
Location: Long Island
Device: Kobo Libra 2, Kindle 4, Nook Gl4, Nook STR, REB 1100, Ebookwise 1500,
Uhm, if you don't want a blank line at the Paragraph mark have you tried turning it into a manual line break? Or a text wrapping break? 90% of my files were RTF before I uploaded them to Calibre for conversion. I quickly learned that I needed to check what kind of line break they had if I didn't want just a solid book length paragraph.
I just did a test file in which I used a Paragraph mark, a Manual Line break, a Text Wrapping break, and two Paragraph Marks. The Paragraph mark gave me an empty line between the two paragraphs. Both the Manual Line break and Text Wrapping Break gave me a new paragraph without an empty line between them and the Double Paragraph marks gave me two blank lines. The conversion settings were at the default settings, nothing special clicked, and I'm currently using Word 97 and Calibre 7.33. I hope this was of some help.

Beth
BookJunkieLI is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra paragraph line when converting from LRF jhempel24 Calibre 3 08-18-2010 07:00 AM
Stripping extra line returns jwhayn Sony Reader 3 02-27-2010 06:46 PM
Odd line/paragraph breaks in epub and FB2? PKFFW Calibre 4 10-01-2009 07:49 AM
No line breaks ecpepper Amazon Kindle 3 08-09-2009 06:42 PM
Removing extra line breaks plemming Calibre 0 07-31-2008 07:50 PM


All times are GMT -4. The time now is 06:31 AM.


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