Skip to content
Auto-generate a PDF notebook from your source codes (useful for ACM-ICPC)
Branch: master
Clone or download
Pull request Compare This branch is 25 commits ahead, 26 commits behind pin3da:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Aug 10, 2015
LICENSE Initial commit Aug 10, 2015
package-lock.json Fix typo Dec 12, 2018
template_header.tex Three columns Dec 12, 2018


Auto generate a PDF notebook from your source codes (useful for your ACM-ICPC cheatsheet)


This generator works in both Linux and Windows, so check how to install TeX Live in your OS.

TeX Live for linux:

sudo aptitude install texlive

TeX Live for Windows:

download installer (install-tl-windows.exe) from

Also install Node.js and NPM on your machine (you can download them from

After installing Node.js on Linux, add this command to your ~/.bashrc:

export PATH="$HOME/.npm_modules/bin:$PATH"


sudo npm install -g codes2pdf


sudo npm update -g codes2pdf


Usage: codes2pdf <source_dir> [options]

Auto generate a PDF notebook from your source codes


    -V, --version             output the version number
    -a --author [name]        author's name to be added in the notebook
    -i --initials [initials]  initials of the author to be placed in the upper-right corner of all pages
    -o --output [filename]    output file for the notebook. Default to `./notebook.pdf`
    -h, --help                output usage information


codes2pdf ./ /tmp/team_reference.pdf
codes2pdf ./ --author "Shahid Beheshti University" --initials SBU

The second one will create a 'notebook.pdf' file in the current directory, from the source code files which are located in the current directory and its subdirectories.

The notebook generator will add your source code with syntax highlighting, additionally you can add .tex files which will be rendered as Latex code.

Sample PDF

Here you can find a sample:

(In the forked version, the generated notebook file will have three columns in each page; so you can put more source codes in a few number of pages.)


  • Try to use up to 3 "levels" in your source code.
  • Use spaces insead of underscore (in the filenames) to print a prettier TOC.
  • In the forked version of the repository, the generated notebook will have three columns in each page.
You can’t perform that action at this time.