Re: Listings e direttive C++

#16131
Up
0
Down
::


Questo codice fa quello che desidero, anche se in modo truffaldino.
`\documentclass{report}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{listings}
\definecolor{veryLightGrey}{rgb}{0.9629411,0.9629411,0.9629411}

\lstset{language=C++,
alsolanguage=[ANSI]C,
backgroundcolor=\color{veryLightGrey},
keywordstyle=\color{RoyalBlue},
keywordstyle=[2]\color{Red},
alsoletter={[2]\#},
morekeywords={[2]\#include},
numbersep=8pt,
basicstyle=\small\sffamily,
commentstyle=\color{Green}\small\sffamily,
stringstyle=\sffamily,
showstringspaces=false,
breaklines=true,
frame=none}

\begin{document}
\begin{lstlisting}
// Include headers
#include “Epetra_MpiComm.h”

// Main driver
int main( int argv, char *argv[]) {

// MPI initialisation
MPI_Init(&argc, &argv);

// Instantiate the communciator
Epetra_MpiComm Comm(MPI_COMM_WORLD);

// MPI finalisation
MPI_Finalize();

}
\end{lstlisting}
\end{document}`
Ciao

Daniele

Go to top