blob: a38d206c9473fbd24e2c4067381f67461dad16c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
%%
%% This is file `srcltx.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% srcltx.dtx (with options: `package,latex')
%%
%% This package is in the public domain. It comes with no guarantees
%% and no reserved rights. You can use or modify this package at your
%% own risk.
%% Originally written by: Aleksander Simonic
%% Current maintainer: Stefan Ulrich <stefanulrich@users.sourceforge.net>
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{srcltx}[2006/11/12 v1.6 Source specials for inverse search in DVI files]
\newif\ifSRCOK \SRCOKtrue
\newif\ifsrc@debug@
\newif\ifsrc@dviwin@
\newif\ifsrc@winedt@\src@winedt@true
\newif\ifsrc@everypar@\src@everypar@true
\newif\ifsrc@everymath@\src@everymath@true
\RequirePackage{ifthen}
\DeclareOption{active}{\SRCOKtrue}
\DeclareOption{inactive}{\SRCOKfalse}
\DeclareOption{nowinedt}{\src@winedt@false}
\DeclareOption{debug}{\src@debug@true}
\DeclareOption{nopar}{\global\src@everypar@false}
\DeclareOption{nomath}{\global\src@everymath@false}
\newcommand*\src@maybe@space{}
\let\src@maybe@space\space
\DeclareOption{dviwin}{\let\src@maybe@space\relax}
\ExecuteOptions{active}
\ProcessOptions
\newcount\src@lastline
\global\src@lastline=-1
\newcommand*\src@debug{}
\def\src@debug#1{\ifsrc@debug@\typeout{DBG: |#1|}\fi}
\newcommand*\MainFile{}
\def\MainFile{\jobname.tex}
\newcommand*\CurrentInput{}
\gdef\CurrentInput{\MainFile}
\newcommand*\WinEdt{}
\def\WinEdt#1{\ifsrc@winedt@\typeout{:#1}\fi}
\newcommand\src@AfterFi{}
\def\src@AfterFi#1\fi{\fi#1}
\AtBeginDocument{%
\@ifpackageloaded{soul}{%
\let\src@SOUL@\SOUL@
\def\SOUL@#1{%
\ifSRCOK
\SRCOKfalse\src@SOUL@{#1}\SRCOKtrue
\else
\src@AfterFi\src@SOUL@{#1}%
\fi
}%
}{}%
}
\newcommand*\srcIncludeHook[1]{\protected@xdef\CurrentInput{#1.tex}}
\newcommand*\srcInputHook[1]{%
\src@getfilename@with@ext{#1}%
}
\newcommand*\src@spec{}
\def\src@spec{%
\ifSRCOK
\ifnum\inputlineno>\src@lastline
\global\src@lastline=\inputlineno
\src@debug{%
src:\the\inputlineno\src@maybe@space\CurrentInput}%
\special{src:\the\inputlineno\src@maybe@space\CurrentInput}%
\fi
\fi
}
\newcommand\src@before@file@hook{}
\newcommand\src@after@file@hook{}
\def\src@before@file@hook{%
\WinEdt{<+ \CurrentInput}%
\global\src@lastline=0
\ifSRCOK\special{src:1\src@maybe@space\CurrentInput}\fi
}
\def\src@after@file@hook#1{%
\WinEdt{<-}%
\global\src@lastline=\inputlineno
\global\advance\src@lastline by -1%
\gdef\CurrentInput{#1}%
\src@spec
}
\newcommand*\src@fname{}%
\newcommand*\src@tempa{}%
\newcommand*\src@extensions@path{}%
\newcommand*\src@getfilename@with@ext{}%
\def\src@extensions@path#1.#2\end{%
\ifthenelse{\equal{#2}{}}{%
\protected@edef\src@extensions@last{#1}%
\let\src@tempa\relax
}{%
\def\src@tempa{\src@extensions@path#2\end}%
}%
\src@tempa
}
\def\src@getfilename@with@ext#1{%
\expandafter\src@extensions@path#1.\end
\ifthenelse{\equal{\src@extensions@last}{tex}}{%
\protected@xdef\CurrentInput{#1}%
}{%
\protected@xdef\CurrentInput{#1.tex}%
}%
\PackageInfo{srcltx}{Expanded filename `#1' to `\CurrentInput'}%
}
\newcommand*\src@include{}
\newcommand*\src@@include{}
\let\src@include\include
\def\include#1{%
\src@spec
\clearpage
\expandafter\src@@include\expandafter{\CurrentInput}{#1}%
}%
\def\src@@include#1#2{%
\srcIncludeHook{#2}%
\src@before@file@hook
\src@include{#2}%
\src@after@file@hook{#1}%
}
\newcommand*\src@input{}
\newcommand*\src@@input{}
\newcommand*\src@@@input{}
\let\src@input\input
\def\input{\src@spec\@ifnextchar\bgroup\src@@input\@@input}%
\def\src@@input#1{%
\expandafter\src@@@input\expandafter{\CurrentInput}{#1}%
}
\def\src@@@input#1#2{%
\srcInputHook{#2}%
\src@before@file@hook
\src@input{#2}%
\src@after@file@hook{#1}%
}
\newcommand\Input{}
\let\Input\input
\ifsrc@everypar@
\newcommand*\src@old@everypar{}
\let\src@old@everypar\everypar
\newtoks\src@new@everypar
\let\everypar\src@new@everypar
\everypar\expandafter{\the\src@old@everypar}
\src@old@everypar{\the\src@new@everypar\src@spec}
\fi
\ifsrc@everymath@
\def\@tempa#1\the\everymath#2\delimiter{{#1\src@spec\the\everymath#2}}
\frozen@everymath=\expandafter\@tempa\the\frozen@everymath\delimiter
\fi
\newcommand*\src@bibliography{}
\newcommand*\src@@bibliography{}
\let\src@bibliography\bibliography
\def\bibliography#1{%
\expandafter\src@@bibliography\expandafter{\CurrentInput}{#1}%
}
\def\src@@bibliography#1#2{%
\protected@xdef\CurrentInput{\jobname.bbl}%
\src@before@file@hook
\src@bibliography{#2}%
\src@after@file@hook{#1}%
}
\newcommand*\src@old@output{}
\let\src@old@output\output
\newtoks\src@new@output
\let\output\src@new@output
\output\expandafter{\the\src@old@output}
\src@old@output{\SRCOKfalse\the\src@new@output}
\endinput
%%
%% End of file `srcltx.sty'.
|