I need to reproduce the output of a command in a LaTeX document. The command uses ANSI escape codes to produce colored output.
I'd like to use minted
, but using \inputminted{shell}{coloredoutput}
produces the following error:
! Text line contains an invalid character.
l.2 ^^[
\PY{o}{[}01\PY{p}{;}31m^^[\PY{o}{[}Kt^^[\PY{o}{[}m^^[\PY{o}{[}K^^[\PY...
To reproduce, create colored output by running
grep --color=always . <(echo test) > coloredoutput
and then compiling the following MWE:
\documentclass{article}
\usepackage{minted}
\begin{document}
\inputminted{shell}{coloredoutput}
\end{document}
You will need -shell-escape
.
The error, I imagine, is due to pygments not properly parsing the color codes. How do I force make it parse them properly?