Difference between revisions of "Listings in Latex"

From Klaus' wiki
Jump to: navigation, search
(Created page with 'Setup code listing like this: <source lang="latex"> \definecolor{listinggray}{gray}{0.9} \definecolor{lbcolor}{rgb}{0.9,0.9,0.9} \lstset{ backgroundcolor=\color{lbcolor}, tab…')
 
Line 6: Line 6:
 
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
 
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
 
\lstset{
 
\lstset{
backgroundcolor=\color{lbcolor},
+
    backgroundcolor=\color{lbcolor},
tabsize=2,
+
    tabsize=2,
rulecolor=,
+
    rulecolor=,
% language=Erlang,
+
 
     basicstyle=\scriptsize,
 
     basicstyle=\scriptsize,
 
     upquote=true,
 
     upquote=true,
Line 30: Line 29:
 
}
 
}
 
\lstloadlanguages{
 
\lstloadlanguages{
% Check Dokumentation for further languages ...
+
% Check Dokumentation for further languages ...
 
         %[Visual]Basic
 
         %[Visual]Basic
 
         %Pascal
 
         %Pascal

Revision as of 18:10, 13 May 2012

Setup code listing like this:

\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
    backgroundcolor=\color{lbcolor},
    tabsize=2,
    rulecolor=,
    basicstyle=\scriptsize,
    upquote=true,
    aboveskip={1.5\baselineskip},
    columns=fixed,
    showstringspaces=false,
    extendedchars=true,
    breaklines=true,
    prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
    frame=single,
    showtabs=false,
    showspaces=false,
    showstringspaces=false,
    identifierstyle=\ttfamily,
    keywordstyle=\color{Purple},
    identifierstyle=\color{Black},
    commentstyle=\color{BrickRed},
    stringstyle=\color{RubineRed},
    captionpos=b,
}
\lstloadlanguages{
	% Check Dokumentation for further languages ...
        %[Visual]Basic
        %Pascal
        C,
        C++,
        %XML
        HTML,
        %Java,
        Erlang
}