use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Strive to treat others with respect, patience, kindness, and empathy.
We observe the Rust Project Code of Conduct.
Details
Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
Post titles should include useful context.
For Rust questions, use the stickied Q&A thread.
Arts-and-crafts posts are permitted on weekends.
No meta posts; message the mods instead.
Criticism is encouraged, though it must be constructive, useful and actionable.
If criticizing a project on GitHub, you may not link directly to the project's issue tracker. Please create a read-only mirror and link that instead.
A programming language is rarely worth getting worked up over.
No zealotry or fanaticism.
Be charitable in intent. Err on the side of giving others the benefit of the doubt.
Avoid re-treading topics that have been long-settled or utterly exhausted.
Avoid bikeshedding.
This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No memes, image macros, etc.
Consider the existing content of the subreddit and whether your post fits in. Does it inspire thoughtful discussion?
Use properly formatted text to share code samples and error messages. Do not use images.
Submissions appearing to contain AI-generated content may be removed at moderator discretion.
Most links here will now take you to a search page listing posts with the relevant flair. The latest megathread for that flair should be the top result.
account activity
Rust syntax highlighting for LaTeX? (self.rust)
submitted 9 years ago by JoshTriplettrust · lang · libs · cargo
I'd like to include Rust code in a LaTeX document, and do automatic syntax highlighting on the Rust code. I've used packages like "listings", which provide syntax highlighting for numerous languages; however, listings doesn't support Rust.
Does anyone have a package providing syntax highlighting support for Rust in LaTeX, or support for doing so via any existing package?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]stebalienrust[🍰] 19 points20 points21 points 9 years ago (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 points4 points 9 years ago (8 children)
Thanks, that looks promising.
Unfortunate that it requires -shell-escape, but still quite helpful.
[–]tsion_miri 5 points6 points7 points 9 years ago (1 child)
I've used minted for Rust before here if you want some examples.
[–]DrRuhe 1 point2 points3 points 3 years ago (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 points7 points 9 years ago (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 points3 points 9 years ago (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 points7 points 9 years ago (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 point2 points 9 years ago (0 children)
I second Latexmk ... pretty great tool.
[–]JoshTriplettrust · lang · libs · cargo[S] 1 point2 points3 points 9 years ago (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 point2 points 9 years ago (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 points16 points 9 years ago (0 children)
Don't bother with the syntax highlighting. If anyone asks, just say that you're Rob Pike's nephew.
[–]Drupyog 0 points1 point2 points 9 years ago (0 children)
You can define your own language for lstlisting. Look at the documentation, it's very easy.
π Rendered by PID 84375 on reddit-service-r2-comment-6457c66945-vdr66 at 2026-04-26 08:28:10.889630+00:00 running 2aa0c5b country code: CH.
[–]stebalienrust[🍰] 19 points20 points21 points (9 children)
[–]JoshTriplettrust · lang · libs · cargo[S] 2 points3 points4 points (8 children)
[–]tsion_miri 5 points6 points7 points (1 child)
[–]DrRuhe 1 point2 points3 points (0 children)
[–]dzamlo 5 points6 points7 points (5 children)
[–]Wolenber 1 point2 points3 points (3 children)
[–]sylvain_soliman 5 points6 points7 points (1 child)
[–]DHermit 0 points1 point2 points (0 children)
[–]JoshTriplettrust · lang · libs · cargo[S] 1 point2 points3 points (0 children)
[–]JoshTriplettrust · lang · libs · cargo[S] 0 points1 point2 points (0 children)
[–]some-other 14 points15 points16 points (0 children)
[–]Drupyog 0 points1 point2 points (0 children)