Einfärben von eingebundenem C++-Quellcode-Includes

Antwort erstellen


Diese Frage dient dazu, das automatisierte Versenden von Formularen durch Spam-Bots zu verhindern.
Smilies
:D :) :( :o :shock: :? 8) :lol: :-x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode ist eingeschaltet
[img] ist eingeschaltet
[flash] ist ausgeschaltet
[url] ist eingeschaltet
Smilies sind eingeschaltet

Die letzten Beiträge des Themas

Ich habe die Datenschutzerklärung gelesen und bin damit einverstanden.

   

Wenn du eine Datei oder mehrere Dateien anhängen möchtest, gib die Details unten ein.

Ansicht erweitern Die letzten Beiträge des Themas: Einfärben von eingebundenem C++-Quellcode-Includes

Einfärben von eingebundenem C++-Quellcode-Includes

von Wiggle » Fr 3. Feb 2012, 14:47

Hallo,

ich bin gerade dabei einen Quelltext in ein LaTeX-Dokument einzufügen. Es handelt sich um ein C++-Quellcode und ich möchte gerne die Includes einfärben.
Die Struktur eines solchen Includes lautet wie folgt:
#include<name_der_datei>
Das Schlüsselwort "#include" wird bereits eingefärbt, jedoch nicht die spitzen Klammern mit dem Inhalt.
Hat hierzu jemand eine Idee? Meine Einstellungen für das \listings-Paket sehen so aus:
\lstset{ 
  language=C++,                % the language of the code
  basicstyle=\footnotesize           % the size of the fonts that are used for the code
  numbers=left,                   % where to put the line-numbers
  numberstyle=\footnotesize,          % the size of the fonts that are used for the line-numbers
  stepnumber=1,                   % the step between two line-numbers. If it's 1, each line will be numbered
  numbersep=5pt,                  % how far the line-numbers are from the code
  backgroundcolor=\color{white},      % choose the background color. You must add \usepackage{color}
  showspaces=false,               % show spaces adding particular underscores
  showstringspaces=false,         % underline spaces within strings
  showtabs=false,                 % show tabs within strings adding particular underscores
  frame=single,                   % adds a frame around the code
  rulecolor=\color{black},        % if not set, the frame-color may be changed on line-breaks within not-black
  tabsize=4,                      % sets default tabsize to 2 spaces
  captionpos=b,                   % sets the caption-position to bottom
  breaklines=true,                % sets automatic line breaking
  breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
  caption=\lstname,                   % show the filename of files included with \lstinputlisting;
                                  % also try caption instead of title
  morekeywords={*, ..., std, string, boolean, AnsiString, package, link,resource, __fastcall, __published, TGroupBox, TSplitter, TOpenDialog,  TStatusBar, TScrollBox, TImage, TPopupMenu, TMenuItem, TActionList, TAction, TFrame, TForm, TListBox, TTimer, TObject, TComponent, POINT, PACKAGE, <##>},               
  																% if you want to add more keywords to the set
  numberstyle=\tiny\color{gray},        % line number style
  keywordstyle=\color{blue},          % keyword style
  commentstyle=\color{dkgreen},       % comment style
  stringstyle=\color{mauve},         % string literal style
  escapeinside={\%*}{*)},            % if you want to add a comment within your code
  flexiblecolumns=false,
  basicstyle=\sffamily,
  literate=
		*{0}{{{\color{red}0}}}1
		{1}{{{\color{red}1}}}1
		{2}{{{\color{red}2}}}1
		{3}{{{\color{red}3}}}1
		{4}{{{\color{red}4}}}1
		{5}{{{\color{red}5}}}1
		{6}{{{\color{red}6}}}1
		{7}{{{\color{red}7}}}1
		{8}{{{\color{red}8}}}1
		{9}{{{\color{red}9}}}1
		{-0}{{{\color{red}-0}}}1
		{-1}{{{\color{red}-1}}}1
		{-2}{{{\color{red}-2}}}1
		{-3}{{{\color{red}-3}}}1
		{-4}{{{\color{red}-4}}}1
		{-5}{{{\color{red}-5}}}1
		{-6}{{{\color{red}-6}}}1
		{-7}{{{\color{red}-7}}}1
		{-8}{{{\color{red}-8}}}1
		{-9}{{{\color{red}-9}}}1
}
Ich danke schonmal für jeglichen Hinweis :D

Nach oben