Font & Tools to print Julia code listings?

I have been struggling for a long time trying to find a way to print Julia code listing where Unicode characters are properly rendered. I have been using enscript for many years to print C++ code, however it does not support Unicode fonts. I had some success with paps and I have tried to use it with the JuliaMono font without success. I am wondering if anyone has found a solution…

Would code listing in a latex document work for you, or do you have another use case in mind?

Conversion to LaTeX would be ok, even if LaTeX is kind of overkill for this problem. If enscript supported Unicode characters that would be perfect.

I guess it depends on what you are using it for, but if you include the file in latex and use minted (and a xelatex or lualatex to ensure you can use unicode characters) then I think it should work well. See What do you use to embed Julia code in LaTeX?

But if you literally are just trying to print this out to a printer, then it is probably overkill.

Just in case, what about using the VS Code extension ‘PrintCode’?

The “Markdown PDF” plug in in vscode produces a nice pdf with unicode characters. Literate.jl could be made to produce the markdown file if you don’t want to do that manually.

1 Like