HowTo keep it Indented as Intended with Scribus
January 31, 2009 2:22 PM   Subscribe

How can I insert computer code samples (e.g. Python) using scribus?

I would like to insert Python (or other) code samples using scribus. When I insert a code sample in a text frame, all line breaks and spacing is lost. A work around is to create a text frame for each line of code; however, this is both extremely tedious and error prone (especially for Python where the code indentation is meaningful).
posted by aroberge to Computers & Internet (3 answers total) 1 user marked this as a favorite
It's not a perfect solution, but you could take a screen shot of the code in the IDE / text editor and use the image in scribus.
posted by jjb at 3:54 PM on January 31, 2009

I gave it a try and didn't have any problems on Ubuntu Intrepid using Scribus 1.3.4. Here's what I did:

1. Draw and select text frame
2. File > Import > Get Text...
3. File Type option bar to "All Files" and select *.py, Importer to "automatic"
4. Then I get a Choose the Importer dialog, where I select "text files"
5. Everything's imported fine, just needs a mono-spaced font

The indents in my python file were just 4 plain spaces, inserted automatically by gedit or IDLE or whatever I used to make it. If yours doesn't use spaces, maybe your text editor is to blame for the format problems. Either that or you're not getting the "choose the importer" step and Scribus is trying to import the file as a comma-delineated spreadsheet or whatever. There's a 'remember this association' checkbox at that step so maybe you did it wrong once and it's just following the association. If you're not getting that dialog, I guess just change the importer option in step #3.
posted by cowbellemoo at 7:45 PM on January 31, 2009

<code>your code sample</code> -- seriously, it's that easy.
posted by gum at 9:18 PM on January 31, 2009

« Older Rent a Guitar in D.C., is it possible?   |   House hunting in England Newer »
This thread is closed to new comments.