summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/listofsymbols/listofsymbols.dtx
blob: 50a8ec903b9772b7eb3c3f2fe7c55fef9e771eb1 (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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
% \title{The \verb|listofsymbols.sty| package (v0.2)}
% \author{Stefan Spreng}
% \date{August 2003}
% \maketitle
%
%\newcommand{\ar}[1]{{\sl #1}}
%\setlength{\parindent}{0cm}
%\setlength{\parskip}{1.5ex plus0.5ex minus0.3ex}
%
%\begin{abstract}
%  \verb|listofsymbols| provides commands to (a) automatically create a list of
%  symbols (also called notation or nomenclature) and (b)
%  handle symbols logically, i.e. use a command that is expanded to the
%  desired output rather than `hardcoding' the output into the text.
%  
%  This helps to ensure consistency throughout the text, especially if
%  there is a chance that symbols will be changed at some stage. 
%  Additionally, you can keep all definitions of symbols in a separate file.
%  
%  This package is more or less a combination of what the packages
%  \verb|nomencl.sty| and \verb|formula.sty| do. The concept of
%  creating the list of symbols, though, is different from the way
%  \verb|nomencl.sty| does it.
%\end{abstract}
%
%\tableofcontents
%
%\newpage
%
%\section{User Interface}
%
%\subsection{Options}
%
%\begin{description}
%\item[draft] Default.
%\item[final] Removes the macronames from the lists. Symbols that are 
%  not used in the document are omitted from the List of Symbols and 
%  from the List of Subscripts.
%\item[Final] Similar to \verb|final|. The difference is that the
%  \verb|.sym| and \verb|.sub| files are not changed any more. Use this
%  mode when your document is ready and you have sorted the \verb|.sym|
%  and \verb|.sub| files manually.
%\item[nomencl] Typesetting the list of symbols with the package
%  \verb|nomencl| (symbols and subscripts are in one list). With this
%  option, the macros described in this documentation call the
%  appropriate commands that \verb|nomencl.sty| provides. See the
%  documentation of \verb|nomencl.sty| for details of the layout.
%\item[nopageno] Default.
%\item[pageno] Inserts the number of the page on which a symbol or
%  subscript is defined.
%\item[usexspace] Default. Uses the package \verb|xspace| to insert an
%  `intelligent' space after the commands.
%\item[noxspace] Do not load package \verb|xspace|. In this case a
%  command must by followed by a backslash and a space if you want a
%  space in the output (This is the LaTeX standard).
%\end{description}
%
%You can use only one of the options \verb|draft|, \verb|final|,
%\verb|Final| or \verb|nomencl| and only one of the options
%\verb|nopageno| or \verb|pageno|.
%
%\subsection{Macros}
%
%\DescribeMacro{\opensymdef} \DescribeMacro{\closeymdef} All
%\verb|\newsym| and \verb|\newsub| commands must be between the commands
%\verb|\opensymdef| and \verb|\closesymdef|. A \verb|\listofsymbols| or a
%\verb|\listofsubscripts| must be outside the region enclosed by these
%commands. Otherwise you will get errors. See section
%\ref{sec:examples} for examples.
%
%\DescribeMacro{\newsym}
%The macro \verb|\newsym| assigns the desired output of a symbol or
%variable to a macro which can thereafter be used like any other macro.
%\verb|\newsym| takes one optional argument and two mandatory arguments.
%\begin{quote}
%\verb|\newsym[| \ar{description} \verb|]{| \ar{macroname} \verb|}{| \ar{output} \verb|}|
%\end{quote}
%The optional argument is the description that will appear in the list of symbols.
%The first mandatory argument is the name of the macro and the second mandatory
%argument is the desired output. Note that the definition of \verb|\newsym| includes 
%\ar{output} in a \verb|\ensuremath{}| command.
%If there is no \ar{description} then the symbol is included in the list of symbols in 
%\verb|draft| mode, but not in \verb|final| mode.
%
%Examples can be found in section \ref{sec:examples}.
%You will probably notice that all the macros start with \verb|sym|. That's because 
%I think that this makes it easier to distinguish between symbols and other
%macros you define in a document. Personally, I use a \verb|y| and an
%\verb|s| as the first characters to indicate that a command is a symbol or 
%a subscript, it's shorter \ldots
%
%The description of a macro can be accessed with \verb|doc| appended to
%the macroname. A string that can be used inside a \verb|tabular|
%environment can be obtained by appending \verb|tabdoc| to the
%command. If \verb|tabdoc| is appended, then the macro expands to\\
%\ar{output}\verb| & |\ar{description}
%
%Example:
%\begin{verbatim}
%\newsym[Energy]{symE}{E}
%The symbol \symE means \symEdoc

%\begin{tabular}{ll}
%Symbol&Description\\
%\symEtabdoc\\
%\end{tabular}
%\end{verbatim}
%
%
%\DescribeMacro{\newsub}
%The macro \verb|\newsub| creates a subscript much in the same way as \verb|\newsym|
%creates a symbol. The syntax is
%\begin{quote}
%\verb|\newsub[| \ar{description} \verb|]{| \ar{subscriptname} \verb|}{| \ar{output} \verb|}|
%\end{quote}
%
%\DescribeMacro{\subsep}
%The macro \verb|\subsep| separates two subscripts and thus avoids a
%LaTeX error. Its syntax is
%\begin{quote}
%\verb|\subsep[| \ar{separator} \verb|]|
%\end{quote}
%By default, the \ar{separator} is empty, i.e. the second subscript
%simply follows the first one.
%
%If you want to use a subscript after a symbol that does not have a
%subscript yet, simply put if after the symbol,
%e.g. \verb|\symx\suby|. If the symbol already has a subscript, you
%have to put a \verb|\subsep| in front of the subscript. In regular
%text, you should enclose such a
%construct with \verb|$|'s to avoid space between the symbol and the
%subscript. 
%
%Example:
%
%\begin{verbatim}
%\newsym{symx}{x}
%\newsym{syma}{a_b}
%\newsub{suby}{y}
%\newsub{subz}{z}
%
%Usage: $\symx\suby$
%Or: $\symx\suby\subsep\subz$
%Finally: $\symx\suby\subsep[,]\subz$
%
%In an equation:
%\[ \symx\suby = \syma\subsep[,]\suby \]
%\end{verbatim}
%
%\DescribeMacro{\listofsymbols}
%The command \verb|\listofsymbols| generates a list of the symbols, 
%that were created with \verb|\newsym|. The symbols are not sorted. You
%have to do that manually by sorting the lines in the \verb|.sym| and
%\verb|.sub| files, for example with an editor or a
%spreadsheet. Once you have sorted the symbols and do not want to have
%the files changed any more, use the \verb|Final| mode. Before using
%the \verb|Final| mode, you must compile the document at least once in
%\verb|final| mode to get the proper \verb|.sym| and \verb|.sub|
%files.
%
%A typical sequence would be
%
%\begin{itemize}
%\item Compile in \verb|draft| mode (as often as you want)
%\item Compile in \verb|final| mode (at least once)
%\item Sort and edit the \verb|.sym| and \verb|.sub| files
%\item Compile in \verb|Final| mode (as often as you want). If you add
%  new symbol or subscript definitions now, they will not appear in the
%  list of symbols or subscripts. If you use \verb|draft| or
%  \verb|final| mode now, the edited version of the  \verb|.sym| and
%  \verb|.sub| files will be overwritten.
%\end{itemize}
%
%Note that the command \verb|\listofsymbols| {\bf must} be outside the
%region that is enclosed by the \verb|\opensymdef| and
%\verb|\closesymdef| commands.
%
%In \verb|draft| mode, which is the default, the names of the macros
%are inlcuded in the lists. That makes it easier to keept track of the
%macro names and the corresponding output. The number of times the symbol 
%was used in the document is given in parentheses. Symbols that do not have a
%\ar{description} are included in the list as well.
%
%In \verb|final| mode, the macro-names disappear. Symbols without a
%\ar{description} (or an empty \ar{description}) and symbols that are not 
%used in the document are not included in the list. This allows you to keep 
%all the symbols you normally need in a separate file that contains only 
%\verb|\newsym| and \verb|\newsub| commands. This file can be included in 
%the main file, e.g. with \verb|\include| or \verb|\input|. See the 
%\verb|.log| file for information which symbols have been omitted from 
%the lists.
%
%The \verb|Final| mode is similar to \verb|final|. The difference is
%that the \verb|.sym| and \verb|.sub| files are not changed. Use this
%mode when your document is ready and you have sorted the \verb|.sym|
%and \verb|.sub| files manually. The first pair of braces after the 
%\verb|\printsymline| in a line of
%the \verb|.sym| and \verb|.sub| files is not used by
%\verb|listofsymbols|. You can use it for example to help the sorting
%process.
%
%Example: It is valid to change the line\\
%\verb|\printsymline{\ell}{\ell}{syml}{Length}{1}|\\
%manually into\\
%\verb|\printsymline{l}{\ell}{syml}{Length}{1}|
%
%In \verb|nomencl| mode the glossary has to be generated manually, for example by entering\\
%\verb|   makeindex| \ar{filename}\verb|.glo -s nomencl.ist -o| \ar{filename}\verb|.gls|\\
%at the command line.  Read the documentation of the \verb|nomencl|
%package for more information.
%
%\DescribeMacro{\symwidth} 
%The length \verb|\symwidth| is the space reserved for the
%symbol on the left side of each line and is by default set to 2.5\,cm. 
%If you have long symbols you may have to change that, for example with\\
%\verb|   \setlength{\symwidth}{3cm}|.
%
%\DescribeMacro{\listofsubscripts}
%Similar to \verb|\listofsymbols|, but for the subscripts obviously.
%
%\DescribeMacro{\listofboth}
%Creates both a list of symbols and a list of subscripts with the heading
%`Notation' above them.
%
%\DescribeMacro{\symheadingname}
%\DescribeMacro{\subheadingname}
%\DescribeMacro{\bothheadingname}
%The headings of the lists are stored in \verb|\symheadingname| and
%\verb|\subheadingname| and \verb|\bothheadingname|. In order to
%change it you can use for example\\
%\verb|   \renewcommand{\symheadingname}{| \ar{New Heading} \verb|}|
%
%\DescribeMacro{\markasused} 
%\DescribeMacro{\markasunused} 
%If you want to decide yourself whether a symbol or subscript should be
%included in the lists, you can issue a \verb|\markasused| or
%\verb|\markasunused| command. A \verb|\markasunused| command should
%occur after the last call of the macro.
%
%Note that \verb|\markasused| works
%only if the description of a symbol or subscript is not empty (why
%would one want to have a symbol without a description in the list of
%symbols?). If, for some reason, you want such a symbol to be in the
%list of symbols, change its description in the \verb|\newsym| command
%to something invisible, e.g. a space.

%Syntax:
%\begin{quote}
%\verb|   \markasused {| \ar{macroname} \verb|}|\\
%\verb|   \markasunused {| \ar{macroname} \verb|}|
%\end{quote}
%Note that \ar{macroname} must be given without the backslash.
%
%\DescribeMacro{\dontmarkasused} 
%If you want to get the output of a symbol without changing the ``used''-flag, 
%you can use the command \verb|\dontmarkasused|.
%This is for example useful if you want to use a symbol in the description of 
%another symbol. In this case you have to insert 
%a \verb|\noexpand| command before the macro \verb|\dontmarkasused|.
%
%Syntax:
%\begin{quote}
%\verb|   \dontmarkasused {| \ar{macroname} \verb|}|
%\end{quote}
%Note that \ar{macroname} must be given without the backslash.

%Example:
%
%\begin{verbatim}
%\opensymdef
%   \newsym{syma}{a}
%   \newsym[Derivative of \noexpand\dontmarkasused{syma}]{symda}{\syma '}
%\closesymdef
%\end{verbatim}
%
%\DescribeMacro{\losstring}
%If the output of a symbol or subscript contains macros 
%and they are not at the very beginning of the definition, then you have to 
%insert a \verb|\losstring| command in front of the macro. 
%
%Example:
%
%\begin{verbatim}
%\opensymdef
%   \newsym{symA}{a}
%   \newsym{symB}{\overline{\losstring\syma}}
%   \newsym{symC}{\overline{\losstring\overline{\losstring\syma}}}
%\closesymdef
%\end{verbatim}
%
%
%\newpage
%\section{Examples}
%\label{sec:examples}
%
%These examples are supposed to illustrate the implications of
%\verb|opensymdef| and \verb|closesymdef|.
%
%\subsection{Example 1}
%
%Here, the definitions are in the preamble
%
%\begin{verbatim}
%\documentclass{article}
%\usepackage{listofsymbols}
%
%\opensymdef
%   \newsym[Energy]{symE}{E}
%   \newsym[Mass]{symm}{m}
%   \newsym[Speed of light]{symc}{c}
%\closesymdef
%
%\begin{document}
%  \[\symE=\symm \symc^2\]
%
%  where \symE is the energy \ldots
%
%  \listofsymbols
%\end{document}
%\end{verbatim}
%
%\hrulefill \ Output:\ \hrulefill
%
%\[E=m\ c^2\]
%
%where $E$ is the energy \ldots\\
%
%{\Large\bf List of Symbols (draft)}
%
%\makebox[2.5cm][l]{{\bf Symbol}}{\bf Description}\\
%\makebox[2.5cm][l]{$E$}\verb|\symE| -- Energy (yes)\\
%\makebox[2.5cm][l]{$m$}\verb|\symm| -- Mass (yes)\\
%\makebox[2.5cm][l]{$c$}\verb|\symc| -- Speed of light (yes)
%
%\rule{\textwidth}{0.2pt}
%
%
%\subsection{Example 2}
%
%Here, the list of symbols is at the end of the document and the
%definitions are in the body.
%
%\begin{verbatim}
%\documentclass{article}
%\usepackage{listofsymbols}
%
%\begin{document}
%  \opensymdef
%     \newsym[Energy]{symE}{E}
%     \newsym[Mass]{symm}{m}
%     \newsym[Speed of light]{symc}{c}
%
%  \[\symE=\symm \symc^2\]
%
%  where \symE is the energy \ldots
%
%  \closesymdef
%  \listofsymbols
%\end{document}
%\end{verbatim}
%
%
%\subsection{Example 3}
%
%Now, the list of symbols is before the definitions.
%
%\begin{verbatim}
%\documentclass{article}
%\usepackage{listofsymbols}
%
%\begin{document}
%  \listofsymbols
%  \opensymdef
%     \newsym[Energy]{symE}{E}
%     \newsym[Mass]{symm}{m}
%     \newsym[Speed of light]{symc}{c}
%
%  \[\symE=\symm \symc^2\]
%
%  where \symE is the energy \ldots
%
%  \closesymdef
%\end{document}
%\end{verbatim}
%
%\section{Contact}
%
%If you have suggestions how this package can be improved, let me know:
%
%e-mail: \verb|listofsymbols@gmx.de|
%
%\section{The Code}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{listofsymbols}
\RequirePackage{ifthen} \RequirePackage{calc} \newboolean{b@nomencl}
\newboolean{b@final} \newboolean{b@Final} \newboolean{b@pageno}
\newboolean{b@xspace}
\DeclareOption{nomencl}{\setboolean{b@nomencl}{true}}
\DeclareOption{draft}{\setboolean{b@nomencl}{false}
\setboolean{b@final}{false}\setboolean{b@Final}{false}}
\DeclareOption{final}{\setboolean{b@nomencl}{false}
\setboolean{b@final}{true}\setboolean{b@Final}{false}}
\DeclareOption{Final}{\setboolean{b@nomencl}{false}
\setboolean{b@final}{true}\setboolean{b@Final}{true}}
\DeclareOption{pageno}{\setboolean{b@pageno}{true}}
\DeclareOption{nopageno}{\setboolean{b@pageno}{false}}
\DeclareOption{usexspace}{\setboolean{b@xspace}{true}}
\DeclareOption{noxspace}{\setboolean{b@xspace}{false}}

\ExecuteOptions{draft,nopageno,usexspace}
\ProcessOptions

\newlength{\symindent}
 %equal to second argument of \l@figure and \l@table:
\setlength{\symindent}{1.5em} 
\newlength{\symwidth}
\setlength{\symwidth}{2.5cm}
\newlength{\sympagenowidth}

\ifthenelse{\boolean{b@nomencl}}
  {\RequirePackage{nomencl}}{}
\ifthenelse{\boolean{b@xspace}}
  {\RequirePackage{xspace}
  \newcommand{\spaceaftersym}{\xspace}}
  {\newcommand{\spaceaftersym}{}}
\ifthenelse{\boolean{b@pageno}}
  {\settowidth{\sympagenowidth}{9999}}
  {\setlength{\sympagenowidth}{0cm}}

%#1: sortkey
%#2: symbol
%#3: macroname
%#4: description
%#5: page number
\newcommand{\printsymline}[5]
{\expandafter\providecommand\expandafter{\csname#3include\endcsname}{no}
\ifthenelse{\boolean{b@final}
  \AND\(\expandafter\equal{\csname #3include\endcsname}{no}\OR\equal{#4}{}\)}
{\PackageInfo{listofsymbols}{symbol/subscript #3 has no or empty 
  description or is not used: omitted}}
{\hspace*{\symindent}\makebox[\symwidth][l]{\ensuremath{#2}}%
\parbox[t]{\textwidth-\symwidth-\sympagenowidth-16pt}
{\begin{raggedright}\strut%
\ifthenelse{\boolean{b@final}} {#4}%
  {$\backslash$\texttt{#3} --- #4 (\csname #3include\endcsname)}%
\strut\end{raggedright}}%
\ifthenelse{\boolean{b@pageno}}{\hfill #5}{}%
\newline}}

\newcommand{\losstring}{}

%#1: sortkey
%#2: symbol
%#3: macroname
%#4: description
%#5: filehandle
\ifthenelse{\boolean{b@Final}}
{\newcommand{\addsymline}[5]{}
\newcommand{\opensymdef}{}
\newcommand{\closesymdef}{}}
{\newcommand{\opensymdef}
{\newwrite\@sym \immediate\openout\@sym=\jobname.sym
\newwrite\@sub \immediate\openout\@sub=\jobname.sub}
\newcommand{\closesymdef}
{\immediate\closeout\@sym
\immediate\closeout\@sub}
\newcommand{\addsymline}[5]
{\renewcommand{\losstring}{\string}
\immediate\write#5{\string\printsymline{\string#1}%
{\string#2}{\string#3}{#4}{\thepage}}
\renewcommand{\losstring}{}}}

%#1: description
%#2: macroname
%#3: symbol
\newcommand{\@createsym}[3]
{\expandafter\newcommand\expandafter{\csname#2\endcsname}
  {\relax\ensuremath{#3}\spaceaftersym%
   \expandafter\protected@xdef\csname#2isused\endcsname {yes}} %evntl. gdef
\expandafter\newcommand\expandafter{\csname#2doc\endcsname}{#1}
\expandafter\newcommand\expandafter{\csname#2tabdoc\endcsname}
  {\ensuremath{#3} & #1}
\expandafter\newcommand\expandafter{\csname#2isused\endcsname}{no}}

%#1: description
%#2: macroname
%#3: symbol
\ifthenelse{\boolean{b@nomencl}}
{\newcommand{\newsym}[3][]
{\@createsym{#1}{#2}{#3}
\ifthenelse{\equal{#1}{}}{}{\nomenclature{\ensuremath{#3}}{#1}}}}
{\newcommand{\newsym}[3][]
{\@createsym{#1}{#2}{#3}
\addsymline{#3}{#3}{#2}{#1}{\@sym}}}

%#1: description
%#2: macroname
%#3: symbol
\newcommand{\@createsub}[3]
{\expandafter\newcommand\expandafter{\csname#2\endcsname}
  {\relax\ensuremath{_{#3}}\spaceaftersym%
   \expandafter\protected@xdef\csname#2isused\endcsname {yes}}
\expandafter\newcommand\expandafter{\csname#2doc\endcsname}{#1}
\expandafter\newcommand\expandafter{\csname#2tabdoc\endcsname}
  {\ensuremath{#3} & #1}
\expandafter\newcommand\expandafter{\csname#2isused\endcsname}{no}}

%#1: description
%#2: macroname
%#3: symbol
\ifthenelse{\boolean{b@nomencl}}
{\newcommand{\newsub}[3][]
{\@createsub{#1}{#2}{#3}
\ifthenelse{\equal{#1}{}}{}{\nomenclature{\ensuremath{#3}}{#1}}}}
{\newcommand{\newsub}[3][]
{\@createsub{#1}{#2}{#3}
\addsymline{#3}{#3}{#2}{#1}{\@sub}}}

\newcommand{\subsep}[1][]{\ensuremath{{}_{#1}{}}}

\newcommand{\symheadingname}{List of Symbols}

\newcommand{\subheadingname}{List of Subscripts}

\newcommand{\bothheadingname}{Notation}

\ifthenelse{\boolean{b@final}}
{\newcommand{\symheading}
{\section*{\symheadingname}}
\newcommand{\subheading}
{\section*{\subheadingname}}}
{\newcommand{\symheading}
{\section*{\symheadingname\ (draft)}
\makebox[\symwidth+\symindent][l]{\bf Symbol}{\bf Description}
\ifthenelse{\boolean{b@pageno}}{\hfill{\bf Defined on page}}{}}
\newcommand{\subheading}
{\section*{\subheadingname\ (draft)}
\makebox[\symwidth+\symindent][l]{\bf Subscript}{\bf Description}
\ifthenelse{\boolean{b@pageno}}{\hfill{\bf Defined on page}}{}}}

\ifthenelse{\boolean{b@nomencl}}
{\makeglossary
\renewcommand{\nomname}{\symheadingname}
\setlength{\nomitemsep}{-1\parsep}
\newcommand{\listofsymbols}{\printglossary}
\newcommand{\listofsubscripts}{}}
{\newlength{\old@parskip}
\newlength{\old@parindent}
\newcommand{\listofsymbols} {
  \setlength{\old@parskip}{\parskip}
  \setlength{\parskip}{0pt}
  \setlength{\old@parindent}{\parindent}
  \setlength{\parindent}{0pt}
\symheading\par
\makeatletter
\IfFileExists{\jobname.syc}{\@input@{\jobname.syc}}{}
\IfFileExists{\jobname.sym}{\@input@{\jobname.sym}}{}
\makeatother
  \setlength{\parskip}{\old@parskip}
  \setlength{\parindent}{\old@parindent}}
\newcommand{\listofsubscripts} {
  \setlength{\old@parskip}{\parskip}
  \setlength{\parskip}{0pt}
  \setlength{\old@parindent}{\parindent}
  \setlength{\parindent}{0pt}
\subheading\par
\makeatletter
\IfFileExists{\jobname.suc}{\@input@{\jobname.suc}}{}
\IfFileExists{\jobname.sub}{\@input@{\jobname.sub}}{}
\makeatother
  \setlength{\parskip}{\old@parskip}
  \setlength{\parindent}{\old@parindent}}}

\ifthenelse{\boolean{b@nomencl}}
{\newcommand{\listofboth}{\listofsymbols}}
{\newcommand{\listofboth}
{\renewcommand{\symheading}{\subsection*{\symheadingname}}
\renewcommand{\subheading}{\subsection*{\subheadingname}}
\section*{\bothheadingname\ifthenelse{\boolean{b@final}}{}{ (draft)}}
\listofsymbols\listofsubscripts}}

\newcommand{\markasunused}[1]
  {\expandafter\protected@xdef\csname#1isused\endcsname {no}}

\newcommand{\markasused}[1]
  {\expandafter\protected@xdef\csname#1isused\endcsname {yes}}

\newcommand{\los@temp}{}

\newcommand{\dontmarkasused}[1]
  {\protected@xdef\los@temp{\csname#1isused\endcsname}
   \csname#1\endcsname%
   \expandafter\protected@xdef\csname#1isused\endcsname{\los@temp}}

\AtEndDocument{
\renewcommand{\printsymline}[5]
{\immediate\write\@syc{\string\newcommand%
  {\expandafter\string\csname #3include\endcsname}%
  {\csname #3isused\endcsname}}}
\newwrite\@syc \immediate\openout\@syc=\jobname.syc
\IfFileExists{\jobname.sym}{\@input@{\jobname.sym}}{}
\immediate\closeout\@syc
\renewcommand{\printsymline}[5]
{\immediate\write\@suc{\string\newcommand%
  {\expandafter\string\csname #3include\endcsname}%
  {\csname #3isused\endcsname}}}
\newwrite\@suc \immediate\openout\@suc=\jobname.suc
\IfFileExists{\jobname.sym}{\@input@{\jobname.sub}}{}
\immediate\closeout\@suc}

\endinput
%    \end{macrocode}