I want to insert some C++ code into my thesis and I tried tons of options to make the code look like in my editor. Here is what I have so far:
\usepackage{listings}
\usepackage{color}
\definecolor{mygray}{rgb}{0.4,0.4,0.4}
\definecolor{mygreen}{rgb}{0,0.8,0.6}
\definecolor{myorange}{rgb}{1.0,0.4,0}
\lstset{
basicstyle=\footnotesize\sffamily\color{black},
commentstyle=\color{mygray},
frame=single,
numbers=left,
numbersep=5pt,
numberstyle=\tiny\color{mygray},
keywordstyle=\color{mygreen},
showspaces=false,
showstringspaces=false,
stringstyle=\color{myorange},
tabsize=2
}
Here is a code snippet:
\begin{lstlisting}[language=C++]{Name=test2}
/*
* Project: ATFOC -> Autonomous Trainer For Object Classification
* Name: Main.cc
* Autor: Bla Blub
* Date: 03.09.2013
* Description: main class for
* 1) executing a web search for images and store them
* 2) and image comparison to filter good from bad samples
*/
#include "stdafx.h"
#include "WebSearch.h"
#include "ImageComparison.h"
using namespace std;
#define NUMBER_OF_IMAGES 50 // default
#define NUMBER_OF_QUERIES 3 // default
int main(int argc, char** argv)
{
vector<string> input_vector;
string input;
uint i;
\end{lstlisting}
Here you see what it looks like:
OK, so now my problem is that the preprocessor directives are colored like the other keywords, my question: How can I change that?
Another problem is that the basic datatypes (int, char...) have the same color as standard keywords (for, else, return...), how can I change that?
Thanks in advance for any solution if there is one.
EDIT: If it's possible, I would also want the colored words to either be shadowed or somehow bordered (I mean that the letters have a thin black border and are filled with the respective color) to make them better visible.