I'm trying to make a pdf language definition for the listings package, but I can't get the string definition to work correctly. This is what I have defined:
\lstdefinelanguage{pdf}{
alsoletter={/,(,)},
morekeywords={/Type,/Outlines, /Count, /Kids, /Page,
/Parent, /Resources, /MediaBox, /Contents, /Length, /ProcSet, /PDF, /Size,
/Root, /Pages, /Catalog, /Font, /F1, /F2, /Text, /Subtype, /Type1, /Name,
/BaseFont, /Helvetica-Bold, /Encoding, /MacRomanEncoding, /Helvetica},
morecomment=[l]{\%},
morestring=[s]{(}{)}
}
Here you can see the result:

It should either go from ( to ), or maybe from BT to ET (which is what vim does).
Okay. So I figured it out. For some reasons using breaklines=true creates this error.
Here is a minimal working example that produces the error:
\documentclass[a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel, listings, color}
\definecolor{darkviolet}{rgb}{0.5,0,0.4}
\definecolor{darkgreen}{rgb}{0,0.4,0.2}
\definecolor{darkblue}{rgb}{0.1,0.1,0.9}
\lstset{ %
keywordstyle=\color{darkviolet},
commentstyle=\color{darkgreen},
stringstyle=\color{darkblue},
breaklines=true,% Produces the error in the highlighting
}
\lstdefinelanguage{pdf}{
alsoletter={/},
morekeywords={/Length, /F1},
morecomment=[l]{\%},
morestring=[s]{(}{)}
}
\begin{document}
\begin{lstlisting}[language=pdf]
%PDF-1.0
5 0 obj
<< /Length 44 >>
stream
BT
/F1 27 Tf
100 100 Td (Hello World) Tj
ET
endstream
endobj
%%EOF
\end{lstlisting}
\end{document}
But I need to have breaklines set to true. So anybody know a reason why this is happening? Or is it just a bug in the listings package?