When I use the backgroundcolor
option in lstset
, all I get is a colored line above the listing:
\lstset{%
language=Matlab,
backgroundcolor=\color{blue}
}
and in the document:
\L{\inputencoding{cp1255}
\begin{lstlisting}[basicstyle={\footnotesize\ttfamily}]
>> x(6)
ans =
9
\end{lstlisting}
\inputencoding{utf8x}}
and the result:
How can I fix this issue?
I'm using LyX and therefore I'm not sure which lines of code are crucial here.
EDIT: Here's a complete example source as generated by LyX, edited down to make a MWE (the output is the same image as above):
\documentclass[hebrew]{article}
\usepackage[T1]{fontenc}
\usepackage[cp1255]{inputenc}
\usepackage{babel}
\usepackage{listings}
\usepackage{color}
\lstset{%
language=Matlab,
backgroundcolor=\color{blue}
}
\begin{document}
\L{
\begin{lstlisting}[basicstyle={\footnotesize\ttfamily}]
>> x(6)
ans =
9
\end{lstlisting}
}
\end{document}
Best Answer
Amir, it seems as if the old fashioned cp1255/babel are not so robust. Here is an example using xetex. Perhaps you can start from it and work backwards to cp1255 and babel.