1 |
tim |
2685 |
%% |
2 |
|
|
%% This is file `lstpatch.sty', generated manually. |
3 |
|
|
%% |
4 |
|
|
%% Please read the software license in listings.dtx or listings.dvi. |
5 |
|
|
%% |
6 |
|
|
%% (w)(c) 2003 Carsten Heinz |
7 |
|
|
%% |
8 |
|
|
%% This file is distributed under the terms of the LaTeX Project Public |
9 |
|
|
%% License from CTAN archives in directory macros/latex/base/lppl.txt. |
10 |
|
|
%% Either version 1.0 or, at your option, any later version. |
11 |
|
|
%% |
12 |
|
|
%% Send comments and ideas on the package, error reports and additional |
13 |
|
|
%% programming languages to <cheinz@gmx.de>. |
14 |
|
|
%% |
15 |
|
|
%% This patch file will remove the following bugs from the listings package. |
16 |
|
|
%% Each item contains the bug finder with date of report and first bug fix |
17 |
|
|
%% version, a short description of the problem, and the reason for the bug |
18 |
|
|
%% in parenthesis. |
19 |
|
|
%% |
20 |
|
|
%% 1) Werner Struckmann, 2003/06/25, 1.1a (2003/06/25) |
21 |
|
|
%% |
22 |
|
|
%% undefined control sequence \lst@name |
23 |
|
|
%% (init of \lst@name not moved up to \lst@MakeCaption) |
24 |
|
|
%% |
25 |
|
|
%% 2) Denis Girou, 2003/07/04, 1.1b |
26 |
|
|
%% |
27 |
|
|
%% problem in list environments with fancyvrb=true |
28 |
|
|
%% (wrong \linewidth used) |
29 |
|
|
%% |
30 |
|
|
%% 3) Carsten Heinz, 2003/07/05, 1.1b |
31 |
|
|
%% |
32 |
|
|
%% indentation outside list environments with fancyvrb=true |
33 |
|
|
%% (unremoved par indentation) |
34 |
|
|
%% |
35 |
|
|
%% 4) Jared Warren, 2003/07/10, 1.1b |
36 |
|
|
%% |
37 |
|
|
%% literate replacement produces "ghosts" |
38 |
|
|
%% (\lst@BeginDropInput did not suppress output) |
39 |
|
|
%% |
40 |
|
|
%% 5) David Aspinall, 2003/07/17, 1.1b |
41 |
|
|
%% |
42 |
|
|
%% loading of .fd file inside tabular produces error |
43 |
|
|
%% (& in \lst@nfss@catcodes must be \&) |
44 |
|
|
%% |
45 |
|
|
%% 6) Edsko de Vries, 2003/07/20, 1.1b (2003/07/22) |
46 |
|
|
%% |
47 |
|
|
%% bad keywords with language selections only in optional arguments |
48 |
|
|
%% (\lst@ProvideFamily defined a marker only locally) |
49 |
|
|
%% |
50 |
|
|
%% |
51 |
|
|
%% Moreover the following features have been added. |
52 |
|
|
%% |
53 |
|
|
%% a) directive delimiter is adjustable: moredelim=*[directive]\# |
54 |
|
|
%% |
55 |
|
|
%% |
56 |
|
|
\ProvidesFile{lstpatch.sty}[2003/08/13 1.1c (Carsten Heinz)] |
57 |
|
|
\lst@CheckVersion{1.1} |
58 |
|
|
{\typeout{^^J% |
59 |
|
|
***^^J% |
60 |
|
|
*** This is a patch for listings 1.1, but you're using^^J% |
61 |
|
|
*** version \lst@version.^^J% |
62 |
|
|
***^^J |
63 |
|
|
*** Patch file not loaded.^^J% |
64 |
|
|
***^^J}% |
65 |
|
|
\endinput |
66 |
|
|
} |
67 |
|
|
% |
68 |
|
|
% 1) Insert initialization of \lst@name ... |
69 |
|
|
\def\lst@MakeCaption#1{% |
70 |
|
|
\ifx #1t% |
71 |
|
|
\ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else |
72 |
|
|
\expandafter\refstepcounter |
73 |
|
|
\fi {lstlisting}% |
74 |
|
|
\ifx\lst@label\@empty\else \label{\lst@label}\fi |
75 |
|
|
% ... here. |
76 |
|
|
\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl |
77 |
|
|
\global\let\lst@name\lst@arg \global\let\lstname\lst@name |
78 |
|
|
\lst@ifnolol\else |
79 |
|
|
\ifx\lst@@caption\@empty |
80 |
|
|
\ifx\lst@caption\@empty |
81 |
|
|
\ifx\lst@intname\@empty \else \def\lst@temp{ }% |
82 |
|
|
\ifx\lst@intname\lst@temp \else |
83 |
|
|
\addcontentsline{lol}{lstlisting}\lst@name |
84 |
|
|
\fi\fi |
85 |
|
|
\fi |
86 |
|
|
\else |
87 |
|
|
\addcontentsline{lol}{lstlisting}% |
88 |
|
|
{\protect\numberline{\thelstlisting}\lst@@caption}% |
89 |
|
|
\fi |
90 |
|
|
\fi |
91 |
|
|
\fi |
92 |
|
|
\ifx\lst@caption\@empty\else |
93 |
|
|
\lst@IfSubstring #1\lst@captionpos |
94 |
|
|
{\begingroup \let\@@vskip\vskip |
95 |
|
|
\def\vskip{\afterassignment\lst@vskip \@tempskipa}% |
96 |
|
|
\def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak}% |
97 |
|
|
\par\normalsize\normalfont |
98 |
|
|
\ifx #1t\allowbreak \fi |
99 |
|
|
\ifx\lst@title\@empty |
100 |
|
|
\expandafter\@makecaption |
101 |
|
|
\else |
102 |
|
|
\expandafter\lst@maketitle |
103 |
|
|
\fi |
104 |
|
|
{\noindent\lstlistingname |
105 |
|
|
\ifx\lst@@caption\@empty\else~\thelstlisting\fi}% |
106 |
|
|
\lst@caption |
107 |
|
|
\ifx #1b\allowbreak \fi |
108 |
|
|
\endgroup}{}% |
109 |
|
|
\fi} |
110 |
|
|
% |
111 |
|
|
% 2) Save \linewidth and restore it after initialization. |
112 |
|
|
\def\lstpatch@fancyvrb{% |
113 |
|
|
\gdef\lstFV@VerbatimBegin{% |
114 |
|
|
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine |
115 |
|
|
\lsthk@TextStyle \lsthk@BoxUnsafe |
116 |
|
|
\lsthk@PreSet |
117 |
|
|
\lst@activecharsfalse |
118 |
|
|
\let\normalbaselines\relax |
119 |
|
|
\xdef\lstFV@RestoreData{\noexpand\linewidth\the\linewidth\relax}% |
120 |
|
|
\lst@Init\relax |
121 |
|
|
\lst@ifresetmargins \advance\linewidth-\@totalleftmargin \fi |
122 |
|
|
\lstFV@RestoreData |
123 |
|
|
\everypar{}\global\lst@newlines\z@ |
124 |
|
|
\lst@mode\lst@nomode \let\lst@entermodes\@empty |
125 |
|
|
\lst@InterruptModes |
126 |
|
|
%% D.G. modification begin - Nov. 25, 1998 |
127 |
|
|
\let\@noligs\relax |
128 |
|
|
%% D.G. modification end |
129 |
|
|
\fi}% |
130 |
|
|
% 3) Change \leavevmode to \noindent. |
131 |
|
|
\gdef\lstFV@FancyVerbFormatLine##1{% |
132 |
|
|
\let\lst@arg\@empty \lst@FVConvert##1\@nil |
133 |
|
|
\global\lst@newlines\z@ |
134 |
|
|
\vtop{\noindent\lst@parshape |
135 |
|
|
\lst@ReenterModes |
136 |
|
|
\lst@arg \lst@PrintToken\lst@EOLUpdate\lsthk@InitVarsBOL |
137 |
|
|
\lst@InterruptModes}}% |
138 |
|
|
} |
139 |
|
|
% |
140 |
|
|
% 4) Suppress the output by \let\lst@OutputBox\@gobble and ... |
141 |
|
|
\def\lst@BeginDropInput#1{% |
142 |
|
|
\lst@EnterMode{#1}% |
143 |
|
|
{\lst@modetrue |
144 |
|
|
\let\lst@OutputBox\@gobble |
145 |
|
|
\let\lst@ifdropinput\iftrue |
146 |
|
|
\let\lst@Process@i\@gobble |
147 |
|
|
\let\lst@Process@n\@gobble |
148 |
|
|
\let\lst@Process@m\@gobble |
149 |
|
|
\let\lst@ProcessSpace\@empty |
150 |
|
|
\let\lst@ProcessTabulator\@empty |
151 |
|
|
\let\lst@ProcessFormFeed\@empty}} |
152 |
|
|
% check for it here: |
153 |
|
|
\def\lst@Literate#1#2#3{% |
154 |
|
|
\ifx\relax#2\@empty\else |
155 |
|
|
\lst@ReplaceInput{#1}% |
156 |
|
|
{\ifx\lst@OutputBox\@gobble\else |
157 |
|
|
\lst@XPrintToken \let\lst@scanmode\lst@scan@m |
158 |
|
|
\lst@token{#2}\lst@length#3\relax |
159 |
|
|
\lst@XPrintToken |
160 |
|
|
\fi}% |
161 |
|
|
\expandafter\lst@Literate |
162 |
|
|
\fi} |
163 |
|
|
% |
164 |
|
|
% 5) Change & to \& at the end of line number four. |
165 |
|
|
\def\lst@nfss@catcodes{% |
166 |
|
|
\lst@makeletter |
167 |
|
|
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax |
168 |
|
|
\@makeother (\@makeother )\@makeother ,\@makeother :\@makeother\&% |
169 |
|
|
\@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4% |
170 |
|
|
\@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9% |
171 |
|
|
\@makeother =\lsts@nfss@catcodes} |
172 |
|
|
% |
173 |
|
|
% 6) Insert \global in front of \@namedef. |
174 |
|
|
\def\lstpatch@keywords{% |
175 |
|
|
\gdef\lst@ProvideFamily##1{% |
176 |
|
|
\@ifundefined{lstfam@##1\ifnum\@tempcnta=\@ne\else\the\@tempcnta\fi}% |
177 |
|
|
{\global\@namedef{lstfam@##1\ifnum\@tempcnta=\@ne\else \the\@tempcnta\fi}{}% |
178 |
|
|
\expandafter\expandafter\expandafter\lst@ProvideFamily@ |
179 |
|
|
\csname\@lst @##1@data\endcsname |
180 |
|
|
{\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}% |
181 |
|
|
{}}% |
182 |
|
|
} |
183 |
|
|
% |
184 |
|
|
% a) Define new delimiter type `directive'. |
185 |
|
|
\def\lstpatch@directives{% |
186 |
|
|
\lst@AddTo\lst@delimtypes{,directive} |
187 |
|
|
\gdef\lst@Delim@directive##1\@empty##2##3##4{% |
188 |
|
|
\lst@CArg ##1\relax\lst@DefDelimB |
189 |
|
|
{\lst@CalcColumn}% |
190 |
|
|
{}% |
191 |
|
|
{\ifnum\@tempcnta=\z@ |
192 |
|
|
\def\lst@bnext{##2\lst@CDmode{##4\lst@Lmodetrue}% |
193 |
|
|
\let\lst@currstyle\lst@directivestyle}% |
194 |
|
|
\fi |
195 |
|
|
\@gobblethree}% |
196 |
|
|
##2\lst@CDmode{##4\lst@Lmodetrue}% |
197 |
|
|
}% Disable old mechanism. |
198 |
|
|
\lst@AddToHook{SelectCharTable} |
199 |
|
|
{\ifx\lst@directives\@empty\else |
200 |
|
|
\lst@Let{`\#}\lsts@CCD |
201 |
|
|
\fi}% |
202 |
|
|
} |
203 |
|
|
%% |
204 |
|
|
\endinput |
205 |
|
|
%% |
206 |
|
|
%% End of file `lstpatch.sty'. |