%%
%% This is file `seealso.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% seealso.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2014 by Leo Liu <leoliu.pku@gmail.com>
%% --------------------------------------------------------------------------
%% 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 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{seealso}
    [2014/04/06 v1.0 makeidx's see and seealso with page number support.]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=seealso@opt,
  prefix=seealso@}
\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}
\newcommand\SeealsoPrintList{%
  \forlistloop\seealso@printlist\seealso@macrolist
  \seealso@clearlists}
\newif\ifseealso@firstitem
\def\seealso@printlist#1{%
  \ifcsempty{seealso@#1@list}
    {}
    {\csuse{seealso@#1@listsep}%
     \csuse{seealso@#1@nameformat}{\csuse{#1name}}%
     \seealso@firstitemtrue
     \forlistcsloop{\seealso@listitem{#1}}{seealso@#1@list}}}
\def\seealso@listitem#1#2{%
  \ifseealso@firstitem
    \seealso@firstitemfalse
  \else
    \csuse{seealso@#1@itemsep}%
  \fi
  \csuse{seealso@#1@itemformat}{#2}}
\newcommand\DeclareSeealsoMacro[3]{%
  \newcommand#1[2]{%
    \seealso@setactivecr
    \ifinlistcs{##1}{seealso@#2@list}
      {}
      {\listcsgadd{seealso@#2@list}{##1}}%
    \csuse{seealso@#2@pageformat}{##2}}%
  \listadd\seealso@macrolist{#2}%
  \define@key{seealso@#2}{name}{%
    \csdef{#2name}{##1}}%
  \ifcsdef{#2name}
    {}
    {\setkeys{seealso@#2}{name=#3}}%
  \def\do##1{%
    \define@key{seealso@#2}{##1}{%
      \csdef{seealso@#2@##1}{####1}}%
    \setkeys{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}}}%
  \docsvlist{nameformat,itemformat,pageformat}}
\@onlypreamble{\DeclareSeealsoMacro}
\newif\ifseealso@iscractive
\def\seealso@setactivecr{%
  \ifseealso@activecr
    \unless\ifseealso@iscractive
      \catcode`\^^M=\active
      \seealso@charlet\^^M\seealso@cr
      \seealso@iscractivetrue
    \fi
  \fi}
\def\seealso@cr{%
  \catcode`\^^M=5
  \seealso@iscractivefalse
  \SeealsoPrintList}
\def\seealso@listsep{,\space}
\def\seealso@itemsep{,\space}
\def\seealso@nameformat#1{\emph{#1}\space}
\def\seealso@itemformat#1{#1}
\def\seealso@pageformat#1{#1}
\def\seealso@define@key#1{%
  \define@key{seealso}{#1}{%
    \csdef{seealso@#1}{##1}}}
\def\seealso@define@keyarg#1{%
  \define@key{seealso}{#1}{%
    \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}
\newcommand\seealsosetup[2][]{%
  \ifstrempty{#1}{%
    \setkeys{seealso}{#2}%
  }{%
    \def\do##1{\setkeys{seealso@##1}{#2}}%
    \forcsvlist{\do}{#1}}}
\let\seenopage\see
\let\seealsonopage\seealso
\DeclareSeealsoMacro\seepage{see}{see}
\DeclareSeealsoMacro\seealsopage{also}{see also}
\ifseealso@override
  \def\see{\seepage}
  \def\seealso{\seealsopage}
\fi
\endinput
%%
%% End of file `seealso.sty'.
