summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-04-14 22:52:27 +0000
committerKarl Berry <karl@freefriends.org>2014-04-14 22:52:27 +0000
commite65f51f91e7c01ee998b546ed4149b5937dbe8db (patch)
tree9322bdd0c4b59db4309be71ea2e3f593efa351cc /Master/texmf-dist
parent069bd295ea9dc6dcb5e73bf9d1171640a4acd61e (diff)
seealso (10apr14)
git-svn-id: svn://tug.org/texlive/trunk@33449 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/seealso/seealso.pdfbin149325 -> 163261 bytes
-rw-r--r--Master/texmf-dist/source/latex/seealso/seealso.dtx285
-rw-r--r--Master/texmf-dist/tex/latex/seealso/seealso.sty92
3 files changed, 273 insertions, 104 deletions
diff --git a/Master/texmf-dist/doc/latex/seealso/seealso.pdf b/Master/texmf-dist/doc/latex/seealso/seealso.pdf
index 76e71cee19c..9640bde81a2 100644
--- a/Master/texmf-dist/doc/latex/seealso/seealso.pdf
+++ b/Master/texmf-dist/doc/latex/seealso/seealso.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/seealso/seealso.dtx b/Master/texmf-dist/source/latex/seealso/seealso.dtx
index 6494a92fcb4..37af75cd1ef 100644
--- a/Master/texmf-dist/source/latex/seealso/seealso.dtx
+++ b/Master/texmf-dist/source/latex/seealso/seealso.dtx
@@ -26,7 +26,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{seealso}
%<*package>
- [2014/04/06 v1.0 makeidx's see and seealso with page number support.]
+ [2014/04/10 v1.1 makeidx's see and seealso with page number support.]
%</package>
%
%<*driver>
@@ -74,10 +74,17 @@
\encapchar main}%
\@esphack}
\def\SpecialOptionIndex#1{\@bsphack
+ \begingroup
+ \HD@target
+ \let\HDorg@encapchar\encapchar
+ \edef\encapchar usage{%
+ \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}}%
\index{#1\actualchar{\protect\ttfamily#1}
(option)\encapchar usage}%
\index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
- usage}\@esphack}
+ usage}%
+ \endgroup
+ \@esphack}
\def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters
\Describe@Option}
\def\Describe@Option#1{\endgroup
@@ -112,7 +119,7 @@
%</driver>
% \fi
%
-% \CheckSum{163}
+% \CheckSum{253}
%
% \CharacterTable
% {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
@@ -134,13 +141,15 @@
% \changes{v0.1}{2014/04/04}{初始版本。}
% \changes{v1.0}{2014/04/05}{功能较完备的版本。}
%
-% \DoNotIndex{\newcommand,\newenvironment,\^,\~,\@ifnextchar,\@onlypreamble,
-% \active, \AtBeginDocument,\begingroup,\catcode, \csdef,\cslet,\cslet,\csuse,
-% \DeclareBoolOption,\def,\define@key,\do, \docsvlist, \dolistloop,\else,
-% \emph,\empty,\endgroup,\fi,\forcsvlist, \forlistcsloop, \forlistloop,
-% \ifcsdef,\ifcsempty, \ifinlistcs,\ifstrempty,\ignorespaces,\lccode,\let,
-% \listadd, \listcsgadd,\lowercase,\newif, \ProcessKeyvalOptions,
-% \RequirePackage, \setkeys,\SetupKeyvalOptions,\space,\unless}
+% \DoNotIndex{\newcommand,\newenvironment,\^,\~,\@for,\@ifnextchar,
+% \@let@token,\@onlypreamble, \active, \AtBeginDocument,\begingroup,\catcode,
+% \csdef,\cslet,\cslet,\csuse, \DeclareBoolOption,\def,\define@key,\do,
+% \docsvlist, \dolistloop,\edef,\else, \emph,\empty,\endgroup,\expandafter,
+% \fi, \forcsvlist, \forlistcsloop, \forlistloop, \futurelet,\global,
+% \ifcsdef, \ifcsempty,\ifinlist,\ifinlistcs, \ifstrempty,\ifundef,\ifx,
+% \ignorespaces, \kvsetkeys,\lccode,\let, \listadd,\listbreak, \listcsgadd,
+% \lowercase,\newif, \next, \noexpand,\ProcessKeyvalOptions, \RequirePackage,
+% \reserved@a, \SetupKeyvalOptions,\space,\unexpanded,\unless}
%
% \GetFileInfo{seealso.dtx}
% \title[The seealso Package (\fileversion)]
@@ -155,7 +164,7 @@
%
% \section{Introduction}
%
-% When preparing index, the macros |\see| and |\seealso| define by \LaTeXe's
+% When preparing index, the macros |\see| and |\seealso| defined by \LaTeXe's
% standard package \pkg{makeidx} are handy to use. They are used as special
% page format command, to present cross reference of index entry. For example,
% if we use
@@ -242,7 +251,7 @@
% \begin{quote}
% foo, \seepage{bar}{1}, \seepage{bar}{2}, \seepage{bar}{3}
% \end{quote}
-%
+%
% It is possible to use different references for one index entry. For example
% we can use
% \begin{Verbatim}
@@ -271,7 +280,7 @@
% \DescribeMacro{\seealso}
% When option |override| is |true|, which is the default, |\see| and
% |\seealso| works just as |\seepage| and |\seealsopage|.
-%
+%
% \DescribeMacro{\SeealsoPrintList}
% |\seepage| and |\seealsopage| will collect the see lists, which will be
% output at the end of the line under default |activecr| option. However, when
@@ -351,49 +360,39 @@
% \seealsosetup[also]{pageformat=\textit{#1}}
% \end{Verbatim}
%
+% Besides the output styles, |\seealsosetup| accepts |enditem| and |enditem+|
+% options, which is a list of token that determines whether to output the see
+% list at the end of line, if |activecr| option is true. The default value of
+% the list includes some common macros in |theindex| environment:
+% |\indexspace|, |\item|, |\subitem|, |\subsubitem|, and |\end|. For example,
+% if we have a special index which supports 4th level item |\subsubsubitem|
+% and a special space |\myindexspace|, we can use
+% \begin{Verbatim}
+% \seealsosetup{enditem+={\subsubsubitem,\myindexspace}}
+% \end{Verbatim}
+% to add the new macros to the list.
+%
% \DescribeMacro{\SeealsoGobble}
% |\SeealsoGobble| takes a character \meta{c} as argument. It checks the
% following character, gobble it and ignore spaces if it is \meta{c}, or do
% nothing if it is not \meta{c}. This macro is useful in |pageformat| style
% to prevent outputting the page numbers, like this:
% \begin{Verbatim}
-% \seealsosetup[see,also]{pageformat=\SeealsoGobble{,}, listsep=}
+% \seealsosetup[see,also]{pageformat=\SeealsoGobble{,}}
% \end{Verbatim}
-% However, |\see| and |\seealso| will be encapsulated by |\hyperindexformat|
-% is we use \pkg{hyperref}, then |\SeealsoGobble| will be invalid.
+%
%
% \section{Known Issues}
%
% Here are some known problems and their solutions:
% \begin{itemize}
% \item
-% Makeindex wraps the output lines with respect to |line_max| variable. The
-% default value of |line_max| is only 72, therefore the entry line containing
-% |\see| and |\seealso| may be wrapped. However, |activecr| is |true| by
-% default, then package \pkg{seealso} will print the see lists at each end of
-% lines, and in the wrapped lines the see lists are output multiple times,
-% which is unexpected.
-%
-% To solve the problem, it is better to set larger |line_max| in the |.ist|
-% style file to prevent wrapping. Another approach is to set |activecr=false|
-% option, and set |delim_t| to be |\SeealsoPrintList| explicitly to output the
-% see lists.
-%
-% \item
% Since the output format of page numbers of |\seepage|, |\seealsopage| is the
% same as normal page numbers, it may be ambiguous if we use normal |\index|
% and \verb=\index{...|seepage}= simultaneously. Usually we should avoid using
% different style of |\index| with or without |\seepage| and |\seealsopage|.
% If it is impossible, we can set special page number format to identify them,
% or we can use |\SeealsoGobble| to disable page numbers.
-%
-% \item
-% When \pkg{hyperref} package is used, the function of avoiding page numbers
-% via |\SeealsoGobble| is invalid. That is because that |\see| and |\seealso|
-% will be encapsulated by |\hyperindexformat| in the |.ind| file. To solve the
-% problem, we can set |hyperindex=false| option of \pkg{hyperref} to disable
-% hyperlinks in the index, or some special patching of \pkg{hyperref} can be
-% considered.
% \end{itemize}
%
%
@@ -583,43 +582,39 @@
% \seealsosetup[also]{pageformat=\textit{#1}}
% \end{Verbatim}
%
+% 除了输出格式,|\seealsosetup| 还接受 |enditem| 和 |enditem+| 选项,用于设置
+% \pkg{seealso} 宏包在 |activecr| 选项设置时,进入行尾之后遇到什么记号时决定输
+% 出参见列表。通常情况下并不需要设置该选项,|enditem| 选项的默认值已经包括了在
+% 标准的 |theindex| 环境中会出现的一些宏:|\indexspace|、|\item|、|\subitem|、
+% |\subsubitem|、|\end|。使用 |enditem+| 选项则可以向列表中增加新的记号。例
+% 如,如果某种特殊的索引支持 4 级项 |\subsubsubitem| 和特殊的间隔
+% |\myindexspace|,就可以使用
+% \begin{Verbatim}
+% \seealsosetup{enditem+={\subsubsubitem,\myindexspace}}
+% \end{Verbatim}
+% 向列表中添加新的记号。
+%
% \DescribeMacro{\SeealsoGobble}
% |\SeealsoGobble| 宏接受一个字符作为参数,它检查后面是否有此字符,如果是则吞
% 掉此字符及后面的空格,否则什么都不做。在 |pageformat| 选项中使用这个宏可以用
% 来禁止显示参见项的页码,像下面这样:
% \begin{Verbatim}
-% \seealsosetup[see,also]{pageformat=\SeealsoGobble{,}, listsep=}
+% \seealsosetup[see,also]{pageformat=\SeealsoGobble{,}}
% \end{Verbatim}
-% 但注意使用 \pkg{hyperref} 时,|\see|、|\seealso| 等命令会被
-% |\hyperindexformat| 所包裹,使这种方法会失效。
%
% \section{已知问题}
%
% 以下是一些已知的问题和解决方案:
% \begin{itemize}
% \item
-% Makeindex 会按输出选项 |line_max| 对输出的内容进行折行,默认的 |line_max| 只
-% 有 72,所以当项目较多时,可能在 |\see| 或 |\seealso| 等命令所在的项目中产生
-% 折行。但由于默认情况下(|activecr| 选项打开)\pkg{seealso} 包遇到换行符就会
-% 输出参见列表,会造成错误。一种解决方法是将 |line_max| 设置得很大,避免折行;
-% 另一种解决方法是设置 |activecr=false|,同时在 Makeindex 的格式文件中显式设置
-% |delim_t| 为 |\SeealsoPrintList| 来输出参见列表。
-%
-% \item
% 由于 |\seepage|, |\seealsopage| 的页码显示形式与普通页码相同,所以可能会造成
% 页码重叠的情况。最好尽量避免交叉引用的项目有多种形式的索引。如果不能避免,为
% 解决此问题,可以设置特别的页码输出格式以示区分,或者借用 |\SeealsoGobble| 设
% 置不输出页码。
-%
-% \item
-% 在使用 \pkg{hyperref} 功能时,用 |\SeealsoGobble| 禁止显示页码的功能会失效。
-% 这是因为 |\see|、|\seealso| 等命令会被 |\hyperindexformat| 包裹。为解决此问
-% 题,可以设置 \pkg{hyperref} 的选项 |hyperindex=false| 禁用索引的超链接,或者
-% 考虑对 \pkg{hyperref} 做特殊的补丁。
% \end{itemize}
%
% \StopEventually{}
-%
+%
% \clearpage
% \section{Implementation / 代码实现}
%
@@ -635,7 +630,8 @@
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=seealso@opt,
- prefix=seealso@}
+ prefix=seealso@,
+ setkeys=\kvsetkeys}
% \end{macrocode}
%
% 声明宏包选项。
@@ -680,25 +676,31 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\seealso@clearlists}
+% \begin{macro}{\seealso@clearlist}
% 清空参见列表,如 |\seealso@see@list|、|\seealso@also@list|。
% \begin{macrocode}
-\def\seealso@clearlists{%
- \def\do##1{\cslet{seealso@##1@list}\empty}%
- \dolistloop\seealso@macrolist}
-\AtBeginDocument{\seealso@clearlists}
+\def\seealso@clearlist#1{%
+ \global\cslet{seealso@#1@list}\empty}
+\AtBeginDocument{\forlistloop\seealso@clearlist\seealso@macrolist}
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\SeealsoPrintList}
% 输出参见列表,如 |\seealso@see@list|、|\seealso@also@list|。
% \begin{macrocode}
\newcommand\SeealsoPrintList{%
\forlistloop\seealso@printlist\seealso@macrolist
- \seealso@clearlists}
+ \forlistloop\seealso@clearlist\seealso@macrolist}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifseealso@gobblefirstlistsep}
+% 测试是否忽略第一个列表分隔符(因为前面使用了 |\SeealsoGobble|)。
+% \begin{macrocode}
+\newif\ifseealso@gobblefirstlistsep
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\ifseealso@firstitem}
% 测试是否是在输出参见列表的第一项。
% \begin{macrocode}
@@ -712,7 +714,11 @@
\def\seealso@printlist#1{%
\ifcsempty{seealso@#1@list}
{}
- {\csuse{seealso@#1@listsep}%
+ {\ifseealso@gobblefirstlistsep
+ \seealso@gobblefirstlistsepfalse
+ \else
+ \csuse{seealso@#1@listsep}%
+ \fi
\csuse{seealso@#1@nameformat}{\csuse{#1name}}%
\seealso@firstitemtrue
\forlistcsloop{\seealso@listitem{#1}}{seealso@#1@list}}}
@@ -731,7 +737,7 @@
\csuse{seealso@#1@itemformat}{#2}}
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\DeclareSeealsoMacro}
% \changes{v1.0}{2014/04/05}{新增以定义新的参见命令。}
% 定义一个新的带页码的参见命令。|#1| 是命令名,|#2| 是该命令使用的参见列
@@ -762,14 +768,14 @@
% \begin{macrocode}
\ifcsdef{#2name}
{}
- {\setkeys{seealso@#2}{name=#3}}%
+ {\kvsetkeys{seealso@#2}{name=#3}}%
% \end{macrocode}
% 定义无参选项。
% \begin{macrocode}
\def\do##1{%
\define@key{seealso@#2}{##1}{%
\csdef{seealso@#2@##1}{####1}}%
- \setkeys{seealso@#2}{##1=\csuse{seealso@##1}}}%
+ \kvsetkeys{seealso@#2}{##1=\csuse{seealso@##1}}}%
\docsvlist{listsep,itemsep}%
% \end{macrocode}
% 定义有一个参数的选项。
@@ -777,7 +783,7 @@
\def\do##1{%
\define@key{seealso@#2}{##1}{%
\csdef{seealso@#2@##1}########1{####1}}%
- \setkeys{seealso@#2}{##1=\csuse{seealso@##1}{####1}}}%
+ \kvsetkeys{seealso@#2}{##1=\csuse{seealso@##1}{####1}}}%
\docsvlist{nameformat,itemformat,pageformat}}
\@onlypreamble{\DeclareSeealsoMacro}
% \end{macrocode}
@@ -789,7 +795,7 @@
\newif\ifseealso@iscractive
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\seealso@setactivecr}
% |activecr| 选项为真时,设置换行符为 |\seealso@cr| 并激活。
% \begin{macrocode}
@@ -803,17 +809,85 @@
\fi}
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\seealso@cr}
-% 是在 |activecr| 选项下,换行符的定义。它取消激活换行符为宏,并输出参见列表。
+% \changes{v1.1}{2014/04/07}{处理折行问题。}
+% 是在 |activecr| 选项下,换行符的定义。它检测后面的记号是否在
+% |\seealso@enditemlist| 中,以判断是否处于折行状态,决定是否输出列表。
% \begin{macrocode}
\def\seealso@cr{%
- \catcode`\^^M=5
- \seealso@iscractivefalse
- \SeealsoPrintList}
+ \futurelet\next\seealso@cr@aux}
+% \end{macrocode}
+% |\seealso@cr@aux| 是实际完成判断折行与输出的辅助过程。如果折行,则补全折行造
+% 成的空白;否则取消激活换行符为宏,并输出参见列表。
+% \begin{macrocode}
+\def\seealso@cr@aux{%
+ \seealso@testwrap
+ \ifseealso@wrap
+ \space
+ \else
+ \catcode`\^^M=5
+ \seealso@iscractivefalse
+ \SeealsoPrintList
+ \fi}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ifseealso@wrap}
+% 判断当前是否在折行的行尾。
+% \begin{macrocode}
+\newif\ifseealso@wrap
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\seealso@testwrap}
+% 检查由 |\seealso@cr| 获取的下一记号 |\next| 是否在列表
+% |\seealso@enditemlist| 中,确定当前是否在折行行尾。
+% \begin{macrocode}
+\def\seealso@testwrap{%
+ \seealso@wraptrue
+ \forlistloop\seealso@testwrap@aux\seealso@enditemlist}
+\def\seealso@testwrap@aux#1{%
+ \ifx#1\next
+ \seealso@wrapfalse
+ \expandafter\listbreak
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\seealso@enditemlist}
+% 表示索引项结束的记号列表。用于判断是否处于折行状态。
+% \begin{macrocode}
+\let\seealso@enditemlist\empty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\seealso@enditemlistadd}
+% 向结束记号列表中增加一项。
+% \begin{macrocode}
+\def\seealso@enditemlistadd#1{%
+ \ifinlist{#1}\seealso@enditemlist
+ {}
+ {\listadd\seealso@enditemlist{#1}}}
+% \end{macrocode}
+% \end{macro}
+% 下面定义结束记号列表的在 |seealso| 族下的键 |enditem| 与 |enditem+|,允许用
+% 户自定义此列表。这里要求列表总包含 |\seealso@cr|。
+% \begin{macrocode}
+\define@key{seealso}{enditem}{%
+ \let\seealso@enditemlist\empty
+ \listadd\seealso@enditemlist{\seealso@cr}%
+ \forcsvlist\seealso@enditemlistadd{#1}}
+\define@key{seealso}{enditem+}{%
+ \forcsvlist\seealso@enditemlistadd{#1}}
+% \end{macrocode}
+% 结束记号列表的默认值,除了 |\seealso@cr| 外,还包括通常在 |theindex| 等环境
+% 中出现的其他一些宏。
+% \begin{macrocode}
+\kvsetkeys{seealso}{%
+ enditem={\indexspace,\item,\subitem,\subsubitem,\end}}
+% \end{macrocode}
+%
% 下面定义参见列表的默认输出格式。以下宏给出的都是全局的默认值,可以单独修改每
% 一项的输出格式。
% \begin{macro}{\seealso@listsep}
@@ -868,16 +942,56 @@
%
% \begin{macro}{\SeealsoGobble}
% \changes{v1.0}{2014/04/06}{支持吞掉分隔符的页码格式,即不显示页码。}
+% \changes{v1.1}{2014/04/07}{处理 \pkg{hyperref} 兼容性。}
+% \changes{v1.1}{2014/04/09}{不再要求设置 \texttt{listsep} 为空。}
% 检查后面的字符是否 |#1|,如果是则吞掉分隔符 |#1| 及后面的空格。这个宏可用于
% 设置 |pageformat| 格式,吞掉一个类似 |,\space| 类型的分隔符。
+%
+% 这里检查是否定义了 \pkg{hyperref} 的 |\hyperindexformat|(表示打开了索引的超
+% 链接功能),如果有 |\hyperindexformat|,则需要调整参数次序以解决
+% |\hyperindexformat| 与 |\see| 等命令嵌套的问题。
% \begin{macrocode}
-\def\SeealsoGobble#1{\@ifnextchar#1{\seealso@gobbleignorespaces}{}}
+\AtBeginDocument{%
+ \ifundef\hyperindexformat{%
+ \let\SeealsoGobble\seealso@gobble
+ }{%
+ \def\SeealsoGobble#1{\seealso@swap{\seealso@gobble{#1}}}%
+ \def\seealso@swap#1#2#3#4{#2#3#4#1}%
+ }}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\seealso@gobble}
+% 实际的 |\SeealsoGobble| 命令,检查后面的字符是否 |#1|,如果是则吞掉分隔符
+% |#1| 及后面的空格。
+% \begin{macrocode}
+\def\seealso@gobble#1{%
+ \@ifnextchar#1%
+ {\seealso@gobbleignorespaces}
+% \end{macrocode}
+% 如果 |\SeealsoGobble| 后面即将输出,即为换行符或 |\SeealsoPrintList|,则决定
+% 后面不再输出第一个参见列表的 |listsep|。
+% \begin{macrocode}
+ {\ifseealso@activecr
+ \ifx\@let@token\seealso@cr
+ \seealso@gobblefirstlistseptrue
+ \fi
+ \else
+ \ifx\@let@token\SeealsoPrintList
+ \seealso@gobblefirstlistseptrue
+ \fi
+ \fi}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\seealso@gobbleignorespaces}
-% 吞掉参数并忽略后面的空格。
+% \changes{v1.1}{2014/04/08}{正确处理 \cs{SeealsoGobble} 在自动折行下的行为。}
+% 吞掉分隔符参数 |#1|(通常是一个逗号)并忽略后面的空格。
+%
+% 为了处理折行时会遇到的换行符宏 |\seealso@cr|,在发现后面的参数是
+% |\seealso@cr| 时就递归调用自身把 |\seealso@cr| 也清除掉。此时就好像直接把两
+% 行连接起来,不再调用 |\seealso@cr| 的复杂判断流程。
% \begin{macrocode}
-\def\seealso@gobbleignorespaces#1{\ignorespaces}
+\def\seealso@gobbleignorespaces#1{%
+ \@ifnextchar\seealso@cr{\seealso@gobbleignorespaces}{\ignorespaces}}
% \end{macrocode}
% \end{macro}
%
@@ -885,17 +999,18 @@
%
% \begin{macro}{\seealsosetup}
% \changes{v1.0}{2014/04/05}{新增格式设置。}
+% \changes{v1.1}{2014/04/09}{正确处理有参数的格式。}
% 设置输出格式。可选参数是一个逗号列表:如果可选参数为空,用 |#2| 设置默认的输
-% 出格式;否则对可选参数的每一项,设置参数 |#2| 的格式。使用 |\forcsvlist| 而
-% 没有使用 |\docsvlist| 是为了避免因嵌套定义造成使用时参数不得不使用双重
-% |##|。
+% 出格式;否则对可选参数的每一项,设置参数 |#2| 的格式。为了避免因嵌套定义造
+% 成使用时参数不得不使用双重 |##|,这里作了特别的展开处理。
% \begin{macrocode}
\newcommand\seealsosetup[2][]{%
\ifstrempty{#1}{%
- \setkeys{seealso}{#2}%
+ \kvsetkeys{seealso}{#2}%
}{%
- \def\do##1{\setkeys{seealso@##1}{#2}}%
- \forcsvlist{\do}{#1}}}
+ \edef\do##1{%
+ \noexpand\kvsetkeys{seealso@##1}{\unexpanded{#2}}}%
+ \docsvlist{#1}}}
% \end{macrocode}
% \end{macro}
%
@@ -935,7 +1050,7 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
-%
+%
% \iffalse
%</package>
% \fi
diff --git a/Master/texmf-dist/tex/latex/seealso/seealso.sty b/Master/texmf-dist/tex/latex/seealso/seealso.sty
index ae67167b76f..235beb8f4a8 100644
--- a/Master/texmf-dist/tex/latex/seealso/seealso.sty
+++ b/Master/texmf-dist/tex/latex/seealso/seealso.sty
@@ -20,30 +20,35 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{seealso}
- [2014/04/06 v1.0 makeidx's see and seealso with page number support.]
+ [2014/04/10 v1.1 makeidx's see and seealso with page number support.]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=seealso@opt,
- prefix=seealso@}
+ prefix=seealso@,
+ setkeys=\kvsetkeys}
\DeclareBoolOption[true]{override}
\DeclareBoolOption[true]{activecr}
\ProcessKeyvalOptions*
\def\seealso@charlet#1{%
\begingroup\lccode`\~=`#1\lowercase{\endgroup\let~}}
\let\seealso@macrolist\empty
-\def\seealso@clearlists{%
- \def\do##1{\cslet{seealso@##1@list}\empty}%
- \dolistloop\seealso@macrolist}
-\AtBeginDocument{\seealso@clearlists}
+\def\seealso@clearlist#1{%
+ \global\cslet{seealso@#1@list}\empty}
+\AtBeginDocument{\forlistloop\seealso@clearlist\seealso@macrolist}
\newcommand\SeealsoPrintList{%
\forlistloop\seealso@printlist\seealso@macrolist
- \seealso@clearlists}
+ \forlistloop\seealso@clearlist\seealso@macrolist}
+\newif\ifseealso@gobblefirstlistsep
\newif\ifseealso@firstitem
\def\seealso@printlist#1{%
\ifcsempty{seealso@#1@list}
{}
- {\csuse{seealso@#1@listsep}%
+ {\ifseealso@gobblefirstlistsep
+ \seealso@gobblefirstlistsepfalse
+ \else
+ \csuse{seealso@#1@listsep}%
+ \fi
\csuse{seealso@#1@nameformat}{\csuse{#1name}}%
\seealso@firstitemtrue
\forlistcsloop{\seealso@listitem{#1}}{seealso@#1@list}}}
@@ -66,16 +71,16 @@
\csdef{#2name}{##1}}%
\ifcsdef{#2name}
{}
- {\setkeys{seealso@#2}{name=#3}}%
+ {\kvsetkeys{seealso@#2}{name=#3}}%
\def\do##1{%
\define@key{seealso@#2}{##1}{%
\csdef{seealso@#2@##1}{####1}}%
- \setkeys{seealso@#2}{##1=\csuse{seealso@##1}}}%
+ \kvsetkeys{seealso@#2}{##1=\csuse{seealso@##1}}}%
\docsvlist{listsep,itemsep}%
\def\do##1{%
\define@key{seealso@#2}{##1}{%
\csdef{seealso@#2@##1}########1{####1}}%
- \setkeys{seealso@#2}{##1=\csuse{seealso@##1}{####1}}}%
+ \kvsetkeys{seealso@#2}{##1=\csuse{seealso@##1}{####1}}}%
\docsvlist{nameformat,itemformat,pageformat}}
\@onlypreamble{\DeclareSeealsoMacro}
\newif\ifseealso@iscractive
@@ -88,9 +93,38 @@
\fi
\fi}
\def\seealso@cr{%
- \catcode`\^^M=5
- \seealso@iscractivefalse
- \SeealsoPrintList}
+ \futurelet\next\seealso@cr@aux}
+\def\seealso@cr@aux{%
+ \seealso@testwrap
+ \ifseealso@wrap
+ \space
+ \else
+ \catcode`\^^M=5
+ \seealso@iscractivefalse
+ \SeealsoPrintList
+ \fi}
+\newif\ifseealso@wrap
+\def\seealso@testwrap{%
+ \seealso@wraptrue
+ \forlistloop\seealso@testwrap@aux\seealso@enditemlist}
+\def\seealso@testwrap@aux#1{%
+ \ifx#1\next
+ \seealso@wrapfalse
+ \expandafter\listbreak
+ \fi}
+\let\seealso@enditemlist\empty
+\def\seealso@enditemlistadd#1{%
+ \ifinlist{#1}\seealso@enditemlist
+ {}
+ {\listadd\seealso@enditemlist{#1}}}
+\define@key{seealso}{enditem}{%
+ \let\seealso@enditemlist\empty
+ \listadd\seealso@enditemlist{\seealso@cr}%
+ \forcsvlist\seealso@enditemlistadd{#1}}
+\define@key{seealso}{enditem+}{%
+ \forcsvlist\seealso@enditemlistadd{#1}}
+\kvsetkeys{seealso}{%
+ enditem={\indexspace,\item,\subitem,\subsubitem,\end}}
\def\seealso@listsep{,\space}
\def\seealso@itemsep{,\space}
\def\seealso@nameformat#1{\emph{#1}\space}
@@ -104,14 +138,34 @@
\csdef{seealso@#1}####1{##1}}}
\forcsvlist\seealso@define@key{listsep,itemsep}
\forcsvlist\seealso@define@keyarg{nameformat,itemformat,pageformat}
-\def\SeealsoGobble#1{\@ifnextchar#1{\seealso@gobbleignorespaces}{}}
-\def\seealso@gobbleignorespaces#1{\ignorespaces}
+\AtBeginDocument{%
+ \ifundef\hyperindexformat{%
+ \let\SeealsoGobble\seealso@gobble
+ }{%
+ \def\SeealsoGobble#1{\seealso@swap{\seealso@gobble{#1}}}%
+ \def\seealso@swap#1#2#3#4{#2#3#4#1}%
+ }}
+\def\seealso@gobble#1{%
+ \@ifnextchar#1%
+ {\seealso@gobbleignorespaces}
+ {\ifseealso@activecr
+ \ifx\@let@token\seealso@cr
+ \seealso@gobblefirstlistseptrue
+ \fi
+ \else
+ \ifx\@let@token\SeealsoPrintList
+ \seealso@gobblefirstlistseptrue
+ \fi
+ \fi}}
+\def\seealso@gobbleignorespaces#1{%
+ \@ifnextchar\seealso@cr{\seealso@gobbleignorespaces}{\ignorespaces}}
\newcommand\seealsosetup[2][]{%
\ifstrempty{#1}{%
- \setkeys{seealso}{#2}%
+ \kvsetkeys{seealso}{#2}%
}{%
- \def\do##1{\setkeys{seealso@##1}{#2}}%
- \forcsvlist{\do}{#1}}}
+ \edef\do##1{%
+ \noexpand\kvsetkeys{seealso@##1}{\unexpanded{#2}}}%
+ \docsvlist{#1}}}
\let\seenopage\see
\let\seealsonopage\seealso
\DeclareSeealsoMacro\seepage{see}{see}