# What configuration do you propose for listings.sty to make the output look comfortable?

The objective of this topic is to make a common place where we can share our settings for listings.sty. So we can use this as a reference.

Note that I am only interested in the following settings:

1. font family, font size, font weight, font color
2. background color

In other words, the layout such as frame, line numbers, etc must not be taken into account here.

The rule of the game:

1. Use the following code snippet as the template. Only modify the lines marked with %<==. NOTE: Please leave the font size unchanged. I already set it to \scriptsize.

\documentclass[dvips,dvipsnames]{article}
\usepackage[a4paper,margin=55mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\lstset%
{%
language={[Sharp]C},
breaklines=true,
breakindent=0pt,
tabsize=2,
showstringspaces=true
}

%=================================
%Rule of the Game:
%You are ONLY allowed  to
%modify the lines marked with %<==
%=================================
\usepackage[rgb]{xcolor}%<==
\lstset
{%
backgroundcolor=%
\color{Black},%<==
%
basicstyle=\scriptsize%leave the font size unchanged please.
\color{lightgray}\ttfamily,%<==
%
keywordstyle=%
\color{Orange}\sffamily,%<==
%
\color{Green},%<==
%
identifierstyle=%
\color{Cyan},%<==
%
stringstyle=%
\color{Yellow}%<==
}
\begin{document}
\begin{lstlisting}
using System;
public class Foo
{
public static void Main()
{
Console.WriteLine("I Love LaTeX");//This is a comment.
}
/*This is a comment too.*/
}
\end{lstlisting}
\end{document}

2. View the pdf output in 150% scale and make a screenshot of it in *.png format.

3. Submit your screenshot followed by your modified settings (NOT complete code please). You can submit as many as you want but make sure you don't make a duplication.
-
@xport: I think you should classify your question as "community wiki". – lockstep Jan 4 '11 at 12:12
@xport: I didn't mean retagging - there should be another button in the edit window that reads "community wiki". (Or is this something only moderators can do?) – lockstep Jan 4 '11 at 12:20
@lockstep: Yep, it's already been some time that only mods can do that. But I do agree with you. – Hendrik Vogt Jan 4 '11 at 12:50
@xport, @Hendrik: I flagged the question so that mods will see (and hopefully edit) it. – lockstep Jan 4 '11 at 13:00
@lockstep, @Hendrik: I've hit it with the wiki-hammer. – Loop Space Jan 4 '11 at 13:09

I prefer to go for simpler designs, both on the web as well as for printed works. Too much color confuses the reader and to paraphrase Bringhurst it is an intrusion.

rather highligh the point of discussion than the whole code. Code must read like a paragraph! Also I prefer generally environments rather than macros on their own and so here is my minimal!

\gdef\emphasis#1{\lstset{emph={write,void,writeln,#1},
emphstyle={\itshape\ttfamily\textcolor{blue}}}}

\lstnewenvironment{teXXX}[1][]
{\lstset{language=[LaTeX]TeX}\lstset{%
breaklines=true,
framesep=5pt,
basicstyle=\normalsize\ttfamily,
showstringspaces=false,
keywordstyle=\itshape,
stringstyle=\color{maroon},
rulecolor=\color{Gray},
xleftmargin=0pt,
xrightmargin=5pt,
aboveskip=\medskipamount,
belowskip=\medskipamount,
backgroundcolor=\color{LightGray!5}, #1
}}
{}

-

## Neon in the dark

\usepackage[rgb]{xcolor}%<==
\lstset
{%
backgroundcolor=%
\color{Black},%<==
%
basicstyle=\scriptsize%
\color{lightgray}\ttfamily,%<==
%
keywordstyle=%
\color{Orange}\sffamily,%<==
%
\color{Green},%<==
%
stringstyle=%
\color{Yellow}%<==
}


-

## Classic Turbo Pascal (not sure 100%)

\usepackage[cmyk]{xcolor}%<==
\lstset
{%
backgroundcolor=%
\color{Blue},%<==
%
basicstyle=\scriptsize%
\color{White}\ttfamily,%<==
%
keywordstyle=%
\color{Yellow}\sffamily,%<==
%
\color{Red},%<==
%
stringstyle=%
\color{Green}%<==
}


-
Almost Turbo Pascal, except the code and the blue! – Yiannis Lazarides Jan 5 '11 at 9:55

## Yellowish

\usepackage[rgb]{xcolor}%<==
\lstset
{%
backgroundcolor=%
\color{Yellow!20},%<==
%
basicstyle=\scriptsize%
\color{black}\ttfamily,%<==
%
keywordstyle=%
\color{blue!80}\sffamily,%<==
%