blob: a1707a6a02f66923f8bab72a04eff7669f2a8d58 (
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
173
174
175
176
|
% File: classlist.sty
% Version: 2005/06/19 v1.1
% Author: Heiko Oberdiek
% Email: <oberdiek@uni-freiburg.de>
%
% Copyright: Copyright (C) 2005 Heiko Oberdiek.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any later
% version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
% LaTeX version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% This Current Maintainer of this work is Heiko Oberdiek.
%
% Function: This package records the loaded classes and stores
% them in a list.
%
% Background: This packages is an answer of a newsgroup question:
% Newsgroup: comp.text.tex
% Subject: Finding the Document Class
% From: Herber Schulz <>
% Date: 18 Jun 2005 13:16:49 -0500
% Message-ID:
% <herbs-D55DB9.13170418062005@news.isp.giganews.com>
%
% Use: Load this package before \documentclass:
% \RequirePackage{classlist}
% \documentclass[some,options]{whatever}
%
% If used after \documentclass, \@filelist is
% parsed for classes. The additional data
% specified options and requested version is no
% longer available here.
%
% \MainClass contains the first loaded class.
% \ClassList stores the class entries, eg.
% \ClassList -> \ClassListEntry{myarticle}{a4paper}{}
% \ClassListEntry{article}{}{}
% \ClassListEntry has three arguments:
% #1: class name
% #2: options given in \documentclass/\LoadClass
% #3: requested version, not the version of class
% \PrintClassList prints the list on screen it can be
% configured by
% \PrintClassListTitle for the title and
% \PrintClassListEntry for formatting the entries.
%
% History:
% 2005/06/19 v1.0:
% * first published version
% (comp.text.tex, CTAN).
% 2005/06/19 v1.1:
% * After \documentclass the package looks
% at \@filelist instead of aborting with error.
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{classlist}%
[2005/06/19 v1.0 Record loaded classes (HO)]
\let\ClassList\@empty
\let\MainClassName\relax
\ifx\@classoptionslist\relax
% before \documentclass
\let\CL@org@fileswith@pti@ns\@fileswith@pti@ns
\def\@fileswith@pti@ns#1[#2]#3[#4]{%
% #1: \@clsextension
% #2: options of \documentclass/\LoadClass
% #3: class name
% #4: requested version
\ifx#1\@clsextension
\@ifl@aded#1{#3}{%
\PackageInfo{classlist}{%
Skipping class `#3', because\MessageBreak
this class is already loaded%
}%
}{%
\@ifundefined{MainClassName}{%
\def\MainClassName{#3}%
}{}%
\@temptokena\expandafter{%
\ClassList
\ClassListEntry{#3}{#2}{#4}%
}%
\edef\ClassList{\the\@temptokena}%
}%
\fi
\CL@org@fileswith@pti@ns{#1}[{#2}]{#3}[{#4}]%
}
\else
% after \documentclass
\PackageInfo{classlist}{Use \string\@filelist\space method}%
\let\ClassListEntry\relax
\expandafter\def\expandafter\CL@test
\expandafter#\expandafter1\@clsextension#2\@nil{%
\ifx\\#2\\%
% name does not contain \@clsextension
\else
\expandafter\CL@test@i\CL@entry\@nil
\fi
}%
\expandafter\def\expandafter\CL@test@i
\expandafter#\expandafter1\@clsextension#2\@nil{%
\ifx\\#2\\%
\@ifundefined{opt@\CL@entry}{%
}{%
\@ifundefined{MainClassName}{%
\let\MainClassName\CL@entry
}{%
}%
\edef\ClassList{%
\ClassList
\ClassListEntry{\CL@entry}{}{}%
}%
}%
\else
% names with more than one \@clsextension are not supported.
\fi
}
\@for\CL@entry:=\@filelist\do{%
\expandafter\expandafter\expandafter\CL@test\expandafter
\CL@entry\@clsextension\@nil
}%
\fi
\providecommand*{\PrintClassListEntry}[3]{%
\toks@{* #1}%
\typeout{\the\toks@}%
}
\providecommand*{\PrintClassListTitle}{%
\typeout{Class list:}%
}
\providecommand*{\PrintClassList}{%
\begingroup
\let\ClassListEntry\PrintClassListEntry
\PrintClassListTitle
\ClassList
\endgroup
}
\def\CL@InfoEntry#1#2#3{%
\advance\count@ by \@ne
\def\x{#2}%
\@onelevel@sanitize\x
\edef\CL@Info{%
\CL@Info
\noexpand\MessageBreak
(\the\count@) %
#1 [\x]%
\ifx\\#3\\%
\else
\space[#3]%
\fi
}%
}
\AtBeginDocument{%
\begingroup
\count@=\z@
\def\CL@Info{Class List:}%
\let\ClassListEntry\CL@InfoEntry
\ClassList
\let\on@line\@empty
\PackageInfo{classlist}{\CL@Info}
\endgroup
}
\endinput
|