Compilateur LaTeX en ligne
www.cpierquet.fr
fichiers/c.pierquet/listingshl.tex
↓ télécharger
% !TeX TXS-program:compile = txs:///pdflatex

\documentclass{report}

\usepackage{color}
\usepackage{listings}
\usepackage{highlightx}

% Definition de couleur supplementaire
\definecolor{colString}{rgb}{0.6,0.1,0.1}

% Definition du langage
\lstdefinelanguage{LangageConsole}{%
	morekeywords={%
		ligne% mot-clé ``ligne''
	}
}

% Definition du style
\lstdefinestyle{styleLangage}{%
	language        = LangageConsole,%
	basicstyle      = \footnotesize\ttfamily\color{black},% ecriture standard
	identifierstyle = \color{black},%
	commentstyle    = \color{green},%
	keywordstyle    = \color{blue},%
	stringstyle     = \color{colString},%
	extendedchars   = true,% permet d'avoir des accents dans le code
	tabsize         = 2,%
	showspaces      = false,%
	showstringspaces = false,%
	numbers=left,%
	numberstyle=\tiny\ttfamily\color{black},%
	breaklines=true,%
	breakautoindent=true,%
	backgroundcolor=\color{white},%
	escapeinside     = {(*}{*)},
}

\lstset{%
	style = styleLangage%
}


\begin{document}
\begin{lstlisting}
(*\ttfamily\SurlignerTexte{a very very very very very long line that will have to break
	+ a new very very very very very long line that will have to break
	- replaced by another very very long line that wants to linebreak at this place
	yet another very very long line that wants to linebreak}*)
+ small
- small
a very very very very very long line that will have to break
+ a new very very very very very long line that will have to break
- replaced by another very very long line that wants to linebreak at this place
yet another very very long line that wants to linebreak
end
\end{lstlisting}
\end{document}