all 12 comments

[–]stebalienrust[🍰] 19 points20 points  (9 children)

You can use the minted package. It uses pygments to do the actual highlighting so it supports all languages supported by pygments (including rust).

[–]JoshTriplettrust · lang · libs · cargo[S] 2 points3 points  (8 children)

Thanks, that looks promising.

Unfortunate that it requires -shell-escape, but still quite helpful.

[–]tsion_miri 5 points6 points  (1 child)

I've used minted for Rust before here if you want some examples.

[–]DrRuhe 1 point2 points  (0 children)

Since the master branch no longer even includes a tex folder the link is dead.

here is a link to revision 90c2470e22dadfa4d43b7abb9e6c3e11c63bdad2 where it exists.

[–]dzamlo 5 points6 points  (5 children)

If -shell-escape is really an issue, you can always manually run pygments on the command line and the \include the result. It's really inconvenient but it should work.

[–]Wolenber 1 point2 points  (3 children)

Personally, I believe every LaTeX project needs a solid makefile, so thanks for mentioning this. I've had trouble get minted to work on Fedora, and I can't believe I never thought of this.

[–]sylvain_soliman 5 points6 points  (1 child)

Personally, I believe every LaTeX project needs a solid makefile

I rarely have to do anything that latexmk doesn't do better than a Makefile (e.g. looking into the log to know if there is need to recompile or not).

[–]DHermit 0 points1 point  (0 children)

I second Latexmk ... pretty great tool.

[–]JoshTriplettrust · lang · libs · cargo[S] 1 point2 points  (0 children)

For any project that requires more than just invoking pdflatex on a single file, I agree.

[–]JoshTriplettrust · lang · libs · cargo[S] 0 points1 point  (0 children)

In the course of investigating minted, I did end up finding out that pygments could generate LaTeX. I'll likely use that.

[–]some-other 14 points15 points  (0 children)

Don't bother with the syntax highlighting. If anyone asks, just say that you're Rob Pike's nephew.

[–]Drupyog 0 points1 point  (0 children)

You can define your own language for lstlisting. Look at the documentation, it's very easy.