3

When I define the Rust language in TeX Live 2023’s lstlisting like this:

\begin{lstlisting}[language=Rust]
let config_redis_string: String = env::var("REDIS_URL").expect("redis url missing");
\end{lstlisting}

it does not seem to support the Rust language. Is it possible to add support for Rust?

2
  • 2
    For adding new languages see section 3.2 and 4.7 of the manual. For getting a new feature within the package, ask the package author. As an alternative try package minted, because Rust is one of the supported languages of pygments.
    – cabohah
    Jul 12 at 12:02
  • 3
    Please don't post code fragments. Always make a small test document which includes a class and the necessary packages. Jul 12 at 12:09

1 Answer 1

7

Using the style from https://github.com/denki/listings-rust , the following seems to work fine:

\documentclass{article}

\usepackage{listings, listings-rust}

\begin{document}

\begin{lstlisting}[language=Rust]
let config_redis_string: String = env::var("REDIS_URL").expect("redis url missing");
\end{lstlisting}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .