minted
minted copied to clipboard
`\begin{pmatrix}...\end{pmatrix}` not working as expected inside comments
Consider the following piece of code.
\documentclass[12pt,twoside,a4paper]{scrartcl}
\usepackage[margin=.8in,footskip=0.25in]{geometry}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{minted}
\usepackage{xcolor}
\begin{document}
\title{test}
\maketitle
\pagecolor{gray!10}
\begin{minted}[linenos=true,numberblanklines=false,obeytabs=true,breaklines=true,style=manni
,mathescape=true,framesep=.8cm]{c}
// this is fine $f=g$
// matrix rendering issue $det=ae-bd$ of the matrix $A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$
\end{minted}
\end{document}
The output when rendered using lualatex looks like this
It looks like the & is not being recognized as a LateX command.
Any way to get around this?
This might be a pygments issue https://github.com/pygments/pygments/issues/1988, and I gave a proof-of-concept workaround in https://tex.stackexchange.com/a/625741.
I gave a proof-of-concept workaround in https://tex.stackexchange.com/a/625741.
The workaround provided in that TeX-SX answer is updated to be (hopefully) more robust.