I am creating a PDF document in which I need to include some annotated, syntax-highlighted source code. The individual code snippets should be PDF files with selectable text, so no .png or .jpg images. Some examples of how I would like the result to look like are at the end of this question.

As I have no graphics design experience, I am unsure which route to take. I tried to recreate something similar using Inkscape, but the process of syntax-highlighting is tedious (can you paste styles in Inkscape, similar to, say, MS Word?)

I am looking for recommendations on tools/workflows to layout source code and add annotations afterwards.

Code example by Görtler et al. (https://arxiv.org/pdf/2110.12536.pdf)

Taken from https://arxiv.org/pdf/2110.12536.pdf

Code example by Kim et al.

Taken from https://arxiv.org/pdf/2203.08314.pdf

  • I just used Powerpoint rather than learning new tools, worked as well.
    – fsperrle
    Mar 26, 2022 at 13:44
  • Welcome on GD.SE, fsperrle! Have you already tried specific tools like LaTeX listings package (see also here)? Else (not tried), there are LibreOffice extensions: you can format your code, add your notes and export as PDF. Mar 28, 2022 at 16:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.