Following code cant highlight as keyword. What am I doing wrong? Shouldn't as be bold like import?
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\lstset{morekeywords={as}}
\title{Python listings}
\author{me}
\begin{document}
\maketitle
\section{Introduction}
Python example
\begin{lstlisting}[language=Python]
#!/usr/bin/env python
"""
An animated image
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
\end{lstlisting}
done with the example.
\end{document}
\lstset{otherkeywords={as}}
seems to work. From the documentation it appears thatotherkeywords
is intended to be used for keywords that may contain other characters or begin with numbers, so perhaps it is a bug thatmorekeywords
did not work.otherkeywords
works. I didn't find a valid reason (in listings documentation) tomorekeywords
ignore 'as', thus it seems it's a bug. Where can I report it? e-mail to the maintainer?