Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Project: Sage cloud templates
Views: 480%%1%% This is file `lstpatch.sty', generated manually.2%%3%% (w)(c) 2004 Carsten Heinz4%%5%% This file may be distributed under the terms of the LaTeX Project Public6%% License from CTAN archives in directory macros/latex/base/lppl.txt.7%% Either version 1.0 or, at your option, any later version.8%%9%% Send comments and ideas on the package, error reports and additional10%% programming languages to <[email protected]>.11%%12%% This patch file will remove the following bugs from the listings package.13%% Each item contains the bug finder with date of report and first bug fix14%% version, a short description of the problem, and the reason for the bug15%% in parenthesis.16%%17%% 1) Frank Atanassow, 2004/10/07, 1.3b18%%19%% space after mathescape is not preserved20%% (\lst@newlines>0)21%%22%% 2) Benjamin Lings, 2004/10/15, 1.3b (2004/10/17)23%%24%% \usepackage{xy,listings} yields:25%% "Forbidden control sequence found while scanning use of \lst@lExtend"26%% (xy-pic correctly resets catcode of ^^L (to active), which is \outer)27%%28%%29%% The following features are added to the base package.30%%31%% 1.3a (2004/09/07)32%%33%% a) H I G H L Y E X P E R I M E N T A L34%%35%% Use the options36%% rangeprefix=<prefix for begin and end of range>37%% rangesuffix=<suffix for begin and end of range>38%%39%% rangebeginprefix=<prefix for begin of range>40%% rangebeginsuffix=<suffix for begin of range>41%%42%% rangeendprefix=<prefix for end of range>43%% rangeendsuffix=<suffix for end of range>44%%45%% includerangemarker=true|false46%% together with47%% firstline=<begin marker>48%% lastline=<end marker>49%% or50%% linerange={<begin marker 1>-<end marker 1>,51%% <begin marker 2>-<end marker 2>, ...}52%% The according markers in the source code are53%% <prefix><marker><suffix>54%% for begin respectively end of range. Moreover, one can use55%% includerangemarker=true|false56%% to show or hide the range markers in the output.57%%58%% 1.3b (2004/10/17)59%%60%% b) multicols=<number> (requires loaded multicol package)61%%62%%63\lst@CheckVersion{1.3}64{\typeout{^^J%65***^^J%66*** This is a patch for listings 1.3, but you're using^^J%67*** version \lst@version.^^J%68***^^J69*** Patch file not loaded.^^J%70***^^J}%71\endinput72}73\def\fileversion{1.3b}74\def\filedate{2004/10/17}75\ProvidesFile{lstpatch.sty}[\filedate\space\fileversion\space (Carsten Heinz)]76%77% 0) Insert % after #1.78\def\@@xbitor #1{\@tempcntb \count#1%79\ifnum \@tempcnta =\z@80\else81\divide\@tempcntb\@tempcnta82\ifodd\@tempcntb \@testtrue\fi83\fi}84%85% 1) Reset \lst@newlines at end of escape.86\def\lstpatch@escape{%87\gdef\lst@Escape##1##2##3##4{%88\lst@CArgX ##1\relax\lst@CDefX89{}%90{\lst@ifdropinput\else91\lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken92\lst@InterruptModes93\lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%94\ifx\^^M##2%95\lst@CArg ##2\relax\lst@ActiveCDefX96{}%97{\lst@escapeend ##4\lst@LeaveAllModes\lst@ReenterModes}%98{\lst@MProcessListing}%99\else100\lst@CArg ##2\relax\lst@ActiveCDefX101{}%102{\lst@escapeend ##4\lst@LeaveAllModes\lst@ReenterModes103\lst@newlines\z@ \lst@whitespacefalse}%104{}%105\fi106##3\lst@escapebegin107\fi}%108{}}%109}110%111% 2) Deactivate \outer definition of ^^L temporarily (inside and outside112% of \lst@ScanChars) and restore \catcode at end of package.113\begingroup \catcode12=\active\let^^L\@empty114\gdef\lst@ScanChars{%115\let\lsts@ssL^^L%116\def^^L{\par}%117\lst@GetChars\lst@RestoreOrigCatcodes\@ne {128}%118\let^^L\lsts@ssL119\lst@GetChars\lst@RestoreOrigExtendedCatcodes{128}{256}}120\endgroup121\lst@lAddTo\lst@RestoreCatcodes{\catcode12\active}122%123% a) Let's start with the options:124\lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}%125\def\lst@rangeendprefix{#1}}126\lst@Key{rangesuffix}\relax{\def\lst@rangebeginsuffix{#1}%127\def\lst@rangeendsuffix{#1}}128\lst@Key{rangebeginprefix}{}{\def\lst@rangebeginprefix{#1}}129\lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}}130\lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}}131\lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}}132\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}\lst@ifincluderangemarker}133%134% The key is a redefinition of \lst@GLI@ checking for numbers.135\def\lst@GLI@#1-#2-#3\@nil{%136\lst@IfNumber{#1}%137{\ifx\@empty#1\@empty138\let\lst@firstline\@ne139\else140\def\lst@firstline{#1\relax}%141\fi142\ifx\@empty#3\@empty143\def\lst@lastline{9999999\relax}%144\else145\ifx\@empty#2\@empty146\let\lst@lastline\lst@firstline147\else148\def\lst@lastline{#2\relax}%149\fi150\fi}%151%152% If we've found a general marker, we set firstline and lastline to 9999999.153% This prevents (almost) anything to be printed for now.154{\def\lst@firstline{9999999\relax}%155\let\lst@lastline\lst@firstline156%157% We add the prefixes and suffixes to the markers.158\let\lst@rangebegin\lst@rangebeginprefix159\lst@AddTo\lst@rangebegin{#1}\lst@Extend\lst@rangebegin\lst@rangebeginsuffix160\ifx\@empty#3\@empty161\let\lst@rangeend\lst@rangeendprefix162\lst@AddTo\lst@rangeend{#1}\lst@Extend\lst@rangeend\lst@rangeendsuffix163\else164\ifx\@empty#2\@empty165\let\lst@rangeend\@empty166\else167\let\lst@rangeend\lst@rangeendprefix168\lst@AddTo\lst@rangeend{#2}\lst@Extend\lst@rangeend\lst@rangeendsuffix169\fi170\fi171% The following definition will be executed in the SelectCharTable hook172% and here right now if we are already processing a listing.173\global\def\lst@DefRange{\expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}%174\ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi}}175% \lst@DefRange is not inserted via a hook anymore. Instead it is now called176% directly from \lst@SelectCharTable. This was necessary to get rid of an177% interference with the escape-to-LaTeX-feature. The bug was reported by178% \lsthelper{Michael~Bachmann}{2004/07/21}{Keine label-Referenzierung179% m\"oglich...}. Another chance is due to the same bug: \lst@DefRange is180% redefined globally when the begin of code is found, see below. The bug was181% reported by \lsthelper{Tobias~Rapp}{2004/04/06}{undetected end of range if182% listing crosses page break} \lsthelper{Markus~Luisser}{2004/08/13}{Bug mit183% 'linerangemarker' in umgebrochenen listings}184%\lst@AddToHook{SelectCharTable}{\lst@DefRange}185\lst@AddToHookExe{DeInit}{\global\let\lst@DefRange\@empty}186%187% Actually defining the marker (via \lst@GLI@, \lst@DefRange, \lst@CArgX as188% seen above) is similar to \lst@DefDelimB---except that we unfold the first189% parameter and use different <execute>, <pre>, and <post> statements.190\def\lst@DefRangeB#1#2{\lst@DefRangeB@#1#2}191\def\lst@DefRangeB@#1#2#3#4{%192\lst@CDef{#1{#2}{#3}}#4{}%193{\lst@ifincluderangemarker194\lst@LeaveMode195\let#1#4%196\lst@DefRangeEnd197\lst@InitLstNumber198\else199\@tempcnta\lst@lineno \advance\@tempcnta\@ne200\edef\lst@firstline{\the\@tempcnta\relax}%201\gdef\lst@OnceAtEOL{\let#1#4\lst@DefRangeEnd}%202\lst@InitLstNumber203\fi204\global\let\lst@DefRange\lst@DefRangeEnd205\lst@CArgEmpty}%206\@empty}207%208% Modify labels and define |\lst@InitLstNumber| used above.209% \lsthelper{Omair-Inam~Abdul-Matin}{2004/05/10}{experimental linerange210% feature does not work with firstnumber}211\def\lstpatch@labels{%212\gdef\lst@SetFirstNumber{%213\ifx\lst@firstnumber\@undefined214\@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax215\ifnum\@tempcnta=\z@ \else216\lst@nololtrue217\advance\@tempcnta\lst@advancenumber218\edef\lst@firstnumber{\the\@tempcnta\relax}%219\fi220\fi}%221}222\lst@AddToAtTop\lsthk@PreInit223{\ifx\lst@firstnumber\@undefined224\def\lst@firstnumber{\lst@lineno}%225\fi}226\def\lst@InitLstNumber{%227\global\c@lstnumber\lst@firstnumber228\global\advance\c@lstnumber\lst@advancenumber229\global\advance\c@lstnumber-\lst@advancelstnum230\ifx \lst@firstnumber\c@lstnumber231\global\advance\c@lstnumber-\lst@advancelstnum232\fi}233%234% The end-marker is defined if and only if it's not empty. The definition is235% similar to \lst@DefDelimE---with the above exceptions and except that we236% define the re-entry point \lst@DefRangeE@@ as it is defined in the new237% version of \lst@MProcessListing above.238\def\lst@DefRangeEnd{%239\ifx\lst@rangeend\@empty\else240\expandafter\lst@CArgX\lst@rangeend\relax\lst@DefRangeE241\fi}242\def\lst@DefRangeE#1#2{\lst@DefRangeE@#1#2}243\def\lst@DefRangeE@#1#2#3#4{%244\lst@CDef{#1#2{#3}}#4{}%245{\let#1#4%246\edef\lst@lastline{\the\lst@lineno\relax}%247\lst@DefRangeE@@}%248\@empty}249\def\lst@DefRangeE@@#1\@empty{%250\lst@ifincluderangemarker251#1\lst@XPrintToken252\fi253\lst@LeaveModeToPmode254\lst@BeginDropInput{\lst@Pmode}}255%256\def\lst@LeaveModeToPmode{%257\ifnum\lst@mode=\lst@Pmode258\expandafter\lsthk@EndGroup259\else260\expandafter\egroup\expandafter\lst@LeaveModeToPmode261\fi}262%263% Eventually we shouldn't forget to install \lst@OnceAtEOL, which must264% also be called in \lst@MSkipToFirst.265\lst@AddToHook{EOL}{\lst@OnceAtEOL\global\let\lst@OnceAtEOL\@empty}266\gdef\lst@OnceAtEOL{}% Init267\def\lst@MSkipToFirst{%268\global\advance\lst@lineno\@ne269\ifnum \lst@lineno=\lst@firstline270\def\lst@next{\lst@LeaveMode \global\lst@newlines\z@271\lst@OnceAtEOL \global\let\lst@OnceAtEOL\@empty272\lst@InitLstNumber % Added to work with modified \lsthk@PreInit.273\lsthk@InitVarsBOL274\lst@BOLGobble}%275\expandafter\lst@next276\fi}277\def\lst@SkipToFirst{%278\ifnum \lst@lineno<\lst@firstline279\def\lst@next{\lst@BeginDropInput\lst@Pmode280\lst@Let{13}\lst@MSkipToFirst281\lst@Let{10}\lst@MSkipToFirst}%282\expandafter\lst@next283\else284\expandafter\lst@BOLGobble285\fi}286%287% Finally the service macro \lst@IfNumber:288\def\lst@IfNumber#1{%289\ifx\@empty#1\@empty290\let\lst@next\@firstoftwo291\else292\lst@IfNumber@#1\@nil293\fi294\lst@next}295\def\lst@IfNumber@#1#2\@nil{%296\let\lst@next\@secondoftwo297\ifnum`#1>47\relax \ifnum`#1>57\relax\else298\let\lst@next\@firstoftwo299\fi\fi}300%301% b) The following is known to fail with some keys.302\lst@Key{multicols}{}{\@tempcnta=0#1\relax\def\lst@multicols{#1}}303\def\lst@Init#1{%304\begingroup305\ifx\lst@float\relax\else306\edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}%307\expandafter\@tempa308\fi309% chmod begin310\ifx\lst@multicols\@empty\else311\edef\lst@next{\noexpand\multicols{\lst@multicols}}312\expandafter\lst@next313\fi314% chmod end315\ifhmode\ifinner \lst@boxtrue \fi\fi316\lst@ifbox317\lsthk@BoxUnsafe318\hbox to\z@\bgroup319$\if t\lst@boxpos \vtop320\else \if b\lst@boxpos \vbox321\else \vcenter \fi\fi322\bgroup \par\noindent323\else324\lst@ifdisplaystyle325\lst@EveryDisplay326\par\penalty-50\relax327\vspace\lst@aboveskip328\fi329\fi330\normalbaselines331\abovecaptionskip\lst@abovecaption\relax332\belowcaptionskip\lst@belowcaption\relax333\lst@MakeCaption t%334\lsthk@PreInit \lsthk@Init335\lst@ifdisplaystyle336\global\let\lst@ltxlabel\@empty337\if@inlabel338\lst@ifresetmargins339\leavevmode340\else341\xdef\lst@ltxlabel{\the\everypar}%342\lst@AddTo\lst@ltxlabel{%343\global\let\lst@ltxlabel\@empty344\everypar{\lsthk@EveryLine\lsthk@EveryPar}}%345\fi346\fi347\everypar\expandafter{\lst@ltxlabel348\lsthk@EveryLine\lsthk@EveryPar}%349\else350\everypar{}\let\lst@NewLine\@empty351\fi352\lsthk@InitVars \lsthk@InitVarsBOL353\lst@Let{13}\lst@MProcessListing354\let\lst@Backslash#1%355\lst@EnterMode{\lst@Pmode}{\lst@SelectCharTable}%356\lst@InitFinalize}357\def\lst@DeInit{%358\lst@XPrintToken \lst@EOLUpdate359\global\advance\lst@newlines\m@ne360\lst@ifshowlines361\lst@DoNewLines362\else363\setbox\@tempboxa\vbox{\lst@DoNewLines}%364\fi365\lst@ifdisplaystyle \par\removelastskip \fi366\lsthk@ExitVars\everypar{}\lsthk@DeInit\normalbaselines\normalcolor367\lst@MakeCaption b%368\lst@ifbox369\egroup $\hss \egroup370\vrule\@width\lst@maxwidth\@height\z@\@depth\z@371\else372\lst@ifdisplaystyle373\par\penalty-50\vspace\lst@belowskip374\fi375\fi376% chmod begin377\ifx\lst@multicols\@empty\else378\def\lst@next{\global\let\@checkend\@gobble379\endmulticols380\global\let\@checkend\lst@@checkend}381\expandafter\lst@next382\fi383% chmod end384\ifx\lst@float\relax\else385\expandafter\lst@endfloat386\fi387\endgroup}388\let\lst@@checkend\@checkend389%%390\endinput391%%392%% End of file `lstpatch.sty'.393394