I would argue that there are no real style guidelines, except maybe (the only one I've ever been given) not to drown your audience in lines of code, thus use excerpts and pseudo-code whenever possible.
However, to still put your code full-length on paper, you pretty much should have it readable on-screen already. You might have a little refactoring to do, if you expect people to actually read it.
- Fixed font size are traditional in source code, which is due according to Joel Spolsky to it being easier to edit (say click on a specific letter) and to distinguish typos (e.g. rn/m vs
rn
/m
) than when using a variable spaced fonts
- A fixed width so you never scroll horizontally while your code is on screen. This, with a correct font size, will take care of line wrapping when on paper.
- Modular code, so people know where (in which file, for example) they are : similarly to opening the interesting file, you want readers to be able to skip the pages of configuration, I/O and whatnot, to find wherever the core of your code is.
- Be consistent, as you already noted, in all conventions: naming, indentation, comments...
- include syntax Highlighting (maybe even colouring ?)
Your main options (most popular on a subjective scale of googleability) to achieve the latter are
- in LaTeX, use a listing (with a language that it understands, hopefully). You can even input code from a file directly
\includecode[asm]{sched.s}
- in LaTeX, use the minted package, an alternative whose code highlighting is done with Pygments
- in MS Word, insert code in an embedded document as an "openDocument Text" object, copying your code from your usual IDE
- in any WYSIWYG on Windows, use the NppExport plugin of Notepad++ to export your code, and then copy it into your document as RTF or HTML.
- With any python interpreter, use Pygments, e.g. :
pygmentize -f html main.c > main.c.html
The only guidelines I could find in the wild were on this random project report page, of rather small scale (4-6 pages), and they are rather succinct :
Format: Use [...] 11 point times font for the main text, and use 10 point courier font for computer code. [...]
Yes, your code should be in the appendix, monospaced, single column. You do not have to turn in all code used in your experiment; use your best judgement. You may want to include only relevent sections of code. For example, you should not include code that someone else wrote, unless you made major modifications. If your code is 100 pages, you should not print all of it. If your code is 6 pages, then you should print all of it.