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:
- font family, font size, font weight, font color
- 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:
-
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,%<== % commentstyle=% \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}
-
View the pdf output in 150% scale and make a screenshot of it in *.png format.
- 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.
Best Answer
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!