> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/formatting/12-code-highlighting-with-minted.md).

# Code Highlighting with minted

## Introduction

This article shows how to use the [`minted` package](https://ctan.org/pkg/minted?lang=en) to format and highlight programming language source code within a LaTeX document, starting with an example:

```latex
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{python}
import numpy as np

def incmatrix(genl1,genl2):
    m = len(genl1)
    n = len(genl2)
    M = None #to become the incidence matrix
    VT = np.zeros((n*m,1), int)  #dummy variable

    #compute the bitwise xor matrix
    M1 = bitxormatrix(genl1)
    M2 = np.triu(bitxormatrix(genl2),1)

    for i in range(m-1):
        for j in range(i+1, m):
            [r,c] = np.where(M2 == M1[i,j])
            for k in range(len(r)):
                VT[(i)*n + r[k]] = 1;
                VT[(i)*n + c[k]] = 1;
                VT[(j)*n + r[k]] = 1;
                VT[(j)*n + c[k]] = 1;

                if M is None:
                    M = np.copy(VT)
                else:
                    M = np.concatenate((M, VT), 1)

                VT = np.zeros((n*m,1), int)

    return M
\end{minted}
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+of+the+minted+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bminted%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bminted%7D%7Bpython%7D%0Aimport+numpy+as+np%0A++++%0Adef+incmatrix%28genl1%2Cgenl2%29%3A%0A++++m+%3D+len%28genl1%29%0A++++n+%3D+len%28genl2%29%0A++++M+%3D+None+%23to+become+the+incidence+matrix%0A++++VT+%3D+np.zeros%28%28n%2Am%2C1%29%2C+int%29++%23dummy+variable%0A++++%0A++++%23compute+the+bitwise+xor+matrix%0A++++M1+%3D+bitxormatrix%28genl1%29%0A++++M2+%3D+np.triu%28bitxormatrix%28genl2%29%2C1%29+%0A%0A++++for+i+in+range%28m-1%29%3A%0A++++++++for+j+in+range%28i%2B1%2C+m%29%3A%0A++++++++++++%5Br%2Cc%5D+%3D+np.where%28M2+%3D%3D+M1%5Bi%2Cj%5D%29%0A++++++++++++for+k+in+range%28len%28r%29%29%3A%0A++++++++++++++++VT%5B%28i%29%2An+%2B+r%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28i%29%2An+%2B+c%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28j%29%2An+%2B+r%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28j%29%2An+%2B+c%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++%0A++++++++++++++++if+M+is+None%3A%0A++++++++++++++++++++M+%3D+np.copy%28VT%29%0A++++++++++++++++else%3A%0A++++++++++++++++++++M+%3D+np.concatenate%28%28M%2C+VT%29%2C+1%29%0A++++++++++++++++%0A++++++++++++++++VT+%3D+np.zeros%28%28n%2Am%2C1%29%2C+int%29%0A++++%0A++++return+M%0A%5Cend%7Bminted%7D%0A%5Cend%7Bdocument%7D)

This example produces the following output:

![Example displaying the output of the minted package](/files/BeQDW1zc5j7LhmKIg4Er)

There are two important commands here. In the preamble the package is imported by writing

```latex
\usepackage{minted}
```

then the tags `\begin{minted}{python}` and `\end{minted}` delimit an environment that print the text verbatim in monospaced fonts and also apply colour to comments, keywords and functions. The parameter `python` is the programming language the source code is written in. `minted` supports over 150 programming and markup languages as well as configuration files, see the [reference guide](#reference-guide) for a list of supported languages.

**Note**: For `minted` to work with your *local* LaTeX distribution, an additional program called [Pygments](https://pygments.org/) must be installed. [Overleaf](https://www.overleaf.com/) can save you the trouble of installing it and having to run special commands to compile your document—on Overleaf, documents that use `minted` will work "out of the box".

## Basic usage

As demonstrated in the following example, the `minted` environment can be configured to modify visual presentation of the typeset code. Here, the `minted` environment uses several comma-separated parameters of the form `key=value`:

```latex
\documentclass{article}
\usepackage{minted}
\usepackage{xcolor} % to access the named colour LightGray
\definecolor{LightGray}{gray}{0.9}
\begin{document}
\begin{minted}
[
frame=lines,
framesep=2mm,
baselinestretch=1.2,
bgcolor=LightGray,
fontsize=\footnotesize,
linenos
]
{python}
import numpy as np

def incmatrix(genl1,genl2):
    m = len(genl1)
    n = len(genl2)
    M = None #to become the incidence matrix
    VT = np.zeros((n*m,1), int)  #dummy variable

    #compute the bitwise xor matrix
    M1 = bitxormatrix(genl1)
    M2 = np.triu(bitxormatrix(genl2),1)

    for i in range(m-1):
        for j in range(i+1, m):
            [r,c] = np.where(M2 == M1[i,j])
            for k in range(len(r)):
                VT[(i)*n + r[k]] = 1;
                VT[(i)*n + c[k]] = 1;
                VT[(j)*n + r[k]] = 1;
                VT[(j)*n + c[k]] = 1;

                if M is None:
                    M = np.copy(VT)
                else:
                    M = np.concatenate((M, VT), 1)

                VT = np.zeros((n*m,1), int)

    return M
\end{minted}
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Another+example+of+the+minted+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bminted%7D%0A%5Cusepackage%7Bxcolor%7D+%25+to+access+the+named+colour+LightGray%0A%5Cdefinecolor%7BLightGray%7D%7Bgray%7D%7B0.9%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bminted%7D%0A%5B%0Aframe%3Dlines%2C%0Aframesep%3D2mm%2C%0Abaselinestretch%3D1.2%2C%0Abgcolor%3DLightGray%2C%0Afontsize%3D%5Cfootnotesize%2C%0Alinenos%0A%5D%0A%7Bpython%7D%0Aimport+numpy+as+np%0A++++%0Adef+incmatrix%28genl1%2Cgenl2%29%3A%0A++++m+%3D+len%28genl1%29%0A++++n+%3D+len%28genl2%29%0A++++M+%3D+None+%23to+become+the+incidence+matrix%0A++++VT+%3D+np.zeros%28%28n%2Am%2C1%29%2C+int%29++%23dummy+variable%0A++++%0A++++%23compute+the+bitwise+xor+matrix%0A++++M1+%3D+bitxormatrix%28genl1%29%0A++++M2+%3D+np.triu%28bitxormatrix%28genl2%29%2C1%29+%0A%0A++++for+i+in+range%28m-1%29%3A%0A++++++++for+j+in+range%28i%2B1%2C+m%29%3A%0A++++++++++++%5Br%2Cc%5D+%3D+np.where%28M2+%3D%3D+M1%5Bi%2Cj%5D%29%0A++++++++++++for+k+in+range%28len%28r%29%29%3A%0A++++++++++++++++VT%5B%28i%29%2An+%2B+r%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28i%29%2An+%2B+c%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28j%29%2An+%2B+r%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28j%29%2An+%2B+c%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++%0A++++++++++++++++if+M+is+None%3A%0A++++++++++++++++++++M+%3D+np.copy%28VT%29%0A++++++++++++++++else%3A%0A++++++++++++++++++++M+%3D+np.concatenate%28%28M%2C+VT%29%2C+1%29%0A++++++++++++++++%0A++++++++++++++++VT+%3D+np.zeros%28%28n%2Am%2C1%29%2C+int%29%0A++++%0A++++return+M%0A%5Cend%7Bminted%7D%0A%5Cend%7Bdocument%7D)

This example produces the following output:

![Example applying formatting to typeset code produced by the minted package](/files/gnBS7uDPC2nI78emAFfL)

The parameters used in this example are:

* `frame=lines`: draws two lines, one on top and one at the bottom of the code to frame it. Other possible values are `leftline`, `topline`, `bottomline` and `single`.
* `framesep=2mm`: the frame separation is set to 2mm. Other [length units](/latex/formatting/01-lengths-in-latex.md) can be used.
* `baselinestretch=1.2`: the line spacing of the code set to 1.2.
* `bgcolor=LightGray`: background colour set to `LightGray`. You need to import the `xcolor` package for this to work. See [Using colours in LaTeX](/latex/formatting/13-using-colors-in-latex.md) to learn more about colour manipulation.
* `fontsize=\footnotesize`: font size set to `footnotesize`. Any other [font size](/latex/fonts/01-font-sizes-families-and-styles.md#reference-guide) can be set.
* `linenos`: enables line numbers.

Other options that may be useful are:

* `mathescape`: enables math mode in code comments.
* `rulecolor`: changes the colour of the frame.
* `showspaces`: enables a special character to make spaces visible.

## Including code from a file

Code is usually stored in a source file, therefore a command which automatically imports code from a file is very convenient, as demonstrated in the following example:

```latex
\documentclass{article}
\usepackage{minted}
\title{Importing files using minted}
\begin{document}
The next code will be directly imported from a file:

\inputminted{octave}{BitXorMatrix.m}
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=\&snip_name\[]=main.tex\&snip\[]=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bminted%7D%0A%5Ctitle%7BImporting+files+using+minted%7D%0A%5Cbegin%7Bdocument%7D%0AThe+next+code+will+be+directly+imported+from+a+file%3A%0A%0A%5Cinputminted%7Boctave%7D%7BBitXorMatrix.m%7D%0A%5Cend%7Bdocument%7D\&snip_name\[]=BitXorMatrix.m\&snip\[]=function+X+%3D+BitXorMatrix%28A%2CB%29%0A%25function+to+compute+the+sum+without+charge+of+two+vectors%0A%09%0A%09%25convert+elements+into+usigned+integers%0A%09A+%3D+uint8%28A%29%3B%0A%09B+%3D+uint8%28B%29%3B%0A%0A%09m1+%3D+length%28A%29%3B%0A%09m2+%3D+length%28B%29%3B%0A%09X+%3D+uint8%28zeros%28m1%2C+m2%29%29%3B%0A%09for+n1%3D1%3Am1%0A%09%09for+n2%3D1%3Am2%0A%09%09%09X%28n1%2C+n2%29+%3D+bitxor%28A%28n1%29%2C+B%28n2%29%29%3B%0A%09%09end%0A%09end\&main_document=main.tex)

This example produces the following output:

![Using minted to import a code file](/files/gVIQ7QgvCjqNwc5VNYzR)

The command `\inputminted{octave}{BitXorMatrix.m}` imports the code from the file `BitXorMatrix.m`, the parameter `octave` tells LaTeX the programming language of the code. This command can take two extra parameters to import only part of the file; for instance, to import code from the line 2 to the line 12, the command becomes:

```latex
\inputminted[firstline=2, lastline=12]{octave}{BitXorMatrix.m}
```

## One-line code

If you need to input only a line of code, the command `\mint`, whose syntax is presented in the next example, will do the trick.

```latex
One-line code formatting also works with \texttt{minted}. For example, a small fragment of HTML like this:
\mint{html}|<h2>Something <b>here</b></h2>|
\noindent can be formatted correctly.
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=One+line+code+example+with+minted\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bminted%7D%0A%5Cbegin%7Bdocument%7D%0AOne-line+code+formatting+also+works+with+%5Ctexttt%7Bminted%7D.+For+example%2C+a+small+fragment+of+HTML+like+this%3A%0A%5Cmint%7Bhtml%7D%7C%3Ch2%3ESomething+%3Cb%3Ehere%3C%2Fb%3E%3C%2Fh2%3E%7C%0A%5Cnoindent+can+be+formatted+correctly.%0A%5Cend%7Bdocument%7D)

This example produces the following output:

![One line code example with minted](/files/hxLMWeoJB0Dh5P5JbTGc)

The parameter between braces sets the programming language (`html` markup language in this case) with the actual text to be formatted being delimited by the '|' character.

## Custom lexers

**(Please note that due to changes in `minted` since 2023, the following approach will only work in** [**TeX Live 2022 or earlier**](/latex/knowledge-base/148-using-the-overleaf-project-menu.md#tex-live-version)**.)**

By default, `minted` supports only languages with lexers that are already installed or registered with `pygmentize`. If you have written a custom lexer, or want to use a lexer for a language that's not yet been installed on Overleaf, you can still use it in your own Overleaf project using the approach mentioned [here](https://tex.stackexchange.com/questions/18083/how-to-add-custom-c-keywords-to-be-recognized-by-minted#comment930474_42392).

Suppose you have defined a lexer in the file `nl-lexer.py`, containing the class `NetLogoLexer` for the NetLogo language. Upload `nl-lexer.py` to your Overleaf project, and then specify `nl-lexer.py:NetLogoLexer` as the "language name" when using `minted`. For example:

```latex
\begin{minted}{nl-lexer.py:NetLogoLexer -x}
   ... your code here ...
\end{minted}
```

[Here's](http://quantixed.org/2018/10/23/new-lexicon-how-to-add-a-custom-minted-lexer-in-overleaf/) another example for the ImageJ Macro language.

## Colours and stylesheets

The colour schemes used for code highlighting are saved in stylesheets. You can create your own or use one already available in your LaTeX distribution. See the [reference guide](#reference-guide) for a list of stylesheets included in [Overleaf](https://www.overleaf.com).

```latex
\documentclass{article}
\usepackage{minted}
\usemintedstyle{borland}
\begin{document}
\begin{minted}{python}
import numpy as np

def incmatrix(genl1,genl2):
    m = len(genl1)
    n = len(genl2)
    M = None #to become the incidence matrix
    VT = np.zeros((n*m,1), int)  #dummy variable

    #compute the bitwise xor matrix
    M1 = bitxormatrix(genl1)
    M2 = np.triu(bitxormatrix(genl2),1)

    for i in range(m-1):
        for j in range(i+1, m):
            [r,c] = np.where(M2 == M1[i,j])
            for k in range(len(r)):
                VT[(i)*n + r[k]] = 1;
                VT[(i)*n + c[k]] = 1;
                VT[(j)*n + r[k]] = 1;
                VT[(j)*n + c[k]] = 1;

                if M is None:
                    M = np.copy(VT)
                else:
                    M = np.concatenate((M, VT), 1)

                VT = np.zeros((n*m,1), int)

    return M
\end{minted}
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+stylesheets+with+minted+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bminted%7D%0A%5Cusemintedstyle%7Bborland%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bminted%7D%7Bpython%7D%0Aimport+numpy+as+np%0A++++%0Adef+incmatrix%28genl1%2Cgenl2%29%3A%0A++++m+%3D+len%28genl1%29%0A++++n+%3D+len%28genl2%29%0A++++M+%3D+None+%23to+become+the+incidence+matrix%0A++++VT+%3D+np.zeros%28%28n%2Am%2C1%29%2C+int%29++%23dummy+variable%0A++++%0A++++%23compute+the+bitwise+xor+matrix%0A++++M1+%3D+bitxormatrix%28genl1%29%0A++++M2+%3D+np.triu%28bitxormatrix%28genl2%29%2C1%29+%0A%0A++++for+i+in+range%28m-1%29%3A%0A++++++++for+j+in+range%28i%2B1%2C+m%29%3A%0A++++++++++++%5Br%2Cc%5D+%3D+np.where%28M2+%3D%3D+M1%5Bi%2Cj%5D%29%0A++++++++++++for+k+in+range%28len%28r%29%29%3A%0A++++++++++++++++VT%5B%28i%29%2An+%2B+r%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28i%29%2An+%2B+c%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28j%29%2An+%2B+r%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++VT%5B%28j%29%2An+%2B+c%5Bk%5D%5D+%3D+1%3B%0A++++++++++++++++%0A++++++++++++++++if+M+is+None%3A%0A++++++++++++++++++++M+%3D+np.copy%28VT%29%0A++++++++++++++++else%3A%0A++++++++++++++++++++M+%3D+np.concatenate%28%28M%2C+VT%29%2C+1%29%0A++++++++++++++++%0A++++++++++++++++VT+%3D+np.zeros%28%28n%2Am%2C1%29%2C+int%29%0A++++%0A++++return+M%0A%5Cend%7Bminted%7D%0A%5Cend%7Bdocument%7D)

Using the `borland` stylesheet produces the following output:

![Output of the minted package using the borland stylesheet](/files/5dzocgS1lZsPN6dWLjCq)

The syntax to set a colouring style is easy, the command `\usemintedstyle{borland}` uses the colour theme `borland` to format the source code. You can find more colour schemes in the [reference guide](#reference-guide).

## Captions, labels and the list of listings

Code listings formatted with **minted** can be included in a float element, just like [figures](/latex/more-topics/27-inserting-images.md#positioning) and [tables](/latex/figures-and-tables/01-tables.md#positioning-tables). Captions and labels can be assigned to code listings, and then later be referenced and included in a "List of listings".

```latex
\documentclass{article}
\usepackage{minted}
\title{Listing code examples}
\begin{document}
\begin{listing}[!ht]
\inputminted{octave}{BitXorMatrix.m}
\caption{Example from external file}
\label{listing:1}
\end{listing}

\begin{listing}[!ht]
\begin{minted}{c}
#include <stdio.h>
int main() {
   printf("Hello, World!"); /*printf() outputs the quoted string*/
   return 0;
}
\end{minted}
\caption{Hello World in C}
\label{listing:2}
\end{listing}

\begin{listing}[!ht]
\begin{minted}{lua}
function fact (n)--defines a factorial function
  if n == 0 then
    return 1
  else
    return n * fact(n-1)
  end
end

print("enter a number:")
a = io.read("*number") -- read a number
print(fact(a))
\end{minted}
\caption{Example from the Lua manual}
\label{listing:3}
\end{listing}
\noindent\texttt{minted} makes a nice job of typesetting listings \ref{listing:1}, \ref{listing:2} and \ref{listing:3}.
\renewcommand\listoflistingscaption{List of source codes}
\listoflistings
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=\&snip_name\[]=main.tex\&snip\[]=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bminted%7D%0A%5Ctitle%7BListing+code+examples%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Blisting%7D%5B%21ht%5D%0A%5Cinputminted%7Boctave%7D%7BBitXorMatrix.m%7D%0A%5Ccaption%7BExample+from+external+file%7D%0A%5Clabel%7Blisting%3A1%7D%0A%5Cend%7Blisting%7D%0A%0A%5Cbegin%7Blisting%7D%5B%21ht%5D%0A%5Cbegin%7Bminted%7D%7Bc%7D%0A%23include+%3Cstdio.h%3E%0Aint+main%28%29+%7B%0A+++printf%28%22Hello%2C+World%21%22%29%3B+%2F%2Aprintf%28%29+outputs+the+quoted+string%2A%2F%0A+++return+0%3B%0A%7D%0A%5Cend%7Bminted%7D%0A%5Ccaption%7BHello+World+in+C%7D%0A%5Clabel%7Blisting%3A2%7D%0A%5Cend%7Blisting%7D%0A%0A%5Cbegin%7Blisting%7D%5B%21ht%5D%0A%5Cbegin%7Bminted%7D%7Blua%7D%0Afunction+fact+%28n%29--defines+a+factorial+function%0A++if+n+%3D%3D+0+then%0A++++return+1%0A++else%0A++++return+n+%2A+fact%28n-1%29%0A++end%0Aend%0A%0Aprint%28%22enter+a+number%3A%22%29%0Aa+%3D+io.read%28%22%2Anumber%22%29+--+read+a+number%0Aprint%28fact%28a%29%29%0A%5Cend%7Bminted%7D%0A%5Ccaption%7BExample+from+the+Lua+manual%7D%0A%5Clabel%7Blisting%3A3%7D%0A%5Cend%7Blisting%7D%0A%5Cnoindent%5Ctexttt%7Bminted%7D+makes+a+nice+job+of+typesetting+listings+%5Cref%7Blisting%3A1%7D%2C+%5Cref%7Blisting%3A2%7D+and+%5Cref%7Blisting%3A3%7D.%0A%5Crenewcommand%5Clistoflistingscaption%7BList+of+source+codes%7D%0A%5Clistoflistings%0A%5Cend%7Bdocument%7D\&snip_name\[]=BitXorMatrix.m\&snip\[]=%25This+code+is+directly+imported+from+a+file%0A%25A+function+to+compute+the+sum+without+charge+of+two+vectors%0Afunction+X+%3D+BitXorMatrix%28A%2CB%29%0A%25convert+elements+into+unsigned+integers%0AA+%3D+uint8%28A%29%3B%0AB+%3D+uint8%28B%29%3B%0A%0Am1+%3D+length%28A%29%3B%0Am2+%3D+length%28B%29%3B%0AX+%3D+uint8%28zeros%28m1%2C+m2%29%29%3B%0A+for+n1%3D1%3Am1%0A++for+n2%3D1%3Am2%0A+++X%28n1%2C+n2%29+%3D+bitxor%28A%28n1%29%2C+B%28n2%29%29%3B%0A++end%0Aend\&main_document=main.tex)

The first page of this example contains the following output:

![Example listing code fragments](/files/qbNfDvGeoOo2J1J8qMIv)

To print the list with all "listing" elements use `\listoflistings`. In the example above, the default title `List of listings` is changed to `List of source codes` by writing

```latex
\renewcommand\listoflistingscaption{List of source codes}
\listoflistings % Now typeset the list
```

The second page produced by the example above contains the following listing:

![An example of listing source codes](/files/BrifpptzqwESgVEjLnJC)

## Reference guide

**Colour styles for minted**

| name     | output                                            | name     | output                                             |
| -------- | ------------------------------------------------- | -------- | -------------------------------------------------- |
| manni    | ![MintedStyles1.png](/files/0eOZ5Mg1mQDYMHm88J7s) | fruity   | ![MintedStyles10.png](/files/nCBW2FH4FlTJsQo9HBGw) |
| rrt      | ![MintedStyles2.png](/files/Ko3tGeQQnVkk9Qp1HTvr) | autumn   | ![MintedStyles11.png](/files/IHfksAh7qrCporZNlt8P) |
| perldoc  | ![MintedStyles3.png](/files/dAutrVL5pS8ovBQUnJX1) | bw       | ![MintedStyles12.png](/files/5PwQHXbUSNwaR1qICP8t) |
| borland  | ![MintedStyles4.png](/files/Hkv8JxRp4EnAQfROeSXS) | emacs    | ![MintedStyles13.png](/files/ulZu2kyMikVsZRgiEeIo) |
| colorful | ![MintedStyles5.png](/files/DVOgNmjSXIGNBlDggjUi) | vim      | ![MintedStyles14.png](/files/5l4TcW5dPjSTyjiVWjcc) |
| murphy   | ![MintedStyles6.png](/files/3hqCdWFQ7mx8aC47nba9) | pastie   | ![MintedStyles15.png](/files/7u7VwVWieGsD0ca1FT7s) |
| vs       | ![MintedStyles7.png](/files/96ButbUMcx28PDOFAQFA) | friendly | ![MintedStyles16.png](/files/EPs2mHPzd8mAL4WXlfK7) |
| trac     | ![MintedStyles8.png](/files/OguQ9n1bXJoSiDUsVzY4) | native   | ![MintedStyles17.png](/files/S4AyCVnmAcGlLfFUtkyA) |
| tango    | ![MintedStyles9.png](/files/MOt03DAV9ukJdnyxSXn7) | monokai  | ![MintedStyles18.png](/files/lw83yAznIwyJQp1FRJBo) |

Some colour schemes need a dark background to be readable.

**Main supported programming languages and configuration files**

|          |            |             |           |
| -------- | ---------- | ----------- | --------- |
| cucumber | abap       | ada         | ahk       |
| antlr    | apacheconf | applescript | as        |
| aspectj  | autoit     | asy         | awk       |
| basemake | bash       | bat         | bbcode    |
| befunge  | bmax       | boo         | brainfuck |
| bro      | bugs       | c           | ceylon    |
| cfm      | cfs        | cheetah     | clj       |
| cmake    | cobol      | cl          | console   |
| control  | coq        | cpp         | croc      |
| csharp   | css        | cuda        | cyx       |
| d        | dg         | diff        | django    |
| dpatch   | duel       | dylan       | ec        |
| erb      | evoque     | fan         | fancy     |
| fortran  | gas        | genshi      | glsl      |
| gnuplot  | go         | gosu        | groovy    |
| gst      | haml       | haskell     | hxml      |
| html     | http       | hx          | idl       |
| irc      | ini        | java        | jade      |
| js       | json       | jsp         | kconfig   |
| koka     | lasso      | livescrit   | llvm      |
| logos    | lua        | mako        | mason     |
| matlab   | minid      | monkey      | moon      |
| mxml     | myghty     | mysql       | nasm      |
| newlisp  | newspeak   | numpy       | ocaml     |
| octave   | ooc        | perl        | php       |
| plpgsql  | postgresql | postscript  | pot       |
| prolog   | psql       | puppet      | python    |
| qml      | ragel      | raw         | ruby      |
| rhtml    | sass       | scheme      | smalltalk |
| sql      | ssp        | tcl         | tea       |
| tex      | text       | vala        | vgl       |
| vim      | xml        | xquery      | yaml      |

## Further reading

For more information see:

* [Lengths in LaTeX](/latex/formatting/01-lengths-in-latex.md)
* [Code listing](/latex/formatting/11-code-listing.md)
* [Counters](/latex/formatting/10-counters.md)
* [Using colours in LaTeX](/latex/formatting/13-using-colors-in-latex.md)
* [Font sizes, families, and styles](/latex/fonts/01-font-sizes-families-and-styles.md)
* [Font typefaces](/latex/fonts/02-font-typefaces.md)
* [Management in a large project](/latex/document-structure/07-management-in-a-large-project.md)
* [Multi-file LaTeX projects](/latex/document-structure/08-multi-file-latex-projects.md)
* [Table of contents](/latex/document-structure/02-table-of-contents.md)
* [Single sided and double sided documents](/latex/formatting/08-single-sided-and-double-sided-documents.md)
* [The **minted** package documentation](https://texdoc.org/serve/minted/0)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/formatting/12-code-highlighting-with-minted.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
