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

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 06-07-2011, 07:33 PM   #1
txgecko
Enthusiast
txgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 27
Karma: 12996
Join Date: Dec 2010
Location: Dallas, TX
Device: Kindle keyboard, Paperwhite
Adding line numbers to an ebook

I'm not quite sure if this is the right place to ask this, but I don't know where else to put it - if this is the wrong place, feel free to tell me so. Anyway, here goes: I have an ebook of Paradise Lost that I am reading for a class. Problem is, it has no line numbers, and as anyone who has had to read epic poetry like Paradise Lost or The Divine Comedy or something else like that knows, everyone references passages by book and line number, making my copy absolutely useless without them. I'd rather not go out and buy a paper copy, so I'm trying to figure out how to add them myself. I have Calibre, so I thought I'd just convert it to rtf, open it up in Open Office, add line numbers, turn it back into a mobi, and be on my merry way. Unfortunately, Open Office adds line numbers to the margin, not the text itself, so they aren't there when the rtf with the line numbers is opened as an ebook in Calibre. I checked in Word, and it adds line numbers the same way. Does anyone know how to make Word or OOo add the line numbers to the lines themselves, like this:

Brought death into the World, and all our woe,
With loss of Eden, till one greater Man
5 Restore us, and regain the blissful seat,
Sing, Heavenly Muse, that, on the secret top
Of Oreb, or of Sinai, didst inspire

without numbering each and every line by hand? Or, if it can't be done in either of those, something else that will do it? I've got Calibre, so I don't mind if I have to change the format to do it, so long as the numbers will stay there when I convert it into something the kindle can read. Thanks!
txgecko is offline   Reply With Quote
Old 06-08-2011, 04:39 PM   #2
Faster
Connoisseur
Faster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of light
 
Posts: 60
Karma: 12096
Join Date: Sep 2010
Location: Tasmania
Device: Sony PRS 650
Download from Project Gutenberg Etext of Paradise Lost(Raben)
The file should be named plrabn11.txt or plrabn11.zip.
Open the text in Notepad.
Delete everything other than the lines which have to be numbered.
(Note there are breaks for 'Book x' within the lines, leave these for now)
Open MS Excel.
Back to Notepad. Select all. Copy.
In Excel click cell B1. Paste (Ctrl V)
In cell A1 enter the number 1, hit ENTER, enter the number 2 in A2.
Select cells A1 and A2 and drag down the column until you get to one of the Book x breaks in the lines and release to number the lines.
Move down the column to where the lines begin again. Start numbering again as above. I don't know how the lines are numbered in your book guide so you'll have to follow their pattern which may start from 1 (one) again or continue from where the earlier numbers finished.
OK, we've got 9000 plus lines. Wow!
Select column A and Column B. (Click on the 'A' at top of column, hold SHIFT and click on the 'B'). Copy. Open a blank Notebook file. Paste.
You now have a text file with the lines numbered. You can open it in whatever you use to make your ebooks.
Faster is offline   Reply With Quote
 
Enthusiast
Old 06-08-2011, 05:04 PM   #3
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 9,655
Karma: 5072002
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
If you have a unix or mac system and a txt version (or some unix commands on a pc as I do). From a command line: cat -n filename.txt > filename1.txt

Dale
DaleDe is online now   Reply With Quote
Old 06-09-2011, 12:01 AM   #4
pholy
Booklegger
pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.
 
pholy's Avatar
 
Posts: 1,799
Karma: 7999034
Join Date: Jun 2009
Location: Toronto, Ontario, Canada
Device: BeBook(1 & 2010), PEZ, PRS-505, Kobo BT, PRS-T1, Playbook, Kobo Touch
Geez, 15 years using Linux and I never bothered to read the cat manual!

Thanks, Dale
pholy is offline   Reply With Quote
Old 06-09-2011, 07:06 PM   #5
txgecko
Enthusiast
txgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 27
Karma: 12996
Join Date: Dec 2010
Location: Dallas, TX
Device: Kindle keyboard, Paperwhite
I'll take a look at the excel method, thanks. As for the one Dale mentioned, I'm using windows 7, so no mac, and I don't have more than a vague idea as to what unix is - can I just put that command in Command Prompt, or is it more complicated than that?
txgecko is offline   Reply With Quote
Old 06-09-2011, 09:34 PM   #6
txgecko
Enthusiast
txgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 27
Karma: 12996
Join Date: Dec 2010
Location: Dallas, TX
Device: Kindle keyboard, Paperwhite
Oh! While I'm here, does Faster (or anyone else for that matter) have any tips for merging the numbered lines back in with the rest of them once I'm done numbering them in excel?
txgecko is offline   Reply With Quote
Old 06-10-2011, 05:46 PM   #7
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 9,655
Karma: 5072002
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
Quote:
Originally Posted by txgecko View Post
I'll take a look at the excel method, thanks. As for the one Dale mentioned, I'm using windows 7, so no mac, and I don't have more than a vague idea as to what unix is - can I just put that command in Command Prompt, or is it more complicated than that?
You first need a cat command and then you can use a cmd prompt. You can download one from http://www.softpedia.com/get/Desktop...dman-Cat.shtml

Be sure you download the cat command and not some advertizing. Then unzip it and put in in the same folder as the file you want to add numbers too and then use the example I gave earlier cat -n sourcefile.txt > resultsfile.txt

Dale
DaleDe is online now   Reply With Quote
Old 06-11-2011, 01:54 PM   #8
txgecko
Enthusiast
txgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametertxgecko can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 27
Karma: 12996
Join Date: Dec 2010
Location: Dallas, TX
Device: Kindle keyboard, Paperwhite
Thanks Dale, I'll take a look and do some fiddling (or maybe even some tinkering). In the mean time, for anyone else who wants to add line numbers to an ebook and does not wish to venture beyond the safety of a GUI, I came up with a pretty good way of adding the numbers in excel yesterday afternoon:
1) In Calibre, convert the book in need of numbering into an epub. Once its done, click on the "Click to open" link under "Path" in the info pane. Open the epub in Sigil (or, if you don't like directly editing the copy calibre uses, make a copy and open it in sigil). From the Book Browser pane on the left, click around the various html files until you find the one with the first chapter/book/whatever in it. Copy the text you want numbered (ie, not the chapter numbers/titles), and paste it into column B of an excel spreadsheet.
2) Now that the text is in excel, Go to cell A1 and enter the number 1. Go to cell A2 and enter the formula =IF(ISTEXT(B2),MAX($A$1:$A1)+1,""). Now, highlight cell A2 and drag down to the bottom of the text. Now all lines are numbered. If you're fine with each and every line having a number, leave it this way and proceed to step 3.
2a) If you prefer to have the lines numbered by 5s the way they are in print editions of poems, copy columns A and B and paste them into Notepad. Hit edit > select all and copy them out of notepad and into a new spreadsheet. (this is to remove the formula association from the line numbers column. If we attempt to remove the numbers that aren't multiples of 5 with the column still associated with a formula, it'll mess up the numbering). In cell C1 of the new spreadsheet, insert the formula =IF(OR(RIGHT(A1)="5", RIGHT(A1)="0"),"keep","remove") and drag down to the bottom. Under the Data tab of the ribbon, click on “Filter”. Click on the drop down menu under cell C1 and uncheck the box labeled “keep”. Highlight column A and hit the delete key on the keyboard. Go back to the filter drop down menu and recheck “keep”. Now the only lines numbered are those that are multiples of 5.
3) Delete the numberless text from the chapter's tab in Sigil. Copy columns A and B only of the excel document and paste them into Sigil under the appropriate chapter. Save and repeat for the next chapter, and so on. Once you're done numbering all the chapters, save and convert the epub to the desired format. (or, if you did not use calibre's epub in sigil, save, import to calibre, and convert to the desired format). There are probably some ways this can be streamlined, but I'll leave that alone for now.

Takes maybe 2 minutes per book, less than that if you don't mind having a number on every line.
txgecko is offline   Reply With Quote
Old 06-11-2011, 02:59 PM   #9
Faster
Connoisseur
Faster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of light
 
Posts: 60
Karma: 12096
Join Date: Sep 2010
Location: Tasmania
Device: Sony PRS 650
With regard to 2a above to number only every fifth line:
In column A enter 5 opposite the fifth line of the text. Enter 10 opposite the tenth line of the text.
Select cells in column A from opposite lines zero to 10. Drag downwards using the black square in the lower right of the selection area. You get 15, 20 25... Takes 2 seconds!
Faster is offline   Reply With Quote
Reply

Tags
line numbers

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BN says Nook line is its best selling ever -- neglects to release the numbers RockdaMan General Discussions 72 01-05-2011 04:34 AM
Command Line Batch Adding of Epubs nkormanik Calibre 6 10-19-2010 08:04 AM
adding books via command line in msdos batch FlaKate Calibre 1 12-25-2009 01:12 AM
Adding books from the command line edembowski Calibre 1 08-29-2009 11:18 AM
Formatting epic poems with line numbers? Lima_dat Workshop 4 02-25-2008 03:53 PM


All times are GMT -4. The time now is 12:51 PM.


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