Re: Listing per java

#42973
Up
0
Down
::


ok, questo funziona:`\documentclass[a4paper,10pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{listings,xcolor}
\usepackage[lighttt]{lmodern}

\lstdefinestyle{JAVA}{
language=JAVA,
basicstyle=\scriptsize\ttfamily,
numbers=left,
numberstyle=\tiny,
numbersep=4pt,
tabsize=1,
extendedchars=false,
breaklines=true,
frame=tb,
showspaces=false,
showtabs=false,
xleftmargin=17pt,
framexleftmargin=14pt,
framexrightmargin=3pt,
framexbottommargin=2pt,
commentstyle=\slshape\color[gray]{0.3},
stringstyle=\slshape\color{black},
backgroundcolor=\color[gray]{0.95},
% showstringspaces=false
moredelim=[is][\bfseries]{>}{<} } \begin{document} \lstinputlisting[style=JAVA, label=samplecode,caption={A sample}]{listings_moredelim.cod} \end{document}`Le modifiche che ho fatto:[ul]caricato il pacchetto lmodern con l'opzione lighttt per dare maggior risalto al grassetto
sostituito “\slshape” a “\itshape” perché quel font il corsivo non ce l’ha, l’ho sostituito con l’inclinato
commentato showstringspaces=…[/ul]L’unico problema che resta, a mio avviso, è il fatto di non poter togliere il simbolo “␣” dagli spazi nelle stringhe. Non riesco a capire dove nel sorgente sia definito quel simbolo per ucciderlo per sempre.. 😉

🙂
LuCa

Go to top