Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 16517 lines (16514 sloc) 614 KB
% \iffalse
%
% Trademarks appear throughout this documentation without any trademark
% symbol, so you can't assume that a name is free. There is no intention
% of infringement; the usage is to the benefit of the trademark owner.
%
%
% S O F T W A R E L I C E N S E
% =================================
%
% The files listings.dtx and listings.ins and all files generated
% from only these two files are referred to as `the listings package'
% or simply `the package'. lstdrvrs.dtx and the files generated from
% that file are `drivers'.
%
% The listings package is copyright 1996--2004 Carsten Heinz, and
% continued maintenance on the package is copyright 2006--2007 Brooks Moses.
% The drivers are copyright 1997/1998/1999/2000/2001/2002/2003/2004/2006/
% 2007 any individual author listed in the driver files.
%
% The listings package and its drivers may be distributed and/or modified
% under the conditions of the LaTeX Project Public License, either version
% 1.3 of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% The package has the LPPL maintenance status "maintained".
%
% The Current Maintainer is Brooks Moses <bmoses@dpdx.net>.
%
% end of software license
%
%
%<*driver>
\documentclass[a4paper]{ltxdoc}
\DisableCrossrefs
\OnlyDescription
\usepackage{lstdoc,textcomp}
\makeindex
\begin{document}
\DocInput{listings.dtx}
\end{document}
%</driver>
% \fi
%
%^^A
%^^A Command/key to aspect relation
%^^A ================================
%^^A
%\lstisaspect[strings]{string,morestring,deletestring,stringstyle,showstringspaces}
%\lstisaspect[comments]{comment,morecomment,deletecomment,commentstyle}
%\lstisaspect[comment styles]{b,d,l,n,s,ib,id,il,in,is}
%\lstisaspect[pod]{printpod,podcomment}
%\lstisaspect[escape]{texcl,escapebegin,escapeend,escapechar,escapeinside,mathescape}
%\lstisaspect[keywords]{sensitive,classoffset,keywords,morekeywords,deletekeywords,keywordstyle,ndkeywords,morendkeywords,deletendkeywords,ndkeywordstyle,keywordsprefix,otherkeywords}
%\lstisaspect[emph]{emph,moreemph,deleteemph,emphstyle}
%\lstisaspect[tex]{texcs,moretexcs,deletetexcs,texcsstyle}
%\lstisaspect[directives]{directives,moredirectives,deletedirectives,directivestyle}
%\lstisaspect[html]{tag,usekeywordsintag,tagstyle,markfirstintag}
%\lstisaspect[keywordcomments]{keywordcomment,morekeywordcomment,deletekeywordcomment,keywordcommentsemicolon}
%\lstisaspect[index]{index,moreindex,deleteindex,indexstyle,\string\lstindexmacro}
%\lstisaspect[procnames]{procnamestyle,indexprocnames,procnamekeys,moreprocnamekeys,deleteprocnamekeys}
%\lstisaspect[style]{style,\string\lstdefinestyle,\string\lst@definestyle,\string\lststylefiles}
%\lstisaspect[language]{language,alsolanguage,defaultdialect,\string\lstalias,\string\lstdefinelanguage,\string\lst@definelanguage,\string\lstloadlanguages,\string\lstlanguagefiles}
%\lstisaspect[formats]{format,fmtindent,\string\lstdefineformat,\string\lst@defineformat,\string\lstformatfiles}
%\lstisaspect[labels]{numbers,numberstyle,numbersep,stepnumber,numberblanklines,firstnumber,\string\thelstnumber,numberfirstline}
%\lstisaspect[lineshape]{xleftmargin,xrightmargin,resetmargins,linewidth,lineskip,breaklines,breakindent,breakautoindent,prebreak,postbreak,breakatwhitespace}
%\lstisaspect[frames]{framexleftmargin,framexrightmargin,framextopmargin,framexbottommargin,backgroundcolor,fillcolor,rulecolor,rulesepcolor,rulesep,framerule,framesep,frameshape,frameround,frame}
%\lstisaspect[make]{makemacrouse}
%\lstisaspect[fancyvrb]{fancyvrb,fvcmdparams,morefvcmdparams}
%\lstisaspect[lgrind]{lgrindef,\string\lstlgrindeffile}
%\lstisaspect[hyper]{hyperref,morehyperref,deletehyperref,hyperanchor,hyperlink}
%\lstisaspect[kernel]{basewidth,fontadjust,columns,flexiblecolumns,identifierstyle,^^A
% tabsize,showtabs,tab,showspaces,keepspaces,formfeed,SelectCharTable,^^A
% MoreSelectCharTable,extendedchars,alsoletter,alsodigit,alsoother,excludedelims,^^A
% literate,basicstyle,print,firstline,lastline,linerange,nolol,captionpos,abovecaptionskip,^^A
% belowcaptionskip,label,title,caption,\string\lstlistingname,boxpos,float,^^A
% floatplacement,aboveskip,belowskip,everydisplay,showlines,emptylines,gobble,name,^^A
% \string\lstname,\string\lstlistlistingname,\string\lstlistoflistings,^^A
% \string\lstnewenvironment,\string\lstinline,\string\lstinputlisting,lstlisting,^^A
% \string\lstloadaspects,\string\lstset,\string\thelstlisting,\string\lstaspectfiles,^^A
% inputencoding,delim,moredelim,deletedelim,upquote,numberbychapter,^^A
% \string\lstMakeShortInline,\string\lstDeleteShortInline}
%\lstisaspect[doc]{lstsample,lstxsample}^^A environment
%\lstisaspect[experimental]{includerangemarker,rangebeginprefix,rangebeginsuffix,rangeendprefix,rangeendsuffix,rangeprefix,rangesuffix}
%
%^^A
%^^A The long awaited beginning of documentation
%^^A =============================================
%^^A
%\newbox\abstractbox
%\setbox\abstractbox=\vbox{
% \begin{abstract}
% The \packagename{listings} package is a source code printer for \LaTeX.
% You can typeset stand alone files as well as listings with an environment
% similar to \texttt{verbatim} as well as you can print code snippets using
% a command similar to |\verb|.
% Many parameters control the output and if your preferred programming
% language isn't already supported, you can make your own definition.
% \end{abstract}}
%
% \title{\vspace*{-2\baselineskip}The \textsf{Listings} Package}
% \author{Copyright 1996--2004, Carsten Heinz%
% \\ Copyright 2006--2007, Brooks Moses
% \\ Maintainer: Brooks Moses\thanks{Brooks %
% Moses became the maintainer of the \packagename{listings}
% package in 2006; see the Preface for details.}~ %
% \textless\lstemail\textgreater}
% \date{2007/02/22\enspace\enspace Version 1.4\\ \box\abstractbox}
% \def\lstemail{\href{mailto:bmoses@dpdx.net}{\texttt{bmoses@dpdx.net}}}
% \ifhyper
% \hypersetup{pdfsubject=Package guide,pdfauthor=Brooks Moses <bmoses@dpdx.net>}
% \fi
%
% \csname @twocolumntrue\endcsname
% \maketitle
%^^A \enlargethispage{2\baselineskip}
% \csname @starttoc\endcsname{toc}
% \onecolumn
%
%
% \section*{Preface}
%
% \paragraph{Transition of package maintenance}
% The \TeX\ world lost contact with Carsten Heinz in late 2004, shortly after
% he released version 1.3b of the \packagename{listings} package. After many
% attempts to reach him had failed, Hendri Adriaens took over maintenance of
% the package in accordance with the LPPL's procedure for abandoned packages.
% He then passed the maintainership of the package to Brooks Moses, who had
% volunteered for the position while this procedure was going through.
%
% This release, version 1.4, is the first substantial bugfix release since
% I accepted maintainership of the package. I would like to thank the
% numerous people who reported bugs to me, and particularly those who
% suggested fixes. Thanks in addition to those who provided
% new language definitions and suggestions for improvements.
%
% \paragraph{News and changes}
% Version 1.4 is the fourth bugfix release. There are no substantial changes
% in this version, but a number of minor changes and fixes. The primary news
% is that the documentation has been substantially copyedited, and improved
% in a number of ways to document workarounds and things learned from the
% recent bug reports.
%
% A |numberbychapter| key has been added, to control whether listings are
% numbered sequentially or by chapter in document classes that provide
% chapters.
%
% The |\lstMakeShortInline| command can be used to define single-character
% inline-listing macros, much like the \packagename{shortvrb} package
% allows for verbatim inline text.
%
% A new |spaceflexible| column alignment style has been added, which is
% similar to the |flexible| style except that it only inserts extra space
% to recover the column alignment at locations where there is already
% existing space.
%
% A |s| string type has been added, akin to the |s| comment type. This is
% used in the Ruby language definition.
%
% The |\lst@for| routine has been sped up substantially, thanks to some code
% provided by Hendri Adriaens. Hopefully this will result in a significant
% speedup of the runtime of the overall package.
%
% Among the bugs fixed are the |*| option to |texcs|, which was quite badly
% broken; the interaction of background colors with inline listings and with
% frames; listing captions being broken in AMS document classes; and better
% integration of the list of listings with KOMAscript document class and other
% document clases that use the |\float@addtolists| mechanism.
%
% The following languages were added: |command.com| (DOS/Windows) batch files,
% Common Intermediate Language, Lingo, Postscript, PSTricks, and SPARQL.
% The following dialects of existing languages were added: Ada (2005),
% Assembler (Motorola68k), and Mathematica (5.2). The definitions for ABAP,
% Fortran, Octave, Python, Ruby, and TCL have been improved. Thanks go to the
% contributers.
%
% \vfill
% \paragraph{Thanks}
% There are many people I have to thank for fruitful communication, posting
% their ideas, giving error reports, adding programming languages to
% \texttt{lstdrvrs.dtx}, and so on. Their names are listed in section
% \ref{uClosingAndCredits}.
%
% \paragraph{Trademarks}
% Trademarks appear throughout this documentation without any trademark
% symbol; they are the property of their respective trademark owner.
% There is no intention of infringement; the usage is to the benefit of the
% trademark owner.
%
%
% \clearpage
%
%
% \part{User's guide}
%
%
% \section{Getting started}\label{uGettingStarted}
%
%
% \subsection{A minimal file}\label{uAMinimalFile}
%
% Before using the \packagename{listings} package, you should be familiar with
% the \LaTeX\ typesetting system. You need not to be an expert.
% Here is a minimal file for \packagename{listings}.
% \begin{verbatim}
% \documentclass{article}
% \usepackage{listings}
%
% \begin{document}
% \lstset{language=Pascal}
%
% % Insert Pascal examples here.
%
% \end{document}\end{verbatim}
% Now type in this first example and run it through \LaTeX.
% \begin{advise}
% \item Must I do that really?
% \advisespace
% Yes and no. Some books about programming say this is good.
% What a mistake! Typing takes time---which is wasted if the code is clear to
% you. And if you need that time to understand what is going on, the
% author of the book should reconsider the concept of presenting the
% crucial things---you might want to say that about this guide even---or
% you're simply inexperienced with programming. If only the latter case
% applies, you should spend more time on reading (good) books about
% programming, (good) documentations, and (good) source code from other
% people. Of course you should also make your own experiments.
% You will learn a lot. However, running the example through \LaTeX\
% shows whether the \packagename{listings} package is installed correctly.
% \item The example doesn't work.
% \advisespace
% Are the two packages \packagename{listings} and \packagename{keyval}
% installed on your system? Consult the administration tool of your
% \TeX\ distribution, your system administrator, the local \TeX\ and
% \LaTeX\ guides, a \TeX\ FAQ, and section \ref{rInstallation}---in
% that order. If you've checked \emph{all} these sources and are
% still helpless, you might want to write a post to a \TeX\ newsgroup
% like \texttt{comp.text.tex}.
% \item Should I read the software license before using the package?
% \advisespace
% Yes, but read this \emph{Getting started} section first to decide
% whether you are willing to use the package.^^A ;-)
% \end{advise}
%
%
% \subsection{Typesetting listings}
%
% Three types of source codes are supported: code snippets, code segments, and
% listings of stand alone files. Snippets are placed inside paragraphs and the
% others as separate paragraphs---the difference is the same as between text
% style and display style formulas.
% \begin{advise}
% \item No matter what kind of source you have, if a listing contains national
% characters like \'e, \L, \"a, or whatever, you must tell the
% package about it! Section \lstref{uSpecialCharacters} discusses this issue.
% \end{advise}
%
% \paragraph{Code snippets}
% The well-known \LaTeX\ command |\verb| typesets code snippets verbatim.
% The new command |\lstinline| pretty-prints the code, for example
%`\lstinline!var i:integer;!' is typeset by
%`{\rstyle|\lstinline|}|!var i:integer;!|'. The exclamation marks delimit
% the code and can be replaced by any character not in the code;
% |\lstinline$var i:integer;$| gives the same result.
%
% \paragraph{Displayed code}
% The \texttt{lstlisting} environment typesets the enclosed source code. Like
% most examples, the following one shows verbatim \LaTeX\ code on the right
% and the result on the left. You might take the right-hand side, put it into
% the minimal file, and run it through \LaTeX.
% \begin{lstsample}[lstlisting]{}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
% It can't be easier.
% \begin{advise}
% \item That's not true. The name `\texttt{listing}' is shorter.
% \advisespace
% Indeed. But other packages already define environments with that name.
% To be compatible with such packages, all commands and environments of
% the \packagename{listings} package use the prefix `\texttt{lst}'.
% \end{advise}
% The environment provides an optional argument. It tells the package to
% perform special tasks, for example, to print only the lines 2--5:
% \begin{lstsample}{\lstset{frame=trbl,framesep=0pt}\label{gFirstKey=ValueList}}{}
% \begin{lstlisting}[firstline=2,
% lastline=5]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item Hold on! Where comes the frame from and what is it good for?
% \advisespace
% You can put frames around all listings except code snippets.
% You will learn how later. The frame shows that empty lines at the end
% of listings aren't printed. This is line 5 in the example.
% \item Hey, you can't drop my empty lines!
% \advisespace
% You can tell the package not to drop them:
% The key `\ikeyname{showlines}' controls these empty lines and is
% described in section \ref{rTypesettingListings}. Warning: First
% read ahead on how to use keys in general.
% \item I get obscure error messages when using `\ikeyname{firstline}'.
% \advisespace
% That shouldn't happen. Make a bug report as described in section
% \lstref{uTroubleshooting}.
% \end{advise}
%
% \paragraph{Stand alone files}
% Finally we come to |\lstinputlisting|, the command used to pretty-print
% stand alone files. It has one optional and one file name argument.
% Note that you possibly need to specify the relative path to the file.
% Here now the result is printed below the verbatim code since both together
% don't fit the text width.
% \begin{lstsample}{\lstset{comment=[l]\%,columns=fullflexible}}{\lstset{alsoletter=\\,emph=\\lstinputlisting,emphstyle=\rstyle}\lstaspectindex{\lstinputlisting}{}}
% \lstinputlisting[lastline=4]{listings.sty}
% \end{lstsample}
% \begin{advise}
% \item The spacing is different in this example.
% \advisespace
% Yes. The two previous examples have aligned columns, i.e.~columns with
% identical numbers have the same horizontal position---this package
% makes small adjustments only. The columns in the example here are not
% aligned. This is explained in section \ref{uFixedAndFlexibleColumns}
% (keyword: full flexible column format).
% \end{advise}
%
% Now you know all pretty-printing commands and environments. It remains
% to learn the parameters which control the work of the \packagename{listings}
% package. This is, however, the main task. Here are some of them.
%
%
% \subsection{Figure out the appearance}\label{gFigureOutTheAppearance}
%
% Keywords are typeset bold, comments in italic shape, and spaces in strings
% appear as \textvisiblespace. You don't like these settings? Look at this:
%\ifcolor
% \begin{lstxsample}[basicstyle,keywordstyle,identifierstyle,commentstyle,stringstyle,showstringspaces]
% \lstset{% general command to set parameter(s)
% basicstyle=\small, % print whole listing small
% keywordstyle=\color{black}\bfseries\underbar,
% % underlined bold black keywords
% identifierstyle=, % nothing happens
% commentstyle=\color{white}, % white comments
% stringstyle=\ttfamily, % typewriter type for strings
% showstringspaces=false} % no special string spaces
% \end{lstxsample}
%\else
% \begin{lstxsample}[basicstyle,keywordstyle,identifierstyle,commentstyle,stringstyle,showstringspaces]
% \lstset{% general command to set parameter(s)
% basicstyle=\small, % print whole listing small
% keywordstyle=\bfseries\underbar,
% % underlined bold keywords
% identifierstyle=, % nothing happens
% commentstyle=\itshape, % default
% stringstyle=\ttfamily, % typewriter type for strings
% showstringspaces=false} % no special string spaces
% \end{lstxsample}
%\fi
% \begin{lstsample}{}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
%\ifcolor
% \begin{advise}
% \item You've requested white coloured comments, but I can see the comment
% on the left side.
% \advisespace
% There are a couple of possible reasons:
% (1) You've printed the documentation on nonwhite paper.
% (2) If you are viewing this documentation as a \texttt{.dvi}-file, your
% viewer seems to have problems with colour specials. Try to print
% the page on white paper.
% (3) If a printout on white paper shows the comment, the colour
% specials aren't suitable for your printer or printer driver.
% Recreate the documentation and try it again---and ensure that
% the \packagename{color} package is well-configured.
% \end{advise}
%\fi
% The styles use two different kinds of commands. |\ttfamily| and |\bfseries|
% both take no arguments but |\underbar| does; it underlines the following
% argument. In general, the \emph{very last} command may read exactly one
% argument, namely some material the package typesets. There's one exception.
% The last command of \ikeyname{basicstyle} \emph{must not} read any
% tokens---or you will get deep in trouble.
% \begin{advise}
% \item `|basicstyle=\small|' looks fine, but comments look really bad with
% `|commentstyle=\tiny|' and empty basic style, say.
% \advisespace
% Don't use different font sizes in a single listing.
% \item But I really want it!
% \advisespace
% No, you don't.
%^^A The package adjusts internal data after selecting the basic style at
%^^A the beginning of each listing. This is a problem if you change the
%^^A font size for comments or strings, for example.
%^^A Section \ref{rColumnAlignment} shows how to overcome this.
%^^A But once again: Don't use different font sizes in a single listing
%^^A unless you really know what you are doing.
% \end{advise}
%
% \paragraph{Warning}\label{wStrikingStyles}
% You should be very careful with striking styles; the recent example is rather
% moderate---it can get horrible. \emph{Always use decent highlighting.}
% Unfortunately it is difficult to give more recommendations since they depend
% on the type of document you're creating. Slides or other presentations often
% require more striking styles than books, for example.
% In the end, it's \emph{you} who have to find the golden mean!
%
%
% \subsection{Seduce to use}\label{gSeduceToUse}
%
% You know all pretty-printing commands and some main parameters. Here now
% comes a small and incomplete overview of other features. The table of
% contents and the index also provide information.
%
% \paragraph{Line numbers}
% are available for all displayed listings, e.g.~tiny numbers on the left, each
% second line, with 5pt distance to the listing:
% \begin{lstxsample}[numbers,numberstyle,stepnumber,numbersep]
% \lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item I can't get rid of line numbers in subsequent listings.
% \advisespace
% `|numbers=none|' turns them off.
% \item Can I use these keys in the optional arguments?
% \advisespace
% Of course. Note that optional arguments modify values for one
% particular listing only: you change the appearance, step or distance
% of line numbers for a single listing. The previous values are
% restored afterwards.
% \end{advise}
% The environment allows you to interrupt your listings: you can end a listing
% and continue it later with the correct line number even if there are other
% listings in between. Read section \ref{uLineNumbers} for a thorough
% discussion.
%
% \paragraph{Floating listings}
% Displayed listings may float:
% \begin{lstsample}{\lstset{frame=tb}}{}
% \begin{lstlisting}[float,caption=A floating example]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
% Don't care about the parameter \ikeyname{caption} now. And if you put the
% example into the minimal file and run it through \LaTeX, please don't wonder:
% you'll miss the horizontal rules since they are described elsewhere.
% \begin{advise}
% \item \LaTeX's float mechanism allows one to determine the placement of floats.
% How can I do that with these?
% \advisespace
% You can write `|float=tp|', for example.
% \end{advise}
%
% \paragraph{Other features}
% There are still features not mentioned so far: automatic breaking of long
% lines, the possibility to use \LaTeX\ code in listings, automated indexing,
% or personal language definitions.
% One more little teaser? Here you are. But note that the result is not
% produced by the \LaTeX\ code on the right alone. The main parameter is
% hidden.
% \begin{lstsample}{\lstset{literate={:=}{{$\gets$}}1 {<=}{{$\leq$}}1 {>=}{{$\geq$}}1 {<>}{{$\neq$}}1}}{}
% \begin{lstlisting}
% if (i<=0) then i := 1;
% if (i>=0) then i := 0;
% if (i<>0) then i := 0;
% \end{lstlisting}
% \end{lstsample}
%
% You're not sure whether you should use \packagename{listings}?
% Read the next section!
%
%
% \subsection{Alternatives}
%
% \begin{advise}
% \item Why do you list alternatives?
% \advisespace
% Well, it's always good to know the competitors.^^A :-)
% \item I've read the descriptions below and the \packagename{listings} package
% seems to incorporate all the features. Why should I use one of the
% other programs?
% \advisespace
% Firstly, the descriptions give a taste and not a complete overview,
% secondly, \packagename{listings} lacks some properties, and, ultimately,
% you should use the program matching your needs most precisely.
% \end{advise}
% This package is certainly not the final utility for typesetting source code.
% Other programs do their job very well, if you are not satisfied with
% \packagename{listings}. Some are independent of \LaTeX, others come as
% separate program plus \LaTeX\ package, and others are packages which
% don't pretty-print the source code. The second type includes converters,
% cross compilers, and preprocessors. Such programs create \LaTeX\ files
% you can use in your document or stand alone ready-to-run \LaTeX\ files.
%
% Note that I'm not dealing with any literate programming tools here, which
% could also be alternatives. However, you should have heard of the
% \texttt{WEB} system, the tool Prof.~Donald E.~Knuth developed and made use
% of to document and implement \TeX.
%
% \paragraph{\href{http://www.infres.enst.fr/~demaille/a2ps}{\packagename{a2ps}}}
% started as `ASCII to PostScript' converter, but today you can invoke the
% program with \texttt{--pretty-print=}\meta{language} option. If your
% favourite programming language is not already supported, you can write your
% own so-called style sheet. You can request line numbers, borders, headers,
% multiple pages per sheet, and many more. You can even print symbols like
% $\forall$ or $\alpha$ instead of their verbose forms. If you just want
% program listings and not a document with some listings, this is the best
% choice.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/nonfree/support/lgrind}{\packagename{LGrind}}}
% is a cross compiler and comes with many predefined programming languages.
% For example, you can put the code on the right in your document, invoke
% \packagename{LGrind} with \texttt{-e} option (and file names), and run the
% created file through \LaTeX. You should get a result similar to the
% left-hand side:
% \begin{center}
% \begin{minipage}{0.45\linewidth}
%\iflgrind
% \LGindent=0pt
% \LGinlinefalse\LGbegin\lgrinde
% \L{\LB{\K{for}_\V{i}:=\V{maxint}_\K{to}_\N{0}_\K{do}}}
% \L{\LB{\K{begin}}}
% \L{\LB{____\C{}\{_do_nothing_\}\CE{}}}
% \L{\LB{\K{end};}}
% \L{\LB{}}
% \L{\LB{\V{Write}(\S{}{'}Case_insensitive_{'}\SE{});}}
% \L{\LB{\V{WritE}(\S{}{'}Pascal_keywords.{'}\SE{});}}
% \endlgrinde\LGend
%\else
% \packagename{LGrind} not installed.
%\fi
% \end{minipage}
% \begin{minipage}{0.45\linewidth}
% \begin{verbatim}
% %[
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% %]\end{verbatim}
% \end{minipage}
% \end{center}
% If you use |%(| and |%)| instead of |%[| and |%]|, you get a code snippet
% instead of a displayed listing. Moreover you can get line numbers to the
% left or right, use arbitrary \LaTeX\ code in the source code, print symbols
% instead of verbose names, make font setup, and more. You will (have to)
% like it (if you don't like \packagename{listings}).
%
% Note that \packagename{LGrind} contains code with a no-sell license and is
% thus nonfree software.
%
% \paragraph{\href{ftp://axp3.sv.fh-mannheim.de/cvt2latex}{\packagename{cvt2ltx}}}
% is a family of `source code to \LaTeX' converters for C, Objective C, \Cpp,
% IDL and Perl. Different styles, line numbers and other qualifiers can be
% chosen by command-line option. Unfortunately it isn't documented how other
% programming languages can be added.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/support/C++2LaTeX-1_1pl1}{\packagename{\Cpp2\LaTeX}}}
% is a C/\Cpp\ to \LaTeX\ converter. You can specify the fonts for comments,
% directives, keywords, and strings, or the size of a tabulator. But as far as
% I know you can't number lines.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/support/slatex}{\packagename{S\LaTeX}}}
% is a pretty-printing Scheme program (which invokes \LaTeX\ automatically)
% especially designed for Scheme and other Lisp dialects. It supports stand
% alone files, text and display listings, and you can even nest the
% commands/environments if you use \LaTeX\ code in comments, for example.
% Keywords, constants, variables, and symbols are definable and use of
% different styles is possible. No line numbers.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/support/tiny_c2l}{\packagename{tiny\textunderscore c2ltx}}}
% is a C/\Cpp/Java to \LaTeX\ converter based on \packagename{cvt2ltx} (or the
% other way round?). It supports line numbers, block comments, \LaTeX\ code
% in/as comments, and smart line breaking. Font selection and tabulators are
% hard-coded, i.e.~you have to rebuild the program if you want to change the
% appearance.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/misc}{\packagename{listing}}}
% ---note the missing \packagename{s}---is not a pretty-printer and the
% aphorism about documentation at the end of \texttt{listing.sty} is not
% true.\space ^^A :-)
% It defines |\listoflistings| and a nonfloating environment for listings.
% All font selection and indention must be done by hand. However, it's
% useful if you have another tool doing that work, e.g.~\packagename{LGrind}.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/alg}{\packagename{alg}}}
% provides essentially the same functionality as \packagename{algorithms}.
% So read the next paragraph and note that the syntax will be different.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/algorithms}{\packagename{algorithms}}}
% goes a quite different way. You describe an algorithm and the package
% formats it, for example
% \begin{center}
% \begin{minipage}{0.45\linewidth}
%\ifalgorithmicpkg
% \begin{algorithmic}
% \IF {$i\leq0$}
% \STATE $i\gets1$
% \ELSE\IF {$i\geq0$}
% \STATE $i\gets0$
% \ENDIF\ENDIF
% \end{algorithmic}
%\else
% \packagename{algorithms} not installed.
%\fi
% \end{minipage}
% \begin{minipage}{0.45\linewidth}
% \begin{verbatim}
%\begin{algorithmic}
%\IF{$i\leq0$}
%\STATE $i\gets1$
%\ELSE\IF{$i\geq0$}
%\STATE $i\gets0$
%\ENDIF\ENDIF
%\end{algorithmic}\end{verbatim}
% \end{minipage}
% \end{center}
% As this example shows, you get a good looking algorithm even from a bad
% looking input. The package provides a lot more constructs like |for|-loops,
% |while|-loops, or comments. You can request line numbers, `ruled', `boxed'
% and floating algorithms, a list of algorithms, and you can customize the
% terms \textbf{if}, \textbf{then}, and so on.
%
% \paragraph{\href{http://www.mimuw.edu.pl/~wolinski/pretprin.html}{\packagename{pretprin}}}
% is a package for pretty-printing texts in formal languages---as the title
% in TUGboat, Volume 19 (1998), No.~3 states. It provides environments which
% pretty-print \emph{and} format the source code. Analyzers for Pascal and
% Prolog are defined; adding other languages is easy---if you are or get a bit
% familiar with automatons and formal languages.
%
% \paragraph{\packagename{alltt}}
% defines an environment similar to \texttt{verbatim} except that |\|, |{| and
% |}| have their usual meanings. This means that you can use commands in the
% verbatims, e.g.~select different fonts or enter math mode.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/moreverb}{\packagename{moreverb}}}
% requires \packagename{verbatim} and provides verbatim output to a file,
% `boxed' verbatims and line numbers.
%
% \paragraph{\packagename{verbatim}}
% defines an improved version of the standard \texttt{verbatim} environment and
% a command to input files verbatim.
%
% \paragraph{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb}{\packagename{fancyvrb}}}
% is, roughly speaking, a superset of \packagename{alltt},
% \packagename{moreverb}, and \packagename{verbatim}, but many more parameters
% control the output. The package provides frames, line numbers on the left or
% on the right, automatic line breaking (difficult), and more. For example, an
% interface to \packagename{listings} exists, i.e.~you can pretty-print source
% code automatically.
% The package \packagename{fvrb-ex} builds on \packagename{fancyvrb} and
% defines environments to present examples similar to the ones in this guide.
%
%
% \section{The next steps}\label{uTheNextSteps}
%
% Now, before actually using the \packagename{listings} package, you should
% \emph{really} read the software license. It does not cost much time and
% provides information you probably need to know.
%
%
% \subsection{Software license}\label{uSoftwareLicense}
%
% The files \texttt{listings.dtx} and \texttt{listings.ins} and all
% files generated from only these two files are referred to as `the
% \packagename{listings} package' or simply `the package'.
% \texttt{lstdrvrs.dtx} and the files generated from that file are
% `drivers'.
%
% \paragraph{Copyright}
% The \packagename{listings} package is copyright 1996--2004 Carsten Heinz,
% and copyright 2006 Brooks Moses. The drivers are copyright any individual
% author listed in the driver files.
%
% \paragraph{Distribution and modification}
% The \packagename{listings} package and its drivers may be distributed
% and/or modified under the conditions of the LaTeX Project Public License,
% either version 1.3 of this license or (at your option) any later version.
% The latest version of this license is in
% \href{http://www.latex-project.org/lppl.txt}{http://www.latex-project.org/lppl.txt}
% and version 1.3 or later is part of all distributions of LaTeX version
% 2003/12/01 or later.
%
% \paragraph{Contacts}
% Read section \lstref{uTroubleshooting} on how to submit a bug report.
% Send all other comments, ideas, and additional programming languages to
% \lstemail\ using \texttt{listings} as part of the subject.
%
%
% \subsection{Package loading}\label{uPackageLoading}
%
% As usual in \LaTeX, the package is loaded by
% |\usepackage[|\meta{options}|]{listings}|,
% where |[|\meta{options}|]| is optional and gives a comma separated list of
% options. Each either loads an additional \packagename{listings} aspect, or
% changes default properties. Usually you don't have to take care of such
% options. But in some cases it could be necessary: if you want to compile
% documents created with an earlier version of this package or if you use
% special features. Here's an incomplete list of possible options.
% \begin{advise}
% \item Where is a list of all of the options?
% \advisespace
% In the developer's guide since they were introduced to debug the
% package more easily. Read section \ref{uHowTos} on how to get that
% guide.
% \end{advise}
% \begin{description}
% \item[\normalfont\texttt{0.21}]\leavevmode
%
% invokes a compatibility mode for compiling documents written for
% \packagename{listings} version 0.21.
%
% \item[\normalfont\texttt{draft}]\leavevmode
%
% The package prints no stand alone files, but shows the captions and
% defines the corresponding labels.
% Note that a global |\documentclass|-option \texttt{draft} is
% recognized, so you don't need to repeat it as a package option.
%
% \item[\normalfont\texttt{final}]\leavevmode\label{uoption:final}
%
% Overwrites a global \texttt{draft} option.
%
% \item[\normalfont\texttt{savemem}]\leavevmode
%
% tries to save some of \TeX's memory. If you switch between languages
% often, it could also reduce compile time. But all this depends on the
% particular document and its listings.
% \end{description}
% Note that various experimental features also need explicit loading via
% options. Read the respective lines in section \ref{rExperimentalFeatures}.
%
% \medbreak
% After package loading it is recommend to load all used dialects of programming
% languages with the following command. It is faster to load several languages
% with one command than loading each language on demand.
% \begin{syntax}
% \item {\rstyle\icmdname\lstloadlanguages}\marg{comma separated list of languages}
%
% Each language is of the form \oarg{dialect}\meta{language}. Without
% the optional \oarg{dialect} the package loads a default dialect. So
% write `|[Visual]C++|' if you want Visual \Cpp\ and `|[ISO]C++|' for
% ISO \Cpp. Both together can be loaded by the command
% |\lstloadlanguages{[Visual]C++,[ISO]C++}|.
%
% Table \ref{uPredefinedLanguages} on page \pageref{uPredefinedLanguages}
% shows all defined languages and their dialects.
% \end{syntax}
%^^A After or even before language loading, you might want to define default
%^^A dialects---just to be independent of configuration files.
%
%
% \subsection{The key=value interface}\label{uTheKey=ValueInterface}
%
% This package uses the \packagename{keyval} package from the
% \packagename{graphics} bundle by David Carlisle. Each parameter is
% controlled by an associated key and a user supplied value. For example,
% \ikeyname{firstline} is a key and |2| a valid value for this key.
%
% The command {\rstyle\icmdname\lstset} gets a comma separated list of
% ``key|=|value'' pairs. The first list with more than a single entry is on
% page \pageref{gFirstKey=ValueList}: |firstline=2,lastline=5|.
% \begin{advise}
% \item So I can write `|\lstset{firstline=2,lastline=5}|' once for all?
% \advisespace
% No. `\ikeyname{firstline}' and `\ikeyname{lastline}' belong to a small
% set of
% keys which are only used on individual listings. However, your command is
% not illegal---it has no effect. You have to use these keys inside the
% optional argument of the environment or input command.
% \item What's about a better example of a key|=|value list?
% \advisespace
% There is one in section \ref{gFigureOutTheAppearance}.
% \item `|language=[77]Fortran|' does not work inside an optional argument.
% \advisespace
% You must put braces around the value if a value with optional argument
% is used inside an optional argument. In the case here write
% `|language={[77]Fortran}|' to select Fortran 77.
% \item If I use the `\ikeyname{language}' key inside an optional argument, the
% language isn't active when I typeset the next listing.
% \advisespace
% All parameters set via `|\lstset|' keep their values up to the end of
% the current environment or group. Afterwards the previous values are
% restored. The optional parameters of the two pretty-printing commands
% and the `\texttt{lstlisting}' environment take effect on the particular
% listing only, i.e.~values are restored immediately. For example, you
% can select a main language and change it for special listings.
% \item \icmdname\lstinline\ has an optional argument?
% \advisespace
% Yes. And from this fact comes a limitation: you can't use the left
% bracket `|[|' as delimiter unless you specify at least an empty
% optional argument as in `|\lstinline[][var i:integer;[|'.
% If you forget this, you will either get a ``runaway argument'' error
% from \TeX, or an error message from the \packagename{keyval} package.
% \end{advise}
%
%
% \subsection{Programming languages}\label{uProgrammingLanguages}
%
% You already know how to activate programming languages---at least Pascal.
% An optional parameter selects particular dialects of a language. For example,
% |language=[77]Fortran| selects Fortran 77 and |language=[XSC]Pascal| does the
% same for Pascal XSC. The general form is
% {\rstyle\ikeyname{language}}|=|\oarg{dialect}\meta{language}.
% If you want to get rid of keyword, comment, and string detection, use
% |language={}| as an argument to |\lstset| or as optional argument.
%
% Table \ref{uPredefinedLanguages} shows all predefined languages and dialects.
% Use the listed names as \meta{language} and \meta{dialect}, respectively. If
% no dialect or `empty' is given in the table, just don't specify a dialect.
% Each underlined dialect is default; it is selected if you leave out
% the optional argument. The predefined defaults are the newest language
% versions or standard dialects.
%^^A
%^^A Make table of predefined languages.
%^^A
%\let\lstlanguages\empty
%\makeatletter
%\@for\lst@temp:={lstlang1.sty,lstlang2.sty,lstlang3.sty}\do
% {\IfFileExists\lst@temp{}{\let\lstlanguages\relax}}
%\makeatother
%\ifx\lstlanguages\relax
% \PackageWarningNoLine{Listings}
% {Standard drivers not available.\MessageBreak
% Please check your installation.\MessageBreak
% Compilation aborted}
% \csname @@end\expandafter\endcsname
%\fi
%\lstscanlanguages\lstlanguages{lstlang1.sty,lstlang2.sty,lstlang3.sty}{}^^A
%\def\topfigrule{\hrule\kern-0.4pt\relax}^^A
%\let\botfigrule\topfigrule
%\belowcaptionskip=\smallskipamount
% \begin{table}[tbhp]
% \small
% \caption{Predefined languages.
% Note that some definitions are preliminary, for example HTML and XML.
% Each underlined dialect is the default dialect.}^^A
% \label{uPredefinedLanguages}^^A
% \makeatletter
% \setbox\@tempboxa\hbox{^^A
% \InputIfFileExists{listings.cfg}{\lst@InputCatcodes}{}}^^A
% \lstprintlanguages\lstlanguages
% \end{table}
%^^A
%^^A end of table
%^^A
%\lstset{defaultdialect=[doc]Pascal}^^A restore
% \begin{advise}
% \item How can I define default dialects?
% \advisespace
% Check section \ref{rLanguagesAndStyles} for `\keyname{defaultdialect}'.
% \item I have C code mixed with assembler lines. Can \packagename{listings}
% pretty-print such source code, i.e.~highlight keywords and comments of
% both languages?
% \advisespace
% `\ikeyname{alsolanguage}|=|\oarg{dialect}\meta{language}' selects a
% language additionally to the active one. So you only have to write a
% language definition for your assembler dialect, which doesn't interfere
% with the definition of C, say. Moreover you might want to use the key
% `\keyname{classoffset}' described in section \ref{rLanguagesAndStyles}.
% \item How can I define my own language?
% \advisespace
% This is discussed in section \ref{rLanguageDefinitions}. And if you
% think that other people could benefit by your definition, you might
% want to send it to the address in section \ref{uSoftwareLicense}.
% Then it will be published under the \LaTeX\ Project Public License.
% \end{advise}
% Note that the arguments \meta{language} and \meta{dialect} are case
% insensitive and that spaces have no effect.
%
%
% \subsection{Special characters}\label{uSpecialCharacters}
%
%
% \paragraph{Tabulators}
% You might get unexpected output if your sources contain tabulators.
% The package assumes tabulator stops at columns 9, 17, 25, 33, and so on.
% This is predefined via |tabsize=8|. If you change the eight to the number
% $n$, you will get tabulator stops at columns $n+1,2n+1,3n+1,$ and so on.
% \begin{lstsample}[tabsize]{}{}
% \lstset{tabsize=2}
% \begin{lstlisting}
% 123456789
% { one tabulator }
% { two tabs }
% 123 { 123 + two tabs }
% \end{lstlisting}
% \end{lstsample}
% For better illustration, the left-hand side uses |tabsize=2| but the verbatim
% code |tabsize=4|. Note that |\lstset| modifies the values for all following
% listings in the same environment or group. This is no problem here since the
% examples are typeset inside minipages. If you want to change settings for a
% single listing, use the optional argument.
%
%
% \paragraph{Visible tabulators and spaces}
% One can make spaces and tabulators visible:
% \begin{lstsample}[showspaces,showtabs,tab]{}{}
% \lstset{showspaces=true,
% showtabs=true,
% tab=\rightarrowfill}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% If you request \ikeyname{showspaces} but no \ikeyname{showtabs},
% tabulators are converted to visible spaces.
% The default definition of \ikeyname{tab} produces a `wide visible space'
% \lstinline[showtabs]! !. So you might want to use |$\to$|, |$\dashv$|
% or something else instead.
% \begin{advise}
% \item Some sort of advice: (1) You should really indent lines of source code
% to make listings more readable. (2) Don't indent some lines with
% spaces and others via tabulators. Changing the tabulator size (of your
% editor or pretty-printing tool) completely disturbs the columns.
% (3) As a consequence, never share your files with differently tab sized
% people!^^A true only if you use tabulators, just :-)
% \item To make the \LaTeX\ code more readable, I indent the environments'
% program listings. How can I remove that indention in the output?
% \advisespace
% Read `How to gobble characters' in section \ref{uHowTos}.
% \end{advise}
%
%
% \paragraph{Form feeds}
% Another special character is a form feed causing an empty line by default.
% {\rstyle\ikeyname{formfeed}}|=\newpage| would result in a new page every
% form feed. Please note that such definitions (even the default) might get
% in conflict with frames.
%
%
% \paragraph{National characters}
% If you type in such characters directly as characters of codes 128--255 and
% use them also in listings, let the package know it---or you'll get really
% funny results. {\rstyle\ikeyname{extendedchars}}|=true| allows and
% |extendedchars=false| prohibits \packagename{listings} from handling
% extended characters in listings. If you use them, you should load
% \packagename{fontenc}, \packagename{inputenc} and/or
% any other package which defines the characters.
% \begin{advise}
% \item I have problems using \packagename{inputenc} together with
% \packagename{listings}.
% \advisespace
% This could be a compatibility problem. Make a bug report as described
% in section \lstref{uTroubleshooting}.
% \end{advise}
% The extended characters don't cover Arabic, Chinese, Hebrew, Japanese, and so
% on---specifically, any encoding which uses multiple bytes per character.
%
% Thus, if you use the a package that supports multibyte characters, such as
% the \packagename{CJK} or \packagename {ucs} packages for Chinese and
% UTF-8 characters, you must avoid letting \packagename{listings}
% process the extended characters. It is generally best to also specify
% |extendedchars=false| to avoid having \packagename{listings} get entangled
% in the other package's extended-character treatment.
%
% If you do have a listing contained within a CJK environment, and want to have
% CJK characters inside the listing, you can place them within a comment that
% escapes to \LaTeX -- see section \ref{rEscapingToLaTeX} for how to do that.
% (If the listing is not inside a CJK environment, you can simply put a small
% CJK environment within the escaped-to-\LaTeX portion of the comment.)
%
% Similarly, if you are using UTF-8 extended characters in a listing, they must
% be placed within an escape to \LaTeX.
%
% Also, section \ref{uNationalCharacters} has a few details on how to work with
% extended characters in the context of $\Lambda$.
%
%
% \subsection{Line numbers}\label{uLineNumbers}
%
% You already know the keys \ikeyname{numbers}, \ikeyname{numberstyle},
% \ikeyname{stepnumber}, and \ikeyname{numbersep} from section
% \ref{gSeduceToUse}. Here now we deal with continued listings.
% You have two options to get consistent line numbering across listings.
%
% \begin{lstsample}[firstnumber]{\lstset{numbers=left,numberstyle=\tiny,stepnumber=2,numbersep=5pt}}{}
% \begin{lstlisting}[firstnumber=100]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% \end{lstlisting}
% And we continue the listing:
% \begin{lstlisting}[firstnumber=last]
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
% In the example, \ikeyname{firstnumber} is initially set to 100; some lines
% later the value is \texttt{last}, which continues the numbering of the last
% listing. Note that the empty line at the end of the first part is not printed
% here, but it counts for line numbering. You should also notice that you can
% write |\lstset{firstnumber=last}| once and get consecutively numbered code
% lines---except you specify something different for a particular listing.
%
% On the other hand you can use |firstnumber=auto| and name your listings.
% Listings with identical names (case sensitive!) share a line counter.
% \begin{lstsample}[name]{\lstset{numbers=left,numberstyle=\tiny,stepnumber=2,numbersep=5pt}}{}
% \begin{lstlisting}[name=Test]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
%
% \end{lstlisting}
% And we continue the listing:
% \begin{lstlisting}[name=Test]
% Write('Case insensitive ');
% WritE('Pascal keywords.');
% \end{lstlisting}
% \end{lstsample}
% The next |Test| listing goes on with line number {\makeatletter\lstno@Test},
% no matter whether there are other listings in between.
% \begin{advise}
% \item Okay. And how can I get decreasing line numbers?
% \advisespace
% Sorry, what?
% \advisespace
% Decreasing line numbers as on page \pageref{rDecreasingLabels}.
% \advisespace
% May I suggest to demonstrate your individuality by other means?
% If you differ, you should try a negative `\ikeyname{stepnumber}'
% (together with `\ikeyname{firstnumber}').
% \end{advise}
%
% Read section \ref{uHowTos} on how to reference line numbers.
%
%
% \subsection{Layout elements}
%
% It's always a good idea to structure the layout by vertical space,
% horizontal lines, or different type sizes and typefaces. The best to stress
% whole listings are---not all at once---colours, frames, vertical space, and
% captions. The latter are also good to refer to listings, of course.
%
% \paragraph{Vertical space}
% The keys {\rstyle\ikeyname{aboveskip}} and {\rstyle\ikeyname{belowskip}}
% control the vertical space above and below displayed listings. Both keys get
% a dimension or skip as value and are initialized to |\medskipamount|.
%
% \paragraph{Frames}
% The key \ikeyname{frame} takes the verbose values \keyvalue{none},
% \keyvalue{leftline}, \keyvalue{topline}, \keyvalue{bottomline},
% \keyvalue{lines} (top and bottom), \keyvalue{single} for single frames, or
% \keyvalue{shadowbox}.
% \begin{lstsample}[frame]{}{}
% \begin{lstlisting}[frame=single]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item The rules aren't aligned.
% \advisespace
% This could be a bug of this package or a problem with your
% \texttt{.dvi} driver. \emph{Before} sending a bug report to the package
% author, modify the parameters described in section \ref{rFrames}
% heavily. And do this step by step!
% For example, begin with `|framerule=10mm|'. If the rules are
% misaligned by the same (small) amount as before, the problem does not
% come from the rule width. So continue with the next parameter. Also,
% Adobe Acrobat sometimes has single-pixel rounding errors which can
% cause small misalignments at the corners when PDF files are displayed
% on screen; these are unfortunately normal.
% \end{advise}
% Alternatively you can control the rules at the \texttt{t}op, \texttt{r}ight,
% \texttt{b}ottom, and \texttt{l}eft directly by using the four initial letters
% for single rules and their upper case versions for double rules.
% \begin{lstsample}[frame]{}{}
% \begin{lstlisting}[frame=trBL]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% Note that a corner is drawn if and only if both adjacent rules are requested.
% You might think that the lines should be drawn up to the edge, but what's
% about round corners? The key \ikeyname{frameround} must get exactly four
% characters as value. The first character is attached to the upper right
% corner and it continues clockwise. `\texttt{t}' as character makes the
% corresponding corner round.
% \begin{lstsample}[frameround]{}{}
% \lstset{frameround=fttt}
% \begin{lstlisting}[frame=trBL]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% Note that \ikeyname{frameround} has been used together with |\lstset| and thus
% the value affects all following listings in the same group or environment.
% Since the listing is inside a \texttt{minipage} here, this is no problem.
% \begin{advise}
% \item Don't use frames all the time, and in particular not with short listings.
% This would emphasize nothing. Use frames for $10\%$ or even less of
% your listings, for your most important ones.
% \item If you use frames on floating listings, do you really want frames?
% \advisespace
% No, I want to separate floats from text.
% \advisespace
% Then it is better to redefine \LaTeX's `|\topfigrule|' and
% `|\botfigrule|'. For example, you could write
% `|\renewcommand*\topfigrule{\hrule\kern-0.4pt\relax}|' and make the
% same definition for |\botfigrule|.
% \end{advise}
%
% \paragraph{Captions}
% Now we come to \ikeyname{caption} and \ikeyname{label}. You might guess
% (correctly) that they can be used in the same manner as \LaTeX's |\caption|
% and |\label| commands, although here it is also possible to have a caption
% regardless of whether or not the listing is in a float:
% \begin{lstsample}[caption,label]{\lstset{xleftmargin=.05\linewidth}}{}
% \begin{lstlisting}[caption={Useless code},label=useless]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% Afterwards you could refer to the listing via |\ref{useless}|. By default
% such a listing gets an entry in the list of listings, which can be printed
% with the command {\rstyle\icmdname\lstlistoflistings}. The key
% {\rstyle\ikeyname{nolol}} suppresses an entry for both the environment or
% the input command. Moreover, you can specify a short caption for the list
% of listings:
% \keyname{caption}|={|\oarg{short}\meta{long}|}|.
% Note that the whole value is enclosed in braces since an optional value is
% used in an optional argument.
%
% If you don't want the label \texttt{\lstlistingname} plus number, you should
% use \ikeyname{title}:
% \begin{lstsample}[title]{\lstset{xleftmargin=.05\linewidth}}{}
% \begin{lstlisting}[title={`Caption' without label}]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item Something goes wrong with `\keyname{title}' in my document: in front of
% the title is a delimiter.
% \advisespace
% The result depends on the document class; some are not compatible.
% Contact the package author for a work-around.
% \end{advise}
%
% \paragraph{Colours}
% One more element. You need the \packagename{color} package and can then
% request coloured background via
% \ikeyname{backgroundcolor}|=|\meta{color command}.
% \begin{advise}
% \item Great! I love colours.
% \advisespace
% Fine, yes, really. And I like to remind you of the warning about
% striking styles on page \pageref{wStrikingStyles}.
% \end{advise}
%\ifcolor
% \begin{lstxsample}[backgroundcolor]
% \lstset{backgroundcolor=\color{yellow}}
% \end{lstxsample}
%\else
% \begin{verbatim}
% color package not installed\end{verbatim}
%\fi
% \begin{lstsample}{}{}
% \begin{lstlisting}[frame=single,
% framerule=0pt]
% for i:=maxint to 0 do
% begin
% j:=square(root(i));
% end;
% \end{lstlisting}
% \end{lstsample}
% The example also shows how to get coloured space around the whole listing:
% use a frame whose rules have no width.
%
%
% \subsection{Emphasize identifiers}\label{uEmphasizeIdentifiers}
%
% Recall the pretty-printing commands and environment. |\lstinline| prints
% code snippets, |\lstinputlisting| whole files, and \texttt{lstlisting}
% pieces of code which reside in the \LaTeX\ file. And what are these
% different `types' of source code good for? Well, it just happens that a
% sentence contains a code fragment. Whole files are typically included in or
% as an appendix. Nevertheless some books about programming also include such
% listings in normal text sections---to increase the number of pages.
% Nowadays source code should be shipped on disk or CD-ROM and only the main
% header or interface files should be typeset for reference. So, please, don't
% misuse the \packagename{listings} package. But let's get back to the topic.
%
% Obviously `\texttt{lstlisting} source code' isn't used to make an executable
% program from. Such source code has some kind of educational purpose or even
% didactic.
% \begin{advise}
% \item What's the difference between educational and didactic?
% \advisespace
% Something educational can be good or bad, true or false.
% Didactic is true by definition.^^A :-)
% \end{advise}
% Usually \emph{keywords} are highlighted when the package typesets a piece of
% source code. This isn't necessary for readers who know the programming
% language well. The main matter is the presentation of interface, library or
% other functions or variables. If this is your concern, here come the right
% keys. Let's say, you want to emphasize the functions |square| and |root|,
% for example, by underlining them. Then you could do it like this:
% \begin{lstxsample}[emph,emphstyle]
% \lstset{emph={square,root},emphstyle=\underbar}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% j:=square(root(i));
% end;
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item Note that the list of identifiers |{square,root}| is enclosed in
% braces. Otherwise the \packagename{keyval} package would complain
% about an undefined key \keyname{root} since the comma finishes the
% key=value pair.
% Note also that you \emph{must} put braces around the value if you
% use an optional argument of a key inside an optional argument of a
% pretty-printing command. Though it is not necessary, the following
% example uses these braces. They are typically forgotten when they
% become necessary,
% \end{advise}
%
% Both keys have an optional \meta{class number} argument for multiple
% identifier lists:
%\ifcolor
% \begin{lstxsample}[emph,emphstyle]
% \lstset{emph={square}, emphstyle=\color{red},
% emph={[2]root,base},emphstyle={[2]\color{blue}}}
% \end{lstxsample}
%\else
% \begin{lstxsample}[emph,emphstyle]
% \lstset{emph={square}, emphstyle=\underbar,
% emph={[2]root,base},emphstyle={[2]\fbox}}
% \end{lstxsample}
%\fi
% \begin{lstsample}{}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% j:=square(root(i));
% end;
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item What is the maximal \meta{class number}?
% \advisespace
% $2^{31}-1=2\,147\,483\,647$. But \TeX's memory will exceed before you
% can define so many different classes.
% \end{advise}
%
% One final hint: Keep the lists of identifiers disjoint. Never use a keyword
% in an `emphasize' list or one name in two different lists. Even if your
% source code is highlighted as expected, there is no guarantee that it is
% still the case if you change the order of your listings or if you use the
% next release of this package.
%
%
%\iffalse
% \subsection{*Listing alignment}\label{uListingAlignment}
%
% The examples are typeset with centered \texttt{minipage}s. That's the reason
% why you can't see that line numbers are printed in the margin. Now we
% separate the minipage margin and the minipage by a vertical rule:
% \begin{lstsample}{\lstset{frame=l,framesep=0pt,numberstyle=\tiny,stepnumber=2,numbersep=5pt}}{}
% Some text before
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% The listing is lined up with the normal text. The parameter \ikeyname{xleftmargin}
% moves the listing to the right (or left if the dimension is negative).
% \begin{lstsample}{\lstset{frame=l,framesep=0pt,numberstyle=\tiny,stepnumber=2,numbersep=5pt}}{}
% Some text before
% \begin{lstlisting}[xleftmargin=15pt]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
%
% \begin{lstlisting}{ }
% Write('Insensitive');
% WritE('keywords.');
% \end{lstlisting}
% \end{lstsample}
% Note again that optional arguments change settings for single listings.
%
% If you use environments like \texttt{itemize} or \texttt{enumerate}, there
% is `natural' indention coming from these environments. By default the
% \packagename{listings} package respects this. But you might use
% |resetmargins=true| (or |false|) to make your own decision. You can use it
% together with |xleftmargin|, of course.
% \begin{advise}
% \item I get heavy overfull |\hbox|es from some listings.
% \advisespace
% This comes from long lines in your listings. You have some options
% to get rid of the overful |\hbox|es. Firstly I recommend to typeset
% listings in smaller fonts than the surrounding text, for example
% `|basicstyle=\small|'. Secondly you might want to use the flexible
% column format. Thirdly you can increase the line width or set it
% explicitly, refer section \ref{rMarginsAndLineShape}.
% If all this doesn't help, you might want to change
% `\ikeyname{basewidth}', but be careful! The two unknown items are
% explained in the next section.
% \end{advise}
%
% You might need to control the vertical position of listings with the
% \ikeyname{boxpos} key, for example, if you use them in \texttt{minipage} or
% \texttt{tabular} environments. Here `listings' means \texttt{lstlisting} or
% |\lstinputlisting|. As the following example shows, you can even place such
% listings inside paragraphs, but you must force the package to do this by
% enclosing the listing in |\hbox{| and |}|.
% \begin{advise}
% \item Is it good form to use the \TeX-primitive `|\hbox|' in a \LaTeX\
% document?
% \advisespace
% No, it's not. But \LaTeX's `|\mbox|' does not work in this example:
% \end{advise}
% \begin{lstsample}{}{}
% Here are some multi-line listings inside a paragraph.
% The `boxpos' key controls their vertical alignment:
% \hbox{\begin{lstlisting}[boxpos=c]
% center
% center
% \end{lstlisting}}
% \hbox{\begin{lstlisting}[boxpos=b]
% bottom baseline
% bottom baseline
% \end{lstlisting}}
% \hbox{\begin{lstlisting}[boxpos=t]
% top baseline
% top baseline
% \end{lstlisting}}
% \end{lstsample}
%\fi
%
%
% \subsection{Indexing}\label{uIndexing}
%
% Indexing is just like emphasizing identifiers---I mean the usage:
% \begin{lstxsample}[index]
% \lstset{index={square},index={[2]root}}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% j:=square(root(i));
% end;
% \end{lstlisting}
% \end{lstsample}
% Of course, you can't see anything here. You will have to look at the index.
% \begin{advise}
% \item Why is the `\ikeyname{index}' key able to work with multiple identifier
% lists?
% \advisespace
% This question is strongly related to the `{\rstyle\ikeyname{indexstyle}}'
% key. Someone might want to create multiple indexes or want to insert
% prefixes like `|constants|', `|functions|', `|keywords|', and so on.
% The `\ikeyname{indexstyle}' key works like the other style keys except
% that the last token \emph{must} take an argument, namely the
% (printable form of the) current identifier.
%
% You can define `|\newcommand\indexkeywords[1]{\index{keywords, #1}}|'
% and make similar definitions for constant or function names. Then
% `|indexstyle=[1]\indexkeywords|' might meet your purpose. This becomes
% easier if you want to create multiple indexes with the
% \href{http://www.ctan.org/tex-archive/macros/latex/contrib/camel}
% {\packagename{index}} package.
% If you have defined appropriate new indexes, it is possible to write
% `|indexstyle=\index[keywords]|', for example.
%
% \item Let's say, I want to index all keywords. It would be annoying to
% type in all the keywords again, specifically if the used programming
% language changes frequently.
% \advisespace
% Just read ahead.
% \end{advise}
% The \ikeyname{index} key has in fact two optional arguments. The first is the
% well-known \meta{class number}, the second is a comma separated list of other
% keyword classes whose identifiers are indexed. The indexed identifiers then
% change automatically with the defined keywords---not automagically, it's not
% an illusion.^^A :-)
%
% Eventually you need to know the names of the keyword classes. It's usually
% the key name followed by a class number, for example, |emph2|, |emph3|,
% \ldots, |keywords2| or |index5|. But there is no number for the first order
% classes |keywords|, |emph|, |directives|, and so on.
% \begin{advise}
% \item `|index=[keywords]|' does not work.
% \advisespace
% The package can't guess which optional argument you mean. Hence you
% must specify both if you want to use the second one. You should try
% `|index=[1][keywords]|'.
% \end{advise}
%
%
% \subsection{Fixed and flexible columns}\label{uFixedAndFlexibleColumns}
%
% The first thing a reader notices---except different styles for keywords,
% etc.---is the column alignment. Arne John Glenstrup invented the flexible
% column format in 1997. Since then some efforts were made to develop this
% branch farther. Currently four column formats are provided: fixed, flexible,
% space-flexible, and full flexible. Take a close look at the following
% examples.
% \begin{center}
% \lstset{style={},language={}}
% \def\sample{\begin{lstlisting}^^J WOMEN\ \ are^^A
% ^^J \ \ \ \ \ \ \ MEN^^A
% ^^J WOMEN are^^A
% ^^J better MEN^^J \end{lstlisting}}
% \begin{tabular}{@{}c@{\qquad\quad}c@{\qquad\quad}c@{\qquad\quad}c@{}}
% {\rstyle\ikeyname{columns}}|=| & \texttt{fixed} & \texttt{flexible} & \texttt{fullflexible}\\
% & (at {\makeatletter\lst@widthfixed})
% & (at {\makeatletter\lst@widthflexible})
% & (at {\makeatletter\lst@widthflexible})\\
% \noalign{\medskip}
% \lstset{basicstyle=\ttfamily,basewidth=0.51em}\sample
% & \lstset{columns=fixed}\sample
% & \lstset{columns=flexible}\sample
% & \lstset{columns=fullflexible}\sample
% \end{tabular}
% \end{center}
% \begin{advise}
% \item Why are women better men?
% \advisespace
% Do you want to philosophize? Well, have I ever said that the
% statement ``women are better men'' is true? I can't even remember this
% about ``women are men'' \ldots . ^^A ;-)
% \end{advise}
% In the abstract one can say: The fixed column format ruins the spacing
% intended by the font designer, while the flexible formats ruin the column
% alignment (possibly) intended by the programmer. Common to all is that the
% input characters are translated into a sequence of basic output units like
% \begingroup \lstset{gobble=6,xleftmargin=\leftmargini}
% \makeatletter
%^^A Make \fbox around each output unit.
% \fboxsep=0pt
% \def\lst@alloverstyle#1{\fbox{\kern-\fboxrule\strut#1}\kern-\fboxrule}
% \begin{lstlisting}[basewidth=1em]
% if x=y then write('align')
% else print('align');
% \end{lstlisting}
% Now, the fixed format puts $n$ characters into a box of width $n\times{}
% $`base width', where the base width is {\makeatletter\lst@widthfixed} in the
% example. The format shrinks and stretches the space between the characters
% to make them fit the box. As shown in the example, some character strings look
% \hbox to 2em{b\hss a\hss d}
% or
% \hbox to 2em{w\hss o\hss r\hss s\hss e},
% but the output is vertically aligned.
% \endgroup
%
% If you don't need or like this, you should use a flexible format. All
% characters are typeset at their natural width. In particular, they never
% overlap. If a word requires more space than reserved, the rest of the line
% simply moves to the right. The difference between the three formats is that
% the full flexible format cares about nothing else, while the normal flexible
% and space-flexible formats try to fix the column alignment if a character
% string needs less space than `reserved'. The normal flexible format will
% insert make-up space to fix the alignment at spaces, before and after
% identifiers, and before and after sequences of other characters; the
% space-flexible format will only insert make-up space by stretching
% existing spaces. In the flexible example above, the two MENs are vertically
% aligned since some space has been inserted in the fourth line to fix the
% alignment. In the full flexible format, the two MENs are not aligned.
%
% Note that both flexible modes printed the two blanks in the first line as a
% single blank, but for different reasons: the normal flexible format fixes
% the column alignment (as would the space-flexible format), and the full
% flexible format doesn't care about the second space.
%
%
% \section{Advanced techniques}\label{uAdvancedTechniques}
%
%
% \subsection{Style definitions}
%
% It is obvious that a pretty-printing tool like this requires some kind of
% language selection and definition. The first has already been described and
% the latter is convered by the next section. However, it is very convenient
% to have the same for printing styles: at a central place of your document
% they can be modified easily and the changes take effect on all listings.
%
% Similar to languages,
% {\rstyle\ikeyname{style}}|=|\meta{style name}
% activates a previously defined style. A definition is as easy:
% {\rstyle|\lstdefinestyle|}\marg{style name}\marg{key=value list}.
% Keys not used in such a definition are untouched by the corresponding style
% selection, of course. For example, you could write
% \begin{verbatim}
% \lstdefinestyle{numbers}
% {numbers=left, stepnumber=1, numberstyle=\tiny, numbersep=10pt}
% \lstdefinestyle{nonumbers}
% {numbers=none}\end{verbatim}
% and switch from listings with line numbers to listings without ones and vice
% versa simply by |style=nonumbers| and |style=numbers|, respectively.
% \begin{advise}
% \item You could even write
% `|\lstdefinestyle{C++}{language=C++,style=numbers}|'.
% Style and language names are independent of each other and so might
% coincide. Moreover it is possible to activate other styles.
%
% \item It's easy to crash the package using styles. Write
% '|\lstdefinestyle{crash}{style=crash}|' and '|\lstset{style=crash}|'.
% \TeX's capacity will exceed, sorry [parameter stack size]. Only bad
% boys use such recursive calls, but only good girls use this package.
% Thus the problem is of minor interest.^^A :-)
% \end{advise}
%
%
% \subsection{Language definitions}\label{uLanguageDefinitions}
%
% These are like style definitions except for an optional dialect name and an
% optional base language---and, of course, a different command name and
% specialized keys. In the simple case it's
% {\rstyle|\lstdefinelanguage|}\marg{language name}\marg{key=value list}.
% For many programming languages it is sufficient to specify keywords and
% standard function names, comments, and strings. Let's look at an example.
% \begin{lstxsample}[morekeywords,sensitive,morecomment,morestring]
% \lstdefinelanguage{rock}
% {morekeywords={one,two,three,four,five,six,seven,eight,
% nine,ten,eleven,twelve,o,clock,rock,around,the,tonight},
% sensitive=false,
% morecomment=[l]{//},
% morecomment=[s]{/*}{*/},
% morestring=[b]",
% }
% \end{lstxsample}
% \begingroup \csname lst@EndWriteFile\endcsname
% \bigbreak
%
% \noindent
% There isn't much to say about keywords. They are defined like identifiers
% you want to emphasize. Additionally you need to specify whether they are
% case sensitive or not. And yes: you could insert |[2]| in front of the
% keyword \texttt{one} to define the keywords as `second order' and print them
% in |keywordstyle={[2]...}|.
% \begin{advise}
% \item I get a `\texttt{Missing = inserted for }|\ifnum|' error when I select
% my language.
% \advisespace
% Did you forget the comma after `|keywords={...}|'? And if you encounter
% unexpected characters after selecting a language (or style), you have
% probably forgotten a different comma or you have given to many
% arguments to a key, for example, |morecomment=[l]{--}{!}|.
% \end{advise}
%
% So let's turn to comments and strings. Each value starts with a
% \emph{mandatory} \oarg{type} argument followed by a changing number of
% opening and closing delimiters. Note that each delimiter (pair) requires a
% key=value on its own, even if types are equal. Hence, you'll need to insert
% \texttt{morestring=[b]'} if single quotes open and close string or character
% literals in the same way as double quotes do in the example.
%
% Eventually you need to know the types and their numbers of delimiters. The
% reference guide contains full lists, here we discuss only the most common.
% For strings these are {\rstyle\texttt{b}} and {\rstyle\texttt{d}} with one
% delimiter each. This delimiter opens and closes the string and inside a
% string it is either escaped by a \texttt backslash or it is \texttt doubled.
% The comment type {\rstyle\texttt{l}} requires exactly one delimiter, which
% starts a comment on any column. This comment goes up to the end of line.
% The other two most common comment types are {\rstyle\texttt{s}} and
% {\rstyle\texttt{n}} with two delimiters each. The first delimiter opens a
% comment which is terminated by the second delimiter. In contrast to the
% \texttt s-type, \texttt n-type comments can be nested.
% \begin{lstxsample}[b,d,l,s,n]
% \lstset{morecomment=[l]{//},
% morecomment=[s]{/*}{*/},
% morecomment=[n]{(*}{*)},
% morestring=[b]",
% morestring=[d]'}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% "str\"ing " not a string
% 'str''ing ' not a string
% // comment line
% /* comment/**/ not a comment
% (* nested (**) still comment
% comment *) not a comment
% \end{lstlisting}
% \end{lstsample}
% \begin{advise}
% \item Is it \emph{that} easy?
% \advisespace
% Almost. There are some troubles you can run into. For example, if
% `\texttt{-*}' starts a comment line and `\texttt{-*-}' a string
% (unlikely but possible), then you must define the shorter delimiter
% first.
% Another problem: by default some characters are not allowed inside
% keywords, for example `\texttt{-}', `\texttt{:}', `\texttt{.}', and
% so on. The reference guide covers this problem by introducing some
% more keys, which let you adjust the standard character table
% appropriately. But note that white space characters are prohibited
% inside keywords.
% \end{advise}
% Finally remember that this section is only an introduction to language
% definitions. There are more keys and possibilities.
%
%
% \subsection{Delimiters}\label{uDelimiters}
%
% You already know two special delimiter classes: comments and strings.
% However, their full syntax hasn't been described so far. For example,
% \ikeyname{commentstyle} applies to all comments---unless you specify
% something different. The \emph{optional} \oarg{style} argument follows the
% \emph{mandatory} \oarg{type} argument.
%\ifcolor
% \begin{lstxsample}
% \lstset{morecomment=[l][keywordstyle]{//},
% morecomment=[s][\color{white}]{/*}{*/}}
% \end{lstxsample}
%\else
% \begin{lstxsample}
% \lstset{morecomment=[l][keywordstyle]{//},
% morecomment=[s][\underbar]{/*}{*/}}
% \end{lstxsample}
%\fi
% \begin{lstsample}{}{}
% \begin{lstlisting}
% // bold comment line
% a single /* comment */
% \end{lstlisting}
% \end{lstsample}
% As you can see, you have the choice between specifying the style explicitly
% by \LaTeX\ commands or implicitly by other style keys. But, you're right,
% some implicitly defined styles have no seperate keys, for example the second
% order keyword style. Here---and never with the number 1---you just append
% the order to the base key: \texttt{keywordstyle2}.
%
% You ask for an application? Here you are: one can define different printing
% styles for `subtypes' of a comment, for example
%\ifcolor
% \begin{lstxsample}
% \lstset{morecomment=[s][\color{blue}]{/*+}{*/},
% morecomment=[s][\color{red}]{/*-}{*/}}
% \end{lstxsample}
%\else
% \begin{lstxsample}
% \lstset{morecomment=[s][\upshape]{/*+}{*/},
% morecomment=[s][\bfseries]{/*-}{*/}}
% \end{lstxsample}
%\fi
% \begin{lstsample}{\lstset{morecomment=[s]{/*}{*/}}}{}
% \begin{lstlisting}
% /* normal comment */
% /*+ keep cool */
% /*- danger! */
% \end{lstlisting}
% \end{lstsample}
% Here, the comment style is not applied to the second and third line.
% \begin{advise}
% \item Please remember that both `extra' comments must be defined \emph{after}
% the normal comment, since the delimiter `\texttt{/*}' is a substring of
% `\texttt{/*+}' and `\texttt{/*-}'.
%
% \item I have another question. Is `\texttt{language=}\meta{different
% language}' the only way to remove such additional delimiters?
% \advisespace
% Call {\rstyle\ikeyname{deletecomment}} and/or
% {\rstyle\ikeyname{deletestring}} with the same arguments to remove
% the delimiters (but you don't need to provide the optional style
% argument).
% \end{advise}
% Eventually, you might want to use the prefix \texttt{i} on any comment type.
% Then the comment is not only invisible, it is completely discarded from the
% output!
% \begin{lstxsample}[is]
% \lstset{morecomment=[is]{/*}{*/}}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% begin /* comment */ end
% begin/* comment */end
% \end{lstlisting}
% \end{lstsample}
%
% Okay, and now for the real challenges. More general delimiters can be defined
% by the key {\rstyle\ikeyname{moredelim}}. Legal types are {\rstyle\texttt{l}}
% and {\rstyle\texttt{s}}. These types can be preceded by an \texttt{i}, but
% this time \emph{only the delimiters} are discarded from the output. This way
% you can select styles by markers.
% \begin{lstxsample}
% \lstset{moredelim=[is][\ttfamily]{|}{|}}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% roman |typewriter|
% \end{lstlisting}
% \end{lstsample}
% You can even let the package detect keywords, comments, strings, and other
% delimiters inside the contents.
% \begin{lstxsample}
% \lstset{moredelim=*[s][\itshape]{/*}{*/}}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% /* begin
% (* comment *)
% ' string ' */
% \end{lstlisting}
% \end{lstsample}
% Moreover, you can force the styles to be applied cumulatively.
% \begin{lstxsample}
% \lstset{moredelim=**[is][\ttfamily]{|}{|}, % cumulative
% moredelim=*[s][\itshape]{/*}{*/}} % not so
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{lstlisting}
% /* begin
% ' string '
% |typewriter| */
%
% | begin
% ' string '
% /*typewriter*/ |
% \end{lstlisting}
% \end{lstsample}
% Look carefully at the output and note the differences. The second
% \texttt{begin} is not printed in bold typewriter type since standard
% \LaTeX\ has no such font.
%
% This suffices for an introduction. Now go and find some more applications.
%
%
% \subsection{Closing and credits}\label{uClosingAndCredits}
%
% You've seen a lot of keys but you are far away from knowing all of them.
% The next step is the real use of the \packagename{listings} package.
% Please take the following advice. Firstly, look up the known commands and
% keys in the reference guide to get a notion of the notation there. Secondly,
% poke around with these keys to learn some other parameters. Then, hopefully,
% you'll be prepared if you encounter any problems or need some special things.
%
% \begin{advise}
% \item
% There is one question `you' haven't asked all the last pages: who is to
% blame. Carsten Heinz wrote the guides, coded the \packagename{listings}
% package and wrote some language drivers. Brooks Moses currently maintains
% the package. Other people defined more languages
% or contributed their ideas; many others made bug reports, but only the first
% bug finder is listed.
%^^A
%^^A Thanks for error reports (first bug finder only), new programming
%^^A languages, etc.
%^^A Special thanks for communication which lead to kernel extensions, and to
%^^A Hendri Adriaens for reviving maintenance on the package.
%^^A
% Special thanks go to (alphabetical order)
% \begin{quote}
% \hyphenpenalty=10000\relax \rightskip=0pt plus \linewidth
% \lstthanks{Hendri~Adriaens}{-},
% \lstthanks{Andreas~Bartelt}{Andreas.Bartelt@Informatik.Uni-Oldenburg.DE},
% \lstthanks{Jan~Braun}{Jan.Braun@tu-bs.de},
% \lstthanks{Denis~Girou}{Denis.Girou@idris.fr},
% \lstthanks{Arne~John~Glenstrup}{panic@diku.dk},
% \lstthanks{Frank~Mittelbach}{frank.mittelbach@latex-project.org},
% \lstthanks{Rolf~Niepraschk}{niepraschk@PTB.DE},
% \lstthanks{Rui~Oliveira}{rco@di.uminho.pt},
% \lstthanks{Jens~Schwarzer}{schwarzer@schwarzer.dk}, and
% \lstthanks{Boris~Veytsman}{boris@plmsc.psu.edu}.
% \end{quote}
% Moreover we wish to thank
% \begin{quote}
% \hyphenpenalty=10000\relax \rightskip=0pt plus \linewidth
% \lstthanks{Bj{\o}rn~{\AA}dlandsvik}{bjorn@imr.no},
% \lstthanks{Omair-Inam~Abdul-Matin}{-},
% \lstthanks{Gaurav~Aggarwal}{gaurav@ics.uci.edu},
% \lstthanks{Jason~Alexander}{jalex@ea.oac.uci.edu},
% \lstthanks{Andrei~Alexandrescu}{-},
% \lstthanks{Holger~Arndt}{-},
% \lstthanks{Donald~Arseneau}{ASND@erich.triumf.ca},
% \lstthanks{David~Aspinall}{David.Aspinall@ed.ac.uk},
% \lstthanks{Frank~Atanassow}{-},
% \lstthanks{Claus~Atzenbeck}{Claus.Atzenbeck@stud.uni-regensburg.de},
% \lstthanks{Michael~Bachmann}{-},
% \lstthanks{Luca~Balzerani}{-},
% \lstthanks{Peter~Bartke}{bartke@inf.fu-berlin.de} (big thankyou), ^^A beta tester
% \lstthanks{Heiko~Bauke}{-},
% \lstthanks{Oliver~Baum}{oli.baum@web.de},
% \lstthanks{Ralph~Becket}{rbeck@microsoft.com},
% \lstthanks{Andres~Becerra~Sandoval}{abecerra@univalle.edu.co},
% \lstthanks{Kai~Below}{below@tu-harburg.de},
% \lstthanks{Matthias~Bethke}{-},
% \lstthanks{Javier~Bezos}{javier.bezos@bancoval.es},
% \lstthanks{Olaf~Trygve~Berglihn}{olafb@pvv.org}, ^^A {1999/11/29}{3-char comment delimiter don't work (Python)}
% \lstthanks{Geraint~Paul~Bevan}{geraint@users.sf.net},
% \lstthanks{Peter~Biechele}{peter.biechele@physik.uni-freiburg.de},
% \lstthanks{Beat~Birkhofer}{beat@birkhofer.ch},
% \lstthanks{Fr\'ed\'eric~Boulanger}{Frederic.Boulanger@supelec.fr},
% \lstthanks{Joachim~Breitner}{-},
% \lstthanks{Martin~Brodbeck}{Martin.Brodbeck@gmx.de},
% \lstthanks{Walter~E.~Brown}{WB@fnal.gov},
% \lstthanks{Achim~D.~Brucker}{brucker@informatik.uni-freiburg.de},
% \lstthanks{J\'an Bu\v{s}a}{-},
% \lstthanks{Thomas~ten~Cate}{-},
% \lstthanks{David~Carlisle}{davidc@nag.co.uk},
% \lstthanks{Bradford~Chamberlain}{brad@cs.washington.edu},
% \lstthanks{Brian~Christensen}{-},
% \lstthanks{Neil~Conway}{-},
% \lstthanks{Patrick~Cousot}{Patrick.Cousot@wanadoo.fr},
% \lstthanks{Xavier~Cr\'egut}{cregut@enseeiht.fr},
% \lstthanks{Christopher~Creutzig}{-},
% \lstthanks{Holger~Danielsson}{dani@fbg.schwerte.de},
% \lstthanks{Andreas~Deininger}{deininger@uni-kassel.de},
% \lstthanks{Robert~Denham}{Robert.Denham@dnr.qld.gov.au},
% \lstthanks{Detlev~Dr\"oge}{droege@informatik.uni-koblenz.de},
% \lstthanks{Anders~Edenbrandt}{Anders.Edenbrandt@dna.lth.se},
% \lstthanks{Mark~van~Eijk}{mark@luon.net},
% \lstthanks{Norbert~Eisinger}{Norbert.Eisinger@informatik.uni-muenchen.de},
% \lstthanks{Brian~Elmegaard}{-},
% \lstthanks{Jon~Ericson}{Jon.Ericson@jpl.nasa.gov},
% \lstthanks{Thomas~Esser}{te@dbs.uni-hannover.de},
% \lstthanks{Chris~Edwards}{edwch00p@infoscience.otago.ac.nz},
% \lstthanks{David~John~Evans}{Matrix.Software@dial.pipex.com},
% \lstthanks{Tanguy~Fautr\'e}{tfautre@pandora.be},
% \lstthanks{Ulrike~Fischer}{-},
% \lstthanks{Robert~Frank}{rf7@ukc.ac.uk},
% \lstthanks{Michael~Franke}{-},
% \lstthanks{Ignacio~Fern\'andez~Galv\'an}{-},
% \lstthanks{Martine~Gautier}{-}
% \lstthanks{Daniel~Gazard}{gazard_d@epita.fr},
% \lstthanks{Daniel~Gerigk}{Daniel.Gerigk@ePost.de},
% \lstthanks{Dr.~Christoph~Giess}{-},
% \lstthanks{KP~Gores}{kp.gores@web.de},
% \lstthanks{Adam~Grabowski}{adam@mizar.org},
% \lstthanks{Jean-Philippe~Grivet}{grivet@cnrs-orleans.fr},
% \lstthanks{Christian~Gudrian}{Christian.Gudrian@kawo1.rwth-aachen.de},
% \lstthanks{Jonathan~de~Halleux}{dehalleux@auto.ucl.ac.be},
% \lstthanks{Carsten~Hamm}{carsten.hamm@siemens.com},
% \lstthanks{Martina~Hansel}{Martina.Hansel@fhtw-berlin.de},
% \lstthanks{Harald~Harders}{h.harders@tu-bs.de},
% \lstthanks{Christian~Haul}{haul@dvs1.informatik.tu-darmstadt.de},
% \lstthanks{Aidan~Philip~Heerdegen}{Aidan.Heerdegen@anu.edu.au},
% \lstthanks{Jim~Hefferon}{Hefferon9@aol.com},
% \lstthanks{Heiko~Heil}{info@heiko-heil.de},
% \lstthanks{J\"urgen~Heim}{heim@astro.uni-tuebingen.de},
% \lstthanks{Martin~Heller}{-},
% \lstthanks{Stephan~Hennig}{-},
% \lstthanks{Alvaro~Herrera}{alvherre@dcc.uchile.cl},
% \lstthanks{Richard~Hoefter}{hoefter@gmx.de},
% \lstthanks{Dr.~Jobst~Hoffmann}{HOFFMANN@rz.rwth-aachen.de},
% \lstthanks{Torben~Hoffmann}{toho@it.dtu.dk},
% \lstthanks{Morten~H\o gholm}{-},
% \lstthanks{Berthold~H\"ollmann}{bhoel@starship.python.net},
% \lstthanks{G\'erard~Huet}{-},
% \lstthanks{Hermann~H\"uttler}{hermann.huettler@gmx.net},
% \lstthanks{Ralf~Imh\"auser}{snoopy@tribal.line.org},
% \lstthanks{R.~Isernhagen}{R.Isernhagen@FH-Wolfenbuettel.DE},
% \lstthanks{Oldrich~Jedlicka}{ojedlick@students.zcu.cz},
% \lstthanks{Dirk~Jesko}{jesko@iti.cs.uni-magdeburg.de},
% \lstthanks{Lo\"\i c~Joly}{-},
% \lstthanks{Christian~Kaiser}{chk@combit.net},
% \lstthanks{Bekir~Karaoglu}{karabekirus@yahoo.com},
% \lstthanks{Marcin~Kasperski}{Marcin.Kasperski@softax.com.pl},
% \lstthanks{Christian~Kindinger}{chkind@uni-wuppertal.de},
% \lstthanks{Steffen~Klupsch}{steffen@vlsi.informatik.tu-darmstadt.de},
% \lstthanks{Markus~Kohm}{-},
% \lstthanks{Peter~K\"oller}{pkoeller@metaprojekt.de} (big thankyou), ^^A beta tester
% \lstthanks{Reinhard~Kotucha}{Reinhard.Kotucha@web.de},
% \lstthanks{Stefan~Lagotzki}{info@lagotzki.de},
% \lstthanks{Tino~Langer}{langer@tournex.de},
% \lstthanks{Rene~H.~Larsen}{rhl@traceroute.dk},
% \lstthanks{Olivier~Lecarme}{ol@i3s.unice.fr},
% \lstthanks{Thomas~Leduc}{Thomas.Leduc@lsv.ens-cachan.fr},
% \lstthanks{Dr.~Peter~Leibner}{Peter.Leibner@sta.siemens.de},
% \lstthanks{Thomas~Leonhardt}{leonhardt@informatik.tu-darmstadt.de} (big thankyou), ^^A beta tester
% \lstthanks{Magnus~Lewis-Smith}{Magnus.Lewis-Smith@pace.co.uk},
% \lstthanks{Knut~Lickert}{knut.lickert@gmx.de},
% \lstthanks{Benjamin~Lings}{-},
% \lstthanks{Dan~Luecking}{luecking@uark.edu},
% \lstthanks{Peter~L\"offler}{-},
% \lstthanks{Markus~Luisser}{-},
% \lstthanks{Kris~Luyten}{no email available},
% \lstthanks{Jos\'e~Romildo~Malaquias}{romildo@urano.iceb.ufop.br},
% \lstthanks{Andreas~Matthias}{amat@kabsi.at},
% \lstthanks{Patrick~TJ~McPhee}{ptjm@interlog.com},
% ^^A \lstthanks{Brooks~Moses}{-},
% \lstthanks{Riccardo~Murri}{riccardo.murri@gmx.it},
% \lstthanks{Knut~M\"uller}{knut@physik3.gwdg.de},
% \lstthanks{Svend~Tollak~Munkejord}{svendm@efisms.energy.sintef.no},
% \lstthanks{Gerd~Neugebauer}{gerd.neugebauer@gmx.de},
% \lstthanks{Torsten~Neuer}{tneuer@inwise.de},
% \lstthanks{Enzo~Nicosia}{-},
% \lstthanks{Michael~Niedermair}{m.g.n@gmx.de},
% \lstthanks{Xavier~Noria}{fxn@hashref.com},
% \lstthanks{Heiko~Oberdiek}{oberdiek@ruf.uni-freiburg.de},
% \lstthanks{Xavier~Olive}{-},
% \lstthanks{Alessio~Pace}{-},
% \lstthanks{Markus~Pahlow}{pahlowm@mar.dfo-mpo.gc.ca},
% \lstthanks{Morten~H.~Pedersen}{mhp@dadlnet.dk},
% \lstthanks{Xiaobo~Peng}{-},
% \lstthanks{Zvezdan~V.~Petkovic}{zpetkovic@acm.org},
% \lstthanks{Michael~Piefel}{piefel@informatik.hu-berlin.de},
% \lstthanks{Michael~Piotrowski}{mxp@linguistik.uni-erlangen.de},
% \lstthanks{Manfred~Piringer}{sz0490@rrze.uni-erlangen.de},
% \lstthanks{Vincent~Poirriez}{Vincent.Poirriez@univ-valenciennes.fr},
% \lstthanks{Adam~Prugel-Bennett}{apb@ecs.soton.ac.uk},
% \lstthanks{Ralf~Quast}{rquast@hs.uni-hamburg.de},
% \lstthanks{Aslak~Raanes}{araanes@ifi.ntnu.no},
% \lstthanks{Venkatesh~Prasad~Ranganath}{vranganath@cox.net},
% \lstthanks{Tobias~Rapp}{-},
% \lstthanks{Jeffrey~Ratcliffe}{-},
% \lstthanks{Georg~Rehm}{Georg.Rehm@germanistik.uni-giessen.de},
% \lstthanks{Fermin~Reig}{reig@ics.uci.edu},
% \lstthanks{Detlef~Reimers}{dreimers@aol.com},
% \lstthanks{Stephen~Reindl}{stephen.reindl@vodafone.com},
% \lstthanks{Franz~Rinnerthaler}{-},
% \lstthanks{Peter~Ruckdeschel}{Peter.Ruckdeschel@uni-bayreuth.de},
% \lstthanks{Magne~Rudshaug}{magne@ife.no},
% \lstthanks{Jonathan~Sauer}{jonathan.sauer@gmx.de},
% \lstthanks{Vespe~Savikko}{vespe@cs.tut.fi},
% \lstthanks{Mark~Schade}{-},
% \lstthanks{Gunther~Schmidl}{gschmidl@gmx.at},
% \lstthanks{Andreas~Schmidt}{-},
% \lstthanks{Walter~Schmidt}{wschmi@arcor.de},
% \lstthanks{Christian~Schneider}{-},
% \lstthanks{Jochen~Schneider}{jschneider@ds3.etech.haw-hamburg.de},
% \lstthanks{Benjamin~Schubert}{benjamin.schubert@berlin.de},
% \lstthanks{Sebastian~Schubert}{-},
% \lstthanks{Uwe~Siart}{uwe.siart@ei.tum.de},
% \lstthanks{Axel~Sommerfeldt}{axel@sommerfeldt.net},
% \lstthanks{Richard~Stallman}{-},
% \lstthanks{Nigel~Stanger}{nstanger@infoscience.otago.ac.nz},
% \lstthanks{Martin~Steffen}{ms@informatik.uni-kiel.de},
% \lstthanks{Andreas~Stephan}{Andreas.Stephan@victoria.de},
% \lstthanks{Stefan~Stoll}{stoll@phys.chem.ethz.ch},
% \lstthanks{Enrico~Straube}{no email available},
% \lstthanks{Werner~Struckmann}{struck@ips.cs.tu-bs.de},
% \lstthanks{Martin~S\"u\ss kraut}{Edon.Myder@web.de},
% \lstthanks{Gabriel~Tauro}{gabriel@informatik.uni-jena.de},
% \lstthanks{Winfried~Theis}{theis@statistik.uni-dortmund.de},
% \lstthanks{Jens~T.~Berger~Thielemann}{jensthi@ifi.uio.no},
% \lstthanks{William~Thimbleby}{-},
% \lstthanks{Arnaud~Tisserand}{arnaud.tisserand@ens-lyon.fr},
% \lstthanks{Jens~Troeger}{-},
% \lstthanks{Kalle~Tuulos}{kalle.tuulos@nic.fi},
% \lstthanks{Gregory~Van~Vooren}{Gregory.VanVooren@rug.ac.be},
% \lstthanks{Timothy~Van~Zandt}{tvz@econ.insead.edu},
% \lstthanks{J\"org~Viermann}{-},
% \lstthanks{Thorsten~Vitt}{vitt@informatik.hu-berlin.de},
% \lstthanks{Herbert~Voss}{voss@perce.de} (big thankyou), ^^A beta tester
% \lstthanks{Edsko~de~Vries}{devriese@tcd.ie},
% \lstthanks{Herfried~Karl~Wagner}{hirf@gmx.at},
% \lstthanks{Dominique~de~Waleffe}{ddw@miscrit.be},
% \lstthanks{Bernhard~Walle}{-},
% \lstthanks{Jared~Warren}{warren@cs.queensu.ca},
% \lstthanks{Michael~Weber}{mweber@informatik.hu-berlin.de},
% \lstthanks{Sonja~Weidmann}{Sonja.Weidmann@gmx.de},
% \lstthanks{Andreas~Weidner}{-},
% \lstthanks{Herbert~Weinhandl}{weinhand@grz08u.unileoben.ac.at},
% \lstthanks{Robert~Wenner}{robert.wenner@gmx.de},
% \lstthanks{Michael~Wiese}{wiese@itwm.uni-kl.de},
% \lstthanks{James~Willans}{-},
% \lstthanks{J\"orn~Wilms}{wilms@rocinante.colorado.edu},
% \lstthanks{Kai~Wollenweber}{kai@ece.WPI.EDU},
% \lstthanks{Ulrich~G.~Wortmann}{uliw@erdw.ethz.ch},
% \lstthanks{Cameron~H.G.~Wright}{-},
% \lstthanks{Andrew~Zabolotny}{-}, and
% \lstthanks{Florian~Z\"ahringer}{-}.
% \end{quote}
% There are probably other people who contributed to this package.
% If I've missed your name, send an email.
% \end{advise}
%
%
% \part{Reference guide}
%
%
% \section{Main reference}\label{rMainReference}
%
% Your first training is completed. Now that you've left the User's guide, the
% friend telling you what to do has gone. Get more practice and become a
% journeyman!^^A :-)
% \begin{advise}
% \item Actually, the friend hasn't gone. There are still some advices, but
% only from time to time.
% \end{advise}
%
%
% \subsection{How to read the reference}
%
% Commands, keys and environments are presented as follows.
% \begin{syntax}
% \item[1.0,default,hints] \texttt{command}, \texttt{environment} or
% \keyname{key} with \meta{parameters}
%
% This field contains the explanation; here we describe the other fields.
%
% If present, the label in the left margin provides extra information:
% `\textit{addon}' indicates additionally introduced functionality,
% `\textit{changed}' a modified key, `\textit{data}' a command just
% containing data (which is therefore adjustable via |\renewcommand|),
% and so on. Some keys and functionality are `\emph{bug}'-marked or
% with a \dag-sign. These features might change in future or could be
% removed, so use them with care.
%
% If there is verbatim text touching the right margin, it is the
% predefined value. Note that some keys default to this value every
% listing, namely the keys which can be used on individual listings only.
% \end{syntax}
% Regarding the parameters, please keep in mind the following:
% \begin{enumerate}
% \item A list always means a comma separated list. You must put braces around
% such a list. Otherwise you'll get in trouble with the
% \packagename{keyval} package; it complains about an undefined key.
% \item You must put parameter braces around the whole value of a key if you
% use an \oarg{optional argument} of a key inside an optional
% \oarg{key=value list}:
% |\begin{lstlisting}[caption=|{\rstyle|{|}|[one]two|{\rstyle|}|}|]|.
% \item Brackets `|[ ]|' usually enclose optional arguments and must be typed
% in verbatim. Normal brackets `[ ]' always indicate an optional argument
% and must not be typed in. Thus |[*]| must be typed in exactly as is,
% but [|*|] just gets |*| if you use this argument.
% \item A vertical rule indicates an alternative, e.g.~^^A
% \meta{\alternative{true,false}} allows either \texttt{true} or
% \texttt{false} as arguments.
% \item If you want to enter one of the special characters |{}#%\|, this
% character must be escaped with a backslash. This means that you must
% write |\}| for the single character `right brace'---but of course not
% for the closing paramater character.
% \end{enumerate}
%
%
% \subsection{Typesetting listings}\label{rTypesettingListings}
%
% \begin{syntax}
% \item[0.19] \rcmdname\lstset\marg{key=value list}
%
% sets the values of the specified keys, see also section
% \ref{uTheKey=ValueInterface}.
% The parameters keep their values up to the end of the current group.
% In contrast, all optional \meta{key=value list}s below modify the
% parameters for single listings only.
%
% \item[0.18] \rcmdname\lstinline\oarg{key=value list}\meta{character}\meta{source code}\meta{same character}
%
% works like |\verb| but respects the active language and style. These
% listings use flexible columns unless requested differently in the
% optional argument, and do not support frames or background colors.
% You can write `|\lstinline!var i:integer;!|' and get
% `\lstinline!var i:integer;!'.
%
% Since the command first looks ahead for an optional argument, you must
% provide at least an empty one if you want to use |[| as
% \meta{character}.
%
% \dag\ An experimental implementation has been done to support the
% syntax |\lstinline|\oarg{key=value list}\marg{source code}. Try it if
% you want and report success and failure. A known limitation is that
% inside another argument the last source code token must not be an
% explicit space token---and, of course, using a listing inside another
% argument is itself experimental, see section \ref{rListingsInsideArguments}.
%
% See also section \ref{rShortInline} for commands to create short analogs
% for the |\lstinline| command.
%
% \item[0.15] |\begin{|\texttt{\rstyle lstlisting}|}|\oarg{key=value list}
%
% \leavevmode\hspace*{-\leftmargini}|\end{|\texttt{\rstyle lstlisting}|}|
%
% typesets the code in between as a displayed listing.
%
% In contrast to the environment of the \packagename{verbatim} package,
% \LaTeX\ code on the same line and after the end of environment is
% typeset respectively executed.
%
% \item[0.1] \rcmdname\lstinputlisting\oarg{key=value list}\marg{file name}
%
% typesets the stand alone source code file as a displayed listing.
% \end{syntax}
%
%
% \subsection{Space and placement}
%
% \begin{syntax}
% \item[0.20,floatplacement] \rkeyname{float}|=|[|*|]\meta{subset of \textup{\texttt{tbph}}}\syntaxor\rkeyname{float}
%
% makes sense on individual displayed listings only and lets them float.
% The argument controls where \LaTeX\ is \emph{allowed} to put the float:
% at the top or bottom of the current/next page, on a separate page, or
% here where the listing is.
%
% The optional star can be used to get a double-column float in a
% two-column document.
%
% \item[0.21,tbp] \rkeyname{floatplacement}|=|\meta{place specifiers}
%
% is used as place specifier if \keyname{float} is used without value.
%
% \item[0.21,\medskipamount] \rkeyname{aboveskip}|=|\meta{dimension}
% \item[0.21,\medskipamount] \rkeyname{belowskip}|=|\meta{dimension}
%
% define the space above and below displayed listings.
%
% \item[0.17,0pt,\dag] \rkeyname{lineskip}|=|\meta{dimension}
%
% specifies additional space between lines in listings.
%
% \item[0.18,c,\dag] \rkeyname{boxpos}|=|\meta{\alternative{b,c,t}}
%
% Sometimes the \packagename{listings} package puts a |\hbox| around a
% listing---or it couldn't be printed or even processed correctly.
% The key determines the vertical alignment to the surrounding material:
% bottom baseline, centered or top baseline.
% \end{syntax}
%
%
% \subsection{The printed range}
%
% \begin{syntax}
% \item[0.12,true] \rkeyname{print}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{print}
%
% controls whether an individual displayed listing is typeset. Even if
% set false, the respective caption is printed and the label is defined.
%
% Note: If the package is loaded without the \texttt{draft} option, you
% can use this key together with |\lstset|. In the other case the key
% can be used to typeset particular listings despite using the
% \texttt{draft} option.
%
% \item[0.1,1] \rkeyname{firstline}|=|\meta{number}
% \item[0.1,9999999] \rkeyname{lastline}|=|\meta{number}
%
% can be used on individual listings only. They determine the physical
% input lines used to print displayed listings.
%
% \item[1.2] \rkeyname{linerange}|={|\meta{first1}\texttt-\meta{last1}\texttt,\meta{first2}\texttt-\meta{last2}\texttt, and so on|}|\label{uoption:linerange}
%
% can be used on individual listings only. The given line ranges
% of the listing are displayed. The intervals must be sorted and must
% not intersect.
%
% \item[0.20,false] \rkeyname{showlines}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{showlines}
%
% If true, the package prints empty lines at the end of listings.
% Otherwise these lines are dropped (but they count for line numbering).
%
% \item[1.0] \rkeyname{emptylines}|=|[|*|]\meta{number}
%
% sets the maximum of empty lines allowed. If there is a block of more
% than \meta{number} empty lines, only \meta{number} ones are printed.
% Without the optional star, line numbers can be disturbed when blank
% lines are omitted; with the star, the lines keep their original
% numbers.
%
% \item[0.19,0] \rkeyname{gobble}|=|\meta{number}
%
% gobbles \meta{number} characters at the beginning of each
% \emph{environment} code line. This key has no effect on \cs{lstinline}
% or \cs{lstinputlisting}.
%
% Tabulators expand to \ikeyname{tabsize} spaces before they are gobbled.
% Code lines with fewer than \ikeyname{gobble} characters are considered
% empty. Never indent the end of environment by more characters.
% \end{syntax}
%
%
% \subsection{Languages and styles}\label{rLanguagesAndStyles}
%
% Please note that the arguments \meta{language}, \meta{dialect}, and
% \meta{style name} are case insensitive and that spaces have no effect.
% \begin{syntax}
% \item[0.18,{{}}] \rkeyname{style}|=|\meta{style name}
%
% activates the key=value list stored with |\lstdefinestyle|.
%
% \item[0.19] \rcmdname\lstdefinestyle\marg{style name}\marg{key=value list}
%
% stores the key=value list.
%
% \item[0.17,{{}}] \rkeyname{language}|=|\oarg{dialect}\meta{language}
%
% activates a (dialect of a) programming language. The `empty' default
% language detects no keywords, no comments, no strings, and so on; it
% may be useful for typesetting plain text.
% If \meta{dialect} is not specified, the package chooses the default
% dialect, or the empty dialect if there is no default dialect.
%
% Table \ref{uPredefinedLanguages} on page \pageref{uPredefinedLanguages}
% lists all languages and dialects provided by \texttt{lstdrvrs.dtx}.
% The predefined default dialects are underlined.
%
% \item[0.21] \rkeyname{alsolanguage}|=|\oarg{dialect}\meta{language}
%
% activates a (dialect of a) programming language in addition to the
% current active one. Note that some language definitions interfere with
% each other and are plainly incompatible; for instance, if one is case
% sensitive and the other is not.
%
% Take a look at the \ikeyname{classoffset} key in section
% \ref{rFigureOutTheAppearance} if you want to highlight the keywords
% of the languages differently.
%
% \item[0.19] \rkeyname{defaultdialect}|=|\oarg{dialect}\meta{language}
%
% defines \meta{dialect} as default dialect for \meta{language}.
% If you have defined a default dialect other than empty, for example
% |defaultdialect=[iama]fool|, you can't select the empty dialect, even
% not with |language=[]fool|.
% \end{syntax}
%
% Finally, here's a small list of language-specific keys.
% \begin{syntax}
% \item[0.19,false,optional] \rkeyname{printpod}|=|\meta{\alternative{true,false}}
%
% prints or drops PODs in Perl.
%
% \item[0.20,true,{renamed,optional}] \rkeyname{usekeywordsintag}|=|\meta{\alternative{true,false}}\label{uoption:usekeywordsintag}
%
% The package either use the first order keywords in tags or prints all
% identifiers inside |<>| in keyword style.
%
% \item[1.1,{{}},optional] \rkeyname{tagstyle}|=|\meta{style}\label{uoption:tagstyle}
%
% determines the style in which tags and their content is printed.
%
% \item[1.1,false,optional] \rkeyname{markfirstintag}|=|\meta{style}\label{uoption:markfirstintag}
%
% prints the first name in tags with keyword style.
%
% \item[0.20,true,optional] \rkeyname{makemacrouse}|=|\meta{\alternative{true,false}}
%
% Make specific: Macro use of identifiers, which are defined as first
% order keywords, also prints the surrounding |$(| and |)| in keyword
% style. e.g.~you could get
% \textbf{\textdollar(}\textbf{strip} \textdollar(BIBS)\textbf{)}.
% If deactivated you get
% \textdollar(\textbf{strip} \textdollar(BIBS)).
% \end{syntax}
%
%
% \subsection{Figure out the appearance}\label{rFigureOutTheAppearance}
%
% \begin{syntax}
% \item[0.18,{{}}] \rkeyname{basicstyle}|=|\meta{basic style}
%
% is selected at the beginning of each listing. You could use
% |\footnotesize|, |\small|, |\itshape|, |\ttfamily|, or something like
% that. The last token of \meta{basic style} must not read any following
% characters.
%
% \item[0.18,{{}}] \rkeyname{identifierstyle}|=|\meta{style}
% \item[0.11,\itshape] \rkeyname{commentstyle}|=|\meta{style}
% \item[0.12,{{}}] \rkeyname{stringstyle}|=|\meta{style}
%
% determines the style for non-keywords, comments, and strings. The
% \emph{last} token can be an one-parameter command like |\textbf| or
% |\underbar|.
%
% \item[0.11,\bfseries,addon] \rkeyname{keywordstyle}|=|\oarg{number}[\textasteriskcentered]\meta{style}\label{roption:keywordstyle}
%
% is used to print keywords. The optional \meta{number} argument is the
% class number to which the style should be applied.
%
% Add-on: If you use the optional star after the (optional) class number, the
% keywords are printed uppercase\,---\,even if a language is case
% sensitive and defines lowercase keywords only. Maybe there should also be an
% option for lowercase keywords \ldots
%
% \item[0.19,keywordstyle,deprecated] \rkeyname{ndkeywordstyle}|=|\meta{style}
%
% is equivalent to |keywordstyle=2|\meta{style}.
%
% \item[1.0,0] \rkeyname{classoffset}|=|\meta{number}
%
% is added to all class numbers before the styles, keywords, identifiers,
% etc.~are assigned. The example below defines the keywords directly;
% you could do it indirectly by selecting two different languages.
% \end{syntax}
%\ifcolor
% \begin{lstxsample}
% \lstset{classoffset=0,
% morekeywords={one,three,five},keywordstyle=\color{red},
% classoffset=1,
% morekeywords={two,four,six},keywordstyle=\color{blue},
% classoffset=0}% restore default
% \end{lstxsample}
%\else
% \begin{lstxsample}
% \lstset{classoffset=0,
% morekeywords={one,three,five},keywordstyle=\itshape,
% classoffset=1,
% morekeywords={two,four,six},keywordstyle=\bfseries},
% classoffset=0}% restore default
% \end{lstxsample}
%\fi
% \begin{lstsample}{}{}
% \begin{lstlisting}
% one two three
% four five six
% \end{lstlisting}
% \end{lstsample}
%
% \begin{syntax}
% \item[0.20,keywordstyle,{addon,bug,optional}] \rkeyname{texcsstyle}|=|[|*|]\oarg{class number}\meta{style}\label{roption:texcsstyle}
% \item[0.20,keywordstyle,optional] \rkeyname{directivestyle}|=|\meta{style}
%
% determine the style of \TeX\ control sequences and directives.
% Note that these keys are present only if you've chosen an appropriate
% language.
%
% The optional star of |texcsstyle| also highlights the backslash in
% front of the control sequence name. Note that this option is set for
% all |texcs| lists.
%
% Bug: \texttt{texcs\ldots} interferes with other keyword lists. If, for
% example, \texttt{emph} contains the word \texttt{foo}, then the control
% sequence |\foo| will show up in \texttt{emphstyle}.
%
% \item[0.21] \rkeyname{emph}|=|\oarg{number}\marg{identifier list}
% \item[0.21] \rkeyname{moreemph}|=|\oarg{number}\marg{identifier list}
% \item[0.21] \rkeyname{deleteemph}|=|\oarg{number}\marg{identifier list}
% \item[0.21] \rkeyname{emphstyle}|=|\oarg{number}\marg{style}
%
% respectively define, add or remove the \meta{identifier list} from
% `emphasize class \meta{number}', or define the style for that class.
% If you don't give an optional argument, the package assumes
% \meta{number}$\,=1$.
%
% These keys are described more detailed in section
% \ref{uEmphasizeIdentifiers}.
%
% \item[1.0] \rkeyname{delim}|=|[\texttt*[\texttt*]]\texttt[\meta{type}\texttt][\texttt[\meta{style}\texttt]]\meta{delimiter\textup(s\textup)}
% \item[1.0] \rkeyname{moredelim}|=|[\texttt*[\texttt*]]\texttt[\meta{type}\texttt][\texttt[\meta{style}\texttt]]\meta{delimiter\textup(s\textup)}
% \item[1.0] \rkeyname{deletedelim}|=|[\texttt*[\texttt*]]\texttt[\meta{type}\texttt]\meta{delimiter\textup(s\textup)}
%
% define, add, or remove user supplied delimiters. (Note that this does
% not affect strings or comments.)
%
% In the first two cases \meta{style} is used to print the delimited
% code (and the delimiters). Here, \meta{style} could be something like
% |\bfseries| or |\itshape|, or it could refer to other styles via
% \texttt{keywordstyle}, \texttt{keywordstyle2}, \texttt{emphstyle},
% etc.
%
% Supported types are \texttt{l} and \texttt{s}, see the comment keys in
% section \ref{uLanguageDefinitions} for an explanation. If you use the
% prefix \texttt i, i.e.~\texttt{il} or \texttt{is}, the delimiters are
% not printed, which is some kind of invisibility.
%
% If you use one optional star, the package will detect keywords,
% comments, and strings inside the delimited code. With both optional
% stars, aditionally the style is applied cumulatively; see section
% \ref{uDelimiters}.
% \end{syntax}
%
%
% \subsection{Getting all characters right}
%
% \begin{syntax}
% \item[0.18,true] \rkeyname{extendedchars}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{extendedchars}
%
% allows or prohibits extended characters in listings, that means
% (national) characters of codes 128--255. If you use extended
% characters, you should load \packagename{fontenc} and/or
% \packagename{inputenc}, for example.
%
% \item[1.0,{{}}] \rkeyname{inputencoding}|=|\meta{encoding}
%
% determines the input encoding. The usage of this key requires the
% \packagename{inputenc} package; nothing happens if it's not loaded.
%
% \item[1.1,false] \rkeyname{upquote}|=|\meta{\alternative{true,false}}\label{uoption:upquote}
%
% determines whether the left and right quote are printed |`'| or
% \texttt{\textasciigrave\textquotesingle}.
% This key requires the \packagename{textcomp} package if true.
%
% \item[0.12,8] \rkeyname{tabsize}|=|\meta{number}
%
% sets tabulator stops at columns $\meta{number}+1$, $2\cdot\meta{number}+1$, $3\cdot\meta{number}+1$, and so on.
% Each tabulator in a listing moves the current column to the next
% tabulator stop.
%
% \item[0.20,false] \rkeyname{showtabs}|=|\meta{\alternative{true,false}}
%
% make tabulators visible or invisible. A visible tabulator looks like
% \lstinline[showtabs]! !, but that can be changed. If you choose
% invisible tabulators but visible spaces, tabulators are converted to
% an appropriate number of spaces.
%
% \item[0.20] \rkeyname{tab}|=|\meta{tokens}
%
% \meta{tokens} is used to print a visible tabulator. You might want to use |$\to$|, |$\mapsto$|, |$\dashv$| or something like that instead of the strange default definition.
%
% \item[0.20,false] \rkeyname{showspaces}|=|\meta{\alternative{true,false}}
%
% lets all blank spaces appear {\textvisiblespace} or as blank spaces.
%
% \item[0.12,true] \rkeyname{showstringspaces}|=|\meta{\alternative{true,false}}
%
% lets blank spaces in strings appear {\textvisiblespace} or as blank
% spaces.
%
% \item[0.19,\bigbreak] \rkeyname{formfeed}|=|\meta{tokens}
%
% Whenever a listing contains a form feed, \meta{tokens} is executed.
% \end{syntax}
%
%
% \subsection{Line numbers}\label{rLineNumbers}
%
% \begin{syntax}
% \item[1.0,none] \rkeyname{numbers}|=|\meta{\alternative{none,left,right}}
%
% makes the package either print no line numbers, or put them on the
% left or the right side of a listing.
%
% \item[0.16,1] \rkeyname{stepnumber}|=|\meta{number}
%
% All lines with ``line number $\equiv 0$ modulo \meta{number}'' get a
% line number.
% If you turn line numbers on and off with \keyname{numbers}, the
% parameter \keyname{stepnumber} will keep its value. Alternatively you
% can turn them off via |stepnumber=0| and on with a nonzero number, and
% keep the value of \keyname{numbers}.
%
% \item[1.1,false] \rkeyname{numberfirstline}|=|\meta{\alternative{true,false}}\label{uoption:numberfirstline}
%
% The first line of each listing gets numbered (if numbers are on at all)
% even if the line number is not divisible by \keyname{stepnumber}.
%
% \item[0.16,{{}}] \rkeyname{numberstyle}|=|\meta{style}
%
% determines the font and size of the numbers.
%
% \item[0.19,10pt] \rkeyname{numbersep}|=|\meta{dimension}
%
% is the distance between number and listing.
%
% \item[1.0,true] \rkeyname{numberblanklines}|=|\meta{\alternative{true,false}}
%
% If this is set to false, blank lines get no printed line number.
%
% \item[0.20,auto] \rkeyname{firstnumber}|=|\meta{\alternative{auto,last,\normalfont\meta{number}}}
%
% \texttt{auto} lets the package choose the first number: a new listing
% starts with number one, a named listing continues the most recent
% same-named listing (see below), and a stand alone file begins with
% the number corresponding to the first input line.
%
% \texttt{last} continues the numbering of the most recent listing and
% \meta{number} sets it to the number.
%
% \item[1.0] \rkeyname{name}|=|\meta{name}
%
% names a listing. Displayed environment-listings with the same name
% share a line counter if |firstnumber=auto| is in effect.
%
% \item[0.20,\arabic{lstnumber},data] \rcmdname\thelstnumber
%
% prints the lines' numbers.
% \end{syntax}
% We show an example on how to redefine |\thelstnumber|. But if you test it,
% you won't get the result shown on the left.
% \begin{lstxsample}
% \renewcommand*\thelstnumber{\oldstylenums{\the\value{lstnumber}}}
% \end{lstxsample}
% \begin{lstsample}{\lstset{stepnumber=-1}\label{rDecreasingLabels}}{}
% \begin{lstlisting}[numbers=left,
% firstnumber=753]
% begin { empty lines }
%
%
%
%
%
%
% end; { empty lines }
% \end{lstlisting}
% \end{lstsample}
%
% \begin{advise}
% \item
% The example shows a sequence $n,n+1,\ldots,n+7$ of 8 three-digit figures such that the sequence contains each digit $0,1,\ldots,9$.
% But 8 is not minimal with that property.
% Find the minimal number and prove that it is minimal.
% How many minimal sequences do exist?
%
% Now look at the generalized problem:
% Let $k\in\{1,\ldots,10\}$ be given.
% Find the minimal number $m\in\{1,\ldots,10\}$ such that there is a sequence $n,{n+1},\ldots,\allowbreak{n+m-1}$ of $m$ $k$-digit figures which contains each digit $\{0,\ldots,9\}$.
% Prove that the number is minimal.
% How many minimal sequences do exist?
%
% If you solve this problem with a computer, write a \TeX\ program!
% \end{advise}
%
%
% \subsection{Captions}
%
% In despite of \LaTeX\ standard behaviour, captions and floats are independent
% from each other here; you can use captions with non-floating listings.
% \begin{syntax}
% \item[0.21] \rkeyname{title}|=|\meta{title text}
%
% is used for a title without any numbering or label.
%
% \item[0.20] \rkeyname{caption}|={|\oarg{short}\meta{caption text}|}|
%
% The caption is made of \cs{lstlistingname} followed by a running
% number, a seperator, and \meta{caption text}. Either the caption text
% or, if present, \meta{short} will be used for the list of listings.
%
% \item[0.21] \rkeyname{label}|=|\meta{name}
%
% makes a listing referable via |\ref|\marg{name}.
%
% \item[0.16] \rcmdname\lstlistoflistings
%
% prints a list of listings. Each entry is with descending priority
% either the short caption, the caption, the file name or the name of the
% listing, see also the key \keyname{name} in section \ref{rLineNumbers}.
%
% \item[1.0] \rkeyname{nolol}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{nolol}
%
% If true, the listing does not make it into the list of listings.
%
% \item[0.16,Listings,data] \rcmdname\lstlistlistingname
%
% The header name for the list of listings.
%
% \item[0.20,Listing,data] \rcmdname\lstlistingname
%
% The caption label for listings.
%
% \item[0.20,\arabic{lstlisting},data] \rcmdname\thelstlisting
%
% prints the running number of the caption.
%
% \item[1.4,true] \rkeyname{numberbychapter}|=|\meta{\alternative{true,false}}
%
% If true, and |\thechapter| exists, listings are numbered by chapter.
% Otherwise, they are numbered sequentially from the beginning of the
% document. This key can only be used before |\begin{document}|.
%
% \item[0.19] \rcmdname\lstname
%
% prints the name of the current listing which is either the file name or
% the name defined by the \keyname{name} key. This command can be used to
% define a caption or title template, for example by
% |\lstset{caption=\lstname}|.
%
% \item[0.20,t] \rkeyname{captionpos}|=|\meta{subset of \textup{\texttt{tb}}}
%
% specifies the positions of the caption: top and/or bottom of the
% listing.
%
% \item[0.20,\smallskipamount] \rkeyname{abovecaptionskip}|=|\meta{dimension}
% \item[0.20,\smallskipamount] \rkeyname{belowcaptionskip}|=|\meta{dimension}
%
% is the vertical space respectively above or below each caption.
% \end{syntax}
%
%
% \subsection{Margins and line shape}\label{rMarginsAndLineShape}
%
% \begin{syntax}
% \item[0.21,\linewidth] \rkeyname{linewidth}|=|\meta{dimension}
%
% defines the base line width for listings. The following three keys are
% taken into account additionally.
%
% \item[0.19,0pt] \rkeyname{xleftmargin}|=|\meta{dimension}
% \item[1.0,0pt] \rkeyname{xrightmargin}|=|\meta{dimension}
%
% The dimensions are used as extra margins on the left and right. Line
% numbers and frames are both moved accordingly.
%
% \item[0.19,false] \rkeyname{resetmargins}|=|\meta{\alternative{true,false}}
%
% If true, indention from list environments like \texttt{enumerate} or
% \texttt{itemize} is reset, i.e.~not used.
%
% \item[0.20,false] \rkeyname{breaklines}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{breaklines}
%
% activates or deactivates automatic line breaking of long lines.
%
% \item[1.2,false] \rkeyname{breakatwhitespace}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{breakatwhitespace}\label{uoption:breakatwhitespace}
%
% If true, it allows line breaks only at white space.
%
% \item[0.20,{{}}] \rkeyname{prebreak}|=|\meta{tokens}
% \item[0.20,{{}}] \rkeyname{postbreak}|=|\meta{tokens}
%
% \meta{tokens} appear at the end of the current line respectively at the beginning of the next (broken part of the) line.
%
% You must not use dynamic space (in particular spaces) since internally we use |\discretionary|.
% However |\space| is redefined to be used inside \meta{tokens}.
%
% \item[0.20,20pt] \rkeyname{breakindent}|=|\meta{dimension}
%
% is the indention of the second, third, \ldots\ line of broken lines.
%
% \item[0.20,true] \rkeyname{breakautoindent}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{breakautoindent}
%
% activates or deactivates automatic indention of broken lines. This
% indention is used additionally to \ikeyname{breakindent}, see the
% example below.
% Visible spaces or visible tabulators might set this auto
% indention to zero.
% \end{syntax}
% In the following example we use tabulators to create long lines, but the
% verbatim part uses |tabsize=1|.
% \begin{lstxsample}
% \lstset{postbreak=\space, breakindent=5pt, breaklines}
% \end{lstxsample}
% \begin{lstsample}{\lstset{string=[d]",tabsize=6}}{\lstset{tabsize=1}\hfuzz=1in}
% \begin{lstlisting}
% "A long string is broken!"
% "Another long line."
% \end{lstlisting}
%
% \begin{lstlisting}[breakautoindent
% =false]
% { Now auto indention is off. }
% \end{lstlisting}
% \end{lstsample}
%
%
% \subsection{Frames}\label{rFrames}
%
% \begin{syntax}
% \item[1.0,none] \rkeyname{frame}|=|\meta{\alternative{none,leftline,topline,bottomline,lines,single,shadowbox}}
%
% draws either no frame, a single line on the left, at the top, at the
% bottom, at the top and bottom, a whole single frame, or a shadowbox.
%
% Note that \packagename{fancyvrb} supports the same frame types except
% \texttt{shadowbox}. The shadow color is \keyname{rulesepcolor}, see
% below.
%
% \item[0.19,{{}}] \rkeyname{frame}|=|\meta{subset of \textup{\texttt{trblTRBL}}}
%
% The characters \texttt{trblTRBL} designate lines at the top and
% bottom of a listing and to lines on the right and left. Upper case
% characters are used to draw double rules. So |frame=tlrb| draws a
% single frame and |frame=TL| double lines at the top and on the left.
%
% Note that frames usually reside outside the listing's space.
%
% \item[0.20,ffff] \rkeyname{frameround}|=|\meta{\alternative{t,f}}\meta{\alternative{t,f}}\meta{\alternative{t,f}}\meta{\alternative{t,f}}
%
% The four letters designate the top right, bottom right, bottom
% left and top left corner. In this order. \texttt{t} makes the
% according corner round. If you use round corners, the rule width is
% controlled via |\thinlines| and |\thicklines|.
%
% Note: The size of the quarter circles depends on \keyname{framesep}
% and is independent of the extra margins of a frame. The size is
% possibly adjusted to fit \LaTeX's circle sizes.
%
% \item[0.19,3pt] \rkeyname{framesep}|=|\meta{dimension}
% \item[0.19,2pt] \rkeyname{rulesep}|=|\meta{dimension}
%
% control the space between frame and listing and between double rules.
%
% \item[0.19,0.4pt] \rkeyname{framerule}|=|\meta{dimension}
%
% controls the width of the rules.
%
% \item[1.0,0pt] \rkeyname{framexleftmargin}|=|\meta{dimension}
% \item[1.0,0pt] \rkeyname{framexrightmargin}|=|\meta{dimension}
% \item[1.0,0pt] \rkeyname{framextopmargin}|=|\meta{dimension}
% \item[1.0,0pt] \rkeyname{framexbottommargin}|=|\meta{dimension}
%
% are the dimensions which are used additionally to \keyname{framesep}
% to make up the margin of a frame.
%
% \item[0.21] \rkeyname{backgroundcolor}|=|\meta{color command}
% \item[0.21] \rkeyname{rulecolor}|=|\meta{color command}
% \item[1.0] \rkeyname{fillcolor}|=|\meta{color command}
% \item[1.0] \rkeyname{rulesepcolor}|=|\meta{color command}
%
% specify the colour of the background, the rules, the space between
% `text box' and first rule, and of the space between two rules,
% respectively.
% Note that the value requires a |\color| command, for example
% \keyname{rulecolor}|=\color{blue}|.
% \end{syntax}
% \ikeyname{frame} does not work with |fancyvrb=true| or when the package
% internally makes a |\hbox| around the listing! And there are certainly more
% problems with other commands; please take the time to make a (bug) report.
%\ifcolor
% \begin{lstxsample}
% \lstset{framexleftmargin=5mm, frame=shadowbox, rulesepcolor=\color{blue}}
% \end{lstxsample}
%\else
% \lstset{framexleftmargin=5mm, frame=shadowbox}
%\fi
% \begin{lstsample}{}{}
% \begin{lstlisting}[numbers=left]
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
%
% Note here the use of |framexleftmargin| to include the line numbers inside
% the frame.
%
% Do you want exotic frames? Try the following key if you want, for example,
% \begin{lstsample}{\lstset{frameshape={RYRYNYYYY}{yny}{yny}{RYRYNYYYY}}}{}
% \begin{lstlisting}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% \begin{syntax}
% \item[0.20,,\dag] \rkeyname{frameshape}|=|\marg{top shape}\marg{left shape}\marg{right shape}\marg{bottom shape}
%
% gives you full control over the drawn frame parts.
% The arguments are not case sensitive.
%
% Both \meta{left shape} and \meta{right shape} are `left-to-right'
% \alternative{y,n} character sequences (or empty). Each |y| lets the
% package draw a rule, otherwise the rule is blank. These vertical rules
% are drawn `left-to-right' according to the specified shapes.
% The example above uses |yny|.
%
% \meta{top shape} and \meta{bottom shape} are `left-rule-right'
% sequences (or empty). The first `left-rule-right' sequence is attached
% to the most inner rule, the second to the next, and so on.
% Each sequence has three characters: `rule' is either |y| or |n|;
% `left' and `right' are |y|, |n| or |r| (which makes a corner round).
% The example uses |RYRYNYYYY| for both shapes:
% |RYR| describes the most inner (top and bottom) frame shape, |YNY|
% the middle, and |YYY| the most outer.
% \end{syntax}
% To summarize, the example above used
% \begin{verbatim}
% \lstset{frameshape={RYRYNYYYY}{yny}{yny}{RYRYNYYYY}}\end{verbatim}
% Note that you are not resticted to two or three levels.
% However you'll get in trouble if you use round corners when they are too big.
%
%
% \subsection{Indexing}
%
% \begin{syntax}
% \item[0.19] \rkeyname{index}|=|\oarg{number}\oarg{keyword classes}\marg{identifiers}
% \item[0.21] \rkeyname{moreindex}|=|\oarg{number}\oarg{keyword classes}\marg{identifiers}
% \item[0.21] \rkeyname{deleteindex}|=|\oarg{number}\oarg{keyword classes}\marg{identifiers}
%
% define, add and remove \meta{identifiers} and \meta{keyword classes}
% from the index class list \meta{number}. If you don't specify the
% optional number, the package assumes \meta{number} $=1$.
%
% Each appearance of the explicitly given identifiers and each appearance
% of the identifiers of the specified \meta{keyword classes} is indexed.
% For example, you could write |index=[1][keywords]| to index all
% keywords. Note that |[1]| is required here---otherwise we couldn't use
% the second optional argument.
%
% \item[0.19,\lstindexmacro] \rkeyname{indexstyle}|=|\oarg{number}\meta{tokens \textup(one-parameter command\textup)}
%
% \meta{tokens} actually indexes the identifiers for the list
% \meta{number}. In contrast to the style keys, \meta{tokens}
% \emph{must} read exactly one parameter, namely the identifier.
% Default definition is\icmdname{\lstindexmacro}\vspace*{-\itemsep}
% \begin{verbatim}
% \newcommand\lstindexmacro[1]{\index{{\ttfamily#1}}}\end{verbatim}
% \vspace*{-\itemsep}which you shouldn't modify.
% Define your own indexing commands and use them as argument to this key.
% \end{syntax}
% Section \ref{uIndexing} describes this feature in detail.
%
%
% \subsection{Column alignment}\label{rColumnAlignment}
%
% \begin{syntax}
% \item[1.0,{[c]fixed}] \rkeyname{columns}|=|\oarg{\alternative{c,l,r}}\meta{alignment}
%
% selects the column alignment. The \meta{alignment} can be |fixed|,
% |flexible|, |spaceflexible|, or |fullflexible|; see section
% \ref{uFixedAndFlexibleColumns} for details.
%
% The optional |c|, |l|, or |r| controls the horizontal orientation of
% smallest output units (keywords, identifiers, etc.). The arguments work
% as follows, where vertical bars visualize the effect:
% $\vert$\lstinline[columns={[c]fixed}]!listing!$\vert$,
% $\vert$\lstinline[columns={[l]fixed}]!listing!$\vert$, and
% $\vert$\lstinline[columns={[r]fixed}]!listing!$\vert$
% in fixed column mode,
% $\vert$\lstinline[columns={[c]flexible}]!listing!$\vert$,
% $\vert$\lstinline[columns={[l]flexible}]!listing!$\vert$, and
% $\vert$\lstinline[columns={[r]flexible}]!listing!$\vert$
% with flexible columns, and
% $\vert$\lstinline[columns={[c]fullflexible}]!listing!$\vert$,
% $\vert$\lstinline[columns={[l]fullflexible}]!listing!$\vert$, and
% $\vert$\lstinline[columns={[r]fullflexible}]!listing!$\vert$
% with space-flexible or full flexible columns (which ignore the
% optional argument, since they do not add extra space around
% printable characters).
%
% \item[0.18,false] \rkeyname{flexiblecolumns}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{flexiblecolumns}
%
% selects the most recently selected flexible or fixed column format,
% refer to section \ref{uFixedAndFlexibleColumns}.
%
% \item[0.21,false,\dag] \rkeyname{keepspaces}|=|\meta{\alternative{true,false}}
%
% |keepspaces=true| tells the package not to drop spaces to fix column
% alignment and always converts tabulators to spaces.
%
% \item[0.16] \rkeyname{basewidth}|=|\meta{dimension}\syntaxor
% \item[0.18,{{0.6em,0.45em}}] \rkeyname{basewidth}|={|\meta{fixed}|,|\meta{flexible mode}|}|
%
% sets the width of a single character box for fixed and flexible column
% mode (both to the same value or individually).
%
% \item[0.20,false] \rkeyname{fontadjust}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{fontadjust}
%
% If true the package adjusts the base width every font selection.
% This makes sense only if \ikeyname{basewidth} is given in font specific
% units like `em' or `ex'---otherwise this boolean has no effect.
%
% After loading the package, it doesn't adjust the width every font
% selection: it looks at \ikeyname{basewidth} each listing and uses the
% value for the whole listing. This is possibly inadequate if the style
% keys in section \ref{rFigureOutTheAppearance} make heavy font size
% changes, see the example below.
%
% Note that this key might disturb the column alignment and might have an
% effect on the keywords' appearance!
% \end{syntax}
% \begin{lstsample}{\lstset{basicstyle=\normalsize}}{}
% \lstset{commentstyle=\scriptsize}
% \begin{lstlisting}
% { scriptsize font
% doesn't look good }
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
% \begin{lstsample}{\lstset{basicstyle=\normalsize,commentstyle=\scriptsize}}{}
% \begin{lstlisting}[fontadjust]
% { scriptsize font
% looks better now }
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{lstlisting}
% \end{lstsample}
%
%
% \subsection{Escaping to \LaTeX}\label{rEscapingToLaTeX}
%
% \textbf{Note:} {\itshape Any escape to \LaTeX\ may disturb the column
% alignment since the package can't control the spacing there.}
% \begin{syntax}
% \item[0.18,false] \rkeyname{texcl}|=|\meta{\alternative{true,false}}\syntaxor\rkeyname{texcl}
%
% activates or deactivates \LaTeX\ comment lines. If activated, comment
% line delimiters are printed as usual, but the comment line text (up to
% the end of line) is read as \LaTeX\ code and typeset in comment style.
% \end{syntax}
% The example uses \Cpp\ comment lines (but doesn't say how to define them).
% Without |\upshape| we would get \textit{calculate} since the comment style
% is |\itshape|.
% \begin{lstsample}{\lstset{morecomment=[l]//}}{}
% \begin{lstlisting}[texcl]
% // \upshape calculate $a_{ij}$
% A[i][j] = A[j][j]/A[i][j];
% \end{lstlisting}
% \end{lstsample}
%
% \begin{syntax}
% \item[0.19,false] \rkeyname{mathescape}|=|\meta{\alternative{true,false}}
%
% activates or deactivates special behaviour of the dollar sign.
% If activated a dollar sign acts as \TeX's text math shift.
%
% This key is useful if you want to typeset formulas in listings.
%
% \item[0.19,{{}}] \rkeyname{escapechar}|=|\meta{character}\syntaxor\rkeyname{escapechar}|={}|
%
% If not empty the given character escapes the user to \LaTeX: all code
% between two such characters is interpreted as \LaTeX\ code. Note that
% \TeX's special characters must be entered with a preceding backslash,
% e.g.~|escapechar=\%|.
%
% \item[0.20,{{}}] \rkeyname{escapeinside}|=|\meta{character}\meta{character}\syntaxor\rkeyname{escapeinside}|={}|
%
% Is a generalization of \ikeyname{escapechar}. If the value is not
% empty, the package escapes to \LaTeX\ between the first and second
% character.
%
% \item[0.20,{{}}] \rkeyname{escapebegin}|=|\meta{tokens}
% \item[0.20,{{}}] \rkeyname{escapeend}|=|\meta{tokens}
%
% The tokens are executed at the beginning respectively at the end of
% each escape, in particular for \ikeyname{texcl}.
% See section \ref{uNationalCharacters} for an application.
% \end{syntax}
%
% \begin{lstsample}{\lstset{morecomment=[l]//}}{}
% \begin{lstlisting}[mathescape]
% // calculate $a_{ij}$
% $a_{ij} = a_{jj}/a_{ij}$;
% \end{lstlisting}
% \end{lstsample}
%
% \begin{lstsample}{\lstset{morecomment=[l]//}}{}
% \begin{lstlisting}[escapechar=\%]
% // calc%ulate $a_{ij}$%
% %$a_{ij} = a_{jj}/a_{ij}$%;
% \end{lstlisting}
% \end{lstsample}
%
% \begin{lstsample}{\lstset{morecomment=[l]//}}{}
% \lstset{escapeinside=`'}
% \begin{lstlisting}
% // calc`ulate $a_{ij}$'
% `$a_{ij} = a_{jj}/a_{ij}$';
% \end{lstlisting}
% \end{lstsample}
% In the first example the comment line up to $a_{ij}$ has been typeset by the
% \packagename{listings} package in comment style. The $a_{ij}$ itself is
% typeset in `\TeX\ math mode' without comment style. About half of the
% comment line of the second example has been typeset by this package, and
% the rest is in `\LaTeX\ mode'.
%
% To avoid problems with the current and future version of this package:
% \begin{enumerate}
% \item Don't use any commands of the \packagename{listings} package when you
% have escaped to \LaTeX.
% \item Any environment must start and end inside the same escape.
% \item You might use |\def|, |\edef|, etc., but do not assume that the
% definitions are present later, unless they are |\global|.
% \item |\if \else \fi|, groups, math shifts |$| and |$$|, \ldots\ must be
% balanced within each escape.
% \item \ldots
% \end{enumerate}
% Expand that list yourself and mail me about new items.
%
%
% \subsection{Interface to \textsf{fancyvrb}}
%
% The \packagename{fancyvrb} package---fancy verbatims---from Timothy van Zandt
% provides macros for reading, writing and typesetting verbatim code. It has
% some remarkable features the \packagename{listings} package doesn't have.
% (Some are possible, but you must find somebody who will implement them |;-)|.
% \begin{syntax}
% \item[0.19] \rkeyname{fancyvrb}|=|\meta{\alternative{true,false}}
%
% activates or deactivates the interface. If active, verbatim code is
% read by \packagename{fancyvrb} but typeset by \packagename{listings},
% i.e.~with emphasized keywords, strings, comments, and so on.
% Internally we use a very special definition of |\FancyVerbFormatLine|.
%
% This interface works with |Verbatim|, |BVerbatim| and |LVerbatim|.
% But you shouldn't use \packagename{fancyvrb}'s \keyname{defineactive}.
% (As far as I can see it doesn't matter since it does nothing at all,
% but for safety \ldots .)
% If \packagename{fancyvrb} and \packagename{listings} provide similar
% functionality, you should use \packagename{fancyvrb}'s.
%
% \item[1.1,{\overlay 1}] \rkeyname{fvcmdparams}|=|\meta{command$_1$}\meta{number$_1$}\ldots\label{uoption:fvcmdparams}
% \item[1.1] \rkeyname{morefvcmdparams}|=|\meta{command$_1$}\meta{number$_1$}\ldots\label{uoption:morefvcmdparams}
%
% If you use \packagename{fancyvrb}'s \keyname{commandchars}, you must
% tell the \packagename{listings} package how many arguments each command
% takes. If a command takes no arguments, there is nothing to do.
%
% The first (third, fifth, \ldots) parameter to the keys is the command
% and the second (fourth, sixth, \ldots) is the number of arguments
% that command takes. So, if you want to use |\textcolor{red}{keyword}|
% with the \packagename{fancyvrb}-\packagename{listings} interface, you
% should write |\lstset{morefvcmdparams=\textcolor 2}|.
% \end{syntax}
%
% \iffancyvrb
% \begin{lstsample}{}{}
% \lstset{morecomment=[l]\ }% :-)
% \fvset{commandchars=\\\{\}}
%
% \begin{BVerbatim}
% First verbatim line.
% \fbox{Second} verbatim line.
% \end{BVerbatim}
%
% \par\vspace{72.27pt}
%
% \lstset{fancyvrb}
% \begin{BVerbatim}
% First verbatim line.
% \fbox{Second} verbatim line.
% \end{BVerbatim}
% \lstset{fancyvrb=false}
% \end{lstsample}
% The lines typeset by the \packagename{listings} package are wider since the
% default \ikeyname{basewidth} doesn't equal the width of a single typewriter type
% character. Moreover, note that the first space begins a comment as defined at
% the beginning of the example.
% \else
% \begin{center}
% \packagename{fancyvrb} seems to be unavailable on your platform, thus the
% example couldn't be printed here.
% \end{center}
% \fi
%
%
% \subsection{Environments}\label{rEnvironments}
%
% If you want to define your own pretty-printing environments, try the
% following command. The syntax comes from \LaTeX's |\newenvironment|.
% \begin{syntax}
% \item[0.19] \rcmdname\lstnewenvironment\\
% \marg{name}\oarg{number}\oarg{opt.~default~arg.}\\
% |{|\meta{starting code}|}|\\
% |{|\meta{ending code}|}|
% \end{syntax}
% As a simple example we could just select a particular language.
% \begin{lstxsample}
% \lstnewenvironment{pascal}
% {\lstset{language=pascal}}
% {}
% \end{lstxsample}
% \begin{lstsample}{}{}
% \begin{pascal}
% for i:=maxint to 0 do
% begin
% { do nothing }
% end;
% \end{pascal}
% \end{lstsample}
% Doing other things is as easy, for example, using more keys and adding an
% optional argument to adjust settings each listing:
% \begin{verbatim}
%\lstnewenvironment{pascalx}[1][]
% {\lstset{language=pascal,numbers=left,numberstyle=\tiny,float,#1}}
% {}\end{verbatim}
%
%
% \subsection{Short Inline Listing Commands}\label{rShortInline}
%
% Short equivalents of |\lstinline| can also be defined, in a manner similar
% to the short verbatim macros provided by \packagename{shortvrb}.
%
% \begin{syntax}
% \item[1.4] \rcmdname\lstMakeShortInline[\oarg{options}]\meta{character}
%
% defines \meta{character} to be an equivalent of
% |\lstinline|[\oarg{options}]\meta{character},
% allowing for a convenient syntax when using lots of inline listings.
%
% \item[1.4] \rcmdname\lstDeleteShortInline\meta{character}
%
% removes a definition of \meta{character} created by |\lstMakeShortInline|,
% and returns \meta{character} to its previous meaning.
% \end{syntax}
%
%
% \subsection{Language definitions}\label{rLanguageDefinitions}
%
% You should first read section \ref{uLanguageDefinitions} for an introduction
% to language definitions. Otherwise you're probably unprepared for the full
% syntax of |\lstdefinelanguage|.
% \begin{syntax}
% \item[0.19] \rcmdname\lstdefinelanguage\syntaxnewline[\oarg{dialect}]\marg{language}\syntaxnewline[\oarg{base dialect}\marg{and base language}]\syntaxnewline\marg{key=value list}\syntaxnewline[\oarg{list of required aspects \textup(keywordcomments,texcs,etc.\textup)}]
%
% defines the (given dialect of the) programming language \meta{language}.
% If the language definition is based on another definition, you must
% specify the whole \oarg{base dialect}\marg{and base language}. Note
% that an empty \meta{base dialect} uses the default dialect!
%
% The last optional argument should specify all required aspects. This is
% a delicate point since the aspects are described in the developer's
% guide. You might use existing languages as templates. For example,
% ANSI C uses \aspectname{keywords}, \aspectname{comments},
% \aspectname{strings} and \aspectname{directives}.
%
% \icmdname{\lst@definelanguage} has the same syntax and is used to
% define languages in the driver files.
%
% \begin{advise}
% \item Where should I put my language definition?
% \advisespace
% If you need the language for one particular document, put it into
% the preamble of that document. Otherwise create the local file
% `\texttt{lstlang0.sty}' or add the definition to that file, but use
% `|\lst@definelanguage|' instead of `|\lstdefinelanguage|'.
% However, you might want to send the definition to the address in
% section \ref{uSoftwareLicense}. Then it will be included with the
% rest of the languages distributed with the package, and published under
% the \LaTeX\ Project Public License.
% \end{advise}
%
% \item[0.18] \rcmdname\lstalias\marg{alias}\marg{language}
%
% defines an alias for a programming language. Each \meta{alias} is
% redirected to the same dialect of \meta{language}.
% It's also possible to define an alias for one particular dialect only:
%
% \item[0.18] \rcmdname\lstalias\oarg{alias dialect}\marg{alias}\oarg{dialect}\marg{language}
%
% Here all four parameters are \emph{nonoptional} and an alias with empty
% \meta{dialect} will select the default dialect. Note that aliases
% cannot be chained: The two aliases `|\lstalias{foo1}{foo2}|' and
% `|\lstalias{foo2}{foo3}|' will \emph{not} redirect |foo1| to |foo3|.
% \end{syntax}
% All remaining keys in this section are intended for building language
% definitions. \emph{No other key should be used in such a definition!}
%
%
% \paragraph{Keywords}
% We begin with keyword building keys. Note: {\itshape If you want to enter
% {\upshape|\|, |{|, |}|, |%|, |#|} or {\upshape|&|} as (part of) an argument
% to the keywords below, you must do it with a preceding backslash!}
% \begin{syntax}
% \item[1.0,,{\dag bug}] \rkeyname{keywordsprefix}|=|\meta{prefix}
%
% All identifiers starting with \meta{prefix} will be printed as first
% order keywords.
%
% Bugs: Currently there are several limitations.
% (1) The prefix is always case sensitive.
% (2) Only one prefix can be defined at a time.
% (3) If used `standalone' outside a language definition, the key might
% work only after selecting a nonempty language (and switching back to
% the empty language if necessary).
% (4) The key does not respect the value of \keyname{classoffset} and
% has no optional class \meta{number} argument.
%
% \item[0.11] \rkeyname{keywords}|=|\oarg{number}\marg{list of keywords}
% \item[0.11] \rkeyname{morekeywords}|=|\oarg{number}\marg{list of keywords}
% \item[0.18] \rkeyname{deletekeywords}|=|\oarg{number}\marg{list of keywords}
%
% define, add to or remove the keywords from keyword list \meta{number}.
% The use of \keyname{keywords} is discouraged since it deletes all
% previously defined keywords in the list and is thus incompatible with
% the \keyname{alsolanguage} key.
%
% Please note the keys \ikeyname{alsoletter} and \ikeyname{alsodigit}
% below if you use unusual charaters in keywords.
%
% \item[0.19,,deprecated] \rkeyname{ndkeywords}|=|\marg{list of keywords}
% \item[0.19,,deprecated] \rkeyname{morendkeywords}|=|\marg{list of keywords}
% \item[0.19,,deprecated] \rkeyname{deletendkeywords}|=|\marg{list of keywords}
%
% define, add to or remove the keywords from keyword list 2; note that
% this is equivalent to |keywords=[2]|\ldots etc.
% The use of \keyname{ndkeywords} is strongly discouraged.
%
% \item[0.19,,{addon,optional}] \rkeyname{texcs}|=|\oarg{class number}\marg{list of control sequences \textup(without backslashes\textup)}
% \item[0.20,,{addon,optional}] \rkeyname{moretexcs}|=|\oarg{class number}\marg{list of control sequences \textup(without backslashes\textup)}
% \item[0.21,,{addon,optional}] \rkeyname{deletetexcs}|=|\oarg{class number}\marg{list of control sequences \textup(without backslashes\textup)}
%
% Ditto for control sequences in \TeX\ and \LaTeX.
%
% \item[0.18,,optional] \rkeyname{directives}|=|\marg{list of compiler directives}
% \item[0.21,,optional] \rkeyname{moredirectives}|=|\marg{list of compiler directives}
% \item[0.21,,optional] \rkeyname{deletedirectives}|=|\marg{list of compiler directives}
%
% defines compiler directives in C, \Cpp, Objective-C, and POV.
%
% \item[0.14] \rkeyname{sensitive}|=|\meta{\alternative{true,false}}
%
% makes the keywords, control sequences, and directives case sensitive
% and insensitive, respectively. This key affects the keywords, control
% sequences, and directives only when a listing is processed. In all
% other situations they are case sensitive, for example,
% |deletekeywords={save,Test}| removes `save' and `Test', but neither
% `SavE' nor `test'.
%
% \item[0.19] \rkeyname{alsoletter}|=|\marg{character sequence}
% \item[0.19] \rkeyname{alsodigit}|=|\marg{character sequence}
% \item[0.19] \rkeyname{alsoother}|=|\marg{character sequence}
%
% All identifiers (keywords, directives, and such) consist of a letter
% followed by alpha-numeric characters (letters and digits).
% For example, if you write
% |keywords={one-two,\#include}|,
% the minus sign must become a digit and the sharp a letter since the
% keywords can't be detected otherwise.
%
% Table \ref{rStdCharTable} show the standard configuration of the
% \packagename{listings} package. The three keys overwrite the default
% behaviour. Each character of the sequence becomes a letter, digit
% and other, respectively.
%
% \item[0.20] \rkeyname{otherkeywords}|=|\marg{keywords}
%
% Defines keywords that contain other characters, or start with digits.
% Each given `keyword' is printed in keyword style, but without changing
% the `letter', `digit' and `other' status of the characters. This key
% is designed to define keywords like |=>|, |->|, |-->|, |--|, |::|, and
% so on. If one keyword is a subsequence of another (like |--| and
% |-->|), you must specify the shorter first.
%
% \item[0.20,,{renamed,optional}] \rkeyname{tag}|=|\meta{character}\meta{character}\syntaxor\rkeyname{tag}|={}|\label{uoption:tag}
%
% The first order keywords are active only between the first and second
% character. This key is used for HTML.
% \end{syntax}
%
% \begin{table}[tb]
% \caption{Standard character table}\label{rStdCharTable}
% \begin{tabular}{ll}
% class & characters\\
% \noalign{\smallskip}
% letter & \texttt{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\\
% & \texttt{a b c d e f g h i j k l m n o p q r s t u v w x y z}\\
% & \texttt{@ \textdollar\ } |_|\\
% digit & \texttt{0 1 2 3 4 5 6 7 8 9}\\
% other & \texttt{!\ " \#\ \%\ \&\ ' ( ) * + , - .\ / :\ ; < = > ?}\\
% & {\catcode`\|=12\texttt{[ \char92\ ] \textasciicircum\ \char123\ | \char125\ \textasciitilde}}\\
% space & chr(32)\\
% tabulator & chr(9)\\
% form feed & chr(12)\\
% \noalign{\smallskip}
% \end{tabular}
% \par\noindent
% Note: Extended characters of codes 128--255 (if defined) are \emph{currently}
% letters.
% \end{table}
%
%
% \paragraph{Strings}
% \begin{syntax}
% \item[0.12] \rkeyname{string}|=|\oarg{\alternative{b,d,m,bd,s}}\marg{delimiter \textup(character\textup)}
% \item[0.21] \rkeyname{morestring}|=|\oarg{\alternative{b,d,m,bd,s}}\marg{delimiter}
% \item[0.21] \rkeyname{deletestring}|=|\oarg{\alternative{b,d,m,bd,s}}\marg{delimiter}
%
% define, add to or delete the delimiter from the list of string
% delimiters. Starting and ending delimiters are the same, i.e.~in the
% source code the delimiters must match each other.
%
% The optional argument is the type and controls the how the delimiter
% itself is represented in a string or character literal: it is escaped by a
% |b|ackslash, |d|oubled (or both is allowed via |bd|). Alternately, the
% type can refer to an unusual form of delimiter: |s|tring delimiters (akin
% to the |s| comment type) or |m|atlab-style delimiters. The latter is a
% special type for Ada and Matlab and possibly other languages where the
% string delimiters are also used for other purposes. It is equivalent
% to |d|, except that a string does not start after a letter, a right
% parenthesis, a right bracket, or some other characters.
% \end{syntax}
%
%
% \paragraph{Comments}
% \begin{syntax}
% \item[0.13] \rkeyname{comment}|=|\oarg{type}\meta{delimiter\textup(s\textup)}
% \item[0.21] \rkeyname{morecomment}|=|\oarg{type}\meta{delimiter\textup(s\textup)}
% \item[0.21] \rkeyname{deletecomment}|=|\oarg{type}\meta{delimiter\textup(s\textup)}
%
% Ditto for comments, but some types require more than a single
% delimiter. The following overview uses \keyname{morecomment} as the
% example, but the examples apply to \keyname{comment} and \keyname{deletecomment}
% as well.
%
% \item[0.13] \keyname{morecomment}|=[l]|\meta{delimiter}
%
% The delimiter starts a comment line, which in general starts with the
% delimiter and ends at end of line. If the character sequence |//|
% should start a comment line (like in \Cpp, Comal 80 or Java),
% |morecomment=[l]//| is the correct declaration. For Matlab it
% would be |morecomment=[l]\%|---note the preceding backslash.
%
% \item[0.13] \keyname{morecomment}|=[s]|\marg{delimiter}\marg{delimiter}
%
% Here we have two delimiters. The second ends a comment starting with
% the first delimiter. If you require two such comments you can use this
% type twice. C, Java, PL/I, Prolog and SQL all define single comments
% via |morecomment=[s]{/*}{*/}|, and Algol does it with
% |morecomment=[s]{\#}{\#}|, which means that the sharp delimits both
% beginning and end of a single comment.
%
% \item[0.13] \keyname{morecomment}|=[n]|\marg{delimiter}\marg{delimiter}
%
% is similar to type |s|, but comments can be nested. Identical arguments
% are not allowed---think a while about it!
% Modula-2 and Oberon-2 use |morecomment=[n]{(*}{*)}|.
%
% \item[0.18] \keyname{morecomment}|=[f]|\meta{delimiter}
% \item[0.18] \keyname{morecomment}|=[f][commentstyle]|\oarg{n=preceding columns}\meta{delimiter}
%
% The delimiter starts a comment line if and only if it appears on a
% fixed column-number, namely if it is in column $n$ (zero based).
%
% \item[0.17,,optional] \rkeyname{keywordcomment}|=|\marg{keywords}
% \item[0.21,,optional] \rkeyname{morekeywordcomment}|=|\marg{keywords}
% \item[0.21,,optional] \rkeyname{deletekeywordcomment}|=|\marg{keywords}
%
% A keyword comment begins with a keyword and ends with the same keyword.
% Consider |keywordcomment={comment,co}|. Then
% `\textbf{comment}\allowbreak\ldots\textbf{comment}' and
% `\textbf{co}\ldots\textbf{co}' are comments.
%
% \item[0.17,,optional] \rkeyname{keywordcommentsemicolon}|=|\marg{keywords}\marg{keywords}\marg{keywords}
%
% The definition of a `keyword comment semicolon' requires three keyword
% lists, e.g.~|{end}{else,end}{comment}|. A semicolon always ends such a
% comment. Any keyword of the first argument begins a comment and any
% keyword of the second argument ends it (and a semicolon also);
% a comment starting with any keyword of the third argument is terminated
% with the next semicolon only. In the example all possible comments are
% `\textbf{end}\ldots\textbf{else}', `\textbf{end}\ldots\textbf{end}'
% (does not start a comment again) and `\textbf{comment}\ldots;' and
% `\textbf{end}\ldots;'.
% Maybe a curious definition, but Algol and Simula use such comments.
%
% Note: The keywords here need not to be a subset of the defined
% keywords. They won't appear in keyword style if they aren't.
%
% \item[0.17,,optional] \rkeyname{podcomment}|=|\meta{\alternative{true,false}}
%
% activates or deactivates PODs---Perl specific.
% \end{syntax}
%
%
% \subsection{Installation}\label{rInstallation}
%
% \paragraph{Software installation}
% \begin{enumerate}
% \item Following the \TeX\ directory structure (TDS), you should put the files
% of the \packagename{listings} package into directories as follows:
% \begin{center}
% \begin{tabular}{lcl}
% \texttt{listings.pdf}&$\to$&\texttt{texmf/doc/latex/listings}\\
% \texttt{listings.dtx}, \texttt{listings.ins},\\
% \texttt{listings.ind}, \texttt{lstpatch.sty},\\
% \texttt{lstdrvrs.dtx}&$\to$&\texttt{texmf/source/latex/listings}
% \end{tabular}
% \end{center}
% Note that you may not have a patch file \texttt{lstpatch.sty}.
% If you don't use the TDS, simply adjust the directories below.
% \item Create the directory \texttt{texmf/tex/latex/listings} or, if it exists
% already, remove all
% files except \texttt{lst}\meta{whatever}\texttt{0.sty} and
% \texttt{lstlocal.cfg} from it.
% \item Change the working directory to \texttt{texmf/source/latex/listings}
% and run \texttt{listings.ins} through \TeX.
% \item Move the generated files to \texttt{texmf/tex/latex/listings} if this
% is not already done.
% \begin{center}
% \begin{tabular}{lcl}
% \texttt{listings.sty}, \texttt{lstmisc.sty},
% &&\qquad(kernel and add-ons)\\
% \texttt{listings.cfg},
% &&\qquad(configuration file)\\
% \texttt{lstlang}\meta{number}\texttt{.sty},
% &&\qquad(language drivers)\\
% \texttt{lstpatch.sty}&$\to$&\texttt{texmf/tex/latex/listings}
% \end{tabular}
% \end{center}
% \item If your \TeX\ implementation uses a file name database, update it.
% \item If you receive a patch file later on, put it where
% \texttt{listings.sty} is (and update the file name database).
% \end{enumerate}
% Note that \packagename{listings} requires at least version 1.10 of the
% \packagename{keyval} package included in the \packagename{graphics} bundle by
% David Carlisle.
%
%
% \paragraph{Software configuration}
% Read this only if you encounter problems with the standard configuration or
% if you want the package to suit foreign languages, for example.
%
% Never modify a file from the \packagename{listings} package, in particular
% not the configuration file. Each new installation or new version overwrites
% it. The software license allows modification, but I can't recommend it.
% It's better to create one or more of the files
% \begin{center}
% \begin{tabular}{lcl}
% \texttt{lstmisc0.sty} & for & local add-ons
% (see the developer's guide),\\
% \texttt{lstlang0.sty} & for & local language definitions
% (see \ref{rLanguageDefinitions}), and\\
% \texttt{lstlocal.cfg} & as & local configuration file
% \end{tabular}
% \end{center}
% and put them in the same directory as the other \packagename{listings} files.
% These three files are not touched by a new installation unless you remove them.
% If \texttt{lstlocal.cfg} exists, it is loaded after \texttt{listings.cfg}.
% You might want to change one of the following parameters.
% \begin{syntax}
% \item[,,data] \rcmdname\lstaspectfiles\quad contains~\rlap{\texttt{\lstaspectfiles}}
% \item[,,data] \rcmdname\lstlanguagefiles\quad contains~\rlap{\texttt{\lstlanguagefiles}}
%
% The package uses the specified files to find add-ons and language
% definitions.
% \end{syntax}
% Moreover, you might want to adjust
% \icmdname\lstlistlistingname,
% \icmdname\lstlistingname,
% \ikeyname{defaultdialect},
% \icmdname\lstalias, or
% \icmdname\lstalias
% \ as described in earlier sections.
%
%
% \section{Experimental features}\label{rExperimentalFeatures}
%
% This section describes the more or less unestablished parts of this package.
% It's unlikely that they will all be removed (unless stated explicitly), but
% they are liable to (heavy) changes and improvements. Such features have been
% \dag-marked in the last sections. So, if you find anything \dag-marked here,
% you should be very, very careful.
%
%
% \subsection{Listings inside arguments}\label{rListingsInsideArguments}
%
% There are some things to consider if you want to use |\lstinline| or the
% listing environment inside arguments. Since \TeX\ reads the argument before
% the `\lst-macro' is executed, this package can't do anything to preserve the
% input: spaces shrink to one space, the tabulator and the end of line are
% converted to spaces, \TeX's comment character is not printable, and so on.
% Hence, \emph{you} must work a bit more. You have to put a backslash in front
% of each of the following four characters: |\{}%|. Moreover you must protect
% spaces in the same manner if: (i) there are two or more spaces following each
% other or (ii) the space is the first character in the line.
% That's not enough: Each line must be terminated with a `line feed' |^^J|.
% And you can't escape to \LaTeX\ inside such listings!
%
% The easiest examples are with |\lstinline| since we need no line feed.
% \begin{verbatim}
%\footnote{\lstinline{var i:integer;} and
% \lstinline!protected\ \ spaces! and
% \fbox{\lstinline!\\\{\}\%!}}\end{verbatim}
% yields\lstset{language=Pascal}\footnote{\lstinline{var i:integer;} and
% \lstinline!protected\ \ spaces! and
% \fbox{\lstinline!\\\{\}\%!}}
% if the current language is Pascal. Note that this example shows another
% experimental feature: use of argument braces as delimiters. This is
% described in section \ref{rTypesettingListings}.
%
% And now an environment example:
% \begin{lstsample}{\lstset{language={}}}{}
% \fbox{%
% \begin{lstlisting}^^J
% \ !"#$\%&'()*+,-./^^J
% 0123456789:;<=>?^^J
% @ABCDEFGHIJKLMNO^^J
% PQRSTUVWXYZ[\\]^_^^J
% `abcdefghijklmno^^J
% pqrstuvwxyz\{|\}~^^J
% \end{lstlisting}}
% \end{lstsample}
% \begin{advise}
% \item You might wonder that this feature is still experimental. The reason:
% You shouldn't use listings inside arguments; it's not always safe.
% \end{advise}
%
%
% \subsection{\dag\ Export of identifiers}\label{rExportOfIdentifiers}
%
% It would be nice to export function or procedure names. In general that's a
% dream so far. The problem is that programming languages use various syntaxes
% for function and procedure declaration or definition. A general interface is
% completely out of the scope of this package---that's the work of a compiler
% and not of a pretty-printing tool. However, it is possible for particular
% languages: in Pascal, for instance, each function or procedure definition and
% variable declaration is preceded by a particular keyword.
% Note that you must request the following keys with the \texttt{procnames} option:
% |\usepackage[procnames]{listings}|.
% \begin{syntax}
% \item[0.19,{{}},{\dag optional}] \rkeyname{procnamekeys}|=|\marg{keywords}
% \item[0.21,,\dag optional] \rkeyname{moreprocnamekeys}|=|\marg{keywords}
% \item[0.21,,\dag optional] \rkeyname{deleteprocnamekeys}|=|\marg{keywords}
%
% each specified keyword indicates a function or procedure definition.
% Any identifier following such a keyword appears in `procname' style.
% For Pascal you might use\vspace{-.5\baselineskip}
% \begin{verbatim}
% procnamekeys={program,procedure,function}\end{verbatim}
%
% \item[0.19,keywordstyle,\dag optional] \rkeyname{procnamestyle}|=|\meta{style}
%
% defines the style in which procedure and function names appear.
%
% \item[0.19,false,\dag optional] \rkeyname{indexprocnames}|=|\meta{\alternative{true,false}}
%
% If activated, procedure and function names are also indexed.
% \end{syntax}
% \begin{TODO}
% The \aspectname{procnames} aspect is unsatisfactory (and has been unchanged
% at least since 2000). It marks and indexes the function definitions so far, but
% it would be possible to mark also the following function calls, for example.
% A key could control whether function names are added to a special keyword
% class, which then appears in `procname' style. But should these names be
% added globally? There are good reasons for both. Of course, we would also
% need a key to reset the name list.
% \end{TODO}
%
%
% \subsection{\dag\ Hyperlink references}\label{rHyperReferences}
%
% This very small aspect must be requested via the \texttt{hyper} option since it
% is experimental. One possibility for the future is to combine this aspect
% with \aspectname{procnames}. Then it should be possible to click on a
% function name and jump to its definition, for example.
% \begin{syntax}
% \item[0.21,,{\dag optional}] \rkeyname{hyperref}|=|\marg{identifiers}
% \item[0.21,,{\dag optional}] \rkeyname{morehyperref}|=|\marg{identifiers}
% \item[0.21,,{\dag optional}] \rkeyname{deletehyperref}|=|\marg{identifiers}
%
% hyperlink the specified identifiers (via \packagename{hyperref}
% package). A `click' on such an identifier jumps to the previous
% occurrence.
%
% \item[0.21,\hyper@@anchor,{\dag optional}] \rkeyname{hyperanchor}|=|\meta{two-parameter macro}
% \item[0.21,\hyperlink,{\dag optional}] \rkeyname{hyperlink}|=|\meta{two-parameter macro}
%
% set a hyperlink anchor and link, respectively.
% The defaults are suited for the \packagename{hyperref} package.
% \end{syntax}
%
%
% \subsection{Literate programming}
%
% We begin with an example and hide the crucial key=value list.
% \begin{lstsample}{\lstset{literate={:=}{{$\gets$}}1 {<=}{{$\leq$}}1 {>=}{{$\geq$}}1 {<>}{{$\neq$}}1}}{}
% \begin{lstlisting}
% var i:integer;
%
% if (i<=0) i := 1;
% if (i>=0) i := 0;
% if (i<>0) i := 0;
% \end{lstlisting}
% \end{lstsample}
% Funny, isn't it? We could leave |i := 0| in our listings instead of
% i| |$\gets$| |0, but that's not literate! ^^A :-)
% Now you might want to know how this has been done. Have a \emph{close}
% look at the following key.
% \begin{syntax}
% \item[0.20,,\dag] \rkeyname{literate}|=|[|*|]\meta{replacement item}\ldots\meta{replacement item}
%
% First note that there are no commas between the items. Each item
% consists of three arguments:
% \marg{replace}\marg{replacement text}\marg{length}.
% \meta{replace} is the original character sequence.
% Instead of printing these characters, we use \meta{replacement text},
% which takes the width of \meta{length} characters in the output.
%
% Each `printing unit' in \meta{replacement text} \emph{must} be in braces
% unless it's a single character. For example, you must put braces
% around |$\leq$|.
% If you want to replace |<-1->| by |$\leftarrow1\rightarrow$|, the
% replacement item would be |{<-1->}{{$\leftarrow$}1{$\rightarrow$}}3|.
% Note the braces around the arrows.
%
% If one \meta{replace} is a subsequence of another \meta{replace}, you
% must define the shorter sequence first. For example, |{-}| must be defined
% before |{--}| and this before |{-->}|.
%
% The optional star indicates that literate replacements should not be
% made in strings, comments, and other delimited text.
% \end{syntax}
% In the example above, I've used
% \begin{verbatim}
% literate={:=}{{$\gets$}}1 {<=}{{$\leq$}}1 {>=}{{$\geq$}}1 {<>}{{$\neq$}}1\end{verbatim}
% \begin{TODO}
% Of course, it's good to have keys for adding and removing single
% \meta{replacement item}s. Maybe the key(s) should work in the same fashion
% as the string and comment definitions, i.e.~one item per key=value.
% This way it would be easier to provide better auto-detection in case of a
% subsequence.
% \end{TODO}
%
%
% \subsection{\textsf{LGrind} definitions}\label{rLGrindDefinitions}
%
% Yes, it's a nasty idea to steal language definitions from other programs.
% Nevertheless, it's possible for the \packagename{LGrind} definition
% file---at least partially. Please note that this file must be found by
% \TeX.
% \begin{syntax}
% \item[0.21,,{optional}] \rkeyname{lgrindef}|=|\meta{language}
%
% scans the \texttt{lgrindef} language definition file for
% \meta{language} and activates it if present. Note that not all