How to create a white-on-black style for LaTeX lists

I watched a Philip Bunge post on how to create a Tango style with LaTeX listings and try to adapt this so that the default text style is white and black (this is for slides, not for the article!). This is what I added:

\definecolor{Black}{gray}{0.0} \definecolor{White}{gray}{0.9} ... \lstset{ basicstyle=\color{White}, backgroundcolor=\color{Black}, ... } 

basicstyle is basicstyle set the default style for all text. The documentation documentation states the following:

basicstyle is selected at the beginning of each listing. You can use \ footnotesize, \ small, \ itshape, \ ttfamily or something like that. The last token should not read the following characters.

The result of this still shows the default text as black. You can set more style directives that cover most tokens in a given programming language, but even so, some tokens will be skipped (for example, brackets and other punctuation marks). What have I done wrong?

+4
source share
1 answer

The following code worked for me, but I converted the .dvi file to .pdf so that the text looked white, so maybe it was your viewer? I use xdvi and xpdf .

 \documentclass[a4paper, 11pt]{article} \usepackage{listings} \usepackage{color} \definecolor{theWhite}{gray}{0.9} \definecolor{theBlack}{gray}{0.0} \lstset { basicstyle=\color{theWhite}, backgroundcolor=\color{theBlack} } \begin{document} \begin{lstlisting} ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x)) \end{lstlisting} \end{document} 

I hope this helps!

+4
source

Source: https://habr.com/ru/post/1314082/


All Articles