diff options
Diffstat (limited to 'macros/latex/contrib/listings')
-rw-r--r-- | macros/latex/contrib/listings/README | 2 | ||||
-rw-r--r-- | macros/latex/contrib/listings/listings-devel.pdf | bin | 1150640 -> 1454263 bytes | |||
-rw-r--r-- | macros/latex/contrib/listings/listings.dtx | 385 | ||||
-rw-r--r-- | macros/latex/contrib/listings/listings.pdf | bin | 750616 -> 1031323 bytes | |||
-rw-r--r-- | macros/latex/contrib/listings/lstdrvrs.dtx | 48 | ||||
-rw-r--r-- | macros/latex/contrib/listings/lstdrvrs.pdf | bin | 565192 -> 752443 bytes |
6 files changed, 299 insertions, 136 deletions
diff --git a/macros/latex/contrib/listings/README b/macros/latex/contrib/listings/README index 5c4a4f0628..8dfe5a667e 100644 --- a/macros/latex/contrib/listings/README +++ b/macros/latex/contrib/listings/README @@ -3,7 +3,7 @@ Listings package Copyright 1996--2004 Carsten Heinz (the package) Copyright 1996--2007 individual authors (language drivers) Copyright 2006--2007 Brooks Moses (continued maintenance) -Copyright 2013--2020 Jobst Hoffmann (continued maintenance) +Copyright 2013-- Jobst Hoffmann (continued maintenance) Released under the LaTeX Project Public License 1.3c or later diff --git a/macros/latex/contrib/listings/listings-devel.pdf b/macros/latex/contrib/listings/listings-devel.pdf Binary files differindex bece208f87..4febb79f4e 100644 --- a/macros/latex/contrib/listings/listings-devel.pdf +++ b/macros/latex/contrib/listings/listings-devel.pdf diff --git a/macros/latex/contrib/listings/listings.dtx b/macros/latex/contrib/listings/listings.dtx index 1874a17849..c507ab5fc1 100644 --- a/macros/latex/contrib/listings/listings.dtx +++ b/macros/latex/contrib/listings/listings.dtx @@ -133,7 +133,7 @@ % Hoffmann became the maintainer of the \packagename{listings} % package in 2013; see the Preface for details.}~ % % \textless\lstemail\textgreater} -% \date{2020/03/24\enspace\enspace Version 1.8d\ \box\abstractbox} +% \date{2023/02/27\enspace\enspace Version 1.9\ \box\abstractbox} % \def\lstemail{\href{mailto:j.hoffmann@fh-aachen.de}{\texttt{j.hoffmann(at)fh-aachen.de}}} % \ifhyper % \hypersetup{pdftitle=The Listings Package, @@ -921,8 +921,12 @@ % insensitive and that spaces have no effect. % % There is at least one language (VDM, Vienna Development Language, -% \url{http://www.vdmportal.org}) which is not directly supported by the -% \packagename{listings} package. It needs a package for its own: +% \url{https://en.wikipedia.org/wiki/Vienna_Development_Method}^^A +% \footnote{\lsthelper{Vladimir Nikishkin}{2019/11/15}% +% {bug report in the listings package documentation} informed that the +% previous mentioned URL \url{http://www.vdmportal.org} doesn't point +% to a VDM specific page anymore.}) which is not directly supported by +% the \packagename{listings} package. It needs a package for its own: % \packagename{vdmlisting}. On the other hand \packagename{vdmlisting} uses % the \packagename{listings} package and so it should be mentioned in this % context. @@ -938,7 +942,7 @@ % |listings-|\meta{language}|.prf|, \meta{language} is the name of the % supported programming language in lowercase letters. % -% So if an user of the \packagename{listings} package wants to use these +% So if a user of the \packagename{listings} package wants to use these % preferences, she/he can say for example when using Python % \begin{quote} % |\input{listings-python.prf}| @@ -1257,9 +1261,13 @@ % % \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: +% (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:\footnote{You should keep in mind that according to +% \cite{Mittelbach:companion} \ldots{} if the caption's text fits on one +% line, the text is centered; if the text does not fit on a single line, it +% will be typeset as a paragraph with a width equal to the line width.} % \begin{lstsample}[caption,label]{\lstset{xleftmargin=.05\linewidth}}{} % \begin{lstlisting}[caption={Useless code},label=useless] % for i:=maxint to 0 do @@ -1788,7 +1796,7 @@ % \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 +% some implicitly defined styles have no separate 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}. % @@ -1985,7 +1993,7 @@ % \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{Ulrike~Fischer}{news3@nililand.de}, % \lstthanks{Robert~Frank}{rf7@ukc.ac.uk}, % \lstthanks{Michael~Franke}{-}, % \lstthanks{Ignacio~Fern\'andez~Galv\'an}{-}, @@ -2337,7 +2345,7 @@ % can be used on individual listings only. They determine the physical % input lines used to print displayed listings. % -% \item[1.2] +% \item[1.2;1.9] % \rkeyname{linerange}|={|\meta{first1}\texttt-\meta{last1}\texttt,^^A % \meta{first2}\texttt-\meta{last2}\texttt, and so % on|}|\label{uoption:linerange} @@ -2346,6 +2354,14 @@ % listing are displayed. The intervals must be sorted and must not % intersect. % +% In fact each part of the triplet \meta{first}\texttt-\meta{last} may +% be omitted. Omitting \meta{first} or \meta{last} means, that the +% range begins at line no. 1 and ends at \meta{last} or begins at +% \meta{first} ends at the last line of the file, a single number +% means, that the range begins and ends at the line given by the +% number, whereas omitting \meta{first} or \meta{last} means the range +% begins at line no. 1 and ends at the last line of the file. +% % \item[1.8, true] % \rkeyname{consecutivenumbers}|=|\meta{\alternative{true,false}}^^A % \syntaxor\rkeyname{consecutivenumbers}\label{uoption:consecutivenumbers} @@ -3590,7 +3606,7 @@ % example, but the examples apply to \keyname{comment} and % \keyname{deletecomment} as well. % -% \item[0.13] \keyname{morecomment}|=[l]|\meta{delimiter} +% \item[0.13] \rkeyname{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 |//| @@ -3598,7 +3614,7 @@ % |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} +% \item[0.13] \rkeyname{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 @@ -3607,14 +3623,14 @@ % |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} +% \item[0.13] \rkeyname{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 +% \item[0.18] \rkeyname{morecomment}|=[f]|\meta{delimiter} +% \item[0.18] \rkeyname{morecomment}|=[f][commentstyle]|\oarg{n=preceding % columns}\meta{delimiter} % % The delimiter starts a comment line if and only if it appears on a @@ -4487,6 +4503,11 @@ % Robin Fairbairns. % \newblock{The \textsf{moreverb} package}, 2011. % +% \bibitem[Mi04]{Mittelbach:companion} +% Frank Mittelbach, Michel Goossens, Johannes Braams, +% David P. Carlisle, and Chris Rowley. +% \newblock{The \LaTeX-Companion}, 2004. +% % \bibitem[Som11]{Sommerfeldt:captions} % Axel Sommerfeldt. % \newblock{Customizing captions of floating environments}, 2011. @@ -5216,7 +5237,7 @@ % defines the specified character respectively assigns \meta{token}. % The catcode table if not affected. Be careful if your definition has % parameters: it is not safe to read more than one character ahead. -% Moreover, the argument can be \emph{arbitrary}; somtimes it's the next +% Moreover, the argument can be \emph{arbitrary}; sometimes it's the next % source code character, sometimes it's some code of the % \packagename{listings} package, e.g.~|\relax|, |\@empty|, |\else|, % |\fi|, and so on. Therefore don't use \TeX's ord-operator |`| on such @@ -5909,7 +5930,7 @@ % \part{Implementation} % % -% \CheckSum{12394} +% \CheckSum{12388} %^^A %^^A Don't index TeX-primitives. %^^A @@ -6053,8 +6074,8 @@ % All files will have same date and version. % \begin{macrocode} %<*kernel|misc|doc> -\def\filedate{2020/03/24} -\def\fileversion{1.8d} +\def\filedate{2023/02/27} +\def\fileversion{1.9} %</kernel|misc|doc> % \end{macrocode} % What we need and who we are. @@ -8570,10 +8591,19 @@ % % \begin{macro}{\lst@outputspace} % \begin{macro}{\lst@visiblespace} -% The first macro is a default definition, \ldots +% \lsthelper{Denis Bitouz\'e}{2020/09/12}{`lst@visiblespace: +% `verbvisiblespace instead of `textvisiblespace} pointed out, that, +% with Lua\LaTeX{} and some monospaced font which doesn't have an +% appropriate glyph in slot 32, `showspaces' hasn't any effect by using +% |\textvisiblespace|. So now we're using |\verbvisiblespace| as a default +% definition for the first macro, the test for the fontfamily +% |\lst@ttfamily| is deleted, because in most of the cases it lead to +% the (wrong) output of |\char32|. The definition of |\verbvisible| +% from latex.ltx takes the different behaviour of the modern \TeX{} +% engines into account and defines a valid |\verbvisiblespace| % \begin{macrocode} \def\lst@outputspace{\ } -\def\lst@visiblespace{\lst@ttfamily{\char32}\textvisiblespace} +\def\lst@visiblespace{\verbvisiblespace} % \end{macrocode} % \end{macro} % \end{macro} @@ -11876,6 +11906,7 @@ \lst@procnamefalse \fi} % \end{macrocode} +% And these are the two implemented keys: % \begin{macrocode} \lst@Key{procnamestyle}{}{\def\lst@procnamestyle{#1}} \lst@Key{indexprocnames}{false}[t]{\lstKV@SetIf{#1}\lst@ifindexproc} @@ -12622,7 +12653,7 @@ }{\def\lst@firstnumber{#1\relax}}} \lst@AddToHook{PreSet}{\let\lst@advancenumber\z@} % \end{macrocode} -% |\lst@firstnumber| now set to |\lst@lineno| instead of |\lst@firstline|, +% |\lst@firstnumber| is now set to |\lst@lineno| instead of |\lst@firstline|, % as per changes in |lstpatch.sty| from 1.3b pertaining to linerange markers. % \begin{macrocode} \lst@AddToHook{PreInit} @@ -13690,8 +13721,7 @@ % \begin{lstkey}{print} % \begin{lstkey}{firstline} % \begin{lstkey}{lastline} -% \begin{lstkey}{linerange} -% The `current line' counter and three keys. +% The `current line' counter and three option keys. % \begin{macrocode} \newcount\lst@lineno % \global \lst@AddToHook{InitVars}{\global\lst@lineno\@ne} @@ -13701,12 +13731,19 @@ \lst@Key{firstline}\relax{\def\lst@firstline{#1\relax}} \lst@Key{lastline}\relax{\def\lst@lastline{#1\relax}} % \end{macrocode} +% Initialize the linerange with reasonable values % \begin{macrocode} \lst@AddToHook{PreSet} - {\let\lst@firstline\@ne \def\lst@lastline{9999999\relax}} +{% + \def\lst@firstline{1\relax} + \def\lst@lastline{9999999\relax} + \let\lst@linerange\@empty +} % \end{macrocode} % \end{lstkey} -% \end{lstkey}\end{lstkey}\end{lstkey}\end{macro} +% \end{lstkey} +% \end{lstkey} +% \end{macro} % The following code is just copied from the current development version, and % from the |lstpatch.sty| file that Carsten left in version 1.3b for doing % line ranges with numbers and range markers. It uses some more keys: @@ -13724,8 +13761,11 @@ % \begin{macrocode} \lst@Key{linerange}\relax{\lstKV@OptArg[]{#1}{% \def\lst@interrange{##1}\def\lst@linerange{##2,}}} +\lst@Key{consecutivenumbers}{true}[t]{% + \lstKV@SetIf{#1}\lst@ifconsecutivenumbers} % \end{macrocode} -% +% The next options are needed for an easy description of arbitrary linerange +% markers: % \begin{macrocode} \lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}% \def\lst@rangeendprefix{#1}} @@ -13735,67 +13775,127 @@ \lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}} \lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}} \lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}} -\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}\lst@ifincluderangemarker} -\lst@AddToHook{PreSet}{\def\lst@firstline{1\relax}% - \let\lst@linerange\@empty} +\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}% + \lst@ifincluderangemarker} +% \end{macrocode} +% The line range is known---it is set either explicitly (by numbers or by +% arbitrary linerange markers) or implicitly from the default values (1 and +% 999999). |\lst@GetLineInterval| parses the known line range recursively, +% because there may be a comma separated list of pairs. +% \begin{macrocode} \lst@AddToHook{Init} - {\ifx\lst@linerange\@empty - \edef\lst@linerange{{\lst@firstline}-{\lst@lastline},}% - \fi% - \lst@GetLineInterval}% +{% + \ifx\lst@linerange\@empty + \edef\lst@linerange{{\lst@firstline}-{\lst@lastline},}% + \fi% + \lst@GetLineInterval% +}% \def\lst@GetLineInterval{\expandafter\lst@GLI\lst@linerange\@nil} -\def\lst@GLI#1,#2\@nil{\def\lst@linerange{#2}\lst@GLI@#1--\@nil} +% \end{macrocode} +% Splitting the comma separated list of pairs is done by +% \begin{macrocode} +\def\lst@GLI#1,#2\@nil{% +% \end{macrocode} +% The list is split into two parts: the first element (\#1) of the list and +% the rest of the list (\#2) which is stored in |\lst@linerange| to be +% processed later. +% \begin{macrocode} + \def\lst@linerange{#2}\lst@GLI@#1--\@nil% +} +% \end{macrocode} +% Further parsing is done by |lst@GLI@|, the argument is |#1--\@nil| that +% is the first element of the list augmented by a sentinel. This +% argument is parsed with the template |#1-#2-#3\@nil|. A linerange given +% as e.\,g. `|12-21|' leads to the argument |12-21--\@nil|, so it is parsed +% as \#1\(\leftarrow\) |12|, \#2\(\leftarrow\)|21|, and \#3\(\leftarrow\)|-|. +% \begin{macrocode} \def\lst@GLI@#1-#2-#3\@nil{% - \lst@IfNumber{#1}% - {\ifx\@empty#1\@empty - \let\lst@firstline\@ne - \else - \def\lst@firstline{#1\relax}% - \fi - \ifx\@empty#3\@empty - \def\lst@lastline{9999999\relax}% - \else - \ifx\@empty#2\@empty - \let\lst@lastline\lst@firstline - \else - \def\lst@lastline{#2\relax}% - \fi - \fi}% % \end{macrocode} -% If we've found a general marker, we set firstline and lastline to 9999999. -% This prevents (almost) anything from being printed for now. +% First we test, if the linerange starts with a number (consisting of -, 1, +% 2, 3, \ldots) or an arbitrary linerange marker. If a linerange starts +% erroneously with a `|-|' character, the argument \#1 isn't set and so the +% range starts with 1, so giving a perhaps expected result, but the +% definition of a linerange must always consist at least of the three parts +% \meta{first}, `|-|', and \meta{last}. +% \begin{macrocode} + \lst@IfNumber{#1}% + {% + \ifx\@empty#1\@empty + \let\lst@firstline\@ne + \else + \def\lst@firstline{#1\relax}% + \fi +% \end{macrocode} +% Now we know the starting number of the linerange. \#3 isn't set with a +% linerange consisting of a single number, in all other cases \#2 defines +% the last line (explicitly or implicitly). +% \begin{macrocode} + \ifx\@empty#3\@empty% + \def\lst@lastline{9999999\relax}% + \ifx\@empty#2\@empty + \let\lst@lastline\lst@firstline% + \fi + \else% + \ifx\@empty#2\@empty + \def\lst@lastline{9999999\relax} + \else % doesn't happen(?) + \def\lst@lastline{#2\relax}% + \fi + \fi + }% +% \end{macrocode} +% If we've found an arbitrary linerange marker, we set firstline and lastline to +% 9999999. This prevents (almost) anything from being printed for now. % \begin{macrocode} - {\def\lst@firstline{9999999\relax}% - \let\lst@lastline\lst@firstline + {% + \def\lst@firstline{9999999\relax}% + \let\lst@lastline\lst@firstline % \end{macrocode} % We add the prefixes and suffixes to the markers. % \begin{macrocode} - \let\lst@rangebegin\lst@rangebeginprefix - \lst@AddTo\lst@rangebegin{#1}\lst@Extend\lst@rangebegin\lst@rangebeginsuffix - \ifx\@empty#3\@empty - \let\lst@rangeend\lst@rangeendprefix - \lst@AddTo\lst@rangeend{#1}\lst@Extend\lst@rangeend\lst@rangeendsuffix - \else - \ifx\@empty#2\@empty - \let\lst@rangeend\@empty - \else - \let\lst@rangeend\lst@rangeendprefix - \lst@AddTo\lst@rangeend{#2}\lst@Extend\lst@rangeend\lst@rangeendsuffix - \fi - \fi + \let\lst@rangebegin\lst@rangebeginprefix + \lst@AddTo\lst@rangebegin{#1}% + \lst@Extend\lst@rangebegin\lst@rangebeginsuffix + \ifx\@empty#3\@empty + \let\lst@rangeend\lst@rangeendprefix + \lst@AddTo\lst@rangeend{#1} + \lst@Extend\lst@rangeend\lst@rangeendsuffix + \else + \ifx\@empty#2\@empty + \let\lst@rangeend\@empty + \else + \let\lst@rangeend\lst@rangeendprefix + \lst@AddTo\lst@rangeend{#2}% + \lst@Extend\lst@rangeend\lst@rangeendsuffix + \fi + \fi % \end{macrocode} % The following definition will be executed in the % \hookname{SelectCharTable} hook and here right now if we are already % processing a listing. % \begin{macrocode} - \global\def\lst@DefRange{\expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}% - \ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi}} + \global\def\lst@DefRange{% + \expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}% + \ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi% + }% +} % \end{macrocode} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% \end{lstkey} +% +% \begin{macro}{\lst@DefRange} % |\lst@DefRange| is not inserted via a hook anymore. Instead it is now called % directly from |\lst@SelectCharTable|. This was necessary to get rid of an % interference with the escape-to-LaTeX-feature. The bug was reported by % \lsthelper{Michael~Bachmann}{2004/07/21}{Keine label-Referenzierung -% m\"oglich...}. Another chance is due to the same bug: |\lst@DefRange| is +% m\"oglich...}. Another change is due to the same bug: |\lst@DefRange| is % redefined globally when the begin of code is found, see below. The bug was % reported by \lsthelper{Tobias~Rapp}{2004/04/06}{undetected end of range if % listing crosses page break} and \lsthelper{Markus~Luisser}{2004/08/13}{Bug mit @@ -13803,9 +13903,6 @@ % \begin{macrocode} \lst@AddToHookExe{DeInit}{\global\let\lst@DefRange\@empty} % \end{macrocode} -% \end{lstkey}\end{lstkey}\end{lstkey} -% \end{lstkey}\end{lstkey}\end{lstkey} -% \end{lstkey}\end{lstkey}\end{lstkey} % % Actually defining the marker (via |\lst@GLI@|, |\lst@DefRange|, % |\lst@CArgX| as seen above) is similar to |\lst@DefDelimB|---except that @@ -13830,6 +13927,7 @@ \lst@CArgEmpty}% \@empty} % \end{macrocode} +% \end{macro} % % Modify labels and define |\lst@InitLstNumber| used above according to an % error reported by @@ -13896,11 +13994,31 @@ \fi} % \end{macrocode} % +% Sometimes it is good to have two or more excerpts of one program numbered +% consecutively, i.\,e. 1--11 instead of 3--5, 12--17, 20--21. So we +% introduce |\lst@DisplayConsecutiveNumbersOrNot|, which corrects the +% displayed line numbers to be always equal to the input line numbers +% \begin{macrocode} +\def\lst@DisplayConsecutiveNumbersOrNot{% + \lst@ifconsecutivenumbers\else% + \c@lstnumber=\numexpr-1+\lst@lineno + \fi% +} +% \end{macrocode} +% % Eventually we shouldn't forget to install |\lst@OnceAtEOL|, which must % also be called in |\lst@MSkipToFirst|. % \begin{macrocode} \lst@AddToHook{EOL}{\lst@OnceAtEOL\global\let\lst@OnceAtEOL\@empty} \gdef\lst@OnceAtEOL{}% Init +% \end{macrocode} +% The following code was introduced in listings version 1.4. The code +% resembles the lines 14031--14061 of version 1.3c, but contains loops: +% \newline|\def\lst@next{...}\expandafter\lst@next|.\newline +% In fact that code will never be expanded, because there are two analoguous +% definitions in section \ref{iTheInputCommand} below, so they override +% these two commands. +% \begin{macrocode} \def\lst@MSkipToFirst{% \global\advance\lst@lineno\@ne \ifnum \lst@lineno=\lst@firstline @@ -13959,10 +14077,13 @@ % Some keys and \ldots % \begin{macrocode} \lst@Key{captionpos}{t}{\def\lst@captionpos{#1}} -\lst@Key{abovecaptionskip}\smallskipamount{\def\lst@abovecaption{#1}} -\lst@Key{belowcaptionskip}\smallskipamount{\def\lst@belowcaption{#1}} +\lst@Key{abovecaptionskip}\smallskipamount{% + \def\lst@abovecaption{#1}} +\lst@Key{belowcaptionskip}\smallskipamount{% + \def\lst@belowcaption{#1}} % \end{macrocode} -% \lsthelper{Rolf~Niepraschk}{2000/01/10}{key: title} proposed \keyname{title}. +% \lsthelper{Rolf~Niepraschk}{2000/01/10}{key: title} proposed +% \keyname{title}. % \begin{macrocode} \lst@Key{label}\relax{\def\lst@label{#1}} \lst@Key{title}\relax{\def\lst@title{#1}\let\lst@caption\relax} @@ -14009,7 +14130,8 @@ \lst@UserCommand\lstlistingnamestyle{} % \end{macrocode} % \begin{macrocode} -\lst@Key{numberbychapter}{true}[t]{\lstKV@SetIf{#1}\lst@ifnumberbychapter} +\lst@Key{numberbychapter}{true}[t]{% + \lstKV@SetIf{#1}\lst@ifnumberbychapter} % \end{macrocode} % \end{lstkey} % \end{macro} @@ -14030,19 +14152,20 @@ % titles. The first is to separate the definitions of the skip registers and % |\@makecaption|. % \begin{macrocode} -\@ifundefined{abovecaptionskip} -{\newskip\abovecaptionskip - \newskip\belowcaptionskip}{} -\@ifundefined{@makecaption} -{\long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1: #2}% - \ifdim \wd\@tempboxa >\hsize - #1: #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi +\@ifundefined{abovecaptionskip}{% + \newskip\abovecaptionskip% + \newskip\belowcaptionskip% +}{} +\@ifundefined{@makecaption}{% + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip% + \sbox\@tempboxa{#1: #2}% + \ifdim \wd\@tempboxa >\hsize% + #1: #2\par% + \else% + \global \@minipagefalse% + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi% \vskip\belowcaptionskip}% }{} % \end{macrocode} @@ -14050,13 +14173,14 @@ % replacement text was used directly in |\lst@MakeCaption|. A |\noindent| has % been moved elsewhere and became |\@parboxrestore| after a bug report from % \lsthelper{Frank~Mittelbach}{2004/02/13}{Re: Info: Inkompatibilit\"at -% zwischen caption und listings}. \lsthelper{Karl Berry}{bold "listings -% 1"?} asked for the ability of customizing the label. So +% zwischen caption und listings}. \lsthelper{Karl Berry}{2019/08/18}{bold +% "listings 1"?} asked for the ability of customizing the label. So % |\lstlistingnamestyle| was introduced in front of |\lstlistingname|. % \begin{macrocode} \def\fnum@lstlisting{% {\lstlistingnamestyle\lstlistingname - \ifx\lst@@caption\@empty\else~\thelstlisting\fi}}% + \ifx\lst@@caption\@empty\else~\thelstlisting\fi}% +} % \end{macrocode} % Captions are set only for display style listings -- thanks to % \lsthelper{Peter~L\"offler}{2004/04/24}{pdfTeX warning (dest): name{figure.1} @@ -14070,7 +14194,7 @@ % \begin{macrocode} \def\lst@MakeCaption#1{% \lst@ifdisplaystyle - \ifx #1t% + \ifx #1t \allowbreak% \ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else \expandafter\refstepcounter \fi {lstlisting}% @@ -14098,8 +14222,8 @@ \addcontentsline{lol}{lstlisting}% {\protect\numberline{\thelstlisting}\lst@@caption}% \fi - \fi - \fi + \fi + \fi % \end{macrocode} % We make a caption if and only if the caption is not empty and the user % requested a caption at |#1| $\in\{\mathtt t,\mathtt b\}$. To disallow @@ -14121,9 +14245,10 @@ \def\vskip{\afterassignment\lst@vskip \@tempskipa}% \def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak}% \par\@parboxrestore\normalsize\normalfont % \noindent (AS) - \ifx #1t\allowbreak \fi + %%\ifx #1t\allowbreak \fi \ifx\lst@title\@empty - \lst@makecaption\fnum@lstlisting{\ignorespaces \lst@caption} + \lst@makecaption\fnum@lstlisting{% + \ignorespaces \lst@caption} \else \lst@maketitle\lst@title % (AS) \fi @@ -14836,7 +14961,8 @@ % |\lst@ShortInlineOldCatcode\|\meta{c}. % \begin{macrocode} \expandafter - \xdef\csname lst@ShortInlineOldCatcode\string#1\endcsname{\the\catcode`#1}% + \xdef\csname lst@ShortInlineOldCatcode\string#1\endcsname{% + \the\catcode`#1}% % \end{macrocode} % The character is spliced into the definition using the same trick as % used in |\verb| (for instance), having activated |~| in a group. @@ -14850,7 +14976,8 @@ % \begin{macrocode} \global\expandafter\let \csname lst@ShortInlineOldMeaning\string#1\endcsname~% - \expandafter\gdef\expandafter~\expandafter{\lst@shortinlinedef#1}}% + \expandafter\gdef\expandafter~\expandafter{% + \lst@shortinlinedef#1}}% \endgroup % \end{macrocode} % Finally the character is made active. @@ -14873,7 +15000,8 @@ % \begin{macro}{\lstDeleteShortInline} % \begin{macrocode} \def\lstDeleteShortInline#1{% - \expandafter\ifx\csname lst@ShortInlineOldCatcode\string#1\endcsname\relax + \expandafter\ifx% + \csname lst@ShortInlineOldCatcode\string#1\endcsname\relax% \PackageError{Listings}% {#1 is not a short reference for \string\lstinline}% {Use \string\lstMakeShortInline first.}% @@ -15103,15 +15231,6 @@ % We just look whether to drop more lines or to leave the mode which restores % the definition of chr(13) and chr(10). % \begin{macrocode} - \lst@Key{consecutivenumbers}{true}[t]{\lstKV@SetIf{#1}\lst@ifconsecutivenumbers} - \def\lst@DisplayConsecutiveNumbersOrNot{% - \lst@ifconsecutivenumbers\typeout{consecutive:}\else% - \typeout{non-consecutive:} - \c@lstnumber=\numexpr-1+\lst@lineno %\relax % this enforces the - %displayed line numbers to always be the - %input line numbers - \fi% -} \def\lst@MSkipToFirst{% \global\advance\lst@lineno\@ne \ifnum \lst@lineno=\lst@firstline @@ -15875,23 +15994,22 @@ % \end{macrocode} % % \paragraph{Indexing} -% The `user' commands. |\rstyle| is defined below. +% The `user' commands. There are two different ways to mark up a +% key. |\ikeyname| is the commmand for keys which are used \textit{i}nline, +% |\rkeyname| defines the \textit{r}eference of a key---displayed green---, +% |\rstyle| is defined below. % \begin{macrocode} \newcommand\ikeyname[1]{% \lstkeyindex{#1}{}% \lstaspectindex{#1}{}% \keyname{#1}} -\newcommand\ekeyname[1]{% - \@bsphack - \lstkeyindex{#1}{}% - \lstaspectindex{#1}{}% - \@esphack} \newcommand\rkeyname[1]{% \@bsphack \lstkeyindex{#1}{}% \lstaspectindex{#1}{}% \@esphack{\rstyle\keyname{#1}}} % \end{macrocode} +% The same rules apply to |\icmdname| and |\rcmdname|: % \begin{macrocode} \newcommand\icmdname[1]{% \@bsphack @@ -15950,6 +16068,7 @@ \fi}} % \end{macrocode} % +% % \paragraph{Unique styles} % \begin{macrocode} \newcommand*\lst{\texttt{lst}} @@ -15972,7 +16091,8 @@ \else\fontfamily#1\fi \selectfont} % \end{macrocode} -% The color mainly for keys and commands in the reference guide. +% The color mainly for keys and commands in the reference +% guide---\textit{r} means reference. % \begin{macrocode} \ifcolor \definecolor{darkgreen}{rgb}{0,0.5,0} @@ -16948,8 +17068,13 @@ \lst@UseHook{SetStyle}\lst@UseHook{EmptyStyle} \lst@UseHook{SetLanguage}\lst@UseHook{EmptyLanguage} % \end{macrocode} -% Finally we load the configuration files. +% Finally we load the configuration files. \lsthelper{Ulrike~Fischer}{2020/11/13} +% {.cfg-file is read with wrong catcode} pointed out that this must happen +% with the correct catcode. At the moment the catcode of |^^M| is 9, which +% is wrong. So we reset the catcodes to the correct values before loading +% the files: % \begin{macrocode} +\lst@RestoreCatcodes% \InputIfFileExists{listings.cfg}{}{} \InputIfFileExists{lstlocal.cfg}{}{} %<info>\lst@ReportAllocs @@ -17059,16 +17184,26 @@ % \item[1.5] 2013/06/27 % \item new maintainership % \item[1.6] 2015/05/05 -% \item add discussion about using |\lstinline|\oarg{key=value list}\marg{source code}. +% \item add discussion about using |\lstinline|\oarg{key=value list}\marg{source code} % \item add section ``Bugs and workarounds''. % \item[1.7] 2018/09/02 -% \item some new or updated language definitions. -% \item several error corrections. +% \item some new or updated language definitions +% \item several error corrections % \item[1.8] from 2019/02/27 on -% \item corrected and activated the option |inputpath|. -% \item some new or updated language definitions. -% \item several error corrections. -% \item introduced |\lstlistingnamestyle|. +% \item corrected and activated the option |inputpath| +% \item some new or updated language definitions +% \item several error corrections +% \item introduced |\lstlistingnamestyle| +% \item[1.9] from 2023/02/27 on +% \item hopefully corrected the long outstanding wrong behaviour of +% displaying visible spaces +% \item generalized the use of |linerange| +% \item introduced key |consecutivenumbers| +% \item a pagebreak between a (top) caption and source code isn't allowed +% anymore +% \item the configuration files |listings.cfg| and |lstlocal.cfg| are read +% with the correct catcode +% \item some documentation and layout enhancements. % \end{itemize} % \endgroup % diff --git a/macros/latex/contrib/listings/listings.pdf b/macros/latex/contrib/listings/listings.pdf Binary files differindex 4d827f4980..bf8ad68ce9 100644 --- a/macros/latex/contrib/listings/listings.pdf +++ b/macros/latex/contrib/listings/listings.pdf diff --git a/macros/latex/contrib/listings/lstdrvrs.dtx b/macros/latex/contrib/listings/lstdrvrs.dtx index f710ef02ae..1d2f4cc5a2 100644 --- a/macros/latex/contrib/listings/lstdrvrs.dtx +++ b/macros/latex/contrib/listings/lstdrvrs.dtx @@ -33,7 +33,7 @@ % \title{Language, Style and Format drivers\\ for \textsf{Listings}\\ % {\large by Carsten Heinz and individual authors:}} % \author{\InputIfFileExists{lstdrvrs.tmp}{}{}} -% \date{2020/03/24\enspace\enspace Version 1.8d\ \box\abstractbox} +% \date{2023/02/27\enspace\enspace Version 1.9\ \box\abstractbox} % % \ifhyper % \hypersetup{pdftitle={Language, Style and Format drivers for the @@ -137,7 +137,7 @@ % \endgroup % We mainly define default dialects. % \begin{macrocode} -\ProvidesFile{listings.cfg}[2020/03/24 1.8d listings configuration] +\ProvidesFile{listings.cfg}[2023/02/27 1.9 listings configuration] \def\lstlanguagefiles {lstlang0.sty,lstlang1.sty,lstlang2.sty,lstlang3.sty} \lstset{defaultdialect=[R/3 6.10]ABAP, @@ -184,7 +184,7 @@ %<+hansl-prf>\ProvidesFile{listings-hansl.prf} %<+lua-prf>\ProvidesFile{listings-lua.prf} %<+python-prf>\ProvidesFile{listings-python.prf} -%<-config> [2020/03/24 1.8d listings language file] +%<-config> [2023/02/27 1.9 listings language file] % \end{macrocode} % % @@ -1724,7 +1724,30 @@ % \begin{macrocode} %<*lang1> % \end{macrocode} -% The current version of Fortran (Fortran 2008) is defined by ISO/IEC +% The current version of Fortran (Fortran 2018) is defined by ISO/IEC +% 1539-1:2018, for a deeper insight have a look at +% \url{https://wg5-fortran.org/f2018.html}. It contains ? new keywords, ? +% of them consisting of +% two words: ^^A +% |FAIL IMAGE|, so +% the list of keywords contains the single parts |FAIL| and |IMAGE|. +% So there is the following definition of Fortran 2018 keywords +% \begin{macrocode} +\lst@definelanguage[18]{Fortran}[08]{Fortran}{% + morekeywords={FAIL, IMAGE, NON_RECURSIVE},% +% \end{macrocode} +% and procedures: +% \begin{macrocode} + morekeywords=[3]{GET_TEAM, TEAM_NUMBER, IMAGE_TEAMS, NUM_IMAGES, + THIS_IMAGE, FAILED_IMAGES, STOPPED_IMAGES, IMAGES_STATUS, CO_BROADCAST, + CO_MAX, CO_MIN, CO_SUM, CO_REDUCE, ATOMIC_ADD, ATOMIC_AND, ATOMIC_OR, + ATOMIC_XOR, ATOMIC_FETCH_ADD, ATOMIC_FETCH_AND, ATOMIC_FETCH_OR, + ATOMIC_FETCH_XOR, ATOMIC_FETCH_CAS, IEEE_GET_MODES, IEEE_SET_MODES, + IEEE_FMA, IEEE_SIGNBIT, IEEE_INT, IEEE_REM, IEEE_MAX_NUM, IEEE_MAX_NUM_MAG, IEEE_MIN_NUM, IEEE_MAX_NUM_MAG, IEEE_NEXT_DOWN, IEEE_NEXT_UP, IEEE_SUPPORT_DATATYPE, IEEE_QUIET_EQ, IEEE_QUIET_GE, IEEE_QUIET_GT, IEEE_QUIET_LE, IEEE_QUIET_LT, IEEE_QUIET_NE, IEEE_SIGNALING_EQ, IEEE_SIGNALING_GE, IEEE_SIGNALING_GT, IEEE_SIGNALING_LE, IEEE_SIGNALING_LT, IEEE_SIGNALING_NE}% +}% +% \end{macrocode} +% +% The Fortran 2008 version is defined by ISO/IEC % 1539-1:2010. It contains nine new keywords, four of them consisting of % two words: ^^A % |ERROR STOP|, |SYNC ALL|, |SYNC IMAGES|, |SYNC MEMORY|, so @@ -1733,7 +1756,7 @@ % \begin{macrocode} \lst@definelanguage[08]{Fortran}[03]{Fortran}{% morekeywords={ALL, BLOCK, CODIMENSION, CONCURRENT, CONTIGUOUS, CRITICAL,% - ERROR, LOCK, SUBMODULE, SYNC, UNLOCK},% + ERROR, IMAGES, LOCK, MEMORY, SUBMODULE, SYNC, UNLOCK},% % \end{macrocode} % New procedures in Fortran 2008: % \begin{macrocode} @@ -1781,8 +1804,8 @@ morekeywords={ALLOCATABLE, ALLOCATE, ASSIGNMENT, CASE, CONTAINS, CYCLE,% DEALLOCATE, DEFAULT, EXIT, INCLUDE, IN, NONE, OUT, INTENT, INTERFACE,% MODULE, NAMELIST, NULLIFY, ONLY, OPERATOR, OPTIONAL, OUT, POINTER,% - PRIVATE, PUBLIC, RECURSIVE, RESULT, SELECT, SEQUENCE, TARGET, USE,% - WHERE, WHILE, BLOCKDATA, DOUBLEPRECISION, ENDBLOCKDATA, ENDFILE,% + PRIVATE, PUBLIC, RECURSIVE, RESULT, SELECT, SEQUENCE, TARGET, TYPE,% + USE, WHERE, WHILE, BLOCKDATA, DOUBLEPRECISION, ENDBLOCKDATA, ENDFILE,% ENDFUNCTION, ENDINTERFACE, ENDMODULE, ENDPROGRAM, ENDSELECT,% ENDSUBROUTINE, ENDTYPE, ENDWHERE, INOUT, SELECTCASE,% % \end{macrocode} @@ -1835,8 +1858,8 @@ morecomment=[l]!% FILE, FORMAT, FUNCTION, GO, TO, GOTO, IF, IMPLICIT, % INQUIRE, INTEGER, INTRINSIC, LOGICAL, % OPEN, PARAMETER, PAUSE, PRECISION, PRINT, PROGRAM, READ, REAL, % - RETURN, REWIND, STOP, SUBROUTINE, THEN, % - WRITE, SAVE},% + RETURN, REWIND, SAVE, STOP, SUBROUTINE, THEN, % + WRITE},% morekeywords=[2]{ACCESS, BLANK, BLOCK, DIRECT, EOF, ERR, EXIST,% FMT, FORM, FORMATTED, IOSTAT, NAMED, NEXTREC, NUMBER, OPENED,% REC, RECL, SEQUENTIAL, STATUS, TYPE, UNFORMATTED, UNIT},% @@ -3703,7 +3726,7 @@ morecomment=[l]!% % % \subsection{Matlab} % -% I took the keywords from \texttt{http://www.utexas.edu/math/Matlab/Manual}, +% I (C.\,H.?) took the keywords from \texttt{http://www.utexas.edu/math/Matlab/Manual}, % but I removed the keywords |i|, |j| and |tmp|---the change was proposed by % \lsthelper{Kai Below}{below@tu-harburg.de}{1998/09/21}{Matlab: keywords % i,j,tmp removed}. @@ -3711,6 +3734,11 @@ morecomment=[l]!% % \begin{macrocode} %<*lang1> % \end{macrocode} +% From the revision history one can conclude that ``Matlab´´ means ``Matlab +% 5.1´´ which was released in 1997 +% \begin{macrocode} +\lst@definelanguage[5.1]{Matlab}[]{Matlab}{} +% \end{macrocode} % \begin{macrocode} \lst@definelanguage{Matlab}% {morekeywords={gt,lt,gt,lt,amp,abs,acos,acosh,acot,acoth,acsc,acsch,% diff --git a/macros/latex/contrib/listings/lstdrvrs.pdf b/macros/latex/contrib/listings/lstdrvrs.pdf Binary files differindex baac9f4b03..2bf416063a 100644 --- a/macros/latex/contrib/listings/lstdrvrs.pdf +++ b/macros/latex/contrib/listings/lstdrvrs.pdf |