dan
New Member
Posts: 2
Joined: Mar 14, 2013 16:09:48 GMT -8
|
Post by dan on Mar 14, 2013 16:20:35 GMT -8
Im writing a programming book. How should I format the source code so that it maintains its indentation in the final version of the kindle and epub versions? I have it in MS words as a fixed width font now, but the leading spaces (or tabs) get stripped off in the conversion. This would be the equivalent of <pre> in html </pre> . Ive tried a million things (ok, dozens) and the only thing that works (sort of) is to format each line as a paragraph with different indentation. Sometimes the indentation gets lost in conversion (3 indent levels looks the same as 1 or 2). Its also insanely tedious to indent each line of code like that. Any ideas on a better way?
Some lines will have text on the left and then need about 20 spaces and more text (the space in significant to the program) but the conversion removes all but 1 space. I havent figured out a solution to that yet, even a tedious one. Any thoughts?
|
|
|
Post by Ted on Mar 14, 2013 17:07:15 GMT -8
Do indents remain as they should when you make a PDF? If so you may want to first make a PDF and then see if using something like Calibre to make an ePub will keep indents intact.
You could then upload that ePub to Smashwords.
I can't be sure but I think Amazon KDP accepts PDF's. It's been a while since I uploaded anything to Amazon so I could be wrong.
If Calibre doesn't work properly you could look at other programs like Jutoh, Sigil, or perhaps even Scrivener for producing the files you need.
|
|
dan
New Member
Posts: 2
Joined: Mar 14, 2013 16:09:48 GMT -8
|
Post by dan on Mar 15, 2013 12:26:33 GMT -8
Yes, PDF is fine. Ill give Calibre a try. Thanks. Too bad the SmashWords meatgrinder doesn't work for this.
|
|
mackmeijers
New Member
Posts: 7
Joined: Jun 20, 2013 21:17:21 GMT -8
|
Post by mackmeijers on Jun 20, 2013 21:24:42 GMT -8
Scrivener is awesome, if you have a mac. Windows, not so much. Jutoh is a beast, it either suits you or it'll break you Sigil is neat, has my own preference. Including code samples is a breeze, especially if you are a little smart with basic CSS.
|
|