Debian Codegraph @

texmf-dist/source/latex/seealso/seealso.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2014, 2017 by Leo Liu <[email protected]>
4 % ---------------------------------------------------------------------------
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Leo Liu.
16 %
17 % This work consists of the files seealso.dtx and seealso.ins
18 % and the derived filebase seealso.sty.
19 %
20 % \fi
21 %
22 % \iffalse
23 %<*driver>
24 \ProvidesFile{seealso.dtx}
25 %</driver>
26 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
27 %<package>\ProvidesPackage{seealso}
28 %<*package>
29 [2017/03/23 v1.2 makeidx's see and seealso with page number support.]
30 %</package>
31 %
32 %<*driver>
33 \documentclass{ltxdoc}
34 \usepackage[a4paper,left=2in,right=1in,top=1in,bottom=1in]{geometry}
35 \newcommand\pkg[1]{\textsf{#1}}
36 \usepackage[UTF8,hyperref]{ctex}
37 \makeatletter
38 \renewcommand\glossary@prologue{%
39 \section*{版本历史}
40 \markboth{版本历史}{版本历史}}
41 \renewcommand\index@prologue{%
42 \section*{Index / 代码索引}
43 \markboth{Index / 代码索引}{Index / 代码索引}
44 斜体的数字表示对应项说明所在的页码。下划线的数字表示定义所在的代码行号;而直
45 立体的数字表示对应项使用时所在的行号。}
46 \def\option{\begingroup
47 \catcode`\\12
48 \MakePrivateLetters \option@}
49 \let\endoption\endtrivlist
50 \long\def\option@#1{\endgroup \topsep\MacroTopsep \trivlist
51 \edef\saved@macroname{\string#1}%
52 \def\makelabel##1{\llap{##1}}%
53 \if@inlabel
54 \let\@tempa\@empty \count@\macro@cnt
55 \loop \ifnum\count@>\z@
56 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
57 \edef\makelabel##1{\llap{\vtop to\baselineskip
58 {\@tempa\hbox{##1}\vss}}}%
59 \advance \macro@cnt \@ne
60 \else \macro@cnt\@ne \fi
61 \edef\@tempa{\noexpand\item[%
62 \noexpand\PrintEnvName
63 {\string#1}]}%
64 \@tempa
65 \global\advance\c@CodelineNo\@ne
66 \SpecialMainOptionIndex{#1}\nobreak
67 \global\advance\c@CodelineNo\m@ne
68 \ignorespaces}
69 \def\SpecialMainOptionIndex#1{\@bsphack
70 \special@index{%
71 #1\actualchar
72 {\string\ttfamily\space#1}
73 (option)%
74 \encapchar main}%
75 \@esphack}
76 \def\SpecialOptionIndex#1{\@bsphack
77 \begingroup
78 \HD@target
79 \let\HDorg@encapchar\encapchar
80 \edef\encapchar usage{%
81 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}}%
82 \index{#1\actualchar{\protect\ttfamily#1}
83 (option)\encapchar usage}%
84 \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
85 usage}%
86 \endgroup
87 \@esphack}
88 \def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters
89 \Describe@Option}
90 \def\Describe@Option#1{\endgroup
91 \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
92 \SpecialOptionIndex{#1}\@esphack\ignorespaces}
93 \def\stylemeaning#1{\texttt{%
94 \expandafter\expandafter\expandafter\strip@prefix
95 \expandafter\meaning\csname seealso@#1\endcsname}}
96 \renewcommand\author[2][]{%
97 \ifstrempty{#1}{}{%
98 \hypersetup{pdfauthor=#1}}%
99 \def\@author{#2}}
100 \renewcommand\title[2][]{%
101 \ifstrempty{#1}{}{%
102 \hypersetup{pdftitle=#1}}%
103 \def\@title{#2}}
104 \makeatother
105 \usepackage{seealso}
106 \usepackage{fancyvrb}
107 \fvset{gobble=2}
108 \usepackage{hypdoc}
109 \hypersetup{pdfstartview=FitH}
110 \AtBeginDocument{\MakeShortVerb\|}
111 \EnableCrossrefs
112 \CodelineIndex
113 \RecordChanges
114 \begin{document}
115 \DocInput{seealso.dtx}
116 \PrintChanges
117 \PrintIndex
118 \end{document}
119 %</driver>
120 % \fi
121 %
122 % \CheckSum{279}
123 %
124 % \CharacterTable
125 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
126 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
127 % Digits \0\1\2\3\4\5\6\7\8\9
128 % Exclamation \! Double quote \" Hash (number) \#
129 % Dollar \$ Percent \% Ampersand \&
130 % Acute accent \' Left paren \( Right paren \)
131 % Asterisk \* Plus \+ Comma \,
132 % Minus \- Point \. Solidus \/
133 % Colon \: Semicolon \; Less than \<
134 % Equals \= Greater than \> Question mark \?
135 % Commercial at \@ Left bracket \[ Backslash \\
136 % Right bracket \] Circumflex \^ Underscore \_
137 % Grave accent \` Left brace \{ Vertical bar \|
138 % Right brace \} Tilde \~}
139 %
140 %
141 % \changes{v0.1}{2014/04/04}{初始版本。}
142 % \changes{v1.0}{2014/04/05}{功能较完备的版本。}
143 %
144 % \DoNotIndex{\newcommand,\newenvironment,\^,\~,\@for,\@ifnextchar,
145 % \@let@token,\@onlypreamble, \active, \AtBeginDocument,\begingroup,\catcode,
146 % \csdef,\cslet,\cslet,\csuse, \DeclareBoolOption,\def,\define@key,\do,
147 % \docsvlist, \dolistloop,\edef,\else, \emph,\empty,\endgroup,\expandafter,
148 % \fi, \forcsvlist, \forlistcsloop, \forlistloop, \futurelet,\global,
149 % \ifcsdef, \ifcsempty,\ifinlist,\ifinlistcs, \ifstrempty,\ifundef,\ifx,
150 % \ignorespaces, \kvsetkeys,\lccode,\let, \listadd,\listbreak, \listcsgadd,
151 % \lowercase,\newif, \next, \noexpand,\ProcessKeyvalOptions, \RequirePackage,
152 % \reserved@a, \SetupKeyvalOptions,\space,\unexpanded,\unless}
153 %
154 % \GetFileInfo{seealso.dtx}
155 % \title[The seealso Package (\fileversion)]
156 % {\hypertarget{English}{The \pkg{seealso} Package (\fileversion)}
157 % \makebox[0pt][l]{\hspace{3cm}\large
158 % \hyperlink{Chinese}{$\Rightarrow$ \textsf{中文版}}}}
159 % \author[Liú Hǎiyáng (Leo Liu) <[email protected]>]
160 % {Liú Hǎiyáng (Leo Liu) \\ \nolinkurl{[email protected]}}
161 % \date{\filedate}
162 %
163 % \maketitle
164 %
165 % \section{Introduction}
166 %
167 % When preparing index, the macros |\see| and |\seealso| defined by \LaTeXe's
168 % standard package \pkg{makeidx} are handy to use. They are used as special
169 % page format command, to present cross reference of index entry. For example,
170 % if we use
171 % \begin{Verbatim}
172 % \index{math|see{mathematics}}
173 % \end{Verbatim}
174 % to reference the index entry ``mathematics'', we will get
175 % \begin{quote}
176 % math, \emph{see} mathematics
177 % \end{quote}
178 % in the output index.
179 %
180 % However, |\see| and |\seealso| commands in \LaTeXe{} cannot produce page
181 % numbers. Moreover, if we use multiple |\see| or |\seealso|'s for one entry,
182 % there will be multiple reference targets produced. Therefore we may get
183 % this unexpected output:
184 % \begin{quote}
185 % math, \emph{see} mathematics, \emph{see} mathematics, \emph{see} mathematics
186 % \end{quote}
187 % if we have used \verb=\index{math|see{mathematics}}= at 3 different places
188 % in the document.
189 %
190 % The \pkg{seealso} package solve the problem. If we use
191 % \begin{Verbatim}
192 % \usepackage{seealso}
193 % \end{Verbatim}
194 % all cross references of index entry will produce page numbers, and the
195 % reference targets, which we call \emph{see list}, will be merged. The
196 % previous example will produce an output like this:
197 % \begin{quote}
198 % math, \seepage{mathematics}{2}, \seepage{mathematics}{4}, \seepage{mathematics}{5}
199 % \end{quote}
200 %
201 % \section{Reference}
202 %
203 % \subsection{Package Loading}
204 %
205 % The basic usage of the package is to simply load the package
206 % \begin{Verbatim}
207 % \usepackage{seealso}
208 % \end{Verbatim}
209 % then |\see| and |\seealso| commands will be redefined to support page number
210 % output and reference target merging.
211 %
212 % The \pkg{seealso} package should be loaded after \pkg{makeidx},
213 % \pkg{imakeidx}, etc. Or the redefinition of |\see| and |\seealso| may be
214 % broken.
215 %
216 % \subsection{Package Options}
217 %
218 % \DescribeOption{override}
219 % |override| is a boolean option, with a default value |true|. When it is set
220 % the original |\see| and |\seealso| will be overridden. However, when it is
221 % set to be |false|, say
222 % \begin{Verbatim}
223 % \usepackage[override=false]{seealso}
224 % \end{Verbatim}
225 % then |\see| and |\seealso| will not be overridden, and |\seepage| and
226 % |\seealsopage| should be used for page number output.
227 %
228 % \DescribeOption{activecr}
229 % |activecr| is a boolean option, with a default value |true|. When it is set,
230 % the see list will be output at the end of an index entry line (in a |.ind|
231 % file). If we set |activecr=false|, however, the see list will not be output
232 % automatically, one should use |\SeealsoPrintList| manually at the end of the
233 % index entry instead. Usually |\SeealsoPrintList| is added via |delim_t|
234 % style of Makeindex.
235 %
236 % \subsection{The \cs{see} and \cs{seealso} Commands}
237 %
238 % \DescribeMacro{\seepage}
239 % \DescribeMacro{\seealsopage}
240 % |\seepage| and |\seealsopage| provide the main functions of this package.
241 % They provide the same faculty of cross reference, but output page numbers
242 % and prevent redundancy. For example, suppose that there are
243 % \begin{Verbatim}
244 % \index{foo|seepage{bar}}
245 % \end{Verbatim}
246 % in page 1, 2, and 3, we will have a |.ind| file as below:
247 % \begin{Verbatim}
248 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{bar}{3}
249 % \end{Verbatim}
250 % And the output of the index will be:
251 % \begin{quote}
252 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{bar}{3}
253 % \end{quote}
254 %
255 % It is possible to use different references for one index entry. For example
256 % we can use
257 % \begin{Verbatim}
258 % \index{foo|seepage{bar}}
259 % \end{Verbatim}
260 % and
261 % \begin{Verbatim}
262 % \index{foo|seepage{foobaz}}
263 % \end{Verbatim}
264 % several times, the generated |.ind| file may be:
265 % \begin{Verbatim}
266 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{foobaz}{3}
267 % \end{Verbatim}
268 % And the output of the index will be:
269 % \begin{quote}
270 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{foobaz}{3}
271 % \end{quote}
272 %
273 % \DescribeMacro{\seenopage}
274 % \DescribeMacro{\seealsonopage}
275 % The macros |\seenopage| and |\seealsonopage| save the original definitions
276 % of |\see| and |\seealso| before loading \pkg{seealso}, which do not produce
277 % page numbers.
278 %
279 % \DescribeMacro{\see}
280 % \DescribeMacro{\seealso}
281 % When option |override| is |true|, which is the default, |\see| and
282 % |\seealso| works just as |\seepage| and |\seealsopage|.
283 %
284 % \DescribeMacro{\SeealsoPrintList}
285 % |\seepage| and |\seealsopage| will collect the see lists, which will be
286 % output at the end of the line under default |activecr| option. However, when
287 % |activecr| is set to be |false|, the see lists won't be output at the end of
288 % source line where |\seepage| and |\seealsopage| are. In the latter case, we
289 % can add |\SeealsoPrintList| manually at the end of line to output the see
290 % lists. Usually we can set |delim_t| variable in the style file of Makeindex,
291 % for example:
292 % \begin{Verbatim}
293 % % example.ist
294 % delim_t "\\SeealsoPrintList"
295 % \end{Verbatim}
296 % Then a |\SeealsoPrintList| will be appended at the end of every non-empty
297 % index entry, and the see lists will be output properly.
298 %
299 % \DescribeMacro{\DeclareSeealsoMacro}
300 % |\DeclareSeealsoMacro| can be used to define a new macro like |\see| and
301 % |\seealso|. The syntax is
302 % \begin{quote}
303 % |\DeclareSeealsoMacro\|\meta{macro}|{|\meta{seelist}|}{|\meta{name}|}|
304 % \end{quote}
305 % where |\|\meta{macro} is the macro name, \meta{seelist} is the new see list,
306 % and \meta{name} is the name of the see list to be output (like |\seename|).
307 % Using |\DeclareSeealsoMacro|, two macros will be defined, the one is
308 % |\|\meta{macro}, the other is |\|\meta{macro}|name|. If there has no
309 % |\|\meta{macro}|name| predefined, it is defined to be \meta{name}, or the
310 % definition remains unchanged.
311 %
312 % For example, |\seepage| and |\seealsopage| are defined like this:
313 % \begin{Verbatim}
314 % \DeclareSeealsoMacro\seepage{see}{see}
315 % \DeclareSeealsoMacro\seealsopage{also}{see also}
316 % \end{Verbatim}
317 % The definitions above also provide the default value of |\seename| and
318 % |\alsoname| to be |see| and |see also|, respectively.
319 %
320 % \subsection{Output Styles}
321 %
322 % \DescribeMacro{\seealsosetup}
323 % The macro |\seealsosetup| is used to configure the output style of see
324 % lists. The syntax is:
325 % \begin{quote}
326 % |\seealsosetup[|\meta{seelists}|]{|\meta{kv-options}|}|
327 % \end{quote}
328 % where \meta{seelists} is a comma separated list, each item of which is a see
329 % list to be setup. \meta{seelists} can also be omitted or set to be empty,
330 % which means we are setting up the default output style of all kind of see
331 % lists. \meta{kv-options} is the options in key-value syntax.
332 %
333 % All possible output styles are summarized in table~\ref{tab:outstyleen}.
334 % \begin{table}[htbp]
335 % \centering
336 % \begin{tabular}{lp{4cm}ll}
337 % \hline
338 % Key & Meaning & Argument & Default Value \\
339 % \hline
340 % |name| & The name of see list to be output, e.g. |\seename| & none
341 % & (invalid) \\
342 % |listsep| & The separator before a see list & none
343 % & \stylemeaning{listsep} \\
344 % |itemsep| & The separator between see list items & none
345 % & \stylemeaning{itemsep} \\
346 % |nameformat| & Output format of the see list name & |#1|
347 % & \stylemeaning{nameformat} \\
348 % |itemformat| & Output format of the see list items & |#1|
349 % & \stylemeaning{itemformat} \\
350 % |pageformat| & Output format of the page numbers & |#1|
351 % & \stylemeaning{pageformat} \\
352 % \hline
353 % \end{tabular}
354 % \caption{Output styles used by \cs{seealsosetup}}\label{tab:outstyleen}
355 % \end{table}
356 %
357 % For example, if we want to set all page numbers produced by |\seealsopage|
358 % to be italic, we can use:
359 % \begin{Verbatim}
360 % \seealsosetup[also]{pageformat=\textit{#1}}
361 % \end{Verbatim}
362 %
363 % Besides the output styles, |\seealsosetup| accepts |enditem| and |enditem+|
364 % options, which is a list of token that determines whether to output the see
365 % list at the end of line, if |activecr| option is true. The default value of
366 % the list includes some common macros in |theindex| environment:
367 % |\indexspace|, |\item|, |\subitem|, |\subsubitem|, and |\end|. For example,
368 % if we have a special index which supports 4th level item |\subsubsubitem|
369 % and a special space |\myindexspace|, we can use
370 % \begin{Verbatim}
371 % \seealsosetup{enditem+={\subsubsubitem,\myindexspace}}
372 % \end{Verbatim}
373 % to add the new macros to the list.
374 %
375 % \DescribeMacro{\SeealsoGobble}
376 % |\SeealsoGobble| takes a character \meta{c} as argument. It checks the
377 % following character, gobble it and ignore spaces if it is \meta{c}, or do
378 % nothing if it is not \meta{c}. This macro is useful in |pageformat| style
379 % to prevent outputting the page numbers, like this:
380 % \begin{Verbatim}
381 % \seealsosetup[see,also]{pageformat=\SeealsoGobble{,}}
382 % \end{Verbatim}
383 %
384 %
385 % \section{Known Issues}
386 %
387 % Here are some known problems and their solutions:
388 % \begin{itemize}
389 % \item
390 % Since the output format of page numbers of |\seepage|, |\seealsopage| is the
391 % same as normal page numbers, it may be ambiguous if we use normal |\index|
392 % and \verb=\index{...|seepage}= simultaneously. Usually we should avoid using
393 % different style of |\index| with or without |\seepage| and |\seealsopage|.
394 % If it is impossible, we can set special page number format to identify them,
395 % or we can use |\SeealsoGobble| to disable page numbers.
396 % \end{itemize}
397 %
398 %
399 % \clearpage
400 % \title{\hypertarget{Chinese}{\pkg{seealso} 宏包 (\fileversion)}
401 % \makebox[0pt][l]{\hspace{3cm}\large
402 % \hyperlink{English}{$\Rightarrow$ \textsf{English Version}}}}
403 % \author{刘海洋 \\ \nolinkurl{[email protected]}}
404 % \date{\filedate}
405 %
406 % \maketitle
407 %
408 % \section{简介}
409 %
410 % 在索引生成时,\LaTeXe{} 的标准宏包 \pkg{makeidx} 定义了 |\see| 与 |\seealso|
411 % 两个宏,它们通常是在 |\index| 中作为一种特殊的页码格式使用,表示索引项的引
412 % 用。例如使用
413 % \begin{Verbatim}
414 % \index{math|see{mathematics}}
415 % \end{Verbatim}
416 % 会使索引项 math 引用到 mathematics。生成类似
417 % \begin{quote}
418 % math, \emph{see} mathematics
419 % \end{quote}
420 % 的索引条目。
421 %
422 % 不过,\LaTeXe{} 的 |\see| 与 |\seealso| 命令并不会为交叉引用的索引项输出页
423 % 码。更严重的问题是,如果对一个索引项使用了多次交叉引用,则会多次输出相同的目
424 % 标引用。因此可能出现这样的尴尬效果:
425 % \begin{quote}
426 % math, \emph{see} mathematics, \emph{see} mathematics, \emph{see} mathematics
427 % \end{quote}
428 % 其中可能在三个不同的地方使用了 \verb=\index{math|see{mathematics}}=。
429 %
430 % \pkg{seealso} 宏包即为解决这种问题而编写。只要使用了
431 % \begin{Verbatim}
432 % \usepackage{seealso}
433 % \end{Verbatim}
434 % 则交叉引用的索引项会同时显示页码,同时多个交叉引用的目标(我们称为\emph{参见
435 % 列表})会合并显示。前面的例子就可能会输出:
436 % \begin{quote}
437 % math, \seepage{mathematics}{2}, \seepage{mathematics}{4}, \seepage{mathematics}{5}
438 % \end{quote}
439 % 这样的格式。
440 %
441 % \section{参考手册}
442 %
443 % \subsection{宏包载入}
444 %
445 % 基本的用法就是直接使用
446 % \begin{Verbatim}
447 % \usepackage{seealso}
448 % \end{Verbatim}
449 % 这样 |\see| 和 |\seealso| 命令就会被重定义为支持输出页码和合并目标的格式。
450 %
451 % 注意 \pkg{seealso} 宏包的载入应该晚于 \pkg{makeidx}、\pkg{imakeidx} 等定义
452 % |\see|、|\seealso| 的宏包,否则其功能将会失效。
453 %
454 % \subsection{宏包选项}
455 %
456 % \DescribeOption{override}
457 % |override| 是布尔型选项,默认为 |true|。表示覆盖已有的 |\see| 与 |\seealso|
458 % 定义。如果设置
459 % \begin{Verbatim}
460 % \usepackage[override=false]{seealso}
461 % \end{Verbatim}
462 % 则不对 |\see| 与 |\seealso| 覆盖,要使用 |\seepage| 和
463 % |\seealsopage| 命令调用相应的功能。
464 %
465 % \DescribeOption{activecr}
466 % |activecr| 是布尔型选项,默认为 |true|。表示打开在(|.ind| 文件中)索引项行
467 % 末自动输出所有参见列表的功能。如果设置 |activecr=false|,则必须手工(通常通
468 % 过设置 Makeindex 的 |delim_t| 格式)在索引项末加上 |\SeealsoPrintList| 输出
469 % 参见列表。
470 %
471 % \subsection{\cs{see} 与 \cs{seealso} 命令}
472 %
473 % \DescribeMacro{\seepage}
474 % \DescribeMacro{\seealsopage}
475 % |\seepage| 与 |\seealsopage| 提供了宏包的主要功能,它们与原始的
476 % |\see|、|\seealso| 命令类似提供索引项的交叉引用功能,但同时会输出页码,并避
477 % 免重复输出交叉引用。例如,在文档中第 1, 2, 3 页分别多次使用
478 % \begin{Verbatim}
479 % \index{foo|seepage{bar}}
480 % \end{Verbatim}
481 % 则在 |.ind| 文件中会生成:
482 % \begin{Verbatim}
483 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{bar}{3}
484 % \end{Verbatim}
485 % 而输出的结果将会是:
486 % \begin{quote}
487 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{bar}{3}
488 % \end{quote}
489 %
490 % 同一个词可以有不同的参见引用项目,例如在不同的位置几次使用
491 % \begin{Verbatim}
492 % \index{foo|seepage{bar}}
493 % \end{Verbatim}
494 % 和
495 % \begin{Verbatim}
496 % \index{foo|seepage{foobaz}}
497 % \end{Verbatim}
498 % 则 |.ind| 文件中可能生成:
499 % \begin{Verbatim}
500 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{foobaz}{3}
501 % \end{Verbatim}
502 % 于是将得到输出结果
503 % \begin{quote}
504 % foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{foobaz}{3}
505 % \end{quote}
506 %
507 % \DescribeMacro{\seenopage}
508 % \DescribeMacro{\seealsonopage}
509 % |\seenopage| 与 |\seealsonopage| 这两个宏则保存了在调用 \pkg{seealso} 宏包之
510 % 前,|\see| 与 |\seealso| 的原始定义,它们不会输出页码。
511 %
512 % \DescribeMacro{\see}
513 % \DescribeMacro{\seealso}
514 % 在默认的 |override| 选项下,|\see| 与 |\seealso| 的功能与
515 % |\seepage|、|\seealsopage| 相同。
516 %
517 % \DescribeMacro{\SeealsoPrintList}
518 % |\seepage| 和 |\seealsopage| 会收集参见列表,在默认的 |activecr| 选项为
519 % |ture| 时会在行末自动输出。但如果 |activecr| 选项设置为 |false|,则
520 % |\seepage| 与 |\seealsopage| 所在行结束后不会自动输出参见列表。此时,可以手
521 % 工在此行最后加上 |\SeealsoPrintList| 宏,输出参见列表。通常可以在 Makeindex
522 % 的格式文件中,输出格式选项 |delim_t| 里面加上 |\SeealsoPrintList| 宏,如:
523 % \begin{Verbatim}
524 % % example.ist
525 % delim_t "\\SeealsoPrintList"
526 % \end{Verbatim}
527 % 这样,每个非空索引项输出的最后都会加上 |\SeealsoPrintList|,按需要输出参见列
528 % 表。
529 %
530 % \DescribeMacro{\DeclareSeealsoMacro}
531 % |\DeclareSeealsoMacro| 命令用于生成新的类似 |\see| 与 |\seealso| 的宏。其语
532 % 法为:
533 % \begin{quote}
534 % |\DeclareSeealsoMacro\|\meta{macro}|{|\meta{seelist}|}{|\meta{name}|}|
535 % \end{quote}
536 % 其中 |\|\meta{macro} 是新的宏名称,\meta{seelist} 是新的参见列表
537 % 名,\meta{name} 是输出参见列表时的名称。使用该命令会生成两个宏,一个是
538 % |\|\meta{macro},一个是对应的名称 |\|\meta{macro}|name|。
539 % |\|\meta{macro}|name| 如果事先没有定义,则定义其值为 \meta{name},否则保持不
540 % 变。
541 %
542 % 例如,|\seepage| 和 |\seealsopage| 就是这样定义的:
543 % \begin{Verbatim}
544 % \DeclareSeealsoMacro\seepage{see}{see}
545 % \DeclareSeealsoMacro\seealsopage{also}{see also}
546 % \end{Verbatim}
547 % 上述命令同时定义了 |\seename| 的备选值为 |see|,以及 |\alsoname| 的备选值为
548 % |see also|。
549 %
550 % \subsection{格式设置}
551 %
552 % \DescribeMacro{\seealsosetup}
553 % |\seealsosetup| 命令用于设置参见列表的输出格式。其语法为:
554 % \begin{quote}
555 % |\seealsosetup[|\meta{seelists}|]{|\meta{kv-options}|}|
556 % \end{quote}
557 % 其中,可选参数 \meta{seelists} 是一个逗号分隔的列表,每一项表示要设置其格式
558 % 的参见列表,如果不设置 \meta{seelists} 或设为空,则设置默认的输出格式。而选
559 % 项 \meta{kv-options} 则是输出格式项。
560 %
561 % 可用的输出格式见表~\ref{tab:outstylezh}。
562 % \begin{table}[htbp]
563 % \centering
564 % \begin{tabular}{llll}
565 % \hline
566 % 选项 & 意义 & 参数 & 默认值 \\
567 % \hline
568 % |name| & 输出参见列表的名称 & 无 & (不可用) \\
569 % |listsep| & 参见列表前的分隔符 & 无 & \stylemeaning{listsep} \\
570 % |itemsep| & 参见列表项间的分隔符 & 无 & \stylemeaning{itemsep} \\
571 % |nameformat| & 输出参见名“see also”的格式 & |#1| & \stylemeaning{nameformat} \\
572 % |itemformat| & 参见列表项的格式 & |#1| & \stylemeaning{itemformat} \\
573 % |pageformat| & 页码格式 & |#1| & \stylemeaning{pageformat} \\
574 % \hline
575 % \end{tabular}
576 % \def\tablename{表}
577 % \caption{\cs{seealsosetup} 使用的输出格式}\label{tab:outstylezh}
578 % \end{table}
579 %
580 % 例如,如果要让所有 |\seealsopage| 命令生成的页码以斜体显示,就可以使用
581 % \begin{Verbatim}
582 % \seealsosetup[also]{pageformat=\textit{#1}}
583 % \end{Verbatim}
584 %
585 % 除了输出格式,|\seealsosetup| 还接受 |enditem| 和 |enditem+| 选项,用于设置
586 % \pkg{seealso} 宏包在 |activecr| 选项设置时,进入行尾之后遇到什么记号时决定输
587 % 出参见列表。通常情况下并不需要设置该选项,|enditem| 选项的默认值已经包括了在
588 % 标准的 |theindex| 环境中会出现的一些宏:|\indexspace|、|\item|、|\subitem|、
589 % |\subsubitem|、|\end|。使用 |enditem+| 选项则可以向列表中增加新的记号。例
590 % 如,如果某种特殊的索引支持 4 级项 |\subsubsubitem| 和特殊的间隔
591 % |\myindexspace|,就可以使用
592 % \begin{Verbatim}
593 % \seealsosetup{enditem+={\subsubsubitem,\myindexspace}}
594 % \end{Verbatim}
595 % 向列表中添加新的记号。
596 %
597 % \DescribeMacro{\SeealsoGobble}
598 % |\SeealsoGobble| 宏接受一个字符作为参数,它检查后面是否有此字符,如果是则吞
599 % 掉此字符及后面的空格,否则什么都不做。在 |pageformat| 选项中使用这个宏可以用
600 % 来禁止显示参见项的页码,像下面这样:
601 % \begin{Verbatim}
602 % \seealsosetup[see,also]{pageformat=\SeealsoGobble{,}}
603 % \end{Verbatim}
604 %
605 % \section{已知问题}
606 %
607 % 以下是一些已知的问题和解决方案:
608 % \begin{itemize}
609 % \item
610 % 由于 |\seepage|, |\seealsopage| 的页码显示形式与普通页码相同,所以可能会造成
611 % 页码重叠的情况。最好尽量避免交叉引用的项目有多种形式的索引。如果不能避免,为
612 % 解决此问题,可以设置特别的页码输出格式以示区分,或者借用 |\SeealsoGobble| 设
613 % 置不输出页码。
614 % \end{itemize}
615 %
616 % \StopEventually{}
617 %
618 % \clearpage
619 % \section{Implementation / 代码实现}
620 %
621 % \iffalse
622 %<*package>
623 % \fi
624 %
625 % \subsection{准备工作}
626 %
627 % 引入相关编程工具。
628 %
629 % \pkg{etoolbox} 是基本宏工具。原有的 \cs{ifinlist} 和 \cs{ifinlistcs} 不能用
630 % 于带花括号的文字的查找,会限制我们的使用。为此按 \pkg{etoolbox} 手册的建议,
631 % 补充了 \cs{seealso@ifstrinlist} 和 \cs{seealso@ifstrinlistcs} 两个宏来在列表
632 % 中搜索字符串。它们会比 \cs{ifinlist} 与 \cs{ifinlistcs} 性能略差一点。
633 % \changes{v1.2}{2017/03/23}{允许 \cs{see} 等命令参数中带花括号。}
634 % \begin{macrocode}
635 \RequirePackage{etoolbox}
636 % {<listmacro>}{<string>}{<true>}{<false>}
637 \long\def\seealso@ifinlist@#1#2#3#4{%
638 \def\next{#4}%
639 \def\do##1{%
640 \ifstrequal{##1}{#2}
641 {\def\next{#3}\listbreak}
642 {}}%
643 \dolistloop{#1}%
644 \next}
645 % {<string>}{<listmacro>}{<true>}{<false>}
646 \protected\long\def\seealso@ifinlist#1#2{%
647 \seealso@ifinlist@{#2}{#1}}
648 % {<string>}{<listcsname>}{<true>}{<false>}
649 \protected\long\def\seealso@ifinlistcs#1#2{%
650 \expandafter\seealso@ifinlist@\csname #2\endcsname{#1}}
651 % \end{macrocode}
652 %
653 % \pkg{kvoptions} 用于处理宏包选项。
654 % \begin{macrocode}
655 \RequirePackage{kvoptions}
656 \SetupKeyvalOptions{
657 family=seealso@opt,
658 prefix=seealso@,
659 setkeys=\kvsetkeys}
660 % \end{macrocode}
661 %
662 % 声明宏包选项。
663 %
664 % \begin{option}{override}
665 % \changes{v1.0}{2014/04/05}{新增选项。}
666 % 重定义 |\see| 与 |\seealso| 为有页码的形式。默认打开。
667 % \begin{macrocode}
668 \DeclareBoolOption[true]{override}
669 % \end{macrocode}
670 % \end{option}
671 %
672 % \begin{option}{activecr}
673 % \changes{v1.0}{2014/04/05}{新增选项。}
674 % 使用换行符作为输出 |\see| 等命令的指令。默认打开。
675 % \begin{macrocode}
676 \DeclareBoolOption[true]{activecr}
677 % \end{macrocode}
678 % \end{option}
679 %
680 % 执行选项。
681 % \begin{macrocode}
682 \ProcessKeyvalOptions*
683 % \end{macrocode}
684 %
685 % \begin{macro}{\seealso@charlet}
686 % 参数 |#1| 是一个字符或 |\| 加字符的形式,|\seealso@charlet| 将此字符看做活动
687 % 字符的宏,使用 |\let| 与后面的内容赋值,但本身不改变字符的 catcode。
688 % \begin{macrocode}
689 \def\seealso@charlet#1{%
690 \begingroup\lccode`\~=`#1\lowercase{\endgroup\let~}}
691 % \end{macrocode}
692 % \end{macro}
693 %
694 % \subsection{参见列表及其实现}
695 %
696 % \begin{macro}{\seealso@macrolist}
697 % 列表记录所有独立的类似 |\seepage| 的宏。默认只有 |see| 和 |also| 两组,对应
698 % 命令 |\seepage| 和 |\seealsopage|。
699 % \begin{macrocode}
700 \let\seealso@macrolist\empty
701 % \end{macrocode}
702 % \end{macro}
703 %
704 % \begin{macro}{\seealso@clearlist}
705 % 清空参见列表,如 |\seealso@see@list|、|\seealso@also@list|。
706 % \begin{macrocode}
707 \def\seealso@clearlist#1{%
708 \global\cslet{seealso@#1@list}\empty}
709 \AtBeginDocument{\forlistloop\seealso@clearlist\seealso@macrolist}
710 % \end{macrocode}
711 % \end{macro}
712 %
713 % \begin{macro}{\SeealsoPrintList}
714 % 输出参见列表,如 |\seealso@see@list|、|\seealso@also@list|。
715 % \begin{macrocode}
716 \newcommand\SeealsoPrintList{%
717 \forlistloop\seealso@printlist\seealso@macrolist
718 \forlistloop\seealso@clearlist\seealso@macrolist}
719 % \end{macrocode}
720 % \end{macro}
721 %
722 % \begin{macro}{\ifseealso@gobblefirstlistsep}
723 % 测试是否忽略第一个列表分隔符(因为前面使用了 |\SeealsoGobble|)。
724 % \begin{macrocode}
725 \newif\ifseealso@gobblefirstlistsep
726 % \end{macrocode}
727 % \end{macro}
728 %
729 % \begin{macro}{\ifseealso@firstitem}
730 % 测试是否是在输出参见列表的第一项。
731 % \begin{macrocode}
732 \newif\ifseealso@firstitem
733 % \end{macrocode}
734 % \end{macro}
735 %
736 % \begin{macro}{\seealso@printlist}
737 % 输出参见列表 |#1|。如果列表为空则无操作。
738 % \begin{macrocode}
739 \def\seealso@printlist#1{%
740 \ifcsempty{seealso@#1@list}
741 {}
742 {\ifseealso@gobblefirstlistsep
743 \seealso@gobblefirstlistsepfalse
744 \else
745 \csuse{seealso@#1@listsep}%
746 \fi
747 \csuse{seealso@#1@nameformat}{\csuse{#1name}}%
748 \seealso@firstitemtrue
749 \forlistcsloop{\seealso@listitem{#1}}{seealso@#1@list}}}
750 % \end{macrocode}
751 % \end{macro}
752 %
753 % \begin{macro}{\seealso@listitem}
754 % 输出参见列表的一项。如果不是第一项,同时输出分隔符。
755 % \begin{macrocode}
756 \def\seealso@listitem#1#2{%
757 \ifseealso@firstitem
758 \seealso@firstitemfalse
759 \else
760 \csuse{seealso@#1@itemsep}%
761 \fi
762 \csuse{seealso@#1@itemformat}{#2}}
763 % \end{macrocode}
764 % \end{macro}
765 %
766 % \begin{macro}{\DeclareSeealsoMacro}
767 % \changes{v1.0}{2014/04/05}{新增以定义新的参见命令。}
768 % 定义一个新的带页码的参见命令。|#1| 是命令名,|#2| 是该命令使用的参见列
769 % 表,|#3| 是列表输出时使用的名字。
770 % \begin{macrocode}
771 \newcommand\DeclareSeealsoMacro[3]{%
772 % \end{macrocode}
773 % 首先定义参见命令 |#1| 本身。
774 % \begin{macrocode}
775 \newcommand#1[2]{%
776 \seealso@setactivecr
777 \seealso@ifinlistcs{##1}{seealso@#2@list}
778 {}
779 {\listcsgadd{seealso@#2@list}{##1}}%
780 \csuse{seealso@#2@pageformat}{##2}}%
781 % \end{macrocode}
782 % 将参见命令加入列表。
783 % \begin{macrocode}
784 \listadd\seealso@macrolist{#2}%
785 % \end{macrocode}
786 % 定义 |name| 选项,用来设置 |\|\meta{macro}|name|。如 |\seename| 和
787 % |\alsoname|。
788 % \begin{macrocode}
789 \define@key{seealso@#2}{name}{%
790 \csdef{#2name}{##1}}%
791 % \end{macrocode}
792 % 如果事先没有定义,则定义 |\|\meta{macro}|name| 为 |#3|。
793 % \begin{macrocode}
794 \ifcsdef{#2name}
795 {}
796 {\kvsetkeys{seealso@#2}{name=#3}}%
797 % \end{macrocode}
798 % 定义无参选项。
799 % \begin{macrocode}
800 \def\do##1{%
801 \define@key{seealso@#2}{##1}{%
802 \csdef{seealso@#2@##1}{####1}}%
803 \kvsetkeys{seealso@#2}{##1=\csuse{seealso@##1}}}%
804 \docsvlist{listsep,itemsep}%
805 % \end{macrocode}
806 % 定义有一个参数的选项。
807 % \begin{macrocode}
808 \def\do##1{%
809 \define@key{seealso@#2}{##1}{%
810 \csdef{seealso@#2@##1}########1{####1}}%
811 \kvsetkeys{seealso@#2}{##1=\csuse{seealso@##1}{####1}}}%
812 \docsvlist{nameformat,itemformat,pageformat}}
813 \@onlypreamble{\DeclareSeealsoMacro}
814 % \end{macrocode}
815 % \end{macro}
816 %
817 % \begin{macro}{\ifseealso@iscractive}
818 % 判断当前换行符是否已经被激活。
819 % \begin{macrocode}
820 \newif\ifseealso@iscractive
821 % \end{macrocode}
822 % \end{macro}
823 %
824 % \begin{macro}{\seealso@setactivecr}
825 % |activecr| 选项为真时,设置换行符为 |\seealso@cr| 并激活。
826 % \begin{macrocode}
827 \def\seealso@setactivecr{%
828 \ifseealso@activecr
829 \unless\ifseealso@iscractive
830 \catcode`\^^M=\active
831 \seealso@charlet\^^M\seealso@cr
832 \seealso@iscractivetrue
833 \fi
834 \fi}
835 % \end{macrocode}
836 % \end{macro}
837 %
838 % \begin{macro}{\seealso@cr}
839 % \changes{v1.1}{2014/04/07}{处理折行问题。}
840 % 是在 |activecr| 选项下,换行符的定义。它检测后面的记号是否在
841 % |\seealso@enditemlist| 中,以判断是否处于折行状态,决定是否输出列表。
842 % \begin{macrocode}
843 \def\seealso@cr{%
844 \futurelet\next\seealso@cr@aux}
845 % \end{macrocode}
846 % |\seealso@cr@aux| 是实际完成判断折行与输出的辅助过程。如果折行,则补全折行造
847 % 成的空白;否则取消激活换行符为宏,并输出参见列表。
848 % \begin{macrocode}
849 \def\seealso@cr@aux{%
850 \seealso@testwrap
851 \ifseealso@wrap
852 \space
853 \else
854 \catcode`\^^M=5
855 \seealso@iscractivefalse
856 \SeealsoPrintList
857 \fi}
858 % \end{macrocode}
859 % \end{macro}
860 %
861 % \begin{macro}{\ifseealso@wrap}
862 % 判断当前是否在折行的行尾。
863 % \begin{macrocode}
864 \newif\ifseealso@wrap
865 % \end{macrocode}
866 % \end{macro}
867 %
868 % \begin{macro}{\seealso@testwrap}
869 % 检查由 |\seealso@cr| 获取的下一记号 |\next| 是否在列表
870 % |\seealso@enditemlist| 中,确定当前是否在折行行尾。
871 % \begin{macrocode}
872 \def\seealso@testwrap{%
873 \seealso@wraptrue
874 \forlistloop\seealso@testwrap@aux\seealso@enditemlist}
875 \def\seealso@testwrap@aux#1{%
876 \ifx#1\next
877 \seealso@wrapfalse
878 \expandafter\listbreak
879 \fi}
880 % \end{macrocode}
881 % \end{macro}
882 %
883 % \begin{macro}{\seealso@enditemlist}
884 % 表示索引项结束的记号列表。用于判断是否处于折行状态。
885 % \begin{macrocode}
886 \let\seealso@enditemlist\empty
887 % \end{macrocode}
888 % \end{macro}
889 %
890 % \begin{macro}{\seealso@enditemlistadd}
891 % 向结束记号列表中增加一项。
892 % \begin{macrocode}
893 \def\seealso@enditemlistadd#1{%
894 \seealso@ifinlist{#1}\seealso@enditemlist
895 {}
896 {\listadd\seealso@enditemlist{#1}}}
897 % \end{macrocode}
898 % \end{macro}
899 % 下面定义结束记号列表的在 |seealso| 族下的键 |enditem| 与 |enditem+|,允许用
900 % 户自定义此列表。这里要求列表总包含 |\seealso@cr|。
901 % \begin{macrocode}
902 \define@key{seealso}{enditem}{%
903 \let\seealso@enditemlist\empty
904 \listadd\seealso@enditemlist{\seealso@cr}%
905 \forcsvlist\seealso@enditemlistadd{#1}}
906 \define@key{seealso}{enditem+}{%
907 \forcsvlist\seealso@enditemlistadd{#1}}
908 % \end{macrocode}
909 % 结束记号列表的默认值,除了 |\seealso@cr| 外,还包括通常在 |theindex| 等环境
910 % 中出现的其他一些宏。
911 % \begin{macrocode}
912 \kvsetkeys{seealso}{%
913 enditem={\indexspace,\item,\subitem,\subsubitem,\end}}
914 % \end{macrocode}
915 %
916 % 下面定义参见列表的默认输出格式。以下宏给出的都是全局的默认值,可以单独修改每
917 % 一项的输出格式。
918 % \begin{macro}{\seealso@listsep}
919 % 参见列表之前的分隔符。
920 % \begin{macrocode}
921 \def\seealso@listsep{,\space}
922 % \end{macrocode}
923 % \end{macro}
924 % \begin{macro}{\seealso@itemsep}
925 % 参见列表项之间的分隔符。
926 % \begin{macrocode}
927 \def\seealso@itemsep{,\space}
928 % \end{macrocode}
929 % \end{macro}
930 % \begin{macro}{\seealso@nameformat}
931 % 参见名“see also”的输出格式。
932 % \begin{macrocode}
933 \def\seealso@nameformat#1{\emph{#1}\space}
934 % \end{macrocode}
935 % \end{macro}
936 % \begin{macro}{\seealso@itemformat}
937 % 参见列表项的输出格式。
938 % \begin{macrocode}
939 \def\seealso@itemformat#1{#1}
940 % \end{macrocode}
941 % \end{macro}
942 % \begin{macro}{\seealso@pageformat}
943 % 参见页码的输出格式。
944 % \begin{macrocode}
945 \def\seealso@pageformat#1{#1}
946 % \end{macrocode}
947 % \end{macro}
948 %
949 % \begin{macro}{\seealso@define@key}
950 % \begin{macro}{\seealso@define@keyarg}
951 % 定义 |seealso| 族的键,用于设置输出格式。
952 % \begin{macrocode}
953 \def\seealso@define@key#1{%
954 \define@key{seealso}{#1}{%
955 \csdef{seealso@#1}{##1}}}
956 \def\seealso@define@keyarg#1{%
957 \define@key{seealso}{#1}{%
958 \csdef{seealso@#1}####1{##1}}}
959 % \end{macrocode}
960 % \end{macro}
961 % \end{macro}
962 % 为每个输出格式定义键。
963 % \begin{macrocode}
964 \forcsvlist\seealso@define@key{listsep,itemsep}
965 \forcsvlist\seealso@define@keyarg{nameformat,itemformat,pageformat}
966 % \end{macrocode}
967 %
968 % \begin{macro}{\SeealsoGobble}
969 % \changes{v1.0}{2014/04/06}{支持吞掉分隔符的页码格式,即不显示页码。}
970 % \changes{v1.1}{2014/04/07}{处理 \pkg{hyperref} 兼容性。}
971 % \changes{v1.1}{2014/04/09}{不再要求设置 \texttt{listsep} 为空。}
972 % 检查后面的字符是否 |#1|,如果是则吞掉分隔符 |#1| 及后面的空格。这个宏可用于
973 % 设置 |pageformat| 格式,吞掉一个类似 |,\space| 类型的分隔符。
974 %
975 % 这里检查是否定义了 \pkg{hyperref} 的 |\hyperindexformat|(表示打开了索引的超
976 % 链接功能),如果有 |\hyperindexformat|,则需要调整参数次序以解决
977 % |\hyperindexformat| 与 |\see| 等命令嵌套的问题。
978 % \begin{macrocode}
979 \AtBeginDocument{%
980 \ifundef\hyperindexformat{%
981 \let\SeealsoGobble\seealso@gobble
982 }{%
983 \def\SeealsoGobble#1{\seealso@swap{\seealso@gobble{#1}}}%
984 \def\seealso@swap#1#2#3#4{#2#3#4#1}%
985 }}
986 % \end{macrocode}
987 % \end{macro}
988 % \begin{macro}{\seealso@gobble}
989 % 实际的 |\SeealsoGobble| 命令,检查后面的字符是否 |#1|,如果是则吞掉分隔符
990 % |#1| 及后面的空格。
991 % \begin{macrocode}
992 \def\seealso@gobble#1{%
993 \@ifnextchar#1%
994 {\seealso@gobbleignorespaces}
995 % \end{macrocode}
996 % 如果 |\SeealsoGobble| 后面即将输出,即为换行符或 |\SeealsoPrintList|,则决定
997 % 后面不再输出第一个参见列表的 |listsep|。
998 % \begin{macrocode}
999 {\ifseealso@activecr
1000 \ifx\@let@token\seealso@cr
1001 \seealso@gobblefirstlistseptrue
1002 \fi
1003 \else
1004 \ifx\@let@token\SeealsoPrintList
1005 \seealso@gobblefirstlistseptrue
1006 \fi
1007 \fi}}
1008 % \end{macrocode}
1009 % \end{macro}
1010 % \begin{macro}{\seealso@gobbleignorespaces}
1011 % \changes{v1.1}{2014/04/08}{正确处理 \cs{SeealsoGobble} 在自动折行下的行为。}
1012 % 吞掉分隔符参数 |#1|(通常是一个逗号)并忽略后面的空格。
1013 %
1014 % 为了处理折行时会遇到的换行符宏 |\seealso@cr|,在发现后面的参数是
1015 % |\seealso@cr| 时就递归调用自身把 |\seealso@cr| 也清除掉。此时就好像直接把两
1016 % 行连接起来,不再调用 |\seealso@cr| 的复杂判断流程。
1017 % \begin{macrocode}
1018 \def\seealso@gobbleignorespaces#1{%
1019 \@ifnextchar\seealso@cr{\seealso@gobbleignorespaces}{\ignorespaces}}
1020 % \end{macrocode}
1021 % \end{macro}
1022 %
1023 % \subsection{定义用户接口}
1024 %
1025 % \begin{macro}{\seealsosetup}
1026 % \changes{v1.0}{2014/04/05}{新增格式设置。}
1027 % \changes{v1.1}{2014/04/09}{正确处理有参数的格式。}
1028 % 设置输出格式。可选参数是一个逗号列表:如果可选参数为空,用 |#2| 设置默认的输
1029 % 出格式;否则对可选参数的每一项,设置参数 |#2| 的格式。为了避免因嵌套定义造
1030 % 成使用时参数不得不使用双重 |##|,这里作了特别的展开处理。
1031 % \begin{macrocode}
1032 \newcommand\seealsosetup[2][]{%
1033 \ifstrempty{#1}{%
1034 \kvsetkeys{seealso}{#2}%
1035 }{%
1036 \edef\do##1{%
1037 \noexpand\kvsetkeys{seealso@##1}{\unexpanded{#2}}}%
1038 \docsvlist{#1}}}
1039 % \end{macrocode}
1040 % \end{macro}
1041 %
1042 % \begin{macro}{\seenopage}
1043 % \begin{macro}{\seealsonopage}
1044 % 保存旧的 |\see| 与 |\seealso| 命令定义,使用 |override| 选项时可临时使用旧的
1045 % 定义。
1046 % \begin{macrocode}
1047 \let\seenopage\see
1048 \let\seealsonopage\seealso
1049 % \end{macrocode}
1050 % \end{macro}
1051 % \end{macro}
1052 %
1053 % \begin{macro}{\seepage}
1054 % \begin{macro}{\seealsopage}
1055 % 带页码输出的 |\seepage| 与 |\seealsopage|。使用 |override| 选项时可直接使用
1056 % |\see| 与 |\seealso| 代替 |\seepage| 与 |\seealsopage|。
1057 %
1058 % 如果之前没有定义,这里会同时定义 |\seename| 和 |\alsoname|,与 \pkg{makeidx}
1059 % 初始值一致。
1060 % \begin{macrocode}
1061 \DeclareSeealsoMacro\seepage{see}{see}
1062 \DeclareSeealsoMacro\seealsopage{also}{see also}
1063 % \end{macrocode}
1064 % \end{macro}
1065 % \end{macro}
1066 %
1067 % \begin{macro}{\see}
1068 % \begin{macro}{\seealso}
1069 % 使用 |override| 时,重定义 |\see| 与 |\seealso|。
1070 % \begin{macrocode}
1071 \ifseealso@override
1072 \def\see{\seepage}
1073 \def\seealso{\seealsopage}
1074 \fi
1075 % \end{macrocode}
1076 % \end{macro}
1077 % \end{macro}
1078 %
1079 % \iffalse
1080 %</package>
1081 % \fi
1082 %
1083 % \Finale
1084 \endinput