-% Listings.dtx is a source code printer for \LaTeX\ --- which always means \LaTeXe\ in this documentation.
-% You can typeset stand alone files as well as enter listings using an environment similar to \texttt{verbatim} as well as you can print fragments using a command similar to |\verb|.
-%^^A Since listings.dtx is a package and not a cross compiler, all listings are up to date without maintaining differences between (changed) source files and cross compiled files.
-% The package supports a wide spectrum of programming languages --- some come already with \texttt{lstdrvrs.dtx}.
-% Finally: Many parameters control the output.
-% \end{abstract}}
-%
-% \title{{Listings.dtx} Version {0.19}}
-% \author{Copyright 1996--1998 Carsten Heinz}
-% \date{\box\abstractbox}
-%
-% \makeatletter\@twocolumntrue\makeatother
-% \maketitle
-% {\makeatletter\@starttoc{toc}}
-%\iftrue
-% \vfill
-% \noindent \textbf{Again incompatibilities!}
-% And there are certainly teething troubles since the complete kernel has been rewritten.
-% So read this manual with care.
-%\fi
-% \onecolumn
-%
-%
-% \part{User's guide}
-%
-%
-% \section{Preface}
-%
-% The files \texttt{listings.dtx} and \texttt{listings.ins} and all files generated from only these two files are referred as 'the \textsf{listings} package' or simply 'the package'.
-% A driver file is any file generated mainly from \texttt{lstdrvrs.dtx}.
-%
-% \paragraph{Alternatives.}
-% The \textsf{listings} package is certainly not the final utility for typesetting source code listings.
-% Other programs do their jobs very well if you are not satiesfied with \textsf{listings}.
-% I should mention \textsf{a2ps} and the \textsf{LGrind} package.
-% Let me know if you're using none of these solutions; I'd like to extend my suggestions.
-%
-% \paragraph{Reading this manual.}
-% In any case you should read section ''\emph{\ref{uGettingStarted}. Getting started}'' step by step.
-% You either start from the scratch there or you get in touch with the new user interface and other changes.
-% That section is an introduction and doesn't cover all of the \textsf{listings} package, but the most common.
-% After reading it you are prepared for the main reference if you need more details, more control or more features.
-%
-% \paragraph{Sorry!}
-% On 1998/11/02 I decided to make major changes to the user interface, which were planned for version 0.2.
-% But it's better to get the interface stable as soon as possible.
-% In particular I must say sorry to all people I posted a pre-version of \textsf{listings} 0.19.
-%
-% \paragraph{Thanks.}
-% There are many people I have to thank for fruitful communication, posting their ideas, giving error reports (first bug finder is listed), adding programming languages to \texttt{lstdrvrs.dtx}, etc..
-% If you want to know that in detail, search for the names in the implementation part.
-%^^A
-%^^A Thanks for error reports (first bug finder only), new programming languages, etc.
-%^^A Special thanks for communication which lead to kernel extensions.
-%^^A
-% Special thanks go to (alphabetical order)
-% \begin{quote}
-% \hyphenpenalty=10000\relax \rightskip=0pt plus \linewidth\relax
-%^^A \lsthelper{Andreas Bartelt}{[email protected]}{1997/09/11}{single line comes out using \inputlisting inside \fbox}
-%^^A \lsthelper{Michael Piotrowski}{[email protected]}{1997/11/04}{! Use of \lstdrv@perl@TestCommentCut doesn't match its definition^^J\lst@line ->I^^JRF::LangID -- Statistical identification of language for IRF/1^^J^^J(POD ist Zeile '=irgendwas' bis Zeile '=cut')}
-%^^A \lsthelper{Bj{\o}rn {\AA}dlandsvik}{[email protected]}{1997/10/27}{listings.sty is incompatible to inputenc.sty}
-%
-%
-% \section{Software license}
-%
-% \paragraph{Copyright.}
-% The \textsf{listings} package is copyright 1996--1998 Carsten Heinz.
-% The driver files are copyright 1997, 1998 or 1997--1998 any individual author listed in these files.
-%
-% \paragraph{Distribution.}
-% The \textsf{listings} package as well as \texttt{lstdrvrs.dtx} and all driver files are distributed freely.
-% You are not allowed to take money for the distribution, except for a nominal charge for copying etc..
-%
-% \paragraph{Use of the package.}
-% The \textsf{listings} package is free for any non-commercial use.
-% Commercial use needs (i) explicit permission of the author of this package and (ii) the payment of a license fee.
-% This fee is to be determined in each instance by the commercial user and the package author and is to be payed as donation to the \LaTeX3 project.
-%
-% \paragraph{No warranty.}
-% The \textsf{listings} package as well as \texttt{lstdrvrs.dtx} and all driver files are distributed without any warranty, express or implied, as to merchantability or fitness for any particular purpose.
-%
-% \paragraph{Modification advice.}
-% Permission is granted to change the \textsf{listings} package as well as \texttt{lstdrvrs.dtx}.
-% You are not allowed to distribute any changed version of the package or any changed version of \texttt{lstdrvrs.dtx}, neither under the same name nor under a different one.
-% Tell the author of the package about your local changes: other users will welcome removed bugs, new features and additional programming languages.
-%
-% \paragraph{Contacts.}
-% Send comments and ideas on the package, error reports and additional programming languages to \emph{Carsten Heinz, Tellweg 6, 42275 Wuppertal, Germany} or preferably to \texttt{[email protected]}.
-%
-% \paragraph{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.
-% \item You need \texttt{listings.dtx} and \texttt{listings.ins} to install the \textsf{listings} package.
-% \texttt{lstdrvrs.dtx} contains some language drivers.
-% Move \texttt{.dtx} and \texttt{.ins} files into a separate folder if you want to.
-% \item Remove all \texttt{lst???.sty} files if you update from an earlier version.
-% \item Run \texttt{listings.ins} through \TeX.
-% This creates the kernel \texttt{listings.sty} and two interface files \texttt{lst017.sty} and \texttt{lstfvrb.sty}.
-% If you have \texttt{lstdrvrs.dtx}, a configuration file \texttt{listings.cfg} and a couple of driver files are also generated.
-% \item Copy all created \texttt{.sty} and \texttt{.cfg} files to a directory searched by \TeX.
-% \end{enumerate}
-% \fi
-%
-%
-% \subsection{Package loading}
-%
-% As usual in \LaTeX\ the package is loaded by |\usepackage[|\meta{options}|]{listings}|, where |[|\meta{options}|]| is optional.
-% Note that \textsf{listings} 0.19 needs more save stack size than any previous version.
-% The following options are available:
-% \begin{description}
-% \item[\texttt{0.17}]
-% Use this option to compile documents created with version 0.17 of the \textsf{listings} package.
-% Note that you can't use old driver files and that the option does not guarantee full compatibility.
-% If you want to polish up an old document, use this option together with new commands and keys.
-% There shouldn't be many problems, but I haven't made deep tests.
-% \item[\normalfont\texttt{index} and \texttt{procnames}] define the 'index' respectively 'procnames' aspect, whatever that means.
-% \item[\normalfont\texttt{ndkeywords} and \texttt{rdkeywords}] define second respectively third order keywords.
-% \end{description}
-% Note: Each option slows down the package, so it becomes quite slow if you use all options, for example.
-% Note also that you can't activate any optional feature after package loading --- except you're a hacker and read the implementation part.
-%
-% Here is some kind of minimal file.
-% \begin{verbatim}
-% \documentclass{article}
-%
-% \usepackage{listings}
-% %\usepackage[ndkeywords,index]{listings}% with some options
-%
-% \begin{document}
-%
-% \lstset{language=Pascal}
-% % Any example may be inserted here.
-%
-% \end{document}\end{verbatim}
-% \label{uMinimalFile}It loads the \textsf{listings} package without any option, but shows how the package is loaded with index option and second order keywords.
-% Moreover we select Pascal as programming language.
-%
-% If you need more than one programming language in your document, I recommend the preamble command |\lstloadlanguages|, which loads the given programming languages only, e.g.\ |\lstloadlanguages{Pascal,Fortran,C++}|.
-% You find more details in section \ref{uLanguagesAndStyles}.
-%
-%
-% \subsection{Typesetting listings}
-%
-% You can print (a) stand alone files, (b) source code from \texttt{.tex} files or (c) code fragments within a paragraph.
-% The difference between (b) and (c) is something like between display and text formulas (|$$| and |$|).
-%
-% We begin with code fragments.
-% If you want '\lstinline!var i:integer;!', you can simply write '|\lstinline!var i:integer;!|'.
-% The exclamation marks delimit the code fragment.
-% They could be replaced by any character not in the code fragment, i.e.\ '|\lstinline$var i:integer;$|' would produce the same output.
-%
-% The \texttt{lstlisting} environment typesets the source code in between.
-% It has one parameter, which we leave empty for the moment.
-% \begin{lstsample}{}
-%\begin{lstlisting}{}
-%for i:=maxint to 0 do
-%begin
-% { do nothing }
-%end;
-%
-%Write('Keywords are case ');
-%WritE('insensitive here.');
-%\end{lstlisting}
-% \end{lstsample}
-% \noindent
-% Like most examples this shows the \LaTeX\ source code on the right and the result on the left.
-% If you insert the \LaTeX\ code in the minimal file and run it through \TeX, the listing uses the whole text width.
-%
-% Finally examples for stand alone files:
-% \begin{lstsample}{\lstset{baseem=0.5}}
-%\lstinputlisting{listings.tmp}
-% \end{lstsample}
-% \noindent
-% Do you wonder about the left hand side?
-% Well, the file \texttt{listings.tmp} contains the current example.
-% This is exactly the line you see on the right.
-% If you want this line to be typeset in Pascal mode, you get what you've got.
-% If you want the lines $3,4,\ldots,10$ of \texttt{testfile.pas}, write
-% |\lstset{keywords=one,two,three}| would set the one and only keyword |one| and gives an error message since the parameters |two| and |three| do not exist.
-%
-% Two final notes:
-% (1) Some keys has default values, e.g.\ |flexiblecolumns=true| turns flexible columns on, but |flexiblecolumns| without any |=true| would do the same since the value true is default for that key.
-% But you must use the value |false| if you want to turn them off.
-% (2) |\lstset| sets the values local to the current group.
-% Just forget it if you don't know what that means.
-% The command |\lstinputlisting| (as seen above) and the environment (as you see below) both have optional arguments.
-% If you use a key=value list as optional argument, these selections are valid for the particular listing only and the previous values are restored afterwards.
-% For example, if the current language is Pascal, but you want \texttt{testfile.f95} from line 3 on, write
-% The style definitions above use two kind of commands; on the one hand |\ttfamily| or |\bfseries| taking no arguments and on the other |\underline|, which gets exactly one argument.
-% The \emph{very last} token of |keywordstyle|, |nonkeywordstyle| and |labelstyle| (see below) \emph{may} be a macro getting exactly one argument, namely the (non)keyword or label.
-% All other tokens \emph{must not} take any arguments --- or you will get deep in trouble.
-% \lstset{style={},blankstring=false}
-%
-% \textbf{Warning:}
-% You shouldn't use striking styles too often, but 'too often' depends on how many keywords the source code contains, for example.
-% Your eyes would concentrate on the framed, bold red printed keywords only, and your brain must compensate this.
-% Reading such source code could be very exhausting.
-% If it were longer, the last example would be quite good in this sense.
-% Believe me.
-%
-%
-% \subsection{Line numbers}
-%
-% You want tiny line numbers each second line?
-% Here you are:
-% \begin{lstsample}{}
-%\lstset{labelstyle=\tiny,% <===
-% labelstep=2}% <===
-%\begin{lstlisting}{}
-%for i:=maxint to 0 do
-%begin
-% { do nothing }
-%end;
-%
-%Write('Keywords are case ');
-%WritE('insensitive here.');
-%\end{lstlisting}
-% \end{lstsample}
-% \noindent
-% |labelstep=0| turns line numbering off.
-% In the sequel we use |labelstyle=\tiny| and |labelstep=2|, even if it doesn't appear in the verbatim part.
-% And now we try to interrupt (continue) a listing.
-% For this purpose we use |{ }| as argument to the environment.
-% But if the boxes are not wide enough, we get '\makeboxes if\ x=y\ then\relax\ldots', and choosing the width so that the widest character fits in leads to
-% Since we put wide and thin characters in the same box, the width of a single character box need not to be the width of the widest character.
-% The empirical value {\makeatletter\lst@baseemfixed}em (which is called 'base em' later) is a compromise between overlapping characters and the number of boxes not exceeding the text width, i.e.\ how many characters fit a line without getting an overfull |\hbox|.
-%
-% \begingroup
-% But overlapping characters are a problem if you use many upper case letters, e.g.\ \docharbox{3}{W\hss O\hss M\hss E\hss N} --- blame me and not the women, in fact \docharbox{1.8}{M\hss E\hss N} doesn't look better.
-% To go around this problem the \textsf{listings} package supports more 'flexible columns' in contrast to the fixed columns above.
-% Arne John Glenstrup (whose idea the format is) pointed out that he had good experience with flexible columns and assembler listings.
-% The differences can be summed up as follows: The fixed column format ruins the nice spacing intended by the font designer, and the flexible format ruins the column alignment (possibly) intended by the programmer.
-% Objective-C becomes default dialect for C, but the language is \emph{not} selected with that command.
-%
-% \medskip
-% Remark: The driver files define the languages with |\lstdefinelanguage|.
-% The languages have all 'bugs' coming from the language commands, e.g.\ in Ada and Matlab it is still possible that the package assumes a string where none exists.
-% See \texttt{lstdrvrs.dtx} for more remarks on special programming languages.
-%
-%
-% \section{Main reference}
-%
-% \newcommand\UTODO[1]{}
-% \newenvironment{TODO}{\begin{quote}\footnotesize To do:}{\end{quote}}
-% typesets the source code file using the active language and style (locally modified by the key=value list).
-% Empty lines at the end of listing are dropped.
-%
-% The keys |first| and |last| determines the printed line range.
-% Default is \emph{always} 1--9999999, where 'always' means that you can't set |first| and |last| globally.
-% If you don't want a whole file, you must specify the line range.
-% The example |\lstinputlisting[first=3,last=10]{testfile.pas}| would print lines 3,4,\ldots,10 of \texttt{testfile.pas} if file and lines are present.
-%
-% The boolean key |print| controls whether or not |\lstinputlisting| typesets a listing:
-% |print=false| speed up things for draft versions of your document and |print=true| typesets the stand alone files.
-%
-% Note: The keys |first|, |last| and |print| only apply to |\lstinputlisting|.
-% typesets source code between |\begin{lstlisting}{|\meta{name}|}| (+ line break) and |\end{lstlisting}|, but empty lines at the end of listing are dropped.
-% Characters on the same line as the end of environment are \emph{not} dropped, i.e.\ source code right before and \LaTeX\ code after the end of environment is typeset respectively executed.
-% If \meta{name} is not empty and the listing is not continued, the name appears in the list of listings.\\
-% Same named listings have common line counter, i.e.\ the second (same named) listing continues the first, the third continues the second, and so on.
-% There are two exceptions: An empty named listing always starts with line number 1 and is continued with listings named |{ }| (single blank space).
-%
-% The key |resetlineno| (given without any value) sets the line number of the first line to 1.
-% You can also specify a number, e.g.\ |resetlineno=10|.
-% |advancelineno=|\meta{number} advances the number of the first line by \meta{number}.
-% These two keys take also effect on |{}| and |{ }| named listings.
-%
-% Note: The keys |resetlineno| and |advancelineno| only apply to the environment and must be used in the optional key=value list.
-%
-% \item[0.18,new] |\lstinline|
-%
-% works like |\verb|, but uses the active language and style, of course.
-% You can write '|\lstinline!var i:integer;!|' and get '\lstinline!var i:integer;!'.
-% Note that these listings always use flexible columns and that |\lstinline| has no optional key=value list.
-% defines \emph{additional} line width for listings, which may avoid overfull |\hbox|es if a listing has long lines.
-% The inner and outer spread is given explicitly or is equally shared.
-% It is initialized via |spread=0pt|.
-% For one sided documents 'inner' and 'outer' have the effect of 'left' and 'right'.
-% Note that |\lstbox| doesn't use this spread but |indent| (which is always 'left').
-%
-% Bug (two sided documents):
-% At top of page it's possible that the package uses inner instead of outer spread or vice versa.
-% This happens when \TeX\ finally moves one or two source code lines to the next page, but hasn't decided it when the \textsf{listings} package processes them.
-% Work-around: interrupt the listing and/or use an explicit |\newpage|.
-%
-% \item[0.17] |lineskip=|\meta{additional space between lines}
-%
-% specifies the additional space between lines in listings.
-% You may write |lineskip=-1pt plus 1pt minus 0.5pt| for example, but 0pt is the default.
-% \item[0.12,addon] |pre=[|\meta{continue}|]{|\meta{commands to execute}|}|
-% \item[0.12,addon] |post=[|\meta{continue}|]{|\meta{commands to execute}|}|
-%
-% The given control sequences are executed before and after typesetting resp.\ when continuing a listing, but in all cases inside a group.
-% The commands are not executed if you use |\lstbox| or |\lstinline| (since the user given pre and post commands are assumed to be unsave inside |\hbox|).
-% By default \meta{continue} is empty.
-% The other arguments are pre-set empty.
-% \end{macrosyntax}
-%
-% \begin{lstsample}{}
-%\lstset{flexiblecolumns}
-%\lstset{pre=[%
-% We continue the listing.
-% ]A simple prelisting example.}
-%\begin{lstlisting}{}
-%{ Get listings.dtx. Now! }
-%\end{lstlisting}
-%
-%\begin{lstlisting}{ }
-%{ You have it already? Good. }
-%\end{lstlisting}
-%
-%\begin{lstlisting}{ }
-%{ Tell your friends about it. }
-%\end{lstlisting}
-% \end{lstsample}
-%\lstset{style={}}
-%
-%
-% \subsection{Languages and styles}\label{uLanguagesAndStyles}
-% defines a default dialect for a language, that means a dialect which is selected whenever you leave out the optional dialect.
-% 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|.
-%
-% Note that a configuration file possibly defines some default dialects.
-% stores \meta{keywords} in \meta{macro} for use with keyword keys.
-% This command can't be used in a language definition since it is a command and not a key.
-% \end{macrosyntax}
-%
-% Now come all the language keys, which might be used in the key=value list of |\lstdefinelanguage|.
-% Note: {\itshape If you want to enter {\upshape|\|, |{|, |}|, |%|, |#|} or {\upshape|&|} inside or as an argument here, you must do it with a preceding backslash!}
-% These keys support the 'special character' auto-detection of the keyword commands.
-% For our purpose here, identifiers are out of letters (|A|--|Z|,|a|--|z|,|_|,|@|,|$|) and digits (|0|--|9|), but an identifier must begin with a letter.
-% If you write |keywords={one-two,\#include}|, the minus becomes necessarily a digit and the sharp a letter since the keywords can't be detected otherwise.
-% The three keys overwrite such default behaviour.
-% Each character of the sequence becomes a letter, digit and other, respectively.
-% Note that the auto-detection might fail if you remove keywords and always fails if you use special characters not listed above.
-%^^A
-%^^A TODO: This is mainly due to improper \lst@ReplaceIn inside ..MakeKeywordArg..
-% The first starts and the second ends a comment, and similarly the third and fourth separator for double comments.
-% If you need three such comments use |singlecomment| and |doublecomment| at the same time.
-% C, Java, PL/I, Prolog and SQL all define single comments via |singlecomment={/*}{*/}|, and Algol does it with |singlecomment={\#}{\#}|, which means that the sharp delimits both beginning and end of a single comment.
-% A (paired) 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.\\
-%^^A
-% Defining a double keyword comment (semicolon) needs 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.\\
-%^^A
-% 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.
-% \end{macrosyntax}
-%
-%
-% \section{Experimental features}
-%
-% This section describes the more or less unestablished parts of the \textsf{listings} package.
-% It's unlikely that they are removed, but they are liable to (heavy) changes and maybe improvements.
-%
-%
-% \subsection{Interface to \textsf{fancyvrb}}
-%
-% The \textsf{fancyvrb} package --- fancy verbatims --- from Timothy van Zandt provides macros for reading, writing and typesetting verbatim code.
-% It has some remarkable features the \textsf{listings} package doesn't have --- some are also possible with \textsf{listings}, but you must find somebody who implements them ; -- ).
-% The \textsf{fancyvrb} package is available from \texttt{CTAN: macros/latex/contrib/supported/fancyvrb}.
-% This defines an appropiate version of |\FancyVerbFormatLine| to make the two packages work together.
-% If active, the verbatim code read by the \textsf{fancyvrb} package is typeset by the \textsf{listings} package, i.e.\ with emphasized keywords, strings, comments, and so on.
-% --- You should know that |\FancyVerbFormatLine| is responsible for the typesetting a single code line.
-%
-% If \textsf{fancyvrb} and \textsf{listings} provide similar functionality, use \textsf{fancyvrb}'s.
-%
-% Note that this is the first interface.
-% It works only with |Verbatim|, neither with |BVerbatim| nor |LVerbatim|.
-% And you shouldn't use \textsf{defineactive}. (As I can see it doesn't matter since it does nothing at all.)
-% I hope to remove some restrictions in future.
-% \end{macrosyntax}
-%
-% \iffancyvrb
-% \begin{lstsample}{}
-%\lstset{commentline=\ }% :-)
-%
-%\begin{Verbatim}[commandchars=\\\{\}]
-%First verbatim line.
-%\fbox{Second} verbatim line.
-%\end{Verbatim}
-%
-%\lstset{fancyvrb}
-%\begin{Verbatim}[commandchars=\\\{\}]
-%First verbatim line.
-%\fbox{Second} verbatim line.
-%\end{Verbatim}
-%\lstset{fancyvrb=false}
-% \end{lstsample}
-% \noindent
-% The last two lines are wider than the first two since |baseem| equals not the width of a single typewriter character.
-% \else
-% \begin{center}
-% \textsf{fancyvrb} seems to be unavailable on your platform, thus the example couldn't be printed here.
-% 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, the comment character is not printable, and so on.
-% Hence, you must work a little 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|.
-% Finally 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.
-% The environment possibly needs a preceding |\lstbox|, as the following examples show.
-%
-%{\let\smallbreak\relax\lstset{language={}}
-% \begin{lstsample}{}
-%\fbox{\lstbox
-%\begin{lstlisting}{}^^J
-%\ !"#$\%&'()*+,-./^^J
-%0123456789:;<=>?^^J
-%@ABCDEFGHIJKLMNO^^J
-%PQRSTUVWXYZ[\\]^_^^J
-%`abcdefghijklmno^^J
-%pqrstuvwxyz\{|\}~^^J
-%\end{lstlisting}}
-% \end{lstsample}
-%
-% \lstset{language={}}
-% \begin{lstsample}{}
-%\fbox{\lstbox
-%\begin{lstlisting}{}^^J
-%We need no protection here,^^J
-%\ but\ \ in\ \ this\ \ line.^^J
-%\end{lstlisting}}
-% \end{lstsample}
-%}
-%
-%
-% \subsection{Frames}
-%
-% \begin{macrosyntax}
-% \item [0.19,new] |frame=|\meta{any subset of \textup{\texttt{tlrbTLRB}}}
-%
-% The characters |tlrbTLRB| are attached to lines at the |t|op of a listing, on the |l|eft, |r|ight and at the |b|ottom.
-% There are two lines if you use upper case letters.
-% If you want a single frame around a listing, write |frame=tlrb| or |frame=bltr| for example (but as optional argument or argument to |\lstset|, of course).
-% If you want double lines at the top and on the left and no other lines, write |frame=TL|.
-% Note that frames reside outside the listing's space.
-% Use |spread| if you want to shrink frames (to |\linewidth| for example) and use |indent| if you want to move line number inside frames.
-% controls the space between frame and listing, but currently only between the listing and vertical frame lines.
-% The predefined value is {\makeatletter\lst@frametextsep}.
-%\fi
-% \end{macrosyntax}
-% |frame| does not work with |\lstbox| or |fancyvrb=true|!
-% And there are certainly more problems with other commands.
-% Take the time to report in.
-%
-% \begin{lstsample}{}
-%\begin{lstlisting}[frame=tLBr]{}
-%for i:=maxint to 0 do
-%begin
-% { do nothing }
-%end;
-%\end{lstlisting}
-% \end{lstsample}
-%
-%
-% \subsection{Export of identifiers}
-%
-%^^A \lsthelper{Aslak Raanes}{[email protected]}{1997/11/24}{export function names}
-% It would be nice to export function or procedure names, for example to index them automatically or to use them in |\listoflistings| instead of a listing name.
-% 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 each function or procedure definition and variable declaration is preceded by a particular keyword.
-% If activated, procedure and function names are also indexed (if used with |index| option).
-% \end{macrosyntax}
-%
-%
-% \section{Troubleshooting}
-%
-% The known bugs have already been described.
-% This section deals with problems concerning not only the \textsf{listings} package.
-%
-%
-% \subsection{Problems with \texttt{.fd} files}
-%
-% You probably get the following error message with a different font definition file:
-% \begin{verbatim}
-%! LaTeX Error: Command textparagraph unavailable in encoding T1.
-%
-%See the LaTeX manual or LaTeX Companion for explanation.
-%Type H <return> for immediate help.
-% ...
-%
-%l.68 \P
-% rovidesFile{omscmr.fd}
-%?\end{verbatim}
-% So, what happened?
-% (a) The \textsf{listings} package redefines the character table to print listings.
-% (b) \LaTeX\ loads the font definition files on demand.
-% (a) plus (b) gives the error: \LaTeX\ loads the \texttt{.fd} files with modified character table.
-% And that goes wrong.
-% The work-around is quite easy: Input the \texttt{.fd} file before typesetting the listing.
-%
-%
-% \subsection{Language definitions}
-%
-% Language definitions and also some style definitions tend to have long definition parts.
-% This is why we tend to forget commas between the key=value elements.
-% If you select a language and get a |Missing = inserted for \ifnum| error, this is surely due to a missing comma after |keywords=|value.
-% If you encounter unexspected characters after selecting a language (or style), you have either forgotten a comma or you have given to many arguments to a key, for example |commentline={--}{!}|.
-%
-%
-% \section{Forthcoming}
-%
-% \begin{itemize}
-% \item I'd like to support more languages, for example Maple, Mathematica, PostScript, Reduce and so on.
-% Fortunately my lifetime is limited, so other people may do that work.
-% Write a language definition and (e-)mail it to me (with a proposal in which file to place the definition).
-%
-% \item There will possibly a boolean |blanklisting=|\meta{true$\vert$false} or a $*$-version of the environment.
-%
-% \item 'procnames' is already interesting, but marks (and indexes) only the function definitions so far.
-% It would be quite easy to mark also the following function calls:
-% Write another 'keyword class' which is empty at the very beginning (and can be reset with a key); each function definition appends a 'keyword' which will appear in 'procnamestyle'.
-% But this would be another 'keyword test' within an inner loop.
-% \item I plan to put all language definitions in a single file.
-% where the first two are executed (if they exist) one time each listing (before selecting character table, but after executing the hook Before\-Select\-Char\-Table).
-% The other two macros are called possibly more than once, namely whenever the package selects the character table.
-% The specialized \meta{dialect} versions are called after the more general \meta{language} macros.
-% \item |lstk@| is reserved for keyword tests,
-%
-% \item |\lstlang@|\meta{language}|@|\meta{dialect} contains a language definition,
-% \item |\lstaa@|\meta{language} contains alias for all dialects of a language,
-% \item |\lstdd@|\meta{language} contains default dialect of a language (if present).
-% \end{itemize}
-% \item If a submacro does the main work, e.g.\ |\lstinputlisting@| does it for |\lstinputlisting|, we use the suffix |@|.
-% \item To distinguish procedure-like macros from macros holding data, the name of procedure macros use upper case letters with each beginning word, e.g.\ |\lst@AddTo|.
-% \end{itemize}
-%
-% The kernel starts with identification and option declaration and processing.
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{listings}[1998/11/09 v0.19 by Carsten Heinz]
-% \item |\lst@ReplaceIn|\meta{macro}|{|\meta{replacement list $c_1m_1$\ldots$c_nm_n$}|}|
-% \end{macrosyntax}
-% Each character $c_i$ inside the given macro is replaced by the macro $m_i$.
-% In fact, $c_i$ may be a character sequence (enclosed in braces and possibly containing macros), but $m_i$ must be a single macro which is not equivalent to |\empty| --- use |\relax| instead.
-% |\lst@ReplaceIn\lst@arg{_\textunderscore {--}\textendash}| is allowed but not |\lst@ReplaceIn\lst@arg{\textunderscore_\textendash{--}}|.
-% These restrictions can be dropped, see the TODO part below.
-%
-% We derive the main macro from \LaTeX's |\zap@space|:
-% \begin{verbatim}
-% \def\zap@space#1 #2{%
-% #1%
-% \ifx#2\@empty\else\expandafter\zap@space\fi
-% #2}\end{verbatim}
-% It is called like this:
-% \begin{verbatim}
-% \zap@space Some characters with(out) sense and \@empty
-% Note that |{}|\textvisiblespace\ produces a space holding up the syntax of |\zap@space|: it's defined with a space between the two parameters.
-% If we want to replace a space by a visible space, we could use
-% \begin{verbatim}
-% \def\lst@temp#1 #2{%
-% #1%
-% \ifx#2\@empty\else %
-% \noexpand\textvisiblespace %
-% \expandafter\lst@temp %
-% \fi #2}\end{verbatim}
-% The additional |\noexpand\textvisiblespace| inserts visible spaces where spaces have been.
-% We want to replace several characters and thus have to save our intermediate results.
-% So we will follow the third '|\edef|' example.
-% But there is some danger: After replacing the first character, the macro $m_1$ will expand inside the next |\edef|.
-% Knowing that letters don't expand, we simply say that $m_1$ is a letter.
-% Such changes must be local, so \ldots
-%
-% \begin{macro}{\lst@ReplaceIn}
-% we open a group, store the original macro contents in |\@gtempa| and start a loop.
-% Afterwards we close the group and assign the modified character string to our given macro.
-% \begin{macrocode}
-\def\lst@ReplaceIn#1#2{%
- \bgroup \global\let\@gtempa#1%
- \lst@ReplaceIn@#2\@empty\@empty %
- \egroup \let#1\@gtempa}
-% \end{macrocode}
-% If we haven't reached the end of the list (the two |\@empty|s), we let the macro $m_i$ be a letter and define an appropiate macro to replace the character (sequence) |#2| by the macro |#3|.
-% \begin{macrocode}
-\def\lst@ReplaceIn@#1#2{%
- \ifx\@empty#2\else %
- \let#2=a%
- \def\lst@temp##1#1##2{##1%
- \ifx\@empty##2\else %
- #2\expandafter\lst@temp %
- \fi ##2}%
-% \end{macrocode}
-% Now we call that macro using |\xdef| (since the changes in |\@gtempa| must exist after closing a group).
-% \subsection{Looking ahead for character sequences}
-%
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-% \end{macrocode}
-% \endgroup
-% \begin{macro}{\lst@IfNextChars}
-% The macro |\@ifnextchar|\meta{single character}|{|\meta{then part}|}{|\meta{else part}|}| from the \LaTeX{} kernel is well known:
-% Whether or not the character behind the three arguments --- usually a character from the 'user input stream' --- equals the given single character the 'then' or 'else' part is executed.
-% We define a macro which looks for an arbitrary character sequence stored in a macro:{}
-% \LaTeX's |\@ifnextchar| doesn't remove the character behind the arguments, but we remove the characters until it is possible to decide whether the 'then' or 'else' part must be executed.
-% However, we save these characters in a macro called |\lst@eaten|, so they can be inserted if necessary.
-%
-% We save the arguments and call the macro which does the comparisons.
-% If the characters are the same, we either execute |\@tempa| or continue the test.
-% \begin{macrocode}
- \ifx\lst@tofind\@empty %
- \let\lst@next\@tempa %
- \else %
- \let\lst@next\lst@IfNextChars@ %
- \fi %
- \expandafter\lst@next %
- \else %
-% \end{macrocode}
-% If the characters are different, we have to call |\@tempb|.
-% \begin{macrocode}
- \expandafter\@tempb %
- \fi}
-% \end{macrocode}
-% Finally comes the subsubmacro |\lst@IfNextChars@@| used above, which assigns the next character to |\lst@temp| and the rest upto |\relax| to |\lst@tofind|.
-% If the implementation is not clear, read the last sentence again.
-% stores the character sequence in |\lst@arg|, but all characters become active.
-% The string must \emph{not} contain a begin group, end group or escape character (|{}\|); it may contain a left brace, right brace or backslash with other meaning (=catcodes).
-% This command would be quite surplus if \meta{character sequence} is not already read by \TeX{} (since such catcodes can be changed easily).
-% It is explicitly allowed that the charcaters have been read, e.g.\ in |\def\test{\lst@MakeActive{ABC}}| |\test|!
-%
-% Note that |\lst@MakeActive| changes |\lccode|s 0--9 without restoring them.
-% executes 'then' part if next character behind the arguments is active, and the 'else' part otherwise.
-% \end{macrosyntax}
-% \TeX{} knows sixteen different catcodes, which say whether a character is a letter, a space, a math shift character, subscript character, and so on.
-% A character gets its catcode right after reading it and \TeX{} has no primitive command to change a catcode of characters already read.
-% Consider for example |\def\mathmode#1{$#1$}|.
-% After that definition there is no chance to say: ''\emph{Print} the two dollar signs and the argument between instead of entering math mode''.
-% And if we write |\mathmode{a_i}| and have just entered the macro |\mathmode|, the argument |a_i| is read and it's too late to change the meaning of the subscript character to a printable underbar, for example.
-% But that's not the whole truth: We can change character-catcodes of an argument.
-% In fact, we replace the characters by characters with same ASCII codes but different catcodes.
-% It's not the same but suffices since the result is the same.
-% Here we treat the very special case that all characters become active.
-% This |\endgroup| restores the catcodes of chr(0)--chr(8), but not the catcodes of the characters inside |\lst@MakeActive@| since they are already read.
-% \end{macro}
-%
-% \begin{macro}{\lst@IfNextCharActive}
-% The implementation is easy now: We compare the character |#3| with its active version |\lowercase{~}|.
-% Note that the right brace between |\ifx~| and |#3| ends the |\lowercase|.
-% The |\egroup| before restores the |\lccode|.
-% \begin{macrocode}
-\def\lst@IfNextCharActive#1#2#3{%
- \bgroup \lccode`\~=`#3\lowercase{\egroup %
- \ifx~}#3%
- \def\lst@next{#1#3}%
- \else %
- \def\lst@next{#2#3}%
- \fi \lst@next}
-% \end{macrocode}
-% \end{macro}
-% \begingroup
-% \begin{macrocode}
-%</kernel>
-% \end{macrocode}
-% \endgroup
-%
-%
-% \subsection{An application to \ref{iCatcodeChangesOfCharactersAlreadyRead}}\label{iAnApplicationTo}
-%
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-% \end{macrocode}
-% \endgroup
-% We need a brief look on how the listing processing works.
-% Right before processing a listing we redefine all characters, for example to preserve successive spaces or to give the tabulator a different meaning.
-% More precisely, each character becomes active in the sense of \TeX, but that's not so important now.
-% After the listing we switch back to the original meanings and all is fine.
-% If an environment is used inside an argument the listing is already read when the environment is executed and we can do nothing to preserve the characters.
-% However, (under certain circumstances) the environment can be used inside an argument --- that's at least what I've said in the user's guide.
-% And now we have to work for it coming true.
-% We define the macro
-% \begin{macrosyntax}
-% \item |\lstenv@AddArg{|\meta{\TeX{} material (already read)}|}|
-% \end{macrosyntax}
-% which \emph{appends} a 'verbatim' version of the argument to |\lstenv@arg|, but all appended characters are active.
-% Since it's not a character to character conversion, 'verbatim' needs to be explained.
-% All characters can be typed in as they are, except |\|, |{|, |}| and |%|.
-% If you want one of these, you must write |\\|, |\{|, |\}| or |\%| instead.
-% If two spaces should follow each other, the second (third, fourth, \ldots) space must be entered as |\|\textvisiblespace.
-%
-% \begin{macro}{\lstenv@AddArg}
-% We call a submacro (similar to |\zap@space|) to preserve single spaces.
-% \begin{macrocode}
-\def\lstenv@AddArg#1{\lstenv@AddArg@#1 \@empty}
-% \end{macrocode}
-% We will need an active space:
-% \begin{macrocode}
-\begingroup \lccode`\~=`\ \relax \lowercase{%
-% \end{macrocode}
-% We make all characters upto the first space (with catcode 10) active and append these (plus an active space) to |\lstenv@arg|.
-% If we haven't found the end |\@empty| of the input, we continue the process.
-% |InitVars| & initializes variables each listing\\
-% |ExitVars| & deinits variables each listing\\
-% |OnExit| & executed at the very end of typesetting\\
-% |EveryLine| & called at the beginning of each line\\
-% |EOL| & executed after printing a source code line\\
-% |InitVarsEOL| & prepares variables for the next line\\
-% |EndGroup| & executed whenever the package closes a group (end of comment or string, e.g.)\\
-% |Output| & called before a printing unit with letters and digits is typeset\\
-% |OutputOther| & called before any other printing unit is typeset\\
-% |BeforeSelectCharTable| & executed before the package changes the character table\\
-% |SelectCharTable| & executed after the package has selected the standard character table\\
-% &\\
-% |SetStyle| & called before |\lststy@|\meta{style}\\
-% |SetLanguage| & called before |\lstlang@|\meta{language}|@|\meta{dialect}\\
-% \end{tabular}\end{center}
-% For example, the hooks make keywords case insensitive (if necessary) before the package processes a listing and call the keyword style before a keyword is printed.
-%
-% \begin{macro}{\lst@Aspect}
-% The command defines the aspect only if not already present.
-% |\lst@ifnew| becomes true (if and) only if a new aspect is defined.
-% While typesetting a listing we will enter 'modes' to distinguish comments from strings, comment lines from single comments, \TeX\ comment lines from fixed comment lines, and so on.
-% The counter |\lst@mode| keeps the current mode number.
-% \begin{macrocode}
-\newcount\lst@mode
-% \end{macrocode}
-% Each mode opens a group level, stores the mode number and execute mode specific tokens.
-% Moreover we keep all these changes in mind (locally).
-% If you 'interrupt modes', enter some modes and say 'interrupt modes' again, then two 're-enter modes' will \emph{not} take you back in front of the first 'interrupt modes'.
-% \end{macro}\end{macro}
-%
-% \begin{macro}{\lst@LeaveAllModes}
-% This is some kind of emergency macro.
-% Since any mode is terminated by closing a group, leaving all modes means closing groups until the mode equals |\lst@nomode|.
-% We'll need that macro to end a listing correctly.
-% \qquad[|[|\meta{base dialect}|]|]|{|\meta{base language (e.g.\ empty)}|}|\\
-% \qquad|{|\meta{key=value list}|}|\\
-% \qquad[|[|\meta{list of extras (keywordcomments,texcs,etc.)}|]|]
-% \end{macrosyntax}
-% To make 'extras' user assessible (without loading a language) a command |\lstloadextras| would be nice.
-% In any case such a macro is needed to load the extras for the supported languages.
-% All in all there should be the following files in future: The kernel |listings.sty|, the language definitions in |lstdrvrs.sty| (or |lstdef.sty|?) and extras in a file |lstextra.sty|.
-% \end{TODO}
-% \end{macro}
-%
-% \begin{macro}{\lstloadlanguages}
-% We iterate through the list and locate and load each language.
-% Languages might have a user name and a different internal name.
-% Moreover we don't always use the standard driver file |lst|\meta{language}|.sty|.
-% If the user writes |language=[fuu]foo|, this could mean that we select (internally) dialect |faa| of language |fee|, which is located in driver file |fii.sty|.
-% We define the following macros:
-% \begin{macrosyntax}
-% \item |\lst@DriverLocation{|\meta{language}|}{|\meta{file name without extension}|}|
-%
-% Afterwards the package inputs the given driver file to load the language.
-% As proposed by \lsthelper{Boris Veytsman}{[email protected]}{1998/03/22}{listing name accessible for user} the name of a listing (file name or argument to the environment) is user accessible now.
-% We need some macros to initialize registers and variables before typesetting a listing and for the update every line.
-%
-% \begin{macro}{\lst@Init}
-% The argument |#1| (assigned at the end) is either |\relax| or |\lstenv@backslash| since the backslash has a special meaning for the environment.
-% The line number is used as current label (proposed by \lsthelper{Boris Veytsman}{[email protected]}{1998/03/25}{make line numbers referenced via \label and \ref}).
-% The end of line character chr(13)=|^^M| controls the processing, see the definition of |\lst@MProcessListing| below.
-% The vertical space in the macro code is for clarity.
-% At the moment we use a fast and not 'everything is looking good' way.
-% When |\lst@MSkipUptoFirst| is executed, one input line has already been skipped.
-% We end the group opened in |\lst@SkipUptoFirst|.
-% This restores the definition of the end of line character chr(13).
-% Then we look whether to skip more lines or not.
-% \begin{macrocode}
-\def\lst@MSkipUptoFirst{\egroup %
- \global\advance\lst@lineno\@ne %
- \ifnum\lst@lineno=\lst@firstline\else %
- \expandafter\lst@MSkipUptoFirst@ %
- \fi}
-% \end{macrocode}
-% The argument of |\lst@MSkipUptoFirst@| ends with the next active chr(13), which means that the next input line is read.
-% Again we look whether to skip more lines or not.
-% \begin{macrocode}
-\begingroup \lccode`\~=`\^^M%
-\lowercase{\gdef\lst@MSkipUptoFirst@#1~}{%
- \global\advance\lst@lineno\@ne %
- \ifnum\lst@lineno=\lst@firstline\else %
- \expandafter\lst@MSkipUptoFirst@ %
- \fi}
-\endgroup
-% \end{macrocode}
-% \begin{TODO}
-% This definition gives rise to a ''runaway argument'' if first line doesn't exist (no |^^M| is found).
-%
-% We could define |\lst@MSkipUptoFirst| exactly as |\lst@MProcessListing|, except that we start the normal line processing if we reach the first printing line.
-% In that case all comments and strings are processed, but not output.
-% Everything looks good, even if the first printing line is in the middle of a comment.
-% We need to do the following things:
-% \begin{enumerate}
-% \item Install an \texttt{if} to choose between speed and good looking, which must be noticed in |\lst@SkipUptoFirst|.
-% There we must (locally) switch to |\lsttexcloff|.
-% \item Call |\lst@BeginDropOutput{\lst@nomode}| in |\lst@SkipUptoFirst| instead of |\bgroup\lst@modetrue| and assigning |\relax|es.
-% \item Define |\lst@MSkipUptoFirstExact| by copying |\lst@MProcessListing| and renaming it.
-% Replace the |\ifnum| by\vspace*{-0.5\baselineskip}
-% The definition of the string which terminates the environment (|end{lstlisting}| or |endlstlisting|, for example) needs some care since the braces must not have catcodes 1 and 2 (or |\lst@MakeActive| fails).
-% We enter them as |\{| and |\}| (with preceding |\noexpand|s).
-% Otherwise we append the characters including the eaten |\end| and the eaten argument to current |\lstenv@arg|.
-% And we look again for the end of environment.
-% \begin{macrocode}
- \lstenv@AddArg{#1\\end\{#2\}}%
- \expandafter\lstenv@ProcessJEnv %
- \fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{lstlisting}
-% The awkward work is done, here we deal with continued line numbering.
-% \lsthelper{Boris Veytsman}{[email protected]}{1998/03/25}{continue line numbering: a.c b.c a.c} proposed to continue line numbers according to listing names.
-% Thus we must save the name and either make a LOL item or define the first line number.
-% Note that the macro |\lstno@| will be undefined or equivalent to |\relax|, so we always start with line number 1 in case of an empty name.
-% Moreover we first test if the user has forgotten the name argument.
-% Afterwards we call the macro with the following arguments:
-% \begin{itemize}
-% \item[] |,|all current keywords|,key,\relax|
-% \end{itemize}
-% The additional |,key,\relax| holds up the syntax of |\lst@temp|.
-% When \TeX{} passes the arguments, the second is empty if and only if |key| is not a current keyword.
-% So we know whether or not to select keyword style.
-%
-% Since \TeX{} always passes two arguments to |\lst@temp|, the whole 'input' |\lst@keywords,#1,\relax| is split in two parts.
-% So there is no need to sort the keywords by probability.
-% Alternatively you could do so and make a loop for the keyword tests, which terminates right after finding a keyword.
-% You might think and guess that's faster than the \TeX{}nique used here.
-% If your source code uses the three or four most common keywords only, you are right.
-% In fact the very first versions 0.1 and 0.11 have used something like loops (even something faster), which in general is slower than this here.
-% \begin{TODO}
-% There exists a faster way.
-% For each keyword we make |\lstk@|\emph{the keyword} equivalent to keyword style.
-% |\csname lstk@|\emph{test word}|\endcsname| expands to |\relax| if the control sequence is undefined and to keyword style otherwise.
-% That's the complete keyword test!
-% It works very well, but needs more of \TeX{}'s memory.
-% Therefore we should define also 'memory saving' and/or 'speeding up' option.
-%
-% Note: A keyword or character string in this state might contain |\lst@underscore| and |\lst@minus| (and possibly more macro names), which will expand inside |\csname|\ldots|\endcsname|.
-% Hence the definition of |\lstk@|\emph{the keyword} needs some care.
-% An easy trick: During keyword definition and keyword testing the macros should expand to |_| and |-|, respectively.
-% But the reassignments of |_|, |-|, \ldots\ also need time, so the implemented way is possibly faster \ldots
-% \end{TODO}
-%
-% \begin{macro}{\lst@SetStyleFor}
-% |\relax| terminates the argument here since it is faster than enclosing it in braces.
-% All the rest should be clear from the discussion above.
-% We have to delete all current keywords before selecting a new language --- otherwise keywords from the previous language would be present if the user specifies no keywords.
-% Finally we come to this attribute --- the introduction is due to communication with \lsthelper{Andreas Bartelt}{[email protected]}{1997/09/11}{problem with redefed \parskip; \lstlineskip introduced}.
-% Things at EOL are easy, but we must allocate new modes for (\TeX) comment lines first.
-% \begin{macrocode}
-\lst@NewMode\lst@TeXCLmode
-\lst@NewMode\lst@CLmode
-\lst@AddToHook{EOL}
- {\ifnum\lst@mode=\lst@TeXCLmode %
- \lst@LeaveAllModes \lst@ReenterModes %
- \fi %
- \ifnum\lst@mode=\lst@CLmode \lst@LeaveMode \fi}
-% \end{macrocode}
-% \end{aspect}
-%
-% \begin{macro}{\lstCC@BeginCommentLine}
-% \begin{macro}{\lstCC@@BeginCommentLine}
-% The first macro starts comment lines indicated by a single character (like |%| in \TeX), whereas the second does this for comment lines indicated by two characters (like |//| in C++).
-% According to the macro naming these two macros belong more or less to section \ref{iCharacterClasses}.
-% But we present them here because of \TeX\ comment lines.
-%
-% We print preceding characters (if any), begin the comment and output the comment separator.
-% The output macros have to keep track of the difference between the real and desired (current) line width; the latter one given by 'current column times |\lst@width|'.
-% More precisely, |\lst@lostspace| equals 'current column times |\lst@width|' minus 'width of so far printed line'.
-% Whenever this dimension is positive we can insert space to fix the column alignment.
-% What we have said about |\lst@NewLine| is not the whole truth.
-% Most times we'll assign |\lst@NewLineMacro|, but sometimes we append |\par\noindent\hbox{}| to prepare a new line, namely in the case that the last line has been empty.
-% Then |\lst@NewLine| deactivates itself and begins two, three or more (empty) lines.
-% This drops empty lines at the end of a listing.
-% \begin{macrocode}
-\lst@AddToHook{EOL}
- {\ifx\lst@NewLine\relax %
- \global\let\lst@NewLine\lst@NewLineMacro %
- \else %
- \lst@AddTo\lst@NewLine{\par\noindent\hbox{}}%
- \fi}
-% \end{macrocode}
-% \end{macro}
-% \begingroup
-% \begin{macrocode}
-%</kernel>
-% \end{macrocode}
-% \endgroup
-%
-%
-% \subsection{Fixed columns}
-%
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-% \end{macrocode}
-% \endgroup
-% \begin{macro}{\lst@OutputOther}
-% This macro outputs a character string with nonletters.
-% If there is anything to output, we possibly start a new line.
-% \begin{macrocode}
-\def\lst@OutputOther{%
- \ifnum\lst@length=\z@\else %
- \lst@NewLine \lst@UseLostSpace %
-% \end{macrocode}
-% The box must take |\lst@length| characters, each |\lst@width| wide.
-% Looking at the submacro, |#1| is an active character with ASCII code |#2|.
-% We must save a previous meaning of |#1| --- or we couldn't output the character since we've forgotten it.
-% Afterwards we can redefine it: If we are in comment mode and furthermore in keyword comment mode, the 'end keyword comment' character ends the comment, as desired.
-% Note that we output the old meaning of the character first.
-% Each input character becomes active in the sense of \TeX{} and characters of different classes expand to different meanings.
-% We use the following ones:
-% \begin{itemize}
-% \item letters --- characters identifiers are of;
-% \item digits --- characters for identifiers or numerical constants;
-% \item spaces --- characters treated as blank spaces;
-% \item tabulators --- characters treated as tabulators;
-% \item stringizers --- characters beginning and ending strings;
-% \item comment indicators --- characters or character sequences beginning and ending comments;
-% \item special classes support particular programming languages;
-% \item others --- all other characters.
-% \end{itemize}
-% How these classes work together?
-% The digit '3' appends the digit to the current character string, e.g.\ |ear| becomes |ear3|.
-% The next nonletter causes the output of the gathered characters.
-% Then we collect all coming nonletters until reaching a letter again.
-% This causes the output of the nonletters, and so on.
-%
-% But there are more details.
-% Stringizers and comment indicators change the processing mode until the string or the comment is over.
-% For example, no keyword tests are done within a string or comment.
-% A tabulator immediately outputs the gathered characters, without looking whether they are letters or not.
-% Afterwards it is possible to determine the tabulator skip.
-% And there is one thing concerning spaces:
-% Many spaces following each other disturb the column alignment since they are not wide enough.
-% Hence, when column alignment is on, we output the space(s) preceding a space.
-%
-% The above classes can be divided into three types:
-% \begin{itemize}
-% \item The 'letter', 'digit' and 'other' class all put characters into the 'output queue' (using |\lstCC@Append| or |\lstCC@AppendOther|, see below).
-% \item Stringizer, comment indicators and special classes don't affect the output queue directly.
-% For example, before a character becomes a stringizer, the 'letter', 'digit' or 'other' meaning is saved.
-% Now the stringizer accesses the output queue via this saved meaning.
-% \item Spaces and tabulators don't put any character into the output queue, but may affect the queue to do their job, as mentioned above.
-% Instances of these classes are not overwritten (in contrast to letters, digits and others).
-% \end{itemize}
-% Some easy implementation before looking closer \ldots
-%
-% \begin{macro}{\lstCC@Append}
-% This macro appends the argument to the current character string and increases the counter |\lst@length|.
-% Now we define the |\lstCC@|\ldots|Use| macros used above.
-% We either define the character with code |#2| to be |#1#3| (where |#1| is |\lstCC@ProcessLetter| for example) or we gobble the two token after |\fi| to terminate the loop.
-% Finally we define a macro (collection) with the ability of moving a basic \emph{instance} of class to another class, e.g. making the digit '0' be a letter.
-% The word 'basic' means any instance defined with |\lstCC@Use| or |\lstCC@ECUse|.
-% The first argument of |\lstCC@ChangeBasicClass| gives the new class and the second argument is a macro containing a character sequence.
-% These characters are changed.
-% First we make all these characters active and call a submacro.
-% First dropping empty lines at the end of a listing, and second the flexible column format.
-% In both cases we use |\lst@lostspace| for the implementation.
-% Whenever this dimension is positive we insert that space before |\lst@token| is output.
-%
-% We've defined |\lst@EOLUpdate| to drop empty lines at the end of a listing.
-% |\lst@NewLine| isn't executed or reset in that case.
-% Instead we append control sequences.
-% But: Lines containing tabulators and spaces only should also be viewed as empty.
-% In order to achieve this tabulators and spaces at the beginning of a line advance |\lst@lostspace| and don't output any characters.
-% The space is inserted if there comes a letter for example.
-% If there are only tabulators and spaces, the line is 'empty' since we haven't done any output.
-%
-% We have to do more for flexible columns.
-% The whitespaces can fix the column alignment:
-% If the real line is wider than it should be (|\lst@lostspace|$<$0pt), a tabulator is at least one space wide; all the other width is used to make |\lst@lostspace| more positive.
-% Spaces do the same: If there are two or more spaces, at least one space is printed; the others fix the column alignment.
-% If we process a string, all spaces are output, of course.
-%
-% \begin{macro}{\lstCC@ProcessTabulator}
-% A tabulator outputs the preceding characters.
-% \begin{macrocode}
-\def\lstCC@ProcessTabulator{%
- \lst@PrintToken %
-% \end{macrocode}
-% Then we must calculate how many columns we need to reach the next tabulator stop.
-% Each printed character decrements the counter |\lst@pos|.
-% Hence we can simply add |\lst@tabsize| until |\lst@pos| is strict positive.
-% That's all.
-% We assign it to |\lst@length|, reset |\lst@pos| \ldots
-% \begin{macrocode}
- \global\advance\lst@column -\lst@pos %
- \@whilenum \lst@pos<\@ne \do %
- {\global\advance\lst@pos\lst@tabsize}%
- \lst@length\lst@pos \global\lst@pos\z@ %}
-% \end{macrocode}
-% and go to the tabulator stop, e.g.\ |\lst@length| columns forward:
-% \begin{macrocode}
- \lst@GotoTabStop}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\lstCC@AppendSpecialSpace}
-% Sometimes we have special spaces:
-% If there are at least two spaces, i.e.\ if the last character have been a space, we output preceding characters and advance |\lst@lostspace| to avoid alignment problems.
-% Otherwise we append a space to the current character string.
-% We'll need that macro soon.
-% \begin{macrocode}
-\def\lstCC@AppendSpecialSpace{%
- \ifx\lst@lastother\lst@outputblank %
- \lst@OutputOther %
- \global\advance\lst@lostspace\lst@width %
- \global\advance\lst@pos\m@ne %
- \else %
- \lstCC@AppendOther\lst@outputblank %
- \fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\lst@outputblank}
-% It's better not to forget this.
-% \begin{macrocode}
-\def\lst@outputblank{\ }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\lstCC@ProcessSpace}
-% If the last character has been a letter, we output the current character string and append one space.
-% \begin{macrocode}
-\def\lstCC@ProcessSpace{%
- \lstCC@ifletter %
- \lst@Output\lstCC@letterfalse %
- \lstCC@AppendOther\lst@outputblank %
-% \end{macrocode}
-% Otherwise we look whether we are in string mode or not.
-% In the first case we must append a space; in the second case we must test if the hitherto line is empty.
-% \begin{macrocode}
- \else \ifnum\lst@mode=\lst@stringmode %
- \lstCC@AppendOther\lst@outputblank %
- \else \ifx\lst@NewLine\relax %
-% \end{macrocode}
-% If the line is not empty we either advance |\lst@lostspace| or append a space to the current character string.
-% \begin{macrocode}
- \lstCC@AppendSpecialSpace %
- \else \ifnum\lst@length=\z@ %
-% \end{macrocode}
-% If the line is empty so far, we advance |\lst@lostspace|.
-% Otherwise we append the space.
-% \begin{macrocode}
- \global\advance\lst@lostspace\lst@width %
- \global\advance\lst@pos\m@ne %
- \else %
- \lstCC@AppendSpecialSpace %
- \fi %
- \fi \fi \fi}
-% \end{macrocode}
-% Note that this version works for fixed and flexible column output.
-% \end{macro}
-% \begingroup
-% \begin{macrocode}
-%</kernel>
-% \end{macrocode}
-% \endgroup
-%
-%
-% \subsection{Stringizer}
-%
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-% \end{macrocode}
-% \endgroup
-% \begin{macro}{\lst@legalstringizer}
-% Currently there are three different stringizer types: 'd'oubled, 'b'ackslashed and 'm'atlabed.
-% The naming of the first two is due to how the stringizer is represented in a string.
-% Pascal doubles it, i.e.\ the string |'| is represented by four single quotes |''''|, where the first and last enclose the string and the two middle quotes represent the desired stringizer.
-% In C++ we would write |"\""|: A backslash indicates that the next double quote belongs to the string and is not the end of string.
-% The matlabed version is described below.
-% I introduced it after communication with \lsthelper{Zvezdan V. Petkovic}{[email protected]}{1997/11/26}{'single stringizer' not a stringizer in Ada (and Matlab)}.
-% \begin{macrocode}
-\def\lst@legalstringizer{d,b,m,bd,db}
-% \end{macrocode}
-% Furthermore we have the two mixed types |bd| and |db|, which in fact equal |b|.
-% \end{macro}
-%
-% \begin{aspect}{stringizer}
-% Here we test whether the user type is supported or not (leading to an error message).
-% In the first case we (re-) define |\lst@DefStrings|.
-% If we already process a string, we execute the saved meaning and look whether the last other (that's the stringizer) is the matching stringizer --- a single quote must not end a string starting with a double quote.
-% The macro |\lstCC@EndString| is defined at the end of this section.
-% \begin{macrocode}
- \ifnum\lst@mode=\lst@stringmode %
- \csname lsts@s#1\endcsname %
- \ifx\lst@lastother\lstCC@closestring %
- \lstCC@EndString %
- \fi %
- \else %
- \lst@OutputOther %
-% \end{macrocode}
-% If we don't process a string, we test whether or not a string is allowed.
-% |\lstCC@BeginString| enters string mode and defines the closing stringizer.
-% This 'begin string' macro gets one argument, hence we expand the control sequence name before executing the macro (if necessary).
-% 'm'atlabed is designed for programming languages where stringizers (for character or string literals) are also used for other purposes, like Matlab or Ada.
-% Here we enter string mode only if the last character has not been a letter and has not been a right parenthesis.
-% Hence, we have to move the |\lstCC@ifletter| and change the main |\else| part.
-% By the way: The stringizer is doubled in a string.
-% Comment commands allow a single character like |!| or two characters like |//|.
-% The calling syntax of this testing macro is
-% \begin{macrosyntax}
-% \item |\lstCC@TestCArg|\meta{characters to test}|\@empty\relax|\meta{macro}
-% \end{macrosyntax}
-% \meta{macro} is called after doing the test and gets three arguments:
-% The given two characters as active characters (where the second equals |\@empty| if and only if a single character is given), and the third is a catcode 12 version of the first character.
-% \begin{macrocode}
-\begingroup \catcode`\^^@=\active
-\gdef\lstCC@TestCArg#1#2#3\relax#4{%
- \lccode`\~=`#1\lccode`\/=`#1%
- \ifx\@empty#2%
- \lowercase{\def\lst@temp{~\@empty/}}%
- \else \lccode`\^^@=`#2%
- \lowercase{\def\lst@temp{~^^@/}}%
- \fi %
-% \end{macrocode}
-% If neither |#2| nor |#3| equals |\@empty|, the user has given more than two characters:
-% Note the order: We define 'end comment' and afterwards 'begin comment'.
-% \end{macro}
-%
-% \begin{macro}{\lstCC@NCommentB}
-% The redefinition of the character is different now.
-% Since we define nested comments, we have to count the comment depth.
-% If we already process a nested comment, we increase that depth by making |\lst@mode| more negative.
-% \begin{macrocode}
-\def\lstCC@NCommentB#1#2#3{%
- \let\lsts@BNC #1%
- \ifx\@empty#2%
- \def#1{%
- \let\lstCC@bnext\relax %
- \lst@ifmode %
- \ifnum\lst@mode<\z@ %
- \advance\lst@mode\m@ne %
- \fi %
- \else %
- \def\lstCC@bnext{\lstCC@BeginComment\m@ne}%
- \fi %
- \lstCC@bnext \lsts@BNC}%
- \else %
- \def#1##1{%
- \let\lstCC@bnext\relax %
- \lst@ifmode %
- \ifnum\lst@mode<\z@ \ifx##1#2%
- \advance\lst@mode\m@ne %
- \fi \fi %
- \else %
- \ifx##1#2%
- \def\lstCC@bnext{\lstCC@@BeginComment\m@ne}%
- \fi %
- \fi %
- \lstCC@bnext \lsts@BNC ##1}%
- \fi}
-% \end{macrocode}
-% \begin{TODO}
-% The third argument (|\catcode| 12 version of the first) is unused so far --- also in |\lst@NCommentE|.
-% If we are in need of 'double' nested comments, we will use this argument for the save name, as we've already done it for normal double comments (and comment lines).
-% \end{TODO}
-% \end{macro}
-%
-% \begin{macro}{\lstCC@NCommentE}
-% If we are in nested comment mode, we either end the comment or decrease the comment depth by making |\lst@mode| less negative.
-% \begin{macrocode}
-\def\lstCC@NCommentE#1#2#3{%
- \let\lsts@ENC #1%
- \ifx\@empty#2%
- \def#1{%
- \let\lstCC@enext\relax %
- \lst@ifmode \ifnum\lst@mode<\z@ %
- \ifnum\lst@mode=\m@ne %
- \let\lstCC@enext\lstCC@EndComment %
- \else %
- \advance\lst@mode\@ne %
- \fi
- \fi \fi %
- \lsts@ENC \lstCC@enext}%
- \else %
- \def#1##1{%
- \def\lstCC@enext{\lsts@ENC ##1}%
- \ifx##1#2%
- \lst@ifmode \ifnum\lst@mode<\z@ %
- \ifnum\lst@mode=\m@ne %
- \def\lstCC@enext{%
- \lsts@ENC ##1\lstCC@EndComment}%
- \else %
- \advance\lst@mode\@ne %
- \fi
- \fi \fi %
- \fi %
- \lstCC@enext}%
- \fi}
-% \end{macrocode}
-% \end{macro}
-% \begingroup
-% \begin{macrocode}
-%</kernel>
-% \end{macrocode}
-% \endgroup
-%
-%
-% \subsection{Escape characters}
-%
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-% \end{macrocode}
-% \endgroup
-% The introduction of this character class is due to a communication with \lsthelper{Rui Oliveira}{[email protected]}{1998/06/05}{escape characters}.
-%
-% \begin{macro}{\lstCC@Escape}
-% gets three arguments all in all.
-% The first is the escape character, the second is executed when the escape starts and the third right before ending it.
-% We use the same grouping mechanism as for \TeX\ comment lines.
-% \section{More \texttt{lst}-aspects and classes}
-%
-%
-% \subsection{Form feeds}
-%
-% \begingroup
-% \begin{macrocode}
-%<*kernel>
-% \end{macrocode}
-% \endgroup
-% \begin{aspect}{formfeed}
-% We begin with the announcement --- the introduction is due to communication with \lsthelper{Jan Braun}{[email protected]}{1998/04/27}{\lstformfeed}.
-% We begin with two user commands, which I introduced after communication with \lsthelper{Michael Piotrowski}{[email protected]}{1997/11/11}{\lstprintpodtrue/false}.
-% \subsection{Special use of \texttt{\#} in Perl}
-%
-% \begingroup
-% \begin{macrocode}
-%<*perl>
-% \end{macrocode}
-% \endgroup
-% \begin{macro}{\lstCC@SpecialUseAfter}
-% We need |#| not to begin a comment in Perl if it follows |$|.
-% We'll define a special use of |#| after |$| via |\lstCC@SpecialUseAfter{\$}{\#}{\lstCC@ProcessOther\#}| where the third argument is executed coming to |$#|.
-% Note that the submacro gets two of the three arguments.
-% |\string#1| from above expands to 'backslash + some characters' if |#1| is a control sequence.
-% In this case the argument |#2| here equals not |\@empty|.
-% The other implication: If |#2| equals |\@empty|, |\string#1| necessarily expanded to a single character, which can't be a control sequence (|\escapechar>=0| granted).
-% Thus, we add an active character if and only if the second argument equals |\@empty|, and we append the control sequence otherwise.
-% In the latter case we must print all preceding characters (and all the lost space).
+% 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.
+% 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.