LaTeX package for syntax highlighting of code in various languages

后端 未结 7 1940
温柔的废话
温柔的废话 2020-11-29 15:00

I am looking for a LaTeX package that does syntax highlighting on code. For example, right now I use the verbatim block to write code:

\\begin{verbatim}
             


        
7条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 15:13

    You can use the listings package. It supports many different languages and there are lots of options for customising the output.

    \documentclass{article}
    \usepackage{listings}
    
    \begin{document}
    \begin{lstlisting}[language=html]
    
        
            Hello
        
        Hello
    
    \end{lstlisting}
    \end{document}
    

提交回复
热议问题