和田さま
サンプルコードまで作って試していただき、ありがとうございます。
和田さんのサンプルコードを実行しましたら、私の環境でもうまく行きました。
いろいろ調べましたら、\lstsetでオプションを設定しているところで、
commentstyle={\smallitshape}
がどうやらエラーの原因になっているらしく、それをコメントアウトしたら、
languageの設定がうまく行くようになりました。
\lstset{
basicstyle={\ttfamily},
identifierstyle={\small},
% commentstyle={\smallitshape},
keywordstyle={\small\bfseries},
ndkeywordstyle={\small},
stringstyle={\small\ttfamily},
frame={tb},
breaklines=true,
upquote=true,
columns=[l]{fullflexible},
numbers=none, %% left
xrightmargin=0ex,
xleftmargin=3ex,
numberstyle={\scriptsize},
stepnumber=1,
numbersep=1ex,
lineskip=-0.5ex
}
どうもありがとうございました。