05-15-2010, 12:33 PM | #1 |
Fanatic
Posts: 534
Karma: 469999
Join Date: Feb 2008
Location: Scotland
Device: Sony PRS-650 (PRS+ alpha - thanks Kartu!)
|
Spurious Line Breaks
These have bothered me for a while, however I've now found a simple way to remove them, effectively.
An example of the problem would be in a .txt file where sentences are broken at the end of each line with a carriage return. The problem is that when you read the file on an electronic reader you'll end up with it looking like this. This is a sample sentence to show how desperately frustrating it is to read a book formatted this way, because no matter what you do you will always end with too many lines in it. But as I've said I've found a simple way to get around the problem. Of course it would be easy to just remove every line break in the document. Problem solved... another created, because paragraphs are gone. So the simple solution was for me (in MS Word) to replace every pair of paragraph markers with something else. Then remove every paragraph marker. and then replace every "something else" with a paragraph marker. I'm quite sure it's possible to do that on many different text editors. I realise it's probably not the biggest revelation in the world, but perhaps it'll help someone who has a .txt file they would like to read electronically. I'd also be interested if someone knew of a way to do this in batches, rather than my basic time consuming way. |
05-15-2010, 01:22 PM | #2 |
Wizard
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
|
You should be able to do it all with a single find & replace if you use regular expressions. I don't know the regular expression syntax Word uses.
There are also text editors with such functionality built in, such as Ebook tidy. For batch mode, I'm sure you could do bulk reg ex find and replaces in something like Notepad++. Or you could do it with a command line search & replaceme tool such as sed. Don't have access to a Windows computer at the moment, or I'd give more detailed instructions. If you want instructions for linux (or, I think mac), I'd be happy to give them. And while I could be wrong, I'd be shocked if calibre doesn't have this functionality built in, at least as something that can optionally be activated, as part of its conversion processes. |
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PDF to EPUB - spurious paragraph breaks | RichieTheK | Calibre | 2 | 09-08-2010 11:27 AM |
CSS for line breaks after dashes? | JaneFancher | Sigil | 4 | 04-05-2010 12:18 PM |
No line breaks | ecpepper | Amazon Kindle | 3 | 08-09-2009 06:42 PM |
fbreader ignores line breaks | red_dragon | OpenInkpot | 3 | 03-20-2009 08:38 AM |
Removing extra line breaks | plemming | Calibre | 0 | 07-31-2008 07:50 PM |