I'm looking for an editor to print (on paper) C++ code. I'm currently in engineering school and the instructor has asked us to submit the code on paper.
He wants name + surname, the class number (on header), the number of page at the bottom, and the reserved words bolded for every page!
On Windows it can be done with notepadd++
. But I'm on Linux and I haven't found an IDE or text editor that works. (I've already tried SCITE
, gedit
, and Syntaxic
)
Best Answer
Well, if you want to go the extra mile, do it in LaTeX and provide a professional level PDF file. You haven't mentioned your distribution so I'll give instructions for Debian based systems. The same basic idea can be done on any Linux though.
Install a LaTeX system and necessary packages
Create a new file (call it
report.tex
) with the following contents:Just make sure to change
/path/to/your/code.c
in the penultimate line so that it point to the actual path of your C file. If you have more than one file to include, add a\newpage
and then a new\lstinputlisting
for the other file.Compile a PDF (this creates
report.pdf
)I tested this on my system with an example file I found here and it creates a PDF that looks like this:
For a more comprehensive example that will automatically find all .c files in the target folder and create an indexed PDF file with each in a separate section, see my answer here.