123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- %%
- %% This is file `lstpatch.sty', generated manually.
- %%
- %% Please read the software license in listings.dtx or listings.dvi.
- %%
- %% (w)(c) 2002 Carsten Heinz
- %%
- %% This file is distributed under the terms of the LaTeX Project Public
- %% License from CTAN archives in directory macros/latex/base/lppl.txt.
- %% Either version 1.0 or, at your option, any later version.
- %%
- %% Send comments and ideas on the package, error reports and additional
- %% programming languages to <[email protected]>.
- %%
- %% This patch file will remove the following bugs from the listings package.
- %% Each item contains the bug finder with date of report and first bug fix
- %% version, a short description of the problem, and the reason for the bug
- %% in parenthesis.
- %%
- %% 1) Jochen Schneider, 2002/04/03, 1.0a (2002/04/05)
- %%
- %% undefined control sequence \lst@CommentB with HTML, XML, tcl
- %% (I didn't renamed them to \lst@DefDelimB|E)
- %%
- %% 2) Michael Niedermair, 2002/04/07, 1.0b
- %%
- %% undefined control sequence \lst@commentmode with XML
- %% (mode not defined any more)
- %%
- %% 3) Carsten Heinz, 2002/04/08, 1.0b
- %%
- %% bad PODs (investigating bugs 1 and 2)
- %% (definition doesn't use 1.0 style)
- %%
- %% 4) Peter Bartke, 2002/04/10, 1.0b
- %%
- %% various problems with fancyvrb interface: string ".5" at beginning
- %% of first line when using lineskip; ditto "perhaps a missing \item
- %% error"; wrong placed characters , and - when using fancyvrb
- %% (bad use of \strip@pt; TeX is not in vertical mode when leaving
- %% Verbatim; bad `noligs' handling)
- %%
- %% 5) Rolf Niepraschk, 2002/04/12, 1.0b
- %%
- %% \RequirePackage is missing keywordstyle when near the top of a page
- %% (\lst@lastother not saved away across page breaks)
- %%
- %% 6) Peter Ruckdeschel, 2002/04/12, 1.0b
- %% Timothy Van Zandt analyzed and fixed the bug
- %%
- %% incompatibility with seminar class
- %% (bad assignment of \lst@do@noligs in \lst@SelectCharTable)
- %%
- %% 7) Rene H. Larsen, 2002/04/12, 1.0b
- %%
- %% \lstinputlistings and texcl conflict
- %% (^^M not active to reenter modes)
- %%
- %% 8) Carsten Heinz, 2002/04/15, 1.0b (2002/04/15)
- %%
- %% gobble doesn't always work (investigating problem with VTeX)
- %% (\lst@BOLGobble@ must test against \lst@Process{FormFeed|Tabulator}X)
- %%
- %% 9) Peter Bartke, 2002/04/17, 1.0c
- %%
- %% TeX capacity exceeded with fancyvrb
- %% (\let\lst@entermodes\@empty must stay in \lstFV@VerbatimBegin)
- %%
- %% 10) Svend Tollak Munkejord, 2002/04/17, 1.0c
- %% Heiko Oberdiek analyzed and fixed the bug
- %%
- %% package incompatible with Lucida .fd files
- %% (parentheses have active catcodes when reading the file)
- %%
- %% 11) Carsten Hamm, 2002/04/19, 1.0c (2002/04/24)
- %%
- %% wrong frame rules with breaklines and xleftmargin>0pt
- %% (missing \kern-\lst@xleftmargin in \lst@discretionary)
- %%
- %% 12) Michael Niedermair, 2002/05/14, 1.0d
- %%
- %% backgroundcolor take effect on bottom captions
- %% (wrong order of \everypar{} and \lsthk@ExitVars in \lst@DeInit)
- %%
- %% 13) Georg Rehm, 2002/05/14, 1.0d
- %%
- %% bad baselineskip with captionpos=b
- %% (missing \normalbaselines)
- %%
- %% 14) Herfried Karl Wagner, 2002/05/11, 1.0d
- %%
- %% undefined control sequence \lst@entermodes
- %% (\output called before first \lst@EnterMode)
- %%
- %% 15) Peter K\"oller, 2002/05/24, 1.0d
- %%
- %% XML keywords don't have keywordstyle
- %% (missing \ifx... in implementation of contentsstyle)
- %%
- %% 16) Stephen Reindl, 2002/05/28, 1.0d
- %%
- %% \inaccessible using Cobol
- %% (\lst@Delim@option didn't enclose option in [])
- %%
- %% 17) Stephen Reindl, 2002/06/04, 1.0d (2002/06/12)
- %%
- %% frames not deactivated for text style listings
- %%
- %% 18) Carsten Heinz, 2002/07/27, 1.0e (2002/07/31)
- %%
- %% broken keywordcomments
- %% (\lst@KCpost inside group level 2; bad \lst@BeginComment call)
- %%
- %% 19) Kris Luyten, 2002/07/30, 1.0f (2002/08/03)
- %%
- %% Undefined control sequence \lst@thestyle
- %% (undefined \lst@directives after _loading_ C)
- %%
- %% 20) Kris Luyten, 2002/08/03, 1.0g (2002/08/06)
- %%
- %% Undefined control sequence \lst@thestyle
- %% (side effect of 19-bugfix on \lst@ProvideFamily)
- %%
- %% 21) Venkatesh Prasad Ranganath, 2002/08/31, 1.0h
- %%
- %% Undefined control sequence \thelstnumber with 0.21-option
- %% (\let must be changed to a \def inition)
- %%
- %% 22) Fermin Reig, 2002/09/04, 1.0h (2002/09/09)
- %%
- %% Bad top frame inside figure+centering
- %% (reset of leftskip, rightskip and parfillskip comes too late)
- %%
- %% 23) Hermann H\"uttler, 2002/10/05, 1.0i (2002/10/13)
- %%
- %% C++-string "... \\" does not end with second double quote
- %% (missing \let\lst@lastother\@empty in old fix)
- %%
- %%
- %% Moreover the following functionality is added.
- %%
- %% a) option "final" (Rolf Niepraschk, Enrico Straube)
- %%
- %% b) keys "fvcmdparams" and "morefvcmdparams" (Denis Girou)
- %%
- %% c) key "contentstyle" (Peter K\"oller)
- %%
- %% d) key "numberfirstline" (Georg Rehm)
- %%
- %%
- \ProvidesFile{lstpatch.sty}[2002/10/13 1.0i (Carsten Heinz)]
- \lst@CheckVersion{1.0}
- {\typeout{^^J%
- ***^^J%
- *** This is a patch for `listings.sty' version 1.0, but^^J%
- *** you're using version \lst@version.^^J%
- ***^^J
- *** Patch file not loaded.^^J%
- ***^^J}%
- \endinput
- }
- %
- % 1) Define the missing control sequences. (Not needed any more.)
- \def\lstpatch@comments{%
- \global\let\lst@CommentB\lst@DefDelimB
- \global\let\lst@CommentE\lst@DefDelimE}
- %
- % 2) Define \lst@commentmode.
- \lst@NewMode\lst@commentmode
- %
- % 3) Introduce \lst@ifxpodcomment as master-clause and define 1.0 style
- % contents for SelectCharTable.
- \def\lstpatch@pod{%
- \lst@Key{podcomment}{false}[t]{\lstKV@SetIf{##1}\lst@ifxpodcomment}%
- \lst@AddToHookExe{SetLanguage}{\let\lst@ifxpodcomment\iffalse}%
- \lst@AddToHook{SelectCharTable}%
- {\lst@ifxpodcomment
- \lst@CArgX =\relax\lst@DefDelimB{}{}%
- {\ifnum\@tempcnta=\z@
- \lst@ifprintpod\else
- \def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}%
- \expandafter\expandafter\expandafter\@gobblethree
- \fi
- \else
- \expandafter\@gobblethree
- \fi}%
- \lst@BeginComment\lst@PODmode{{\lst@commentstyle}}% modified
- \lst@CArgX =cut\^^M\relax\lst@DefDelimE
- {\lst@CalcColumn}%
- {\ifnum\@tempcnta=\z@\else
- \expandafter\@gobblethree
- \fi}%
- {}%
- \lst@EndComment\lst@PODmode
- \fi}%
- }
- %
- % 4) Redefine lineskip like podcomment above and don't use \strip@pt
- % together with \divide.
- \def\lstpatch@lineshape{%
- \lst@Key{lineskip}{\z@}{\def\lst@xlineskip{##1\relax}}
- \lst@AddToHook{Init}
- {\ifdim\z@=\lst@xlineskip\else
- \@tempdima\baselineskip
- \advance\@tempdima\lst@xlineskip
- \multiply\@tempdima\@cclvi
- \divide\@tempdima\baselineskip\relax
- \multiply\@tempdima\@cclvi
- \edef\baselinestretch{\strip@pt\@tempdima}%
- \selectfont
- \fi}%
- % 11) Add \kern-\lst@xleftmargin.
- \gdef\lst@discretionary{%
- \discretionary{\let\space\lst@spacekern\lst@prebreak}%
- {\llap{\lsthk@EveryLine
- \kern\lst@breakcurrindent\kern-\lst@xleftmargin}%
- \let\space\lst@spacekern\lst@postbreak}{}}%
- }
- % Back to 4): Insert \par for vertical mode.
- \def\lstpatch@fancyvrb{%
- \gdef\lstFV@VerbatimEnd{%
- \ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
- \global\setbox\lstFV@gtempboxa\box\@tempboxa
- \global\let\@gtempa\FV@ProcessLine
- \lst@mode\lst@Pmode
- \lst@DeInit
- \let\FV@ProcessLine\@gtempa
- \setbox\@tempboxa\box\lstFV@gtempboxa
- \par % modified
- \fi}%
- % 9) Redefined \lstFV@VerbatimBegin removed.
- % b) Refine conversion definitions to either work as usual or to ...
- \gdef\lst@FVConvert{\@tempcnta\z@ \lst@FVConvertO@}%
- \gdef\lst@FVConvertO@{%
- \ifcase\@tempcnta \expandafter
- \futurelet\expandafter\@let@token\expandafter\lst@FVConvert@@
- \else
- % append arguments as they are.
- \expandafter\lst@FVConvertO@a
- \fi}%
- \gdef\lst@FVConvertO@a##1{%
- \lst@lAddTo\lst@arg{{##1}}\advance\@tempcnta\m@ne
- \lst@FVConvertO@}%
- % Here, ...
- \gdef\lst@FVConvert@##1{%
- \ifx \@nil##1\else
- \if\relax\noexpand##1%
- \lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken##1}%
- % ... actually here, we check for commands with arguments and set the
- % value of \@tempcnta as required.
- \def\lst@temp####1,##1####2,####3####4\relax{%
- \ifx####3\@empty \else \@tempcnta####2\relax \fi}%
- \expandafter\lst@temp\lst@FVcmdparams,##1\z@,\@empty\relax
- \else
- \lccode`\~=`##1\lowercase{\lst@lAddTo\lst@arg~}%
- \fi
- \expandafter\lst@FVConvertO@
- \fi}
- % Eventually we define user keys to adjust \lst@FVcmdparams. The base
- % set of commands and parameter numbers was provided by Denis Girou.
- \lst@Key{fvcmdparams}%
- % D.G. suggestion begin - 2002/05/31
- {\overlay\@ne}%
- % D.G. suggestion end
- {\def\lst@FVcmdparams{,##1}}%
- \lst@Key{morefvcmdparams}\relax{\lst@lAddTo\lst@FVcmdparams{,##1}}%
- }
- %
- % 5) Extend \lst@SaveToken to save \lst@lastother.
- \def\lst@SaveToken{%
- \global\let\lst@gthestyle\lst@thestyle
- \global\let\lst@glastother\lst@lastother
- \xdef\lst@RestoreToken{\noexpand\lst@token{\the\lst@token}%
- \noexpand\lst@length\the\lst@length\relax
- \noexpand\let\noexpand\lst@thestyle
- \noexpand\lst@gthestyle
- \noexpand\let\noexpand\lst@lastother
- \noexpand\lst@glastother}%
- }
- %
- % 6) Assign \lst@do@noligs to \do.
- \def\lst@SelectCharTable{%
- \lst@SelectStdCharTable
- \lst@ifactivechars
- \catcode9\active \catcode12\active \catcode13\active
- \@tempcnta=32\relax
- \@whilenum\@tempcnta<128\do
- {\catcode\@tempcnta\active\advance\@tempcnta\@ne}%
- \fi
- \lst@ifec \lst@DefEC \fi
- \let\do\lst@do@noligs \verbatim@nolig@list % modified
- \lsthk@SelectCharTable
- \lst@DeveloperSCT
- \ifx\lst@Backslash\relax\else
- \lst@LetSaveDef{"5C}\lsts@backslash\lst@Backslash
- \fi}
- % 4)+6) And we need correct versions of \lst@do@noligs[@].
- \def\lst@do@noligs#1{%
- \begingroup \lccode`\~=`#1\lowercase{\endgroup
- \lst@do@noligs@~}}
- \def\lst@do@noligs@#1{%
- \expandafter\expandafter\expandafter\def
- \expandafter\expandafter\expandafter#1%
- \expandafter\expandafter\expandafter{\expandafter\lst@NoLig#1}}
- %
- % 7) Make ^^M active.
- \def\lst@InputListing#1{%
- \begingroup
- \lsthk@PreSet \gdef\lst@intname{#1}%
- \expandafter\lstset\expandafter{\lst@set}%
- \lsthk@DisplayStyle
- \catcode\active=\active % added
- \lst@Init\relax \let\lst@gobble\z@
- \lst@SkipToFirst
- \lst@ifprint \def\lst@next{\input{#1}}%
- \else \let\lst@next\@empty \fi
- \lst@next
- \lst@DeInit
- \endgroup}
- %
- % 8) Replace \lst@Process{FormFeed|Tabulator}.
- \def\lst@ProcessFormFeedX{\lst@ProcessFormFeed}
- \def\lst@ProcessTabulatorX{\lst@ProcessTabulator}
- \def\lst@BOLGobble@#1{%
- \let\lst@next#1%
- \ifx \lst@next\relax\else
- \ifx \lst@next\lst@MProcessListing\else
- \ifx \lst@next\lst@ProcessFormFeedX\else
- \ifx \lst@next\lstenv@backslash
- \let\lst@next\lstenv@BOLGobble@@
- \else
- \let\lst@next\lst@BOLGobble@@
- \ifx #1\lst@ProcessTabulatorX
- \advance\@tempcnta-\lst@tabsize\relax
- \ifnum\@tempcnta<\z@
- \lst@length-\@tempcnta \lst@PreGotoTabStop
- \fi
- \else
- \advance\@tempcnta\m@ne
- \fi
- \fi \fi \fi \fi
- \lst@next}
- %
- % 10) Add some \@makeother to \lst@nfss@catcodes.
- \def\lst@nfss@catcodes{%
- \lst@makeletter
- ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax
- \@makeother (\@makeother )\@makeother ,\@makeother :\@makeother &%
- \@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4%
- \@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9%
- \@makeother =\lsts@nfss@catcodes}
- %
- % 12) and 13) Deactivate \everypar and use normal baseline parameters.
- \lst@AddToHook{DeInit}{\everypar{}\normalbaselines}
- %
- % 14) Define \lst@entermodes.
- \let\lst@entermodes\@empty
- %
- % 16) Insert [ and ] in replacement text.
- \def\lst@Delim@option[#1]{\def\lst@arg{[#1]}\lst@Delim@delim}
- %
- % 17) Just empty `frame' and top, right, bottom, and left shape.
- \lst@AddToHook{TextStyle}
- {\let\lst@frame\@empty
- \let\lst@frametshape\@empty
- \let\lst@framershape\@empty
- \let\lst@framebshape\@empty
- \let\lst@framelshape\@empty}
- %
- % 18) Execute \lst@BeginKC and \lst@BeginKCS outside the two groups.
- % Modify third argument to \lst@BeginComment to work properly.
- \def\lstpatch@keywordcomments{%
- \gdef\lst@BeginKC{\aftergroup\aftergroup\aftergroup\lst@BeginKC@}%
- \gdef\lst@BeginKC@{%
- \lst@ResetToken
- \lst@BeginComment\lst@KCmode{{\lst@commentstyle}\lst@modetrue}\@empty}%
- \gdef\lst@BeginKCS{\aftergroup\aftergroup\aftergroup\lst@BeginKCS@}%
- \gdef\lst@BeginKCS@{%
- \lst@ResetToken
- \lst@BeginComment\lst@KCSmode{{\lst@commentstyle}\lst@modetrue}\@empty}%
- \gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken
- \let\lst@thestyle\lst@identifierstyle \lsthk@Output}% renew style selection
- }
- %
- % 19) Init \lst@directives.
- \def\lstpatch@directives{%
- \global\let\lst@directives\@empty}
- %
- % 20) Use new prefix for a family -- the now initialized \lst@directives
- % clashes with the default.
- \def\lstpatch@keywords{%
- \gdef\lst@ProvideFamily##1{%
- \@ifundefined{lstfam@##1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}%
- {\@namedef{lstfam@##1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}{}%
- \expandafter\expandafter\expandafter\lst@ProvideFamily@
- \csname\@lst @##1@data\endcsname
- {\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}%
- {}}%
- }
- % 21) Define \thelstnumber every listing via \def.
- \@namedef{lstpatch@021}{%
- \lst@AddToHook{Init}{\def\thelstnumber{\thelstlabel}}%
- }
- % 22) Reset the registers in PreInit hook
- \lst@AddToHook{PreInit}
- {\rightskip\z@ \leftskip\z@ \parfillskip\z@ plus 1fil}
- %
- % 23) Add \let\lst@lastother\@empty
- \lst@AddToHook{SelectCharTable}{%
- \lst@ifbstring
- \lst@CArgX \\\\\relax \lst@CDefX{}%
- {\lst@ProcessOther\lstum@backslash
- \lst@ProcessOther\lstum@backslash
- \let\lst@lastother\@empty}%
- {}%
- \fi}
- %
- % a) Just declare the option.
- \DeclareOption{final}{\let\lst@ifdraft\iffalse}
- %
- % c) Define contentstyle and use it.
- \def\lstpatch@html{%
- \lst@Key{contentstyle}{}{\def\lst@contentstyle{##1}}%
- \lst@AddToHook{Init}%
- {\ifx\lst@DefInside\@empty\else
- \let\lst@tagstyle\lst@identifierstyle
- \let\lst@identifierstyle\lst@contentstyle
- \fi}%
- \lst@AddToHook{Output}%
- {\ifnum\lst@mode=\lst@insidemode
- % 15) Check for keywordstyle.
- \ifx\lst@thestyle\lst@gkeywords@sty\else
- \lst@ifusekeysinside \let\lst@thestyle\lst@tagstyle
- \else \let\lst@thestyle\lst@gkeywords@sty \fi
- \fi\fi}%
- \lst@AddToHook{OutputOther}%
- {\lst@ifmode\else \ifnum\lst@mode=\lst@insidemode\else
- \ifx\lst@DefInside\@empty\else
- \let\lst@thestyle\lst@contentstyle
- \fi
- \fi\fi}%
- }
- %
- % d) Define key and adjust \lst@SkipOrPrintLabel.
- \def\lstpatch@labels{%
- \lst@Key{numberfirstline}{f}[t]{\lstKV@SetIf{##1}\lst@ifnumberfirstline}%
- \gdef\lst@numberfirstlinefalse{\let\lst@ifnumberfirstline\iffalse}
- \gdef\lst@SkipOrPrintLabel{%
- \ifnum\lst@skipnumbers=\z@
- \global\advance\lst@skipnumbers-\lst@stepnumber\relax
- \lst@PlaceNumber
- \lst@numberfirstlinefalse
- \else
- \lst@ifnumberfirstline
- \lst@PlaceNumber
- \lst@numberfirstlinefalse
- \fi
- \fi
- \global\advance\lst@skipnumbers\@ne}%
- }
- %%
- \endinput
- %%
- %% End of file `lstpatch.sty'.
|