I'm able to compile the following in Overleaf for the desired inline code-coloring effect:
\documentclass{article}
\usepackage{minted}
\usepackage{xcolor}
\definecolor{codeblue}{rgb}{0,0.3,0.6}
\newmintinline[bluecode]{c++}{\color{codeblue}}
\begin{document}
This is a blue \bluecode{keyword} and this is a normal \mintinline[]{C++}{keyword}.
Which produces:
Yet I have the following errors: Missing \endcsname inserted.
and Package keyval Error: \color {codeblue} undefined.
I need these errors to go away so I can upload to arXiv. How can I correct this, or otherwise color inline code?
Best Answer
The following patches
\mintinline
to place the\color
inside of it. Note that this only changes the colour of things that are not coloured by theminted
package (you can see this in the output of%
). The patch doesn't kill the verbatim reading of the argument.To also suppress the colours placed by
minted
, you can change the definition of\mybluecode
: