The makesdx package^{∗}

Andrew D. Lewis

1998/04/03

1 How to use makesdx

makesdx is meant to be used with the Perl program Makesymbolindex whose operation will not be discussed here. The program, when used with makesdx will create a list of symbols.

There are options colon and nocolon for makesdx. Choose the one you want depending on whether you want a colon after the symbol in the list. Try each and see which you like… There are also options uppercase and lowercase which set the heading for the list of symbols in, you guessed it, either upper or lower case. This heading appears only if you are using a documentclass which defines \chapter (e.g., book.cls). The default options are colon and uppercase.

To define the user commands for making a list of symbols enter the command

\makesymbolindex  \makesymbolindex in the document preamble.

\listofsymbols Where you want the actual list to appear, type \listofsymbols. If you are

using a document class which defines \chapter, this will start a new, unnumbered

\listsymbolname chapter with title \listsymbolname. If you give \listofsymbols an optional

argument (in brackets [] as usual with L^{A}TEX) then the argument will be printed before the symbol list. You may want to, for example, describe some details about how to read the list.

\sindex The basic user macro for defining a new symbol is \sindex whose syntax is

\sindex*[page format]{sort string}{symbol}{description}

If the optional * is given, then no page number is attached to the symbol. page format allows you to specify some L^{A}TEX formatting for the page number as it appears in the list. You may, for example, want to italicise the first occurrence of a symbol or where it is defined. sort string is the string Makesymbolindex uses to sort the list. See the Makesymbolindex documentation for more on sorting. The actual symbol is specified by symbol, and the symbol’s description by description.

To see how all this gets made into a list, read the documentation for Makesymbolindex!

∗This file has version number v2.0c, last revised 1998/04/03.

2 Implementation

1 ⟨∗package⟩

   colon and nocolon, and uppercase and lowercase options.

2 3

 4 \def\@ADL@sdxdraft{\z@}
 5 \DeclareOption{colon}{\def\@ADL@colontrue{\@ne}}
 6 \DeclareOption{nocolon}{\def\@ADL@colontrue{\z@}}
 7 \DeclareOption{uppercase}{\def\listsymbolname{List of Symbols}}
 8 \DeclareOption{lowercase}{\def\listsymbolname{List of symbols}}
 9 \DeclareOption{draft}{\def\@ADL@sdxdraft{\@ne}}
10 \ExecuteOptions{colon,uppercase}
11 \ProcessOptions

12

13 \RequirePackage{verbatim}

Command to start symbol list.

14

15 \newcommand\listofsymbols{\@ifnextchar [{\@ADL@listofsymbols}
16 {\@ADL@@listofsymbols}}

17

18 \def\@ADL@listofsymbols[#1]{\newwrite\@ADL@lospreamblefile
19 \immediate\openout\@ADL@lospreamblefile=\jobname.pre
20 \immediate\write\@ADL@lospreamblefile{#1}
21 \immediate\closeout\@ADL@lospreamblefile
22 \@ADL@@listofsymbols}

23

24 \@ifundefined{chapter}{%
25 \ifnum\@ADL@sdxdraft=\z@
26  \newcommand\@ADL@@listofsymbols{\@input{\jobname.los}}
27 \else
28  \newcommand\@ADL@@listofsymbols{\@input{\jobname.los}
29  \clearpage\@input{\jobname.dft}}
30 \fi

31 }

32 {%
33 \ifnum\@ADL@sdxdraft=\z@
34  \newcommand\@ADL@@listofsymbols{\@restonecolfalse\if@twocolumn
35  \@restonecoltrue\onecolumn\fi\chapter*{\listsymbolname\@mkboth
36  {\listsymbolname}{\listsymbolname}}\@input{\jobname.los}
37  \if@restonecol\twocolumn\fi}
38 \else
39  \newcommand\@ADL@@listofsymbols{\@restonecolfalse\if@twocolumn
40  \@restonecoltrue\onecolumn\fi\chapter*{\listsymbolname\@mkboth
41  {\listsymbolname}{\listsymbolname}}\@input{\jobname.los}\clearpage
42  \@input{\jobname.dft}\if@restonecol\twocolumn\fi}
43 \fi

44 }

Width of symbols in list.

46 \newlength\symbolwidth\setlength{\symbolwidth}{0.25\columnwidth}

Command to define user commands.

47

48 \newcommand\makesymbolindex{\if@filesw \newwrite\@ADL@sindexfile
49 \def\@ADL@sindexstarb{\@bsphack\begingroup
50  \def\protect####1{\string####1\space}\@sanitize
51  \@ADL@wrsindexstarb}
52 \def\@ADL@sindexstarnob{\@bsphack\begingroup
53  \def\protect####1{\string####1\space}\@sanitize
54  \@ADL@wrsindexstarnob}
55 \def\@ADL@sindexnostarb{\@bsphack\begingroup
56  \def\protect####1{\string####1\space}\@sanitize
57  \@ADL@wrsindexnostarb}
58 \def\@ADL@sindexnostarnob{\@bsphack\begingroup
59  \def\protect####1{\string####1\space}\@sanitize
60  \@ADL@wrsindexnostarnob}
61 \immediate\openout\@ADL@sindexfile=\jobname.sdx
62 \def\sindex{\@ifstar{\@ADL@sindexstar}{\@ADL@sindexnostar}}
63 \def\@ADL@sindexstar{\@ifnextchar[{\@ADL@sindexstarb}{\@ADL@sindexstarnob}}
64 \def\@ADL@sindexnostar{\@ifnextchar[{\@ADL@sindexnostarb}
65  {\@ADL@sindexnostarnob}}
66 \typeout{Writing symbol index file \jobname.sdx }\fi}

67

68 \def\@ADL@wrsindexnostarb[#1]#2#3#4{\let\thepage\relax
69 \xdef\@gtempa{\write\@ADL@sindexfile{\string
70  \sindexentry{#2}{#3}{#4}{\thepage}{#1}}}\endgroup\@gtempa
71 \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

72

73 \newcommand\@ADL@wrsindexnostarnob[3]{\let\thepage\relax
74 \xdef\@gtempa{\write\@ADL@sindexfile{\string
75  \sindexentry{#1}{#2}{#3}{\thepage}{}}}\endgroup\@gtempa
76 \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

77

78 \def\@ADL@wrsindexstarb[#1]#2#3#4{\let\thepage\relax
79 \xdef\@gtempa{\write\@ADL@sindexfile{\string
80  \sindexentry{#2}{#3}{#4}{}{}}}\endgroup\@gtempa
81 \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

82

83 \newcommand\@ADL@wrsindexstarnob[3]{\let\thepage\relax
84 \xdef\@gtempa{\write\@ADL@sindexfile{\string
85  \sindexentry{#1}{#2}{#3}{}{}}}\endgroup\@gtempa
86 \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

The user command \sindex and its default value (do nothing).

87

88 \newcommand\sindex{\@ifstar{\@ADL@sindex}{\@ADL@sindex}}
89 \newcommand\@ADL@sindex{\@bsphack\begingroup \@sanitize\@ADL@@sindex}
90 \newcommand\@ADL@@sindex[3]{\endgroup\@esphack}

The symbollist list environment.

 92 \newlength\@ADL@curlabelwidth

93

 94 \ifnum\@ADL@colontrue=\@ne
 95 \newcommand\sindexlabel[1]{%
 96 \settowidth{\@ADL@curlabelwidth}{\textrm{#1\hfill\ :}}%
 97 \ifdim\@ADL@curlabelwidth>\labelwidth%
 98  \parbox[b]{\labelwidth}{\makebox[0pt][l]{\textrm{#1\hfill\ :}}%
 99  \\\null}\else%
100  \textrm{#1\hfill\ :}\fi%
101 \hfil\relax}
102 \else
103 \newcommand\sindexlabel[1]{%
104 \settowidth{\@ADL@curlabelwidth}{\textrm{#1\hfill\ }}%
105 \ifdim\@ADL@curlabelwidth>\labelwidth%
106  \parbox[b]{\labelwidth}{\makebox[0pt][l]{\textrm{#1}\hfill\ }%
107  \\\null}\else%
108  \textrm{#1\hfill\ }\fi%
109 \hfil\relax}
110 \fi

111

112 \newenvironment{symbollist}{\list{}{\labelwidth\symbolwidth%
113 \leftmargin\labelwidth\advance\leftmargin by\labelsep%
114 \topsep 3\p@ \@plus 1\p@ \@minus 1\p@%
115 \parsep 1\p@ \@plus 0.5\p@ \@minus 0.5\p@%
116 \itemsep \parsep%
117 \let\makelabel\sindexlabel}}{\endlist}

118

119 ⟨/package⟩