- Create a new
.tex
file for your project. - Copy
%%-----DOCUMENT
section into your file. Everything else will go into the$DOCUMENT CONTENTS HERE$
section. - Select files, which you want to format. Currently supported formats are
makefile
,C
code andREADME
files.- Copy
%%-----C
,%%-----README
or%%-----MAKEFILE
section into your document. - Replace
$FILE CONTENTS HERE$
with the contents of your file.
- Copy
- Optional:
- If you want your code sections to be labled with filenames, add a
%%-----FILENAME
section before the code section you are labeling. And replace$FILENAME HERE$
with full path to your file. - Split your document into pages by adding
\newpage
between code sections. - Split one file into pages by inserting
%%-----PAGEBREAK
section inside code sections. (It looks much better than the default paging, trust me.) - In the
%%------README
section, you can highlight words in bold with<:words in bold:>
and italicize words with<|words in italics|>
. - Add extra keywords (like
size_t
orFILE
) for highlighting, by adding the%%-----MOREKW
section before the code section and replacing$EXTRA KEYWORDS HERE$
with the keywords you want highlighted. (Comma seperated list. Sadly, no spaces are allowed in keywords)
- If you want your code sections to be labled with filenames, add a
The paging is set up in such a way, that exactly 80 characters fit horizontally. If your listing looks ugly, because of hard wrapping lines/ugly alignment, please consider refactoring your code, so it does fit into 80 characters.
Installing TeX and the packages used in this preset, may be quite bothersome. As an alternative, I suggest using an online latex editor/compiler. Not all of them work. It is almost guaranteed that overleaf will work.