I using the following settings for code listings.
\usepackage{listings}
\usepackage{textcomp}
\lstset{language=Java,
keywordstyle=\color{RoyalBlue},
basicstyle=\scriptsize\ttfamily,
commentstyle=\color{Green}\ttfamily,
rulecolor=\color{black},
upquote=true,
numbers=left,
numberstyle=\tiny\color{gray},
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
frame=single,
belowskip=3em,
belowcaptionskip=.25\baselineskip
}
The actual code listing contains comments as well as URLs. How can I ensure that only the comment will be colored with commentstyle but not the URL that contains a double slash // as well?
// This is a comment.
http://tex.stackexchange.com
In the example tex.stackexchange.com would be colored Green.
