%%% ====================================================================
%%%  @LaTeX-file{
%%%     author          = "Scott Pakin",
%%%     version         = "16.0",
%%%     date            = "12 April 2026",
%%%     time            = "16:26:15 MDT",
%%%     filename        = "symbols.tex",
%%%     checksum        = "49629 5738 12223 191728",
%%%     email           = "scott+clsl@pakin.org (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "symbols, LaTeX2e, typesetting, accents,
%%%                        mathematics, scientific, dingbats, fonts",
%%%     supported       = "yes",
%%%     abstract        = "This document lists tens of thousands of
%%%                        symbols and the corresponding LaTeX commands
%%%                        that produce them.  Some of these symbols are
%%%                        guaranteed to be available in every LaTeX2e
%%%                        system; others require fonts and packages
%%%                        that may not accompany a given distribution
%%%                        and that therefore need to be installed.
%%%                        All of the fonts and packages used to
%%%                        prepare this document -- as well as this
%%%                        document itself -- are freely available
%%%                        from the Comprehensive TeX Archive Network
%%%                        (https://www.ctan.org).",
%%%     docstring       = "This LaTeX document showcases tens of
%%%                        thousands of symbols that are available to
%%%                        authors.  The original version of this
%%%                        document was written by David Carlisle on
%%%                        1994/10/02.  It subsequently was changed and
%%%                        expanded by Scott Pakin.
%%%
%%%                        To build this document, run ``latex
%%%                        symbols'', then ``makeindex -s gind.ist
%%%                        symbols'', then two more ``latex symbols''
%%%                        commands.  This ensures the stability of
%%%                        all generated content (tables, references,
%%%                        etc.)
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by
%%%                        the equivalent of the standard UNIX wc
%%%                        (word count) utility output of lines,
%%%                        words, and characters.  This is produced by
%%%                        Robert Solovay's checksum utility.  This file
%%%                        header was produced with the help of Nelson
%%%                        Beebe's filehdr utility.  Both checksum and
%%%                        filehdr are available from CTAN
%%%                        (https://www.ctan.org)."
%%%  }
%%% ====================================================================

\NeedsTeXFormat{LaTeX2e}
\IfFileExists{cmap.sty}{\RequirePackage[resetfonts]{cmap}}{}

% Before we load any fonts, ensure that METAFONT fonts will be
% compiled to 1200 DPI .pk files.  This code assumes a not-too-old TeX
% distribution.
\RequirePackage{iftex}
\ifluatex
  \directlua{
    pdf.setpkresolution(1200)
    os.setenv("MAKETEX_MODE", "ljfzzz")
    os.setenv("BDPI", "1200")
  }
\else
  \ifpdftex
    \pdfpkresolution=1200
    \pdfpkmode{ljfzzz}
  \fi
\fi

\documentclass{report}
\usepackage{expl3}
\usepackage{etex}   % Increase available TeX resources.
\usepackage[
  margin=1in,
  includehead,
  headheight=15pt,
  ignorefoot,
  ignoremp]{geometry}
\usepackage{array}
\usepackage{longtable}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{fakelatexsym}
\usepackage{varioref}
\usepackage{xspace}
\usepackage{makeidx}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{xltabular}
\usepackage{keyval}
\usepackage{accsupp}
\usepackage{xstring}
\usepackage{mflogo}
\usepackage{url}
\usepackage{multicol}
\usepackage{rotating}
\usepackage{slashed}
\usepackage{centernot}
\usepackage{changepage}
\usepackage[svgnames]{xcolor}
\usepackage{cutwin}
\usepackage{tocloft}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage{relsize}
\ifluatex
  \usepackage{luatex85}
  \usepackage{luacode}
\fi

\newcommand{\doctitle}{Comprehensive \latex Symbol List}  % Reusable
\title{The \doctitle}

\author{\person{Scott}{Pakin} \texttt{<scott+clsl@pakin.org>}%
  \thanks{The original version of this document was written by
    \person{David}{Carlisle}, with several additional tables provided
    by \person{Alexander}{Holt}.  See \vref{about-doc} for more
    information about who did what.}}
\date{12 April 2026}

\makeindex

% Specify the document header and (empty) footer.
\pagestyle{fancy}
\fancyhead[L]{\scshape\nouppercase{\leftmark}}
\fancyhead[R]{\thepage\rule[-6pt]{0pt}{0pt}}
\fancyfoot[C]{}
\renewcommand{\headrulewidth}{1pt}

% Make index entries invoke \markboth for use in the header.
\newcommand*{\recordentry}[1]{#1\markboth{#1}{#1}}

% Limit the insertion of line breaks within URLs.
\def\UrlBreaks{}
\def\UrlBigBreaks{\do/}

% Index "X Y" and "Y, X".  The "begin" and "end" variants are for page ranges.
\newcommand{\idxboth}[2]{\mbox{}\index{#1 #2}\index{#2>#1}}
\newcommand{\idxbothbegin}[2]{\mbox{}\index{#1 #2|(}\index{#2>#1|(}}
\newcommand{\idxbothend}[2]{\mbox{}\index{#1 #2|)}\index{#2>#1|)}}

% Index "X" and "X>Y".
\newcommand{\subindex}[2]{\index{#1}\index{#1>#2}}
\newcommand{\ltsubindex}[2]{\ltindex{#1}\ltindex{#1>#2}}

% Index package names and hyperlink them to the CTAN package information.
% An optional argument of "index=false" suppresses indexing the package name.
% An optional argument of "pkg=<name>" uses package <name> for the CTAN
% hyperlink target.
% An optional argument of "link=<URL>" replaces the whole hyperlink with <URL>.
% An optional argument of "nolink" suppresses the hyperlink entirely.
% An optional argument of "fmt=<code>" typesets the package name using <code>.
% The package name must be pure text.  Use "fmt=<code>" for special formatting.
% Define \pkgnameopts as the default options for all subsequent calls.
% Use \setpkgnameopts to set the default options for a specific package.
\def\equalsign{=}
\newcommand*{\catalogueURL}[1]{%
  https://www.ctan.org/pkg/#1%
}
\makeatletter
\define@key{pkgname}{pkg}{\def\pkglinktarget{#1}}
\define@key{pkgname}{link}{\def\catalogueURL##1{#1}}
\define@key{pkgname}{nolink}[true]{\def\pkglink##1{\pkgnamefmt{##1}}}
\define@key{pkgname}{index}[true]{\csname pkgidx#1\endcsname}
\define@key{pkgname}{fmt}{\def\pkgnamefmt##1{#1}}
\def\pkgnameopts{}
\newcommand{\setpkgnameopts}[2]{%
  \expandafter\gdef\csname pkgnameopts@#1\endcsname{#2}%
}
\makeatother
\newif\ifpkgidx
\newcommand{\pkgname}[2][]{%
  \bgroup
    \def\pkglinktarget{#2}%
    \def\pkgnamefmt##1{\mbox{\textsf{##1}}}%
    \def\pkglink##1{\href{\catalogueURL{\pkglinktarget}}{\pkgnamefmt{##1}}}%
    \pkgidxtrue
    \edef\next{\noexpand\setkeys{pkgname}{\pkgnameopts}}\next
    \expandafter\ifx\csname pkgnameopts@#2\endcsname\relax
    \else
      \edef\next{\noexpand\setkeys{pkgname}{\csname pkgnameopts@#2\endcsname}}%
      \next
    \fi
    \setkeys{pkgname}{#1}%
    \pkglink{#2}%
    \ifpkgidx
      \def\equalsign{!=}%   % Escape the equals sign for makeindex's sake.
      \index{#2=\pkglink{#2} (package)}%
      \index{packages>#2=\pkglink{#2}}%
    \fi
  \egroup
}

% Index some other logical styles.
\newcommand{\optname}[2]{%
  \textsf{#2}%
  \index{#2=\textsf{#2} (\pkgname[index!=false]{#1} package option)}%
  \index{package options>#2=\textsf{#2} (\pkgname[index!=false]{#1})}}
\newcommand{\filename}[1]{%
  \texttt{#1}%
  \index{#1=\texttt{#1} (file)}}
\newcommand{\hfilename}[2]{%
  \href{#1}{\texttt{#2}}%
  \index{#2=\noexpand\href{#1}{\noexpand\texttt{#2}} (file)}}
\newcommand{\fileext}[1]{%
  \texttt{.#1}%
  \index{#1 files=\texttt{.#1} files}%
  \index{file extensions>#1=\texttt{.#1}}%
}
\newcommand{\PSfont}[1]{%
  #1%
  \index{#1 (font)}%
  \index{fonts>#1}%
}
\DeclareRobustCommand{\person}[2]{#1\index{#2, #1} #2}

% Support searching of "#1" as if it were written in plain text as "#2".
\newcommand{\searchAs}[2]{%
  \texorpdfstring{%
    \BeginAccSupp{ActualText={#2}}%
    #1%
    \EndAccSupp{}%
  }{%
    #2%
  }%
}

% Index common words and phrases.
\DeclareRobustCommand{\latex}{%
  \searchAs{\LaTeX}{LaTeX}%
  \index{LaTeX=\string\searchAs{\string\LaTeX}{LaTeX}}\xspace
}
\DeclareRobustCommand{\latexEinternal}{%
  % Split the two space-separated terms for Acrobat's benefit.  (Okular
  % seems okay with ActualText containing spaces.)  Rather than an epsilon
  % we use an "e" in "LaTeX 2e" because epsilon seems harder to search
  % consistently across platforms with different native character
  % encodings.
  \searchAs{\LaTeX}{LaTeX}%
  \texorpdfstring{\kern.15em}{ }%
  \searchAs{2$_{\textstyle\varepsilon}$}{2e}%
}
\newcommand{\latexE}{%
  \latexEinternal
  \index{LaTeX2e=\noexpand\latexEinternal}\xspace
}
\let\MFlogo=\MF  % Avoid a naming conflict between mflogo and fontmfizz.
\let\MF=\relax
\newcommand{\metafont}{\MFlogo\index{Metafont=\string\MFlogo}\xspace}
\newcommand{\tex}{\TeX\index{TeX=\string\TeX}\xspace}
\newcommand{\xypic}{%
  \mbox{\kern-.1em X\kern-.3em\lower.4ex\hbox{Y\kern-.15em}-pic}%
  \index{Xy-pic=\mbox{\kern-.1em X\kern-.3em\lower.4ex\hbox{Y\kern-.15em}-pic}}}
\newcommand{\TeXbook}{%
  The \TeX{}book\index{TeXbook, The=\TeX{}book, The}~\cite{Knuth:ct-a}\xspace}
\newcommand{\ctt}{%
  \texttt{comp.text.tex}%
  \index{comp.text.tex=\texttt{comp.text.tex} (newsgroup)}\xspace}
\newcommand{\fntenc}[1][]{%
  \def\firstarg{#1}%
  font encoding%
  \index{font encodings}%
  \ifx\firstarg\empty
  \else
    \index{font encodings>\firstarg}%
  \fi
}
\newcommand{\fntfam}[1][]{%
  \def\firstarg{#1}%
  font family%
  \index{font families}%
  \ifx\firstarg\empty
  \else
    \index{font families>\firstarg=\string\texttt{\firstarg}}%
  \fi
}
\newcommand{\selftex}{\hfilename{https://mirror.ctan.org/info/symbols/comprehensive/source/symbols.tex}{symbols.tex}\xspace}
\newcommand{\fontdefdtx}{\hfilename{https://mirror.ctan.org/macros/latex/base/fontdef.dtx}{fontdef.dtx}\xspace}
\newcommand{\testfonttex}{\hfilename{https://mirror.ctan.org/macros/plain/base/testfont.tex}{testfont.tex}\xspace}
\newcommand{\TUGboat}{%
  \href{https://www.tug.org/TUGboat/}{TUGboat}%
  \index{TUGboat=\href{https://www.tug.org/TUGboat/}{TUGboat}}\xspace
}
\newcommand{\thanhhanthe}{Th\`anh, H\`an Th\diatop[\'|\^e]}   % "|" confuses MakeIndex.
\newcommand{\postscript}{PostScript\index{PostScript}\xspace}
\newcommand{\ascii}{ASCII\index{ASCII}\xspace}
\newcommand{\utfviii}{\mbox{UTF-8}\index{UTF-8}\xspace}
\DeclareRobustCommand{\xetexInternal}{%
  \mbox{X\lower0.5ex\hbox{\kern-0.15em\reflectbox{E}}\kern-0.1em\TeX}}
\newcommand{\xetex}{%
  \searchAs{\xetexInternal}{XeTeX}%
  \index{XeTeX=\string\searchAs{\string\xetexInternal}{XeTeX}}\xspace
}
\DeclareRobustCommand{\xelatexInternal}{%
  \mbox{X\lower0.5ex\hbox{\kern-0.15em\reflectbox{E}}\kern-0.1em\LaTeX}}
\newcommand{\xelatex}{%
  \searchAs{\xelatexInternal}{XeLaTeX}%
  \index{XeLaTeX=\string\searchAs{\string\xelatexInternal}{XeLaTeX}}\xspace
}
\newcommand{\lualatex}{%
  \searchAs{Lua\LaTeX}{LuaLaTeX}%
  \index{LuaLaTeX=\string\searchAs{Lua\string\LaTeX}{LuaLaTeX}}\xspace
}
\newcommand{\pdflatex}{%
  \searchAs{pdf\LaTeX}{pdfLaTeX}%
  \index{pdfLaTeX=\string\searchAs{pdf\string\LaTeX}{pdfLaTeX}}\xspace
}
\newcommand{\italic}[1][italic]{#1\index{italic}}
\newcommand{\TikZ}{\pkgname{TikZ}}
\DeclareRobustCommand{\TikZinternal}{\searchAs{Ti\textit{k}Z}{TikZ}}
\setpkgnameopts{TikZ}{pkg=pgf,fmt={\noexpand\TikZinternal}}
\newcommand{\PSTricks}{\pkgname{PSTricks}}
\setpkgnameopts{PSTricks}{pkg=pstricks-base}
\newcommand{\rawtables}{Raw\index{Raw Font Tables} Font Tables}

% Index TeXbook symbols and the CTAN repository.
\newcommand{\idxTBsyms}{%
  \index{symbols>TeXbook=\TeX{}book}%
  \index{TeXbook, The=\TeX{}book, The>symbols from}%
}
\newcommand{\idxCTAN}{%
  \index{Comprehensive TeX Archive Network=\href{https://www.ctan.org/}{Comprehensive \string\TeX{} Archive Network}}%
}
\newcommand{\CTAN}{\href{https://www.ctan.org/}{CTAN}\idxCTAN\xspace}
\newcommand{\CTANfull}{Comprehensive\idxCTAN\ \TeX\ Archive Network\xspace}
\newcommand{\TeXFAQ}[1]{\url{https://www.texfaq.org/FAQ-#1.html}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% There are a number of symbols (e.g., \Square) that are defined by      %
% multiple packages.  In order to typeset all the variants in this       %
% document, we have to give glyph a unique name.  To do that, we define  %
% \savesymbol{XXX}, which renames a symbol from \XXX to \origXXX, and    %
% \restoresymbol{yyy}{XXX}, which renames \origXXX back to \XXX and      %
% defines a new command, \yyyXXX, which corresponds to the most recently %
% loaded version of \XXX.                                                %
%                                                                        %
% This implementation of \savesymbol and \restoresymbol was copied from  %
% the savesym package, which started with symbol.tex's old definitions   %
% of those macros and improved upon them.  However, \renamerobustsymbol  %
% and \ifnotsavedsym are new to this set.                                %
%                                                                        %

% Save a symbol that we know is going to get redefined.
\newcommand*{\savesymbol}[1]{%
  \expandafter\let\csname orig#1\expandafter\endcsname\csname#1\endcsname
  \expandafter\let\csname #1\endcsname\relax
}

% Restore a previously saved symbol, and rename the current one.
\newcommand*{\restoresymbol}[2]{%
  \expandafter\global\expandafter\let\csname#1#2\expandafter\endcsname%
    \csname#2\endcsname
  \expandafter\global\expandafter\let\csname#2\expandafter\endcsname%
    \csname orig#2\endcsname
}

% Rename a robust command.
\newcommand*{\renamerobustsymbol}[2]{%
  \expandafter\let\expandafter\origrealcommand
    \csname #2\space\endcsname
  \expandafter\global\expandafter\let\csname#1#2\endcsname=\origrealcommand
}

% Test if a symbol is not saved.
\makeatletter
\def\ifnotsavedsym@helper#1#2!{\expandafter\ifx\csname orig#2\endcsname\relax}
\newcommand*{\ifnotsavedsym}[1]{%
  \expandafter\ifnotsavedsym@helper\string#1!%
}
\makeatother
%                                                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define various other commands that are helpful for making various      %
% symbol packages behave better.                                         %

% A few packages obnoxiously change the font encoding.  To protect
% against this we define \saveencoding and \restoreencoding commands,
% which can wrap the loading of ill-behaved packages.
\makeatletter
\newcommand*{\saveencoding}{%
  \xdef\prevencoding{\f@encoding}%
  \xdef\prevdefencoding{\encodingdefault}%
}
\newcommand*{\restoreencoding}{%
  \xdef\encodingdefault{\prevdefencoding}%
  \fontencoding{\prevencoding}\selectfont
}
\makeatother

% Some packages pollute LaTeX's global namespace with numerous symbol
% commands with common names.  To prevent this, \setnewcommandprefix
% redefines \newcommand to prefix every command name with a given prefix.
% \restorenewcommand restores \newcommand to its previous definition.
\makeatletter
\newcommand*{\setnewcommandprefix}[1]{%
  \let\ncp@newcommand=\newcommand
  \def\ncp@prefix{#1}%
  \renewcommand{\newcommand}{%
    \@ifstar{\ncp@star}{\ncp@no@star}%
  }
}
\newcommand*{\ncp@star}[1]{%
  \edef\ncp@cs{\ncp@prefix\expandafter\@gobble\string#1}%
  \expandafter\ncp@newcommand\expandafter*\csname\ncp@cs\endcsname
}
\newcommand*{\ncp@no@star}[1]{%
  \edef\ncp@cs{\ncp@prefix\expandafter\@gobble\string#1}%
  \expandafter\ncp@newcommand\csname\ncp@cs\endcsname
}
\newcommand*{\restorenewcommand}{\let\newcommand=\ncp@newcommand}
\makeatother

%                                                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Each of the packages used by this document is loaded conditionally.
% However, it might be nice to know if we have a complete set.  So we
% define \ifcomplete which starts true, but gets set to false if any
% package is missing.
\newif\ifcomplete
\completetrue

% For debugging purposes we define a switch that enables us to toggle
% on and off the loading of packages.
\newif\ifloadpackages
\loadpackagestrue

% \IfStyFileExists* is just like \IfFileExists, except that it appends
% ".sty" to its first argument.  \IfStyFileExists is the same as
% \IfStyFileExists*, but it additionally adds its first argument to a
% list (\missingpkgs) and marks the document as incomplete (with
% \completefalse) if the .sty file doesn't exist.  \IfPackageFileExists
% is the same as \IfStyFileExists except that it separates the package
% name from a file within the package (not necessarily a .sty file) for
% which to search.
\makeatletter
\newcommand{\missingpkgs}{}
\newcommand{\foundpkgs}{}
\newcommand{\if@sty@file@exists@star}[3]{%
  \ifloadpackages
    \IfFileExists{#1.sty}{#2}{#3}%
  \else
    #3%
  \fi
}
\newcommand{\if@sty@file@exists}[3]{%
  \ifloadpackages
    \IfFileExists{#1.sty}%
                 {#2\@cons\foundpkgs{{#1}}}%
                 {#3\completefalse\@cons\missingpkgs{{#1}}}%
  \else
    #3\completefalse\@cons\missingpkgs{{#1}}%
  \fi
}
\newcommand{\IfStyFileExists}{%
  \@ifstar{\if@sty@file@exists@star}{\if@sty@file@exists}%
}
\newcommand{\IfPackageFileExists}[4]{%
  \ifloadpackages
    \IfFileExists{#2}%
                 {#3\@cons\foundpkgs{{#1}}}%
                 {#4\completefalse\@cons\missingpkgs{{#1}}}%
  \else
    #4\completefalse\@cons\missingpkgs{{#1}}%
  \fi
}
\makeatother

% Load Lua helper functions to sort package lists.
\ifluatex
  \luadirect{require "sorting"}
\fi

% We get a few packages for free.
\makeatletter
\@cons\foundpkgs{{textcomp}}
\@cons\foundpkgs{{latexsym}}
\makeatother
\newcommand{\TC}{\pkgname{textcomp}}
\setpkgnameopts{latexsym}{link=https://www.ctan.org/pkg/latex-base}

% Typeset a string in various encodings.
\DeclareRobustCommand*{\encOone}[1]{{\fontencoding{OT1}\selectfont#1}}
\DeclareRobustCommand*{\encone}[1]{{\fontencoding{T1}\selectfont#1}}
\DeclareRobustCommand*{\enctwoA}[1]{{\fontencoding{T2A}\selectfont#1}}
\DeclareRobustCommand*{\encfour}[1]{{\fontencoding{T4}\selectfont#1}}
\DeclareRobustCommand*{\encfive}[1]{{\fontencoding{T5}\selectfont#1}}
\DeclareRobustCommand*{\encgreek}[1]{{\fontencoding{LGR}\selectfont#1}}
\DeclareRobustCommand*{\encuni}[1]{{\fontencoding{TU}\selectfont#1}}

% Various punctuation marks confuse makeindex when used directly.
\let\magicrbrack=]
\let\magicequal=\=
\DeclareRobustCommand{\magicequalname}{\texttt{\string\=}}
\DeclareRobustCommand{\magicvertname}{\texttt{|}}
\DeclareRobustCommand{\magicVertname}{\texttt{\string\|}}
\DeclareRobustCommand{\showmacron}{\blackacchack\=}   % Can't index "=".

% Vertically center a text-mode symbol.
\newsavebox{\tvcbox}
\newcommand*{\textvcenter}[1]{%
  \savebox{\tvcbox}{#1}%
  \raisebox{0.5\dp\tvcbox}{\raisebox{-0.5\ht\tvcbox}{\usebox{\tvcbox}}}%
}

% Do the same work as \DeclareTextSymbol but only if the symbol is not
% already declared.
\let\origDeclareTextSymbol=\DeclareTextSymbol
\DeclareRobustCommand{\DeclareNewTextSymbol}[3]{%
  \ifnotsavedsym{#1}%
    \origDeclareTextSymbol{#1}{#2}{#3}%
  \fi
}

% Do the same work as \DeclareTextCommand but only if the symbol is not
% already declared.
\let\origDeclareTextCommand=\DeclareTextCommand
\DeclareRobustCommand{\DeclareNewTextCommand}[3]{%
  \ifnotsavedsym{#1}%
    \origDeclareTextCommand{#1}{#2}{#3}%
  \fi
}

% Define a helper function for \CLSL@fake@tdelim and \CLSL@fake@ddelim below.
\makeatletter
\def\CLSL@char@in@box#1{%
  \setbox0=\hbox{\char#1}%
  \hbox{%
    \vrule width \wd0 height 0pt depth 0pt%
    \vrule width 0pt height \ht0 depth \dp0%
    \smash{\box0}%
  }%
  \vspace*{-1pt}% Why is this necessary?
}
\makeatother

% Construct a text-sized delimiter from its constituent characters.
\makeatletter
\DeclareRobustCommand{\CLSLfaketdelim}[3]{%
  \begingroup
    \offinterlineskip
    \vbox{%
      \halign{##\cr
        \CLSL@char@in@box{#1}\cr  % top
        \CLSL@char@in@box{#2}\cr  % mid
        \CLSL@char@in@box{#3}\cr  % bot
      }%
    }%
  \endgroup
}
\makeatother

% Construct a display-sized delimiter from its constituent characters.
\makeatletter
\newcounter{CLSL@reps@left}
\DeclareRobustCommand{\CLSLfakeddelim}[5][2]{%
  \begingroup
    \offinterlineskip
    \vbox to 4ex{%
      \halign{##\cr
        \CLSL@char@in@box{#2}\cr     % top
        \setcounter{CLSL@reps@left}{#1}%
        \gdef\CLSL@reps{}
        \loop
          \g@addto@macro\CLSL@reps{\CLSL@char@in@box{#5}\cr}%
          \addtocounter{CLSL@reps@left}{-1}%
          \ifnum\c@CLSL@reps@left>0%
        \repeat
        \CLSL@reps                % rep
        \CLSL@char@in@box{#3}\cr  % mid
        \gdef\CLSL@reps{}
        \loop
          \g@addto@macro\CLSL@reps{\CLSL@char@in@box{#5}\cr}%
          \addtocounter{CLSL@reps@left}{-1}%
          \ifnum\c@CLSL@reps@left>0%
        \repeat
        \CLSL@reps                % rep
        \CLSL@char@in@box{#4}\cr  % bot
      }%
      \vss
    }%
  \endgroup
}
\makeatother

% Given a math expression, a small accent character, and a large
% accent character, typeset the expression with the appropriate-sized
% accent above it.
\DeclareRobustCommand{\CLSLfakewidetopaccent}[6]{%
  \setbox0=\hbox{\ensuremath{#1}}%
  \setbox1=\hbox{\ensuremath{abc}}%
  \mbox{\itshape#1}%
  \ifdim\wd0<\wd1
    \llap{\raisebox{#2}{\makebox[\wd0]{\usefont#6\char#3}}}%
  \else
    \llap{\raisebox{#4}{\makebox[\wd0]{\usefont#6\char#5}}}%
  \fi
}

% Load a package only up to its \ProvidesPackage invocation so as to
% acquire the package version string.
\newcommand*{\getversionstring}[1]{%
  \let\origProvidesPackage=\ProvidesPackage
  \def\ProvidesPackage##1[##2]{\origProvidesPackage{##1}[##2]\endinput}
  \usepackage{#1}
  \let\ProvidesPackage=\origProvidesPackage
}

% Load a faked version of a package.
\newcommand*{\usefakepackage}[1]{%
  \getversionstring{#1}
  \usepackage{fake#1}
}

% Given "\command{argument}", mark underscores in <argument> as ordinary
% characters before invoking \command.
\makeatletter
\bgroup
\gdef\CLSLcleanarg#1{%
  \begingroup
  \catcode`_=12
  \CLSLclean@helper#1
}
\gdef\CLSLclean@helper#1#2{\endgroup#1{#2}}
\egroup
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Redefine a few robust LaTeX commands as non-robust so they don't become
% dangling pointers when saved and restored as we load packages that redefine
% them.
\makeatletter
\renewcommand*{\rightleftharpoons}{\mathrel{\mathpalette\rlh@{}}}
\renewcommand*{\angle}{{\vbox{\ialign{$\m@th\scriptstyle##$\crcr
        \not\mathrel{\mkern14mu}\crcr
        \noalign{\nointerlineskip}
        \mkern2.5mu\leaders\hrule \@height.34pt\hfill\mkern2.5mu\crcr}}}}
\makeatother

\newif\ifAMS
\newcommand\AMS{\pkgname{AMS}}
\setpkgnameopts{AMS}{pkg=amsfonts,fmt={\noexpand\AmS}}
\makeatletter
\IfStyFileExists{amssymb}
  {\AMStrue
   \savesymbol{angle} \savesymbol{rightleftharpoons}
   \savesymbol{lefthapoondown} \savesymbol{rightharpoonup}
   \savesymbol{iint} \savesymbol{iiint}
   \savesymbol{iiiint} \savesymbol{idotsint}
   \let\orig@ifstar=\@ifstar
   \usepackage{amsmath}
   \usepackage{amssymb}
   \let\@ifstar=\orig@ifstar
   \restoresymbol{AMS}{angle} \restoresymbol{AMS}{rightleftharpoons}
   \restoresymbol{AMS}{lefthapoondown} \restoresymbol{AMS}{rightharpoonup}
   \restoresymbol{AMS}{iint} \restoresymbol{AMS}{iiint}
   \restoresymbol{AMS}{iiiint} \restoresymbol{AMS}{idotsint}
  }
  {
    % The following was modified from amsmath.sty.
    \newcommand{\AmSfont}{%
      \usefont{OMS}{cmsy}{m}{n}}
    \providecommand{\AmS}{{\protect\AmSfont
      A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
  }
\makeatother

\newif\ifST
\newcommand\ST{\pkgname{stmaryrd}}
\IfStyFileExists{stmaryrd}
  {\STtrue
   \savesymbol{lightning}
   \savesymbol{bigtriangleup} \savesymbol{bigtriangledown}
   \usepackage{stmaryrd}
   \restoresymbol{ST}{lightning}
   \restoresymbol{ST}{bigtriangleup} \restoresymbol{ST}{bigtriangledown}
  }
  {}

\newif\ifEU
\IfStyFileExists{euscript}
  {\EUtrue\usepackage[mathcal]{euscript}
   \renewcommand{\mathcal}[1]{\mbox{\usefont{U}{eus}{m}{n}##1}}
  }
  {\let\CMcal\mathcal}
\setpkgnameopts{euscript}{pkg=amsfonts}

\newif\ifWASY
\newcommand\WASY{\pkgname{wasysym}}
\IfStyFileExists{wasysym}
  {\WASYtrue
   \usepackage{fakewasysym}   % Note that we check wasysym but load fakewasysym.
   \newcommand{\wasytextint}[1]{%
     \textwasy{\setbox0=\hbox{\char##1}\raisebox{0.5ex}{\raisebox{0.5\dp0}{\copy0}}}}
   \DeclareRobustCommand{\WASYint}{%
     \mathchoice{\wasytextint{"77}}{\wasytextint{"72}}{}{}}
   \DeclareRobustCommand{\WASYiint}{%
     \mathchoice{\wasytextint{"78}}{\wasytextint{"73}}{}{}}
   \DeclareRobustCommand{\WASYiiint}{%
     \mathchoice{\wasytextint{"79}}{\wasytextint{"74}}{}{}}
   \DeclareRobustCommand{\WASYoint}{%
     \mathchoice{\wasytextint{"7A}}{\wasytextint{"75}}{}{}}
   \DeclareRobustCommand{\WASYoiint}{%
     \mathchoice{\wasytextint{"7B}}{\wasytextint{"76}}{}{}}
  }
  {}

\newif\ifPI
\newcommand\PI{\pkgname{pifont}}
\setpkgnameopts{pifont}{pkg=psnfss}
\IfStyFileExists{pifont}
  {\PItrue\usepackage{pifont}}
  {}

% Define all marvosym commands robustly so they don't show up in the index
% as
% "{\fontfamily{mvs}\fontencoding{U}\fontseries{m}\fontshape{n}\selectfont\char235}",
% for example.
\newif\ifMARV
\newcommand\MARV{\pkgname{marvosym}}
\IfStyFileExists{marvosym}
  {\MARVtrue
   \let\orignewcommand=\newcommand
   \let\newcommand=\DeclareRobustCommand
   \usepackage{marvosym}
   \let\newcommand=\orignewcommand
  }
  {}

\newif\ifMAN
\newcommand\MAN{\pkgname{manfnt}}
\IfStyFileExists{manfnt}
  {\MANtrue\usepackage{manfnt}}
  {}

\newif\ifDING
\newcommand\DING{\pkgname{bbding}}
\IfStyFileExists{bbding}
  {\DINGtrue
   \savesymbol{Cross} \savesymbol{Square}
   \usepackage{bbding}
   \restoresymbol{ding}{Cross} \restoresymbol{ding}{Square}
  }
  {}

\newif\ifUTILD
\newcommand\UTILD{\pkgname{undertilde}}
\IfStyFileExists{undertilde}
  {\UTILDtrue\usepackage{undertilde}}
  {}

\newif\ifIFS
\newcommand\IFS{\pkgname{ifsym}}
\IfStyFileExists{ifsym}
  {\IFStrue
   \savesymbol{Letter} \savesymbol{Square} \savesymbol{Cross} \savesymbol{Sun}
   \savesymbol{TriangleUp} \savesymbol{TriangleDown} \savesymbol{Circle}
   \savesymbol{Lightning}
   \usepackage[alpine,clock,electronic,geometry,misc,weather]{ifsym}[2000/04/18]
   \restoresymbol{ifs}{Letter} \restoresymbol{ifs}{Square}
   \restoresymbol{ifs}{Cross} \restoresymbol{ifs}{Sun}
   \restoresymbol{ifs}{TriangleUp} \restoresymbol{ifs}{TriangleDown}
   \restoresymbol{ifs}{Circle} \restoresymbol{ifs}{Lightning}
   \DeclareRobustCommand{\allCubes}{%
     \Cube{1}~%
     \Cube{2}~%
     \Cube{3}~%
     \Cube{4}~%
     \Cube{5}~%
     \Cube{6}%
   }
  }
  {}

\newif\ifTIPA
\newcommand\TIPA{\pkgname{tipa}}
\IfStyFileExists{tipa}
  {\TIPAtrue\usepackage[safe]{tipa}}
  {}

\newif\ifTIPX
\newcommand\TIPX{\pkgname{tipx}}
\setpkgnameopts{tipx}{pkg=tipa}
\IfStyFileExists{tipx}
  {\TIPXtrue\usepackage{tipx}}
  {}

\newif\ifXIPA
\newcommand\XIPA{\pkgname{extraipa}}
\setpkgnameopts{extraipa}{pkg=tipa}
\IfStyFileExists{extraipa}
  {\XIPAtrue\usepackage{extraipa}}
  {}

% We use the *-form of \IfStyFileExists, because the package is named
% "wsuipa", while the .sty file is named "ipa.sty".
\makeatletter
\newif\ifWIPA
\newcommand\WIPA{\pkgname{wsuipa}}
\IfStyFileExists*{ipa}
  {\@cons\foundpkgs{{wsuipa}}
   \WIPAtrue
   \savesymbol{baro} \savesymbol{eth} \savesymbol{openo} \savesymbol{thorn}
   \usepackage{ipa}
   \expandafter\xdef\csname ver@wsuipa.sty\endcsname{%
     \csname ver@ipa.sty\endcsname}
   \restoresymbol{WSU}{baro}  \restoresymbol{WSU}{eth}
   \restoresymbol{WSU}{openo} \restoresymbol{WSU}{thorn}
  }
  {\completefalse\@cons\missingpkgs{{wsuipa}}}
\makeatother

\newif\ifPHON
\newcommand\PHON{\pkgname{phonetic}}
\IfStyFileExists{phonetic}
  {\PHONtrue
   \savesymbol{esh} \savesymbol{eth} \savesymbol{hookb}
   \savesymbol{hookd} \savesymbol{hookh} \savesymbol{openo}
   \savesymbol{schwa} \savesymbol{taild} \savesymbol{thorn}
   \savesymbol{varg} \savesymbol{yogh}
   \usepackage{phonetic}
   \restoresymbol{PHON}{esh} \restoresymbol{PHON}{eth}
   \restoresymbol{PHON}{hookb} \restoresymbol{PHON}{hookd}
   \restoresymbol{PHON}{hookh} \restoresymbol{PHON}{openo}
   \restoresymbol{PHON}{schwa} \restoresymbol{PHON}{taild}
   \restoresymbol{PHON}{thorn} \restoresymbol{PHON}{varg}
   \restoresymbol{PHON}{yogh}

   % A few phonetic macros are fragile but need to be made robust.
   \DeclareRobustCommand{\PHONibar}{\ibar}
   \DeclareRobustCommand{\PHONrbar}{\rbar}
   \DeclareRobustCommand{\PHONvod}{\vod}
  }
  {}

\newif\ifULSY
\newcommand\ULSY{\pkgname{ulsy}}
\IfStyFileExists{ulsy}
  {\ULSYtrue\usepackage{ulsy}}
  {}

\newif\ifASP
\newcommand\ASP{\pkgname{ar}}
\IfStyFileExists{ar}
  {\ASPtrue\usepackage{ar}}
  {}

\newif\ifMETRE
\newcommand\METRE{\pkgname{metre}}
\IfStyFileExists{metre}
  {\METREtrue
   \savesymbol{breve}
   \newcommand{\breve}{PLACEHOLDER FOR RENEWCOMMAND}
   \usepackage{metre}
   \restoresymbol{METRE}{breve}
   %
   \DeclareRobustCommand{\METREantidiplestar}{\antidiple*}
   \DeclareRobustCommand{\METREantidiple}{\antidiple}
   \DeclareRobustCommand{\METREdiplestar}{\diple*}
   \DeclareRobustCommand{\METREdiple}{\diple}
   \DeclareRobustCommand{\METREobelusstar}{\obelus*}
   \DeclareRobustCommand{\METREobelus}{\obelus}
   \DeclareRobustCommand{\METRErespondens}{\respondens}
   \DeclareRobustCommand{\METREterminusstar}{\terminus*}
   \DeclareRobustCommand{\METREterminus}{\terminus}
   %
   \DeclareRobustCommand{\METREAntidiplestar}{\Antidiple*}
   \DeclareRobustCommand{\METREAntidiple}{\Antidiple}
   \DeclareRobustCommand{\METREDiplestar}{\Diple*}
   \DeclareRobustCommand{\METREDiple}{\Diple}
   \DeclareRobustCommand{\METREObelusstar}{\Obelus*}
   \DeclareRobustCommand{\METREObelus}{\Obelus}
   \DeclareRobustCommand{\METRERespondens}{\Respondens}
   \DeclareRobustCommand{\METRETerminusstar}{\Terminus*}
   \DeclareRobustCommand{\METRETerminus}{\Terminus}
  }
  {}

% pxfonts relies on txfonts (I think), so either package can be loaded.
% Note that txfonts/pxfonts redefine every LaTeX and AMS character,
% which is not what we want.  As a result, we have to rely on some
% serious trickery to prevent our old characters from getting redefined.
\newif\ifTX
\newcommand\TX{\pkgname{txfonts}}
\newcommand\PX{\pkgname{pxfonts}}
\newcommand\TXPX{\pkgname{txfonts}/\pkgname{pxfonts}}
\makeatletter
\IfStyFileExists{txfonts}
  {\TXtrue
   % Manually declare the new txfonts fonts.
   \DeclareSymbolFont{lettersA}{U}{txmia}{m}{it}
   \SetSymbolFont{lettersA}{bold}{U}{txmia}{bx}{it}
   \DeclareFontSubstitution{U}{txmia}{m}{it}
   \DeclareSymbolFont{symbolsC}{U}{txsyc}{m}{n}
   \SetSymbolFont{symbolsC}{bold}{U}{txsyc}{bx}{n}
   \DeclareFontSubstitution{U}{txsyc}{m}{n}
   \DeclareSymbolFont{largesymbolsA}{U}{txexa}{m}{n}
   \SetSymbolFont{largesymbolsA}{bold}{U}{txexa}{bx}{n}
   \DeclareFontSubstitution{U}{txexa}{m}{n}
   % Prevent txfonts from redeclaring any old fonts.
   \let\origDeclareMathAlphabet=\DeclareMathAlphabet
   \renewcommand{\DeclareMathAlphabet}[5]{}
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \renewcommand{\DeclareSymbolFont}[5]{}
   \let\origSetSymbolFont=\SetSymbolFont
   \renewcommand{\SetSymbolFont}[6]{}
   \let\origDeclareFontSubstitution=\DeclareFontSubstitution
   \renewcommand{\DeclareFontSubstitution}[4]{}
   % Prevent txfonts from defining any existing symbols.
   \let\origDeclareTextSymbol=\DeclareTextSymbol
   \let\DeclareTextSymbol=\DeclareNewTextSymbol
   % Load txfonts.
   \savesymbol{angle} \savesymbol{rightleftharpoons}
   \savesymbol{textcent} \savesymbol{textsterling}
   \savesymbol{L} \savesymbol{l} \savesymbol{r}
   \savesymbol{succapprox} \savesymbol{precapprox} \savesymbol{Perp}
   \usepackage{txfonts}
   \restoresymbol{TX}{angle} \restoresymbol{TX}{rightleftharpoons}
   \restoresymbol{TX}{succapprox} \restoresymbol{TX}{precapprox}
   \restoresymbol{TX}{Perp}
   % Restore the old font commands.
   \global\let\DeclareTextSymbol=\origDeclareTextSymbol
   \global\let\DeclareSymbolFont=\origDeclareSymbolFont
   \global\let\SetSymbolFont=\origSetSymbolFont
   \global\let\DeclareFontSubstitution=\origDeclareFontSubstitution
   \global\let\DeclareMathAlphabet=\origDeclareMathAlphabet
   % Restore the default fonts.
   \renewcommand\rmdefault{cmr}
   \renewcommand\sfdefault{cmss}
   \renewcommand\ttdefault{cmtt}
   \ifAMS
     \DeclareMathAlphabet\mathfrak{U}{euf}{m}{n}
   \fi
   % Are \textcent, \mathcent, \mathsterling, and \r the
   % only symbols that get screwed up?
   \DeclareTextSymbol{\textcent}{TS1}{162}
   \renewcommand{\mathcent}{\mbox{\usefont{OT1}{txr}{m}{n}\char"A2}}
   \renewcommand{\mathsterling}{\mbox{\textsterling}}
   \newcommand{\TXmathsterling}{\mbox{\usefont{OT1}{txr}{m}{n}\char"A3}}
   \DeclareTextAccent{\r}{OT1}{23}
  }
  {}
\makeatother

% Here's a real problem child: mathabx, which also redefines virtually
% every symbol provided by LaTeX2e and AMS.  We have to resort to our
% most devious trickery to get mathabx to load properly.
\newif\ifABX
\newcommand\ABX{\pkgname{mathabx}}
\let\origDeclareMathSymbol=\DeclareMathSymbol
\let\origDeclareMathDelimiter=\DeclareMathDelimiter
\let\origDeclareMathRadical=\DeclareMathRadical
\let\origDeclareMathAccent=\DeclareMathAccent
\makeatletter
  % Redefine \DeclareMathSymbol to stick "ABX" in front of each symbol name.
  \renewcommand{\DeclareMathSymbol}[4]{%
    \let\mathabx@undefine=\@gobble  % Undefining symbols causes all sorts of problems for us.
    \edef\newname{\expandafter\@gobble\string#1}
    \ifx\newname\@empty
    \else
      \edef\newname{ABX\newname}
      \expandafter\origDeclareMathSymbol\expandafter{%
        \csname\newname\endcsname}{#2}{#3}{#4}%
    \fi
  }
  % Do the same for \DeclareMathDelimiter.
  \def\DeclareMathDelimiter#1{%
    \edef\newname{\expandafter\@gobble\string#1}
    \def\eatfour##1##2##3##4{}%
    \def\eatfive##1##2##3##4##5{}%
    \ifx\newname\@empty
      \if\relax\noexpand#1%
        \def\next{\eatfive}
      \else
        \def\next{\eatfour}
      \fi
    \else
      \edef\newname{ABX\newname}
      \def\next{%
        \expandafter\origDeclareMathDelimiter\expandafter{%
          \csname\newname\endcsname}}
    \fi
    \next
  }
  % Do the same for \DeclareMathAccent.
  \renewcommand{\DeclareMathAccent}[4]{%
    \edef\newname{\expandafter\@gobble\string#1}
    \ifx\newname\@empty
    \else
      \edef\newname{ABX\newname}
      \expandafter\origDeclareMathAccent\expandafter{%
        \csname\newname\endcsname}{#2}{#3}{#4}%
    \fi
  }
  % Redefine \DeclareMathRadical to do nothing.
  \renewcommand{\DeclareMathRadical}[5]{}
\makeatother
\let\proofmode=1
\IfStyFileExists{mathabx}
  {\ABXtrue
   \savesymbol{not} \savesymbol{widering}\savesymbol{Moon}
   \savesymbol{notowner} \savesymbol{iint} \savesymbol{iiint}
   \savesymbol{oint} \savesymbol{oiint} \savesymbol{bigboxperp}
   \savesymbol{bigoperp} \savesymbol{boxedcirc} \savesymbol{boxeddash}
   \savesymbol{boxeedast} \savesymbol{boxperp} \savesymbol{boy}
   \savesymbol{Cap} \savesymbol{centerdot} \savesymbol{circledast}
   \savesymbol{circledcirc} \savesymbol{circleddash} \savesymbol{Cup}
   \savesymbol{curvearrowtopleft} \savesymbol{curvearrowtopleftright}
   \savesymbol{curvearrowtopright} \savesymbol{doteqdot}
   \savesymbol{geqslant} \savesymbol{gets} \savesymbol{girl}
   \savesymbol{Join} \savesymbol{land} \savesymbol{leqslant}
   \savesymbol{looparrowupleft} \savesymbol{looparrowupright}
   \savesymbol{lor} \savesymbol{lsemantic}
   \savesymbol{mayaleftdelimiter} \savesymbol{mayarightdelimiter}
   \savesymbol{ndivides} \savesymbol{nequiv} \savesymbol{ngeqslant}
   \savesymbol{ni} \savesymbol{nleqslant} \savesymbol{notni}
   \savesymbol{notowns} \savesymbol{notsign} \savesymbol{operp}
   \savesymbol{rsemantic} \savesymbol{sqCap} \savesymbol{sqCup}
   \savesymbol{to} \savesymbol{ulsh} \savesymbol{ursh}
   \savesymbol{overbrace} \savesymbol{underbrace}
   \savesymbol{overgroup} \savesymbol{undergroup}
   \savesymbol{dddot} \savesymbol{ddddot}

   \usepackage{mathabx}

   \restoresymbol{ABX}{not} \restoresymbol{ABX}{widering}
   \restoresymbol{ABX}{Moon} \restoresymbol{ABX}{notowner}
   \restoresymbol{ABX}{iint} \restoresymbol{ABX}{iiint}
   \restoresymbol{ABX}{oint} \restoresymbol{ABX}{oiint}
   \restoresymbol{ABX}{bigboxperp} \restoresymbol{ABX}{bigoperp}
   \restoresymbol{ABX}{boxedcirc} \restoresymbol{ABX}{boxeddash}
   \restoresymbol{ABX}{boxeedast} \restoresymbol{ABX}{boxperp}
   \restoresymbol{ABX}{boy} \restoresymbol{ABX}{Cap}
   \restoresymbol{ABX}{centerdot} \restoresymbol{ABX}{circledast}
   \restoresymbol{ABX}{circledcirc} \restoresymbol{ABX}{circleddash}
   \restoresymbol{ABX}{Cup} \restoresymbol{ABX}{curvearrowtopleft}
   \restoresymbol{ABX}{curvearrowtopleftright}
   \restoresymbol{ABX}{curvearrowtopright}
   \restoresymbol{ABX}{doteqdot} \restoresymbol{ABX}{geqslant}
   \restoresymbol{ABX}{gets} \restoresymbol{ABX}{girl}
   \restoresymbol{ABX}{Join} \restoresymbol{ABX}{land}
   \restoresymbol{ABX}{leqslant} \restoresymbol{ABX}{looparrowupleft}
   \restoresymbol{ABX}{looparrowupright} \restoresymbol{ABX}{lor}
   \restoresymbol{ABX}{lsemantic}
   \restoresymbol{ABX}{mayaleftdelimiter}
   \restoresymbol{ABX}{mayarightdelimiter}
   \restoresymbol{ABX}{ndivides} \restoresymbol{ABX}{nequiv}
   \restoresymbol{ABX}{ngeqslant} \restoresymbol{ABX}{ni}
   \restoresymbol{ABX}{nleqslant} \restoresymbol{ABX}{notni}
   \restoresymbol{ABX}{notowns} \restoresymbol{ABX}{notsign}
   \restoresymbol{ABX}{operp} \restoresymbol{ABX}{rsemantic}
   \restoresymbol{ABX}{sqCap} \restoresymbol{ABX}{sqCup}
   \restoresymbol{ABX}{to} \restoresymbol{ABX}{ulsh}
   \restoresymbol{ABX}{ursh} \restoresymbol{ABX}{overbrace}
   \restoresymbol{ABX}{underbrace} \restoresymbol{ABX}{overgroup}
   \restoresymbol{ABX}{undergroup}
   \restoresymbol{ABX}{dddot} \restoresymbol{ABX}{ddddot}
  }
  {}
\let\DeclareMathAccent=\origDeclareMathAccent
\let\DeclareMathRadical=\origDeclareMathRadical
\let\DeclareMathDelimiter=\origDeclareMathDelimiter
\let\DeclareMathSymbol=\origDeclareMathSymbol
\ifABX
  % Define only those accents that are not defined elsewhere.
  \DeclareMathAccent{\widecheck}     {0}{mathx}{"71}
  \DeclareMathAccent{\widebar}       {0}{mathx}{"73}
  \DeclareMathAccent{\widearrow}     {0}{mathx}{"74}
  % Redefine all let-bound symbols.
  \let\ABXcenterdot=\ABXsqbullet
  \let\ABXcircledast=\ABXoasterisk
  \let\ABXcircledcirc=\ABXocirc
  % Ensure that \ABXwidering invokes \ABXwideparen, not \wideparen.
  \def\ABXwidering#1{\ring{\ABXwideparen{#1}}}
  % Redefine commands that are used by other commands.
  \DeclareMathSymbol{\ABXnotsign}    {3}{matha}{"7F}
  \DeclareMathSymbol{\ABXvarnotsign} {3}{mathb}{"7F}
  \DeclareMathSymbol{\ABXnotowner}   {3}{matha}{"53}
  \makeatletter
    \def\ABXoverbrace{\overbrace@{\bracefill\ABXbraceld\ABXbracemd\ABXbracerd\ABXbracexd}}
    \def\ABXunderbrace{\underbrace@{\bracefill\ABXbracelu\ABXbracemu\ABXbraceru\ABXbracexu}}
    \def\ABXovergroup{\overbrace@{\bracefill\ABXbraceld{}\ABXbracerd\ABXbracexd}}
    \def\ABXundergroup{\underbrace@{\bracefill\ABXbracelu{}\ABXbraceru\ABXbracexu}}
  \makeatother
  % Define a command to select the mathb font.
  \newcommand{\mathbfont}{\usefont{U}{mathb}{m}{n}}
\fi    % ABX test

\newif\ifFC
\newcommand\FC{\pkgname{fc}}
\setpkgnameopts{fclfont}{pkg=fc}
\IfStyFileExists{fclfont}
  {\FCtrue
   \getversionstring{fclfont}
   \let\origlbrace=\{
   \let\origrbrace=\}
   \let\origbar=\|
   \let\origdollar=\$
   \let\origspace=\_
   \let\origS=\S
   \let\origpounds=\pounds
   \input{t4enc.def}
   \DeclareTextAccent{\FCbar}{T4}{'277}% single universal accent
   \global\let\{=\origlbrace
   \global\let\}=\origrbrace
   \global\let\|=\origbar
   \global\let\$=\origdollar
   \global\let\_=\origspace
   \global\let\S=\origS
   \global\let\pounds=\origpounds
   \let\origtextsterling=\textsterling
   \gdef\textsterling{{\fontencoding{TS1}\selectfont\origtextsterling}}
   \DeclareFontSubstitution{T4}{fcr}{m}{n}
  }
  {}

\newif\ifCHFSS
\newcommand\CHFSS{\pkgname{chessfss}}
\IfStyFileExists{chessfss}
  {\CHFSStrue
   \savesymbol{comment}
   \usepackage{chessfss}
   \renamerobustsymbol{CHFSS}{etc}
   \restoresymbol{CHFSS}{comment}
  }
  {}

\newif\ifASCII
\newcommand\ASCII{\pkgname{ascii}}
\IfStyFileExists{ascii}
  {\ASCIItrue
   \savesymbol{HT}
   \usepackage{ascii}
   \restoresymbol{ascii}{HT}
  }
  {}

\newif\ifARK                           % ark10 and dingbat fonts
\newcommand\ARK{\pkgname{dingbat}}
\IfStyFileExists{dingbat}
  {\ARKtrue
   \savesymbol{checkmark}
   \usepackage{dingbat}
   \restoresymbol{ARK}{checkmark}
   \DeclareRobustCommand{\ARKlargepencil}{\largepencil\rule{0pt}{7ex}}
  }
  {}

\newif\ifSKULL
\newcommand\SKULL{\pkgname{skull}}
\IfStyFileExists{skull}
  {\SKULLtrue
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \def\DeclareSymbolFont##1##2##3##4##5{}
   \def\DeclareMathSymbol##1##2##3##4{}
   \usepackage{skull}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
   \newcommand{\SKULLskull}{{\usefont{U}{skulls}{m}{n}\char'101}}
  }
  {}

\newif\ifEUSYM
\newcommand\EUSYM{\pkgname{eurosym}}
\IfStyFileExists{eurosym}
  {\EUSYMtrue
   \savesymbol{EUR}
   \usepackage{eurosym}
   \restoresymbol{eusym}{EUR}
  }
  {}

\newif\ifESV
\newcommand\ESV{\pkgname{esvect}}
\IfStyFileExists{esvect}
  {\ESVtrue
   \usepackage{esvect}
   \DeclareMathSymbol{\fldra}{\mathrel}{esvector}{'021}
   \DeclareMathSymbol{\fldrb}{\mathrel}{esvector}{'022}
   \DeclareMathSymbol{\fldrc}{\mathrel}{esvector}{'023}
   \DeclareMathSymbol{\fldrd}{\mathrel}{esvector}{'024}
   \DeclareMathSymbol{\fldre}{\mathrel}{esvector}{'025}
   \DeclareMathSymbol{\fldrf}{\mathrel}{esvector}{'026}
   \DeclareMathSymbol{\fldrg}{\mathrel}{esvector}{'027}
   \DeclareMathSymbol{\fldrh}{\mathrel}{esvector}{'030}
  }
  {}

% yfonts re-encodes \aa and \AA as LY, so we have to re-re-encode them
% in terms of a ring accent.
\IfStyFileExists{yfonts}
  {\usepackage{yfonts}
   \gdef\aa{\r a}
   \gdef\AA{\r A}
  }
  {}

% To avoid wasting a math alphabet and preventing the bigints package
% from scaling integral sizes, we reimplement the entire yhmath
% package in terms of text fonts.
\newif\ifYH
\newcommand\YH{\pkgname{yhmath}}
\makeatletter
\IfStyFileExists{yhmath}
  {\YHtrue
   \getversionstring{yhmath}
   \def\adots{\mathinner{\mkern2mu\raise\p@\hbox{.}
     \mkern2mu\raise4\p@\hbox{.}\mkern1mu
     \raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}
   \newcommand{\YHwideparen}[1]{%
     \rlap{\raisebox{3pt}{\kern1pt\usefont{U}{yhex}{m}{n}\char"F6}}{##1}}
   \newcommand{\YHwidering}[1]{\overset{\smash{\lower1.333ex\hbox{$%
     \displaystyle\ring{}$}}}{\YHwideparen{##1}}}
   \newcommand{\YHwidetriangle}[1]{%
     \rlap{\raisebox{3pt}{\kern1pt\usefont{U}{yhex}{m}{n}\char"E9}}{##1}}
   \newcommand{\YHwidetilde}[1]{%
     \rlap{\raisebox{3pt}{\kern1pt\usefont{U}{yhex}{m}{n}\char"DD}}{##1}}
   \newcommand{\YHwidehat}[1]{%
     \rlap{\raisebox{3pt}{\kern1pt\usefont{U}{yhex}{m}{n}\char"D3}}{##1}}
  }
  {}
\ifYH
  \DeclareFontFamily{U}{yhex}{}{}
  \DeclareFontShape{U}{yhex}{m}{n}{<-> sfixed * yhcmex10}{}
\fi
\makeatother

% At the time of this writing we're completely out of math alphabets.
% (Knuth shortsightedly assumed that 16 would be plenty for anyone.)
% Hence, instead of loading the esint package we manually define all of
% its characters as text characters.  Yuck.
\newif\ifES
\newcommand\ES{\pkgname{esint}}
\IfStyFileExists{esint}
  {\EStrue
   % Center an esint character against an ordinary integral.
   \newsavebox{\esbox}
   \newlength{\intcenterdelta}
   \newcommand{\esintchar}[1]{%
     \ifodd##1
       \sbox{\esbox}{$\int$}%
     \else
       \sbox{\esbox}{$\displaystyle\int$}%
     \fi
     \setlength  {\intcenterdelta}{0.5\ht\esbox}%
     \addtolength{\intcenterdelta}{-0.5\dp\esbox}%
     \sbox{\esbox}{\usefont{U}{esint}{m}{n}\char##1\relax}%
     \addtolength{\intcenterdelta}{-0.5\ht\esbox}%
     \addtolength{\intcenterdelta}{0.5\dp\esbox}%
     \raisebox{\intcenterdelta}{\usebox{\esbox}}%
   }
   % Manually define all of the characters we care about.
   \newcommand{\ESintT}{\esintchar{'001}}
   \newcommand{\ESintD}{\esintchar{'002}}
   \newcommand{\ESiintT}{\esintchar{'003}}
   \newcommand{\ESiintD}{\esintchar{'004}}
   \newcommand{\ESiiintT}{\esintchar{'005}}
   \newcommand{\ESiiintD}{\esintchar{'006}}
   \newcommand{\ESiiiintT}{\esintchar{'007}}
   \newcommand{\ESiiiintD}{\esintchar{'010}}
   \newcommand{\ESdotsintT}{\esintchar{'011}}
   \newcommand{\ESdotsintD}{\esintchar{'012}}
   \newcommand{\ESointT}{\esintchar{'013}}
   \newcommand{\ESointD}{\esintchar{'014}}
   \newcommand{\ESoiintT}{\esintchar{'015}}
   \newcommand{\ESoiintD}{\esintchar{'016}}
   \newcommand{\ESsqintT}{\esintchar{'017}}
   \newcommand{\ESsqintD}{\esintchar{'020}}
   \newcommand{\ESsqiintT}{\esintchar{'021}}
   \newcommand{\ESsqiintD}{\esintchar{'022}}
   \newcommand{\ESointctrclockwiseT}{\esintchar{'027}}
   \newcommand{\ESointctrclockwiseD}{\esintchar{'030}}
   \newcommand{\ESointclockwiseT}{\esintchar{'031}}
   \newcommand{\ESointclockwiseD}{\esintchar{'032}}
   \newcommand{\ESvarointclockwiseT}{\esintchar{'033}}
   \newcommand{\ESvarointclockwiseD}{\esintchar{'034}}
   \newcommand{\ESvarointctrclockwiseT}{\esintchar{'035}}
   \newcommand{\ESvarointctrclockwiseD}{\esintchar{'036}}
   \newcommand{\ESfintT}{\esintchar{'037}}
   \newcommand{\ESfintD}{\esintchar{'040}}
   \newcommand{\ESvaroiintT}{\esintchar{'041}}
   \newcommand{\ESvaroiintD}{\esintchar{'042}}
   \newcommand{\ESlandupintT}{\esintchar{'043}}
   \newcommand{\ESlandupintD}{\esintchar{'044}}
   \newcommand{\ESlanddownintT}{\esintchar{'045}}
   \newcommand{\ESlanddownintD}{\esintchar{'046}}
  }
  {}

\newif\ifMDOTS
\newcommand\MDOTS{\pkgname{mathdots}}
\IfStyFileExists{mathdots}
  {\MDOTStrue
   \savesymbol{ddots}
   \savesymbol{vdots}
   \savesymbol{iddots}
   \savesymbol{dddot}
   \savesymbol{ddddot}
   \usepackage{mathdots}
   \restoresymbol{MDOTS}{ddots}
   \restoresymbol{MDOTS}{vdots}
   \restoresymbol{MDOTS}{iddots}
   \restoresymbol{MDOTS}{dddot}
   \restoresymbol{MDOTS}{ddddot}
  }
  {}

\newif\ifTRSYM
\newcommand\TRSYM{\pkgname{trsym}}
\IfStyFileExists{trsym}
  {% We're painfully low on math alphabets so we define trsym's symbols in
   % text mode.
   \TRSYMtrue
   \newcommand{\transfsymbol}[1]{{\usefont{U}{trsy}{m}{n}##1}}
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \renewcommand{\DeclareSymbolFont}[5]{}
   \renewcommand{\DeclareMathSymbol}[4]{\gdef##1{\transfsymbol{\char##4}}}
   \usepackage{trsym}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
  }
  {}

% We use the *-form of \IfStyFileExists, because the package is named
% "universa", while the .sty file is named "uni.sty".
\makeatletter
\newif\ifUNI
\newcommand\UNI{\pkgname{universa}}
\IfStyFileExists*{uni}
  {\@cons\foundpkgs{{universa}}
   \UNItrue
   \usepackage{uni}
   \expandafter\xdef\csname ver@universa.sty\endcsname{%
     \csname ver@uni.sty\endcsname}
   % Redefine all of uni's non-textual symbols to use the Universal font.
   \renewcommand{\bausquare}{{\usefont{OT1}{uni}{m}{n}\char"00}}
   \renewcommand{\baucircle}{{\usefont{OT1}{uni}{m}{n}\char"01}}
   \renewcommand{\bautriangle}{{\usefont{OT1}{uni}{m}{n}\char"02}}
   \renewcommand{\bauhead}{{\usefont{OT1}{uni}{m}{n}\char"03}}
   \renewcommand{\bauforms}{{\usefont{OT1}{uni}{m}{n}\char"04}}
  }
  {\completefalse\@cons\missingpkgs{{universa}}}
\makeatother

\newif\ifUPGR
\newcommand\UPGR{\pkgname{upgreek}}
\IfStyFileExists{upgreek}
  {% We're painfully low on math alphabets so we define upgreek's symbols
   % in text mode.
   \UPGRtrue
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \let\origSetSymbolFont=\SetSymbolFont
   \renewcommand{\DeclareSymbolFont}[5]{}
   \renewcommand{\DeclareMathSymbol}[4]{%
     \newcommand{##1}{{\usefont{U}{eur}{m}{n}\char##4}}%
   }
   \renewcommand{\SetSymbolFont}[6]{}
   \usepackage[Euler]{upgreek}
   \DeclareFontFamily{U}{eur}{\skewchar\font'177}
   \DeclareFontShape{U}{eur}{m}{n}{%
     <-6> eurm5 <6-8> eurm7 <8-> eurm10}{}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
   \let\SetSymbolFont=\origSetSymbolFont
  }
  {}

% overrightarrow depends upon various macros that are defined by AMS.
\newif\ifORA
\newcommand\ORA{\pkgname{overrightarrow}}
\makeatletter
\ifAMS
  \IfStyFileExists{overrightarrow}
    {\ORAtrue
     \savesymbol{Rightarrowfill@}
     \usepackage{overrightarrow}
     \restoresymbol{ORA}{Rightarrowfill@}
     \renewcommand{\Overrightarrow}{\mathpalette{\overarrow@\ORARightarrowfill@}}
    }
    {}
\fi    % AMS test
\makeatother

\newif\ifCHEMA
\newcommand\CHEMA{\pkgname{chemarr}}
\IfStyFileExists{chemarr}
  {\CHEMAtrue
   \let\origRequirePackage=\RequirePackage
   \renewcommand{\RequirePackage}[1]{}
   \usepackage{chemarr}
   \let\RequirePackage=\origRequirePackage
  }
  {}

\newif\ifCHEMB
\newcommand\CHEMB{\pkgname{chemarrow}}
\IfStyFileExists{chemarrow}
  {\CHEMBtrue\usepackage{chemarrow}}
  {}

% nath is another of those "problem packages" that redefine just about
% everything.  To make nath work in this document we need to explicitly
% define only those symbols that we actually need.
\newif\ifNATH
\newcommand\NATH{\pkgname{nath}}
\makeatletter
\IfStyFileExists{nath}
  {\NATHtrue
   \def\vin{\mathrel{\hbox{\hglue .1ex
     \vrule \@height .06ex \@width 1ex
     \vrule \@height 1.33ex \@width .06ex
     \hglue .4ex}}}

   \def\niv{\mathrel{\hbox{\hglue .2ex
     \vrule \@height 1.33ex \@width .06ex
     \vrule \@height .06ex \@width 1ex
     \hglue .5ex}}}

   % The following was derived from nath's \extend@delim macro.
   \newcommand*{\nathrep}[2]{%
     \setbox0\hbox{$\displaystyle##2$}%
     \count@=0
     \loop\ifnum\count@<##1
      ##2%
      \hskip -.75\wd0 \hskip .25ex%
      \advance\count@ by 1%
     \repeat
   }
   \newcommand*{\nathdouble}[1]{\nathrep{2}{##1}}
   \newcommand*{\nathtriple}[1]{\nathrep{3}{##1}}
  }
  {}
\makeatother

\newif\ifTRF
\newcommand\TRF{\pkgname{trfsigns}}
\IfStyFileExists{trfsigns}
  {\TRFtrue\usepackage{trfsigns}}
  {}

\newif\ifABRACES
\newcommand\ABRACES{\pkgname{abraces}}
\IfStyFileExists{abraces}
  {\ABRACEStrue\usepackage{abraces}}
  {}

\newif\ifMTOOLS
\newcommand\MTOOLS{\pkgname{mathtools}}
\IfStyFileExists{mathtools}
  {\MTOOLStrue
   \savesymbol{xleftrightarrow} \savesymbol{xLeftarrow}
   \savesymbol{xRightarrow} \savesymbol{xLeftrightarrow}
   \savesymbol{xrightharpoondown} \savesymbol{xrightharpoonup}
   \savesymbol{xleftharpoondown} \savesymbol{xleftharpoonup}
   \savesymbol{xleftrightharpoons} \savesymbol{xrightleftharpoons}
   \savesymbol{xhookleftarrow} \savesymbol{xhookrightarrow}
   \savesymbol{xmapsto} \savesymbol{underbracket}
   \savesymbol{overbracket} \savesymbol{lparen} \savesymbol{rparen}
   \savesymbol{dblcolon} \savesymbol{coloneqq} \savesymbol{Coloneqq}
   \savesymbol{coloneq} \savesymbol{Coloneq} \savesymbol{eqqcolon}
   \savesymbol{Eqqcolon} \savesymbol{eqcolon} \savesymbol{Eqcolon}
   \savesymbol{colonapprox} \savesymbol{Colonapprox}
   \savesymbol{colonsim} \savesymbol{Colonsim} \savesymbol{overbrace}
   \savesymbol{underbrace}

   % The mathtools package delays the definitions of some of its symbols
   % to the \begin{document}.  Here we paste in the problematically
   % delayed definitions so \savesymbol and \restoresymbol behave as
   % expected.
   \usepackage[donotfixamsmathbugs]{mathtools}
   \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
   \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
   \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
   \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
   \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
   \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
   \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
   \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
   \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
   \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
   \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
   \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
   \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}

   \restoresymbol{MTOOLS}{xleftrightarrow}
   \restoresymbol{MTOOLS}{xLeftarrow}
   \restoresymbol{MTOOLS}{xRightarrow}
   \restoresymbol{MTOOLS}{xLeftrightarrow}
   \restoresymbol{MTOOLS}{xrightharpoondown}
   \restoresymbol{MTOOLS}{xrightharpoonup}
   \restoresymbol{MTOOLS}{xleftharpoondown}
   \restoresymbol{MTOOLS}{xleftharpoonup}
   \restoresymbol{MTOOLS}{xleftrightharpoons}
   \restoresymbol{MTOOLS}{xrightleftharpoons}
   \restoresymbol{MTOOLS}{xhookleftarrow}
   \restoresymbol{MTOOLS}{xhookrightarrow}
   \restoresymbol{MTOOLS}{xmapsto}
   \restoresymbol{MTOOLS}{underbracket}
   \restoresymbol{MTOOLS}{overbracket} \restoresymbol{MTOOLS}{lparen}
   \restoresymbol{MTOOLS}{rparen} \restoresymbol{MTOOLS}{dblcolon}
   \restoresymbol{MTOOLS}{coloneqq} \restoresymbol{MTOOLS}{Coloneqq}
   \restoresymbol{MTOOLS}{coloneq} \restoresymbol{MTOOLS}{Coloneq}
   \restoresymbol{MTOOLS}{eqqcolon} \restoresymbol{MTOOLS}{Eqqcolon}
   \restoresymbol{MTOOLS}{eqcolon} \restoresymbol{MTOOLS}{Eqcolon}
   \restoresymbol{MTOOLS}{colonapprox}
   \restoresymbol{MTOOLS}{Colonapprox}
   \restoresymbol{MTOOLS}{colonsim} \restoresymbol{MTOOLS}{Colonsim}
   \restoresymbol{MTOOLS}{overbrace} \restoresymbol{MTOOLS}{underbrace}

   % Some of the above are defined in terms of \dblcolon.  At the time
   % of this writing it doesn't seem like any other package uses the
   % name \dblcolon so it should be safe to retain its mathtools
   % definition.
   \let\dblcolon=\MTOOLSdblcolon
  }
  {}

% We don't actually load the following as their symbols are all
% implemented in terms of existing symbols and we need to save math
% alphabets.
\newcommand\MC{\pkgname{mathcomp}}
\newcommand\GSYMB{\pkgname{gensymb}}

\newif\ifPHAI
\newcommand\PHAI{\pkgname{phaistos}}
\IfStyFileExists{phaistos}
  {\PHAItrue\usepackage{phaistos}}
  {}

% The latest version of arcs, dated 2004/05/09, doesn't work with the
% latest version of relsize, dated 2013/03/29.  We therefore load a
% version that was patched according to Michael Sharpe's suggestion
% (cf. https://tug.org/pipermail/xetex/2013-August/024674.html).
\newif\ifARCS
\newcommand\ARCS{\pkgname{arcs}}
\IfStyFileExists{arcs}
  {\ARCStrue
   \usefakepackage{arcs}
   \def\RSpercentTolerance{5}  % Prevent \overarc and \underarc from hanging.
  }
  {}

% If we have t5enc.def, use it and its prerequisite definitions directly
% instead of loading vietnam.sty or dblaccnt.sty, as these affect other
% things in the document.
\newif\ifVIET
\newcommand\VIET{\pkgname{vntex}}
\setpkgnameopts{vietnam}{pkg=vntex}
\makeatletter
\IfStyFileExists{vietnam}
  {\VIETtrue
   \getversionstring{vietnam}
   \input{t5enc.def}
  }
  {}
\makeatother

\newif\ifPHONFC
\newcommand\PHONFC{\pkgname{t4phonet}}
\setpkgnameopts{t4phonet}{pkg=fc}
\makeatletter
\IfStyFileExists{t4phonet}
  {\PHONFCtrue
   \let\origDeclareTextSymbol=\DeclareTextSymbol
   \let\origDeclareTextAccent=\DeclareTextAccent
   \renewcommand{\DeclareTextSymbol}[3]{%
     \edef\PHONFCsym{\expandafter\@gobble\string##1}%
     \expandafter\origDeclareTextSymbol\expandafter{%
       \csname PHONFC\PHONFCsym\endcsname}{##2}{##3}%
   }
   \renewcommand{\DeclareTextAccent}[3]{%
     \edef\PHONFCsym{\expandafter\@gobble\string##1}%
     \expandafter\origDeclareTextAccent\expandafter{%
       \csname PHONFC\PHONFCsym\endcsname}{##2}{##3}%
   }
   \usepackage{t4phonet}
   \let\DeclareTextSymbol=\origDeclareTextSymbol
   \let\DeclareTextAccent=\origDeclareTextAccent
   \DeclareFontSubstitution{T4}{fcr}{m}{n}
  }
  {}
\makeatother

\newif\ifHOPO
\newcommand\HOPO{\pkgname{holtpolt}}
\IfStyFileExists{holtpolt}
  {\HOPOtrue\usepackage{holtpolt}}
  {}

\newif\ifSMTR
\newcommand\SMTR{\pkgname{semtrans}}
\IfStyFileExists{semtrans}
  {\SMTRtrue
   % semtrans's use of DeclareMathSymbol screws up \lhook and \rhook.
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \renewcommand{\DeclareMathSymbol}[4]{}
   \savesymbol{U}
   \savesymbol{D}
   \savesymbol{T}
   \usepackage{semtrans}
   \restoresymbol{smtr}{U}
   \restoresymbol{smtr}{D}
   \restoresymbol{smtr}{T}
   \let\DeclareMathSymbol=\origDeclareMathSymbol
  }
  {}

\newif\ifDICT
\newcommand\DICT{\pkgname{dictsym}}
\IfStyFileExists{dictsym}
  {\DICTtrue
   \ifpdf
     % Bug workaround. See
     % https://tex.stackexchange.com/questions/615300/pdflatex-builtin-glyph-names-is-empty/634975#634975
     \pdfmapline{=dictsym DictSym <dictsym.pfb}
   \fi
   \usepackage{dictsym}
  }
  {}

\newif\ifEXTAR
\newcommand\EXTAR{\pkgname{extarrows}}
\IfStyFileExists{extarrows}
  {\EXTARtrue
   \savesymbol{xLeftrightarrow}
   \savesymbol{xleftrightarrow}
   \usepackage{extarrows}
   \restoresymbol{EXTAR}{xLeftrightarrow}
   \restoresymbol{EXTAR}{xleftrightarrow}
  }
  {}

\newif\ifPROTO
\newcommand\PROTO{\pkgname{protosem}}
\IfStyFileExists{protosem}
  {\PROTOtrue\usepackage{protosem}}
  {}

\newif\ifHARM
\newcommand\HARM{\pkgname{harmony}}
\IfStyFileExists{harmony}
  {\HARMtrue
   \let\orignewcommand=\newcommand
   \let\newcommand=\DeclareRobustCommand
   \savesymbol{HH}
   \usepackage{harmony}
   \restoresymbol{harm}{HH}
   \let\newcommand=\orignewcommand
  }
  {}

\newif\ifHIER
\newcommand\HIER{\pkgname{hieroglf}}
\IfStyFileExists{hieroglf}
  {\HIERtrue
   \savesymbol{HF}
   \usepackage{hieroglf}
   \restoresymbol{HIER}{HF}
  }
  {}

\newif\ifCCLIC
\newcommand\CCLIC{\pkgname{cclicenses}}
\IfStyFileExists{cclicenses}
  {\CCLICtrue
   \usepackage{cclicenses}
   % cclicenses doesn't get along with textcomp's remapping of
   % \textcircled to the TS1 font encoding.  Mapping it back doesn't
   % _seem_ to cause any problems.
   \DeclareTextAccentDefault{\textcircled}{OMS}
  }
  {}

% The mathdesign package primarily redefines all of the existing
% mathematical symbols and is therefore a pain to load.  Hence, we just
% check if it exists and then manually define all of the symbols we care
% about (i.e., those offered only by mathdesign).
\newif\ifMDES
\newcommand\MDES{\pkgname{mathdesign}}
\IfStyFileExists{mathdesign}
  {\MDEStrue\usefakepackage{mathdesign}
  }
  {}

% We care only about the "extra" symbols in arevmath.  Hence, to save on
% math alphabets we load a faked version of the package that defines all
% the symbols as text characters.
\newif\ifAREV
\newcommand\AREV{\pkgname{arev}}
\IfStyFileExists{arev}
  {\AREVtrue
   \usefakepackage{arevmath}
   \getversionstring{arev}
  }
  {}

% Aaarrrggghhh!  MnSymbol conflicts with pretty much every mathematical
% symbol and, furthermore, defines more math alphabets than we can
% handle.  The situation has gotten so bad that we replace MnSymbol.sty
% with a generated, "faked" version that uses exclusively text fonts
% and renames all symbols to avoid conflicts.
\newif\ifMNS
\newcommand\MNS{\pkgname{MnSymbol}}
\setpkgnameopts{MnSymbol}{pkg=mnsymbol}
\IfStyFileExists{MnSymbol}
  {\MNStrue\usefakepackage{MnSymbol}}
  {}

% fdsymbol defines pretty much the same set of symbols as MnSymbol --
% and uses just as many math alphabets.  Hence, we apply the same
% trick as above.
\newif\ifFDSYM
\newcommand\FDSYM{\pkgname{fdsymbol}}
\DeclareRobustCommand*{\FDSYMpkgname}{\sffamily FdSymbol}
\setpkgnameopts{fdsymbol}{fmt={\noexpand\FDSYMpkgname}}
\IfStyFileExists{fdsymbol}
  {\FDSYMtrue\usefakepackage{fdsymbol}}
  {}

% boisik defines pretty much the same set of symbols as MnSymbol --
% and uses just as many math alphabets.  Hence, we apply the same
% trick as above.
\newif\ifBSK
\newcommand\BSK{\pkgname{boisik}}
\IfStyFileExists{boisik}
  {\BSKtrue\usefakepackage{boisik}}
  {}

% Manually define every symbol in cmll so we don't have to use any more
% math alphabets.
\newif\ifCMLL
\newcommand\CMLL{\pkgname{cmll}}
\IfStyFileExists{cmll}
  {\CMLLtrue
   \getversionstring{cmll}
   \newcommand*{\textCMLL}[1]{{\usefont{U}{cmllr}{m}{n}##1}}
   \DeclareRobustCommand{\CMLLparr}{\textCMLL{\char0}}
   \DeclareRobustCommand{\CMLLshpos}{\textCMLL{\char1}}
   \DeclareRobustCommand{\CMLLshneg}{\textCMLL{\char2}}
   \DeclareRobustCommand{\CMLLshift}{\textCMLL{\char3}}
   \DeclareRobustCommand{\CMLLcoh}{\textCMLL{\char4}}
   \DeclareRobustCommand{\CMLLscoh}{\textCMLL{\char5}}
   \DeclareRobustCommand{\CMLLincoh}{\textCMLL{\char6}}
   \DeclareRobustCommand{\CMLLsincoh}{\textCMLL{\char7}}
   \DeclareRobustCommand{\CMLLbigwith}{\raisebox{2ex}{\textCMLL{\char8}}}
   \DeclareRobustCommand{\CMLLbigparr}{\raisebox{2ex}{\textCMLL{\char10}}}
   \DeclareRobustCommand{\CMLLmultimapboth}{\textCMLL{\char12}}
   \DeclareRobustCommand{\CMLLBot}{\textCMLL{\char13}}
   \let\CMLLPerp=\CMLLBot
   \DeclareRobustCommand{\CMLLsimbot}{\textCMLL{\char14}}
   \let\CMLLsimperp=\CMLLsimbot
  }
  {}

\newif\ifXPFEIL
\newcommand\XPFEIL{\pkgname{extpfeil}}
\IfStyFileExists{extpfeil}
  {\XPFEILtrue
   % extpfeil tries to do a \RequirePackage of stmaryrd with
   % conflicting options from what we used to load stmaryd.  We
   % therefore temporarily make \RequirePackage a no-op to prevent LaTeX
   % from complaining.
   \let\origRequirePackage=\RequirePackage
   \renewcommand*{\RequirePackage}[2][]{}
   \savesymbol{xlongequal}
   \savesymbol{xmapsto}
   \usepackage{extpfeil}
   \restoresymbol{XPFEIL}{xlongequal}
   \restoresymbol{XPFEIL}{xmapsto}
   \let\RequirePackage=\origRequirePackage
  }
  {}

\newif\ifKEYS
\newcommand\KEYS{\pkgname{keystroke}}
\IfStyFileExists{keystroke}
  {\KEYStrue
   \savesymbol{Alt}
   \savesymbol{End}
   \usepackage{keystroke}
   \restoresymbol{KEYS}{Alt}
   \restoresymbol{KEYS}{End}
   % \Tab and \BSpace's use of \reflectbox confuses our indexing code.
   \DeclareRobustCommand{\keysTab}{\Tab}
   \DeclareRobustCommand{\keysBSpace}{\BSpace}
  }
  {}

% We have no math alphabets left so we trick fge.sty into defining all of
% its characters in text mode.
\newif\ifFGE
\newcommand\FGE{\pkgname{fge}}
\makeatletter
\IfStyFileExists{fge}
  {\FGEtrue
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \renewcommand{\DeclareSymbolFont}[5]{}
   \renewcommand{\DeclareMathSymbol}[4]{%
     \newcommand{##1}{{\usefont{U}{##3}{m}{n}\char##4}}%
   }
   \usepackage{fge}
   \newcommand*{\spiritusaccent}[2]{%
     \leavevmode
     \setbox0=\hbox{##2}%
     \@tempdima=\ht0
     \@tempdimb=\wd0
     \box0\llap{%
       \raisebox{\@tempdima}{%
         \makebox[\@tempdimb]{\usefont{U}{fgerm}{m}{n}\char##1}%
       }%
     }%
   }
   \DeclareRobustCommand{\spiritusasperA}[1]{\spiritusaccent{"13}{##1}}
   \DeclareRobustCommand{\spiritusasperB}[1]{\spiritusaccent{"14}{##1}}
   \DeclareRobustCommand{\spirituslenisA}[1]{\spiritusaccent{"15}{##1}}
   \DeclareRobustCommand{\spirituslenisB}[1]{\spiritusaccent{"16}{##1}}
   \let\spirituslenis=\spirituslenisA
   \let\spiritusasper=\spiritusasperA
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
  }
  {}
\makeatother

\newif\ifTURN
\newcommand\TURN{\pkgname{turnstile}}
\IfStyFileExists{turnstile}
  {\TURNtrue\usepackage{turnstile}}
  {}

\newif\ifSIMP
\newcommand\SIMP{\pkgname{simpsons}}
\IfStyFileExists{simpsons}
  {\SIMPtrue
   \usepackage{simpsons}
   \let\origSimpson=\Simpson
   \DeclareRobustCommand{\Simpson}{\origSimpson}
  }
  {}

\newif\ifEDICE
\newcommand\EDICE{\pkgname{epsdice}}
\IfStyFileExists{epsdice}
  {\EDICEtrue
   \usepackage{epsdice}
   \let\origepsdice=\epsdice
   \DeclareRobustCommand{\epsdice}[1]{\origepsdice{##1}}
   \DeclareRobustCommand{\allepsdice}{%
     \epsdice{1}%
     \epsdice{2}%
     \epsdice{3}%
     \epsdice{4}%
     \epsdice{5}%
     \epsdice{6}%
   }
  }
  {}

\newif\ifCUSTDICE
\newcommand\CUSTDICE{\pkgname{customdice}}
\IfStyFileExists{customdice}
  {\CUSTDICEtrue
   \usepackage{customdice}
  }
  {}

% feyn provides yet another math font for which we have no room.
% Fortunately, it's relatively easy to define all of its symbols in
% terms of a text font.
\newif\ifFEYN
\newcommand\FEYN{\pkgname{feyn}}
\IfStyFileExists{feyn}
  {\FEYNtrue
   \savesymbol{filename}
   \getversionstring{feyn}
   \restoresymbol{FEYN}{filename}
   \DeclareFontFamily{OMS}{textfeyn}{\skewchar\font'000}
   \DeclareFontShape{OMS}{textfeyn}{m}{n}{%
     <-10.5>feyntext10%
     <10.5-11.5>feyntext11%
     <11.5->feyntext12%
   }{}
   \DeclareRobustCommand{\feyn}[1]{{\usefont{OMS}{textfeyn}{m}{n}##1}}
   \DeclareRobustCommand{\wfermion}{\feyn{\char"64}}
   \DeclareRobustCommand{\hfermion}{\feyn{\char"6B}}
   \DeclareRobustCommand{\shfermion}{\feyn{\char"6C}}
   \DeclareRobustCommand{\whfermion}{\feyn{\char"6D}}
   \DeclareRobustCommand{\gvcropped}{\feyn{\char"07}}
   \DeclareRobustCommand{\bigbosonloop}{\feyn{\char"7B}}
   \DeclareRobustCommand{\smallbosonloop}{\feyn{\char"7C}}
   \DeclareRobustCommand{\bigbosonloopA}{\feyn{\char"5B}}
   \DeclareRobustCommand{\smallbosonloopA}{\feyn{\char"5C}}
   \DeclareRobustCommand{\bigbosonloopV}{\feyn{\char"1B}}
   \DeclareRobustCommand{\smallbosonloopV}{\feyn{\char"1C}}
  }
  {}

\newif\ifSTAVE
\newcommand\STAVE{\pkgname{staves}}
\IfStyFileExists{staves}
  {\STAVEtrue\usepackage{staves}}
  {}

\newif\ifIGO
\newcommand\IGO{\pkgname{igo}}
\IfStyFileExists{igo}
  {\savesymbol{black}
   \savesymbol{white}
   \savesymbol{repeat}
   % Don't let igo redefine all of the font-size commands.
   \savesymbol{scriptsize}\newcommand{\scriptsize}{}
   \savesymbol{tiny}\newcommand{\tiny}{}
   \savesymbol{large}\newcommand{\large}{}
   \savesymbol{Large}\newcommand{\Large}{}
   \savesymbol{LARGE}\newcommand{\LARGE}{}
   \savesymbol{huge}\newcommand{\huge}{}
   \savesymbol{Huge}\newcommand{\Huge}{}
   \IGOtrue\usepackage{igo}
   \restoresymbol{IGO}{black}
   \restoresymbol{IGO}{white}
   \restoresymbol{IGO}{repeat}
   \restoresymbol{IGO}{tiny}
   \restoresymbol{IGO}{large}
   \restoresymbol{IGO}{Large}
   \restoresymbol{IGO}{LARGE}
   \restoresymbol{IGO}{huge}
   \restoresymbol{IGO}{Huge}
   % Define a version of \whitestone and \blackstone that avoid
   % bracketed arguments.
   \DeclareRobustCommand{\igowhitestone}[1]{\whitestone[##1]}
   \DeclareRobustCommand{\igoblackstone}[1]{\blackstone[##1]}
  }
  {}

\newif\ifCEQ
\newcommand\CEQ{\pkgname{colonequals}}
\IfStyFileExists{colonequals}
  {\savesymbol{colonapprox}
   \savesymbol{colonsim}
   \CEQtrue
   \usepackage{colonequals}
   \restoresymbol{CEQ}{colonapprox}
   \restoresymbol{CEQ}{colonsim}
  }
  {}

% No point wasting a math alphabet on shuffle.
\newif\ifSHUF
\newcommand\SHUF{\pkgname{shuffle}}
\IfStyFileExists{shuffle}
  {\let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \renewcommand{\DeclareSymbolFont}[5]{}
   \renewcommand{\DeclareMathSymbol}[4]{%
     \DeclareRobustCommand{##1}{{\usefont{U}{shuffle}{m}{n}\char##4\relax}}
   }
   \SHUFtrue
   \usepackage{shuffle}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
  }
  {}

% Fourier defines a lot of math symbols, but we care about only a few
% of them.  Hence, we load only the fourier-orns package and manually
% define everything else as text-mode symbols.
%
% As Fourier obnoxiously changes the font encoding to TU when run from
% LuaLaTeX or XeLaTeX, we save the original encoding and restore it
% after fourier is loaded.
\newif\ifFOUR
\newcommand\FOUR{\pkgname{fourier}}
\saveencoding
\IfStyFileExists{fourier}
  {\FOURtrue
   \getversionstring{fourier}
   \usepackage{fourier-orns}

   % Define single-glyph symbols.
   \DeclareFontEncoding{FMS}{}{}
   \DeclareFontSubstitution{FMS}{futm}{m}{n}
   \DeclareFontEncoding{FML}{}{}
   \DeclareFontSubstitution{FML}{futmi}{m}{it}
   \newcommand{\fourierdef}[6]{%
     \DeclareRobustCommand{##1}{{\usefont{##2}{##3}{##4}{##5}\char##6}}}
   \fourierdef{\parallelslant}{FMS}{futm}{m}{n}{134}
   \fourierdef{\nparallelslant}{FMS}{futm}{m}{n}{143}
   \fourierdef{\FOURrho}{FML}{futmi}{m}{it}{26}
   \fourierdef{\FOURvarrho}{FML}{futmi}{m}{it}{37}
   \fourierdef{\varvarrho}{FML}{futmi}{m}{it}{129}
   \fourierdef{\FOURpi}{FML}{futmi}{m}{it}{25}
   \fourierdef{\FOURvarpi}{FML}{futmi}{m}{it}{36}
   \fourierdef{\varvarpi}{FML}{futmi}{m}{it}{131}
   \fourierdef{\FOURpartial}{FML}{futmi}{m}{it}{64}
   \fourierdef{\varpartialdiff}{FML}{futmi}{m}{it}{130}
   \fourierdef{\FOURtexteuro}{TS1}{futx}{m}{n}{191}

   % Fake a math accent with text-mode commands.
   \DeclareRobustCommand{\FOURfakewidetopaccent}[5]{%
     \setbox0=\hbox{\ensuremath{##1}}%
     \setbox1=\hbox{\ensuremath{abc}}%
     \leavevmode
     \ifdim\wd0<\wd1
       \kern1pt
       \rlap{\raisebox{##2}{\makebox[\wd0]{\usefont{FMX}{futm}{m}{n}\char##3}}}%
       \kern-0.1em
       \box0
     \else
       \rlap{\raisebox{##4}{\makebox[\wd0]{\usefont{FMX}{futm}{m}{n}\char##5}}}%
       \box0
     \fi
   }

   % Manually define Fourier's extensible accents.  Note that we don't
   % bother trying to use Fourier's \mathring to construct the
   % \FOURwidering symbol.
   \DeclareFontEncoding{FMX}{}{}
   \DeclareFontSubstitution{FMX}{futm}{m}{n}
   \DeclareRobustCommand{\FOURwidearc}[1]{%
     \FOURfakewidetopaccent{##1}{0ex}{216}{0.5ex}{217}}
   \DeclareRobustCommand{\FOURwideOarc}[1]{%
     \FOURfakewidetopaccent{##1}{0ex}{228}{0.5ex}{229}}
   \DeclareRobustCommand{\FOURwideparen}[1]{%
     \FOURfakewidetopaccent{##1}{0ex}{148}{0.5ex}{150}}
   \DeclareRobustCommand{\FOURwidering}[1]{\overset{\smash{\vbox to .2ex{%
     \hbox{$\mathring{}$}}}}{\FOURwideparen{##1}}}

   % Manually define Fourier's variable-sized delimiters.
   \newcommand{\fouriercdef}[6]{%
     \DeclareRobustCommand{##1}{%
       \textvcenter{\usefont{##2}{##3}{##4}{##5}\char##6}}}
   \fouriercdef{\FOURtllbracket}{FMX}{futm}{m}{n}{133}
   \fouriercdef{\FOURdllbracket}{FMX}{futm}{m}{n}{139}
   \fouriercdef{\FOURtrrbracket}{FMX}{futm}{m}{n}{134}
   \fouriercdef{\FOURdrrbracket}{FMX}{futm}{m}{n}{140}
   \newcommand*{\FOURverticals}[1]{%
     \vbox{%
       \baselineskip=-\maxdimen
       \lineskiplimit=\maxdimen
       \lineskip=0pt%
       \usefont{FMX}{futm}{m}{n}%
       \ialign{####\cr##1}%
     }%
   }
   \DeclareRobustCommand{\FOURtVERT}{%
     \raisebox{0.5ex}{\textvcenter{\FOURverticals{\char147\cr\char147\cr}}}}
   \DeclareRobustCommand{\FOURdVERT}{%
     \raisebox{0.5ex}{\textvcenter{\FOURverticals{\char147\cr\char147\cr\char147\cr\char147\cr}}}}
  }
  {}
\restoreencoding

\newif\ifDOZ
\newcommand\DOZ{\pkgname{dozenal}}
\makeatletter
\IfStyFileExists{dozenal}
  {\DOZtrue
   \usefakepackage{dozenal}
   \DeclareRobustCommand{\DOZx}{\doz{X}}
   \DeclareRobustCommand{\DOZe}{\doz{E}}
   \DeclareRobustCommand{\alldoztallies}{%
     \doz{1}~%
     \doz{2}~%
     \doz{3}~%
     \doz{4}~%
     \doz{5}~%
     \doz{6}%
   }
  }
  {}
\makeatother

\newif\ifPMBOX
\newcommand\PMBOX{\pkgname{pmboxdraw}}
\IfStyFileExists{pmboxdraw}
  {\PMBOXtrue\usepackage{pmboxdraw}}
  {}

\newif\ifPIG
\newcommand\PIG{\pkgname{pigpen}}
\IfStyFileExists{pigpen}
  {\PIGtrue
   \ifpdf
     % Bug workaround. See
     % https://tex.stackexchange.com/questions/615300/pdflatex-builtin-glyph-names-is-empty/634975#634975
     \pdfmapline{=pigpen <pigpen.pfa}
   \fi
   \usepackage{pigpen}
   \DeclareRobustCommand{\CLSLpig}[1]{{\pigpenfont##1}}
  }
  {}

\newif\ifCLOCK
\newcommand\CLOCK{\pkgname{clock}}
\IfStyFileExists{clock}
  {\CLOCKtrue\usepackage{clock}}
  {}
\DeclareRobustCommand*{\renderCLOCK}[2]{{%
  \ClockStyle=#1
  \ifx#2t
    \ClockFrametrue
  \else
    \ClockFramefalse
  \fi
  \clock{15}{41}%
}}
\newcommand*{\showCLOCK}[2]{%
  \renderCLOCK{#1}{#2}%
  \index{clock=\string\verb+\string\clock+ (\string\renderCLOCK{#1}{#2})}%
}

% We define our own teubner package to try to minimize symbol conflicts.
\newif\ifTEUB
\newcommand\TEUB{\pkgname{teubner}}
\makeatletter
\IfStyFileExists{teubner}
   {\TEUBtrue
    \let\origamp=\&
    \usepackage{teubner-subset}
    \let\&=\origamp
  }
  {}
\makeatother

\newif\ifLINA
\newcommand\LINA{\pkgname{linearA}}
\setpkgnameopts{linearA}{pkg=lineara}
\IfStyFileExists{linearA}
  {\LINAtrue\usepackage{linearA}}
  {}

\newif\ifLINB
\newcommand\LINB{\pkgname{linearb}}
\IfStyFileExists{linearb}
  {\LINBtrue\usepackage{linearb}}
  {}

\newif\ifCYPR
\newcommand\CYPR{\pkgname{cypriot}}
\IfStyFileExists{cypriot}
  {\CYPRtrue\usepackage{cypriot}}
  {}

\newif\ifSARAB
\newcommand\SARAB{\pkgname{sarabian}}
\IfStyFileExists{sarabian}
  {\SARABtrue\usepackage{sarabian}}
  {}

% Cuneiform -- not sure if this is appropriate for the list so it's
% commented out for now.
\newif\ifPRSN
\newcommand\PRSN{\pkgname{oldprsn}}
%\IfStyFileExists{oldprsn}
%  {\PRSNtrue\usepackage{oldprsn}}
%  {}

% Cuneiform -- not sure if this is appropriate for the list so it's
% commented out for now.
\newif\ifUGAR
\newcommand\UGAR{\pkgname{ugarite}}
%\IfStyFileExists{ugarite}
%  {\UGARtrue\usepackage{ugarite}}
%  {}

\newif\ifCHINA
\newcommand{\CHINA}{\pkgname{china2e}}
\IfStyFileExists{china2e}
  {\CHINAtrue
   \savesymbol{Info}
   \savesymbol{Earth}
   \savesymbol{Telephone}
   \savesymbol{Fire}
   \savesymbol{vdots}
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \renewcommand{\DeclareSymbolFont}[5]{}
   \renewcommand{\DeclareMathSymbol}[4]{%
     \DeclareRobustCommand{##1}{{\uchr##4}}}
   \usepackage{china2e}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
   \restoresymbol{china}{Info}
   \restoresymbol{china}{Earth}
   \restoresymbol{china}{Telephone}
   \restoresymbol{china}{Fire}
   \restoresymbol{CHINA}{vdots}
   \DeclareRobustCommand{\chinainternal}{\searchAs{\Chinasym}{CHiNA2e}}
   \setpkgnameopts{china2e}{fmt={\noexpand\chinainternal}}
  }
  {}

\newif\ifHARP
\newcommand\HARP{\pkgname{harpoon}}
\IfStyFileExists{harpoon}
  {\HARPtrue\usepackage{harpoon}}
  {}

\newif\ifSTEIN
\newcommand\STEIN{\pkgname{steinmetz}}
\IfStyFileExists{steinmetz}
  {\STEINtrue\usepackage{steinmetz}}
  {}

% Note that the CTAN catalogue entry is "logic", but all the files
% within the package are named "milstd.*".
\newif\ifLOGIC
\newcommand\LOGIC{\pkgname{logic}}
\IfStyFileExists{milstd}
  {\LOGICtrue\usepackage{milstd}}
  {}

\newif\ifRECYC
\newcommand\RECYC{\pkgname{recycle}}
\IfStyFileExists{recycle}
  {\RECYCtrue
   \usepackage{recycle}
   \DeclareRobustCommand{\RECYCrecycle}{{\recycle}}
  }
  {}

\newif\ifDOTARR
\newcommand\DOTARR{\pkgname{DotArrow}}
\setpkgnameopts{DotArrow}{pkg=dotarrow}
\IfStyFileExists{DotArrow}
  {\DOTARRtrue\usepackage{DotArrow}}
  {}

\newif\ifUSHORT
\newcommand\USHORT{\pkgname{ushort}}
\IfStyFileExists{ushort}
  {\USHORTtrue\usepackage{ushort}}
  {}

\newif\ifHHCNT
\newcommand\HHCNT{\pkgname{hhcount}}
\setpkgnameopts{hhcount}{link=https://mirror.ctan.org/usergrps/uktug/baskervi/5_5/hhcount.sty}
\IfStyFileExists{hhcount}
  {\HHCNTtrue
   \usepackage{hhcount}
   \DeclareRobustCommand{\allfcdice}{%
     \fcbigdice{1}~%
     \fcbigdice{2}~%
     \fcbigdice{3}~%
     \fcbigdice{4}~%
     \fcbigdice{5}~%
     \fcbigdice{6}%
   }
   \DeclareRobustCommand{\allfcscores}{%
     \fcbigscore{1}~%
     \fcbigscore{2}~%
     \fcbigscore{3}~%
     \fcbigscore{4}~%
     \fcbigscore{5}%
   }
  }
  {}

\newif\ifOGON
\newcommand\OGON{\pkgname{ogonek}}
\makeatletter
\IfStyFileExists{ogonek}
  {\OGONtrue
   \let\origAtBeginDocument=\AtBeginDocument
   \long\def\AtBeginDocument##1{}
   \usepackage{ogonek}
   \let\AtBeginDocument=\origAtBeginDocument
   \DeclareTextCommand\OGONk{T1}[1]{%
     \@testogonekletter{##1}\@oldfontsogonek{##1}%
   }
  }
  {}
\makeatother

\newif\ifCBEL
\newcommand\CBEL{\pkgname{combelow}}
\IfStyFileExists{combelow}
  {\CBELtrue\usepackage{combelow}}
  {}

% MusiXTeX's symbols aren't really designed to be used outside of
% typesetting music.  We therefore use our own faked version of MusiXTeX
% that's a bit easier to work with.
%
% Note that we call \usepackage{fakemusixtex} instead of
% \usefakepackage{musixtex} because the musixtex package doesn't begin
% with a \ProvidesPackage command and therefore gets loaded in its
% entirely, which is problematic.
\newif\ifMSX
\newcommand\MSX{MusiX\TeX\index{MusiXTeX=MusiX\TeX}}
\makeatletter
\IfStyFileExists{musixtex}
  {\MSXtrue
   \usepackage{fakemusixtex}
   \expandafter\xdef\csname ver@musixtex.sty\endcsname{%
     \csname ver@fakemusixtex.sty\endcsname}
  }
  {}
\makeatother

\newif\ifCCICO
\newcommand\CCICO{\pkgname{ccicons}}
\IfStyFileExists{ccicons}
  {\CCICOtrue
   \savesymbol{ccby}
   \usepackage{ccicons}
   \restoresymbol{CCICO}{ccby}
  }
  {}

% The package is named "adfsymbols", while the .sty files are named
% "adfarrows.sty" and "adfbullets.sty".
\makeatletter
\newif\ifADFSYM
\newcommand\ADFSYM{\pkgname{adfsymbols}}
\IfStyFileExists{adfarrows}
  {\@cons\foundpkgs{{adfbullets}}
   \ADFSYMtrue
   \savesymbol{temp}
   \usepackage{adfarrows}
   \usepackage{adfbullets}
   \restoresymbol{ADF}{temp}
  }
  {}
\makeatother

\newif\ifADFORN
\newcommand\ADFORN{\pkgname{adforn}}
\IfStyFileExists{adforn}
  {\ADFORNtrue
   \savesymbol{adfbullet}
   \usepackage{adforn}
   \restoresymbol{ADF}{adfbullet}
  }
  {}

\newif\ifBIGINTS
\newcommand\BIGINTS{\pkgname{bigints}}
\IfStyFileExists{bigints}
  {\BIGINTStrue\usepackage{bigints}}
  {}

\newif\ifSOYO
\newcommand\SOYO{\pkgname{soyombo}}
\IfStyFileExists{soyombo}
  {\SOYOtrue
   \usepackage{soyombo}
   \DeclareRobustCommand{\SOYOsA}{{\soyombo\sA}}
   \DeclareRobustCommand{\SOYOsO}{{\soyombo\sO}}
  }
  {}

\newif\ifTFRUP
\newcommand\TFRUP{\pkgname{tfrupee}}
\IfStyFileExists{tfrupee}
  {\TFRUPtrue\usepackage{tfrupee}}
  {}

% The knitting package conflicts with mylatex.ltx.  Hence, we use
% a faked version instead.
\newif\ifKNIT
\newcommand\KNIT{\pkgname{knitting}}
\IfStyFileExists{knitting}
  {\KNITtrue
   \usefakepackage{knitting}
   \knitnogrid
  }
  {}

\newif\ifTGRK
\newcommand\TGRK{\pkgname{textgreek}}
\IfStyFileExists{textgreek}
  {\TGRKtrue
   \savesymbol{textmu}
   \usepackage{textgreek}
   \restoresymbol{TGRK}{textmu}
  }
  {}

\newif\ifBEGRIFF
\newcommand\BEGRIFF{\pkgname{begriff}}
\IfStyFileExists{begriff}
  {\BEGRIFFtrue\usepackage{begriff}}
  {}
\hyphenation{Be-griffs-schrift}

\newif\ifFREGE
\newcommand\FREGE{\pkgname{frege}}
\IfStyFileExists{frege}
  {\let\temp=\relax\FREGEtrue\usepackage{frege}}
  {}

% countriesofeurope obnoxiously changes the font encoding to T1.  We
% therefore save the current font encoding and restore it after loading
% countriesofeurope.
\newif\ifCOE
\newcommand\COE{\pkgname{countriesofeurope}}
\saveencoding
\IfStyFileExists{countriesofeurope}
  {\COEtrue
    \usepackage{countriesofeurope}
  }
  {}
\restoreencoding

\newif\ifCOOK
\newcommand\COOK{\pkgname{cookingsymbols}}
\IfStyFileExists{cookingsymbols}
  {\COOKtrue\usepackage{cookingsymbols}}
  {}

\newif\ifPRODINT
\newcommand\PRODINT{\pkgname{prodint}}
\IfStyFileExists{prodint}
  {\PRODINTtrue
   % Define all three symbols manually to avoid consuming a math alphabet.
   \DeclareFontFamily{U}{ProdInt}{}
   \DeclareFontShape{U}{ProdInt}{m}{n}{<-> prodint}{}
   \DeclareRobustCommand{\prodi}{\text{\usefont{U}{ProdInt}{m}{n}\char80}}
   \DeclareRobustCommand{\Prodi}{\text{\usefont{U}{ProdInt}{m}{n}\char82}}
   \DeclareRobustCommand{\PRODI}{\text{\usefont{U}{ProdInt}{m}{n}\char84}}
  }
  {}

\newif\ifEPI
\newcommand\EPI{\pkgname{epiolmec}}
\IfStyFileExists{epiolmec}
  {\EPItrue\usepackage{epiolmec}}
  {}

\newif\ifMDW
\newcommand\MDW{\pkgname{mdwmath}}
\IfStyFileExists{mdwmath}
  {\MDWtrue
   \usepackage{mdwmath}
   \DeclareRobustCommand{\MDWsqrt}[2][]{\sqrt*[##1]{##2}}
  }
  {}

% Don't waste a precious math alphabet on the rsfso package.
\newif\ifRSFSO
\newcommand\RSFSO{\pkgname{rsfso}}
\IfStyFileExists{rsfso}
  {\RSFSOtrue
   \getversionstring{rsfso}
   \DeclareRobustCommand{\RSFSmathcal}[1]{\text{\usefont{U}{rsfso}{m}{n}##1}}
  }
  {}

\newif\ifFNTAWE
\newcommand\FNTAWE{\pkgname{fontawesome7}}
\newcommand\FNTAWEv{\pkgname{fontawesome5}}
\IfStyFileExists{fontawesome7}
  {\FNTAWEtrue
   \usepackage{fontawesome7}
  }
  {}

% stix defines a very large set of symbols and consumes a lot of math
% alphabets.  Hence, we once again use a faked version of the font to
% avoid using up all of our math alphabets.
\newif\ifSTIX
\newcommand\STIX{\pkgname{stix}}
\IfStyFileExists{stix}
  {\STIXtrue\usefakepackage{stix}}
  {}

% hands has no LaTeX support so we fabricate it ourselves.
\newif\ifHANDS
\newcommand\HANDS{\pkgname{hands}}
\IfPackageFileExists{hands}{hands.mf}
  {\HANDStrue
   \DeclareFontFamily{U}{hands}{}
   \DeclareFontShape{U}{hands}{m}{n}{<-> hands}{}
  }
  {}

% greenpoint has no LaTeX support so we fabricate it ourselves.
\newif\ifGRPNT
\newcommand\GRPNT{\pkgname{greenpoint}}
\IfPackageFileExists{greenpoint}{greenpoint.mf}
  {\GRPNTtrue
   \DeclareFontFamily{U}{greenpoint}{}
   \DeclareFontShape{U}{greenpoint}{m}{n}{<-> greenpoint}{}
  }
  {}

% nkarta has no LaTeX support so we fabricate it ourselves.
\newif\ifNKARTA
\newcommand\NKARTA{\pkgname{nkarta}}
\IfPackageFileExists{nkarta}{nkarta.mf}
  {\NKARTAtrue
   \DeclareFontFamily{U}{nkarta}{}
   \DeclareFontShape{U}{nkarta}{m}{n}{<-> nkarta}{}
  }
  {}

% astrosym has no LaTeX support so we fabricate it ourselves.
\newif\ifASTRO
\newcommand\ASTRO{\pkgname{astrosym}}
\IfPackageFileExists{astrosym}{astrosym.mf}
  {\ASTROtrue
   \DeclareFontFamily{U}{astrosym}{}
   \DeclareFontShape{U}{astrosym}{m}{n}{<-> astrosym}{}
  }
  {}

% Web-O-Mints has no LaTeX support so we fabricate it ourselves.
\newif\ifWEBO
\newcommand\WEBO{\pkgname{webomints}}
\IfPackageFileExists{webomints}{WebOMintsGD.pfb}
  {\WEBOtrue
   \DeclareFontFamily{U}{WebOMintsGD}{}
   \DeclareFontShape{U}{WebOMintsGD}{m}{n}{<-> WebOMintsGD}{}
  }
  {}

% moonphase has no LaTeX support so we fabricate it ourselves.
\newif\ifMOON
\newcommand\MOON{\pkgname{moonphase}}
\IfPackageFileExists{moonphase}{moonphase.mf}
  {\MOONtrue
   \DeclareFontFamily{U}{moonphase}{}
   \DeclareFontShape{U}{moonphase}{m}{n}{<-> moonphase}{}
  }
  {}

% dancers has no LaTeX support so we fabricate it ourselves.
\newif\ifDANCE
\newcommand\DANCE{\pkgname{dancers}}
\IfPackageFileExists{dancers}{dancers.mf}
  {\DANCEtrue
   \DeclareFontFamily{U}{dancers}{}
   \DeclareFontShape{U}{dancers}{m}{n}{<-> dancers}{}
  }
  {}

% semaphor has no LaTeX support so we fabricate it ourselves.
\newif\ifSEMA
\newcommand\SEMA{\pkgname{semaphor}}
\IfPackageFileExists{semaphor}{smfpr10.mf}
  {\SEMAtrue
   \input{semaf.fd}
   \DeclareFontFamily{U}{smfpr10}{}
   \DeclareFontShape{U}{smfpr10}{m}{n}{<-> smfpr10}{}
  }
  {}

% umranda has no LaTeX support so we fabricate it ourselves.
\newif\ifUMRANDA
\newcommand\UMRANDA{\pkgname{umranda}}
\IfPackageFileExists{umranda}{umranda.mf}
  {\UMRANDAtrue
   \DeclareFontFamily{U}{umranda}{}
   \DeclareFontShape{U}{umranda}{m}{n}{<-> umranda}{}
  }
  {}

% umrandb has no LaTeX support so we fabricate it ourselves.
\newif\ifUMRANDB
\newcommand\UMRANDB{\pkgname{umrandb}}
\IfPackageFileExists{umrandb}{umrandb.mf}
  {\UMRANDBtrue
   \DeclareFontFamily{U}{umrandb}{}
   \DeclareFontShape{U}{umrandb}{m}{n}{<-> umrandb}{}
  }
  {}

% cryst has no LaTeX support so we fabricate it ourselves.
\newif\ifCRYST
\newcommand\CRYST{\pkgname{cryst}}
\IfPackageFileExists{cryst}{cryst.mf}
  {\CRYSTtrue
   \DeclareFontFamily{U}{cryst}{}
   \DeclareFontShape{U}{cryst}{m}{n}{<-> cryst}{}
  }
  {}

% starfont has symbol conflicts with pretty much every other package
% providing astronomical symbols.  We therefore use a faked version of
% the package that prefixes all starfont symbols with "STAR".
\newif\ifSTAR
\newcommand\STAR{\pkgname{starfont}}
\IfStyFileExists{starfont}
  {\STARtrue\usefakepackage{starfont}}
  {}

\newif\ifTIKZSYM
\newcommand\TIKZSYM{\pkgname{tikzsymbols}}
\IfStyFileExists{tikzsymbols}
  {\TIKZSYMtrue
   \savesymbol{Smiley}
   \savesymbol{Coffeecup}
   \usepackage{tikzsymbols}
   \restoresymbol{TIKZSYM}{Smiley}
   \restoresymbol{TIKZSYM}{Coffeecup}
  }
  {}

% dice has no LaTeX support so we fabricate it ourselves.
\newif\ifDICE
\newcommand\DICE{\pkgname{dice}}
\IfPackageFileExists{dice}{dice3d.mf}{\DICEtrue}{}
\ifDICE
 \DeclareFontFamily{U}{dice3d}{}
 \DeclareFontShape{U}{dice3d}{m}{n}{<-> s*[4] dice3d}{}
\fi

\newif\ifAPL
\newcommand\APL{\pkgname{apl}}
\IfStyFileExists{apl}
  {\APLtrue
   \savesymbol{NG}
   \savesymbol{SS}
   \usepackage{apl}
   \restoresymbol{APL}{NG}
   \restoresymbol{APL}{SS}
  }
  {}

% The go package only defines a few symbols, but these have worrisome
% names from a conflict standpoint (e.g., \square, \triangle, and
% \empty).  Rather than protect each command individually, we use a
% faked version of the package that prefixes all of the go symbols with
% "GO".  Note that we call \usepackage{fakego} instead of
% \usefakepackage{go} because the go package doesn't begin with a
% \ProvidesPackage command and therefore gets loaded in its entirely,
% which is problematic.
\newif\ifGOPKG
\newcommand\GOPKG{\pkgname{go}}
\IfStyFileExists{go}
  {\GOPKGtrue\usepackage{fakego}}
  {}

% magic has no LaTeX support so we fabricate it ourselves.
\newif\ifMAGIC
\newcommand\MAGIC{\pkgname{magic}}
\IfPackageFileExists{magic}{magic.mf}
  {\MAGICtrue
   \DeclareFontFamily{U}{magic}{}
   \DeclareFontShape{U}{magic}{m}{n}{<-> magic}{}
  }
  {}

% bartel-chess-fonts has no LaTeX support so we fabricate it ourselves.
\newif\ifBARTEL
\newcommand\BARTEL{\pkgname{bartel-chess-fonts}}
\IfPackageFileExists{bartel-chess-fonts}{fselch10.mf}{\BARTELtrue}{}
\ifBARTEL
  \DeclareFontFamily{U}{fselch}{}
  \DeclareFontShape{U}{fselch}{m}{n}{<-> s * [13] fselch10}{}
  \DeclareFontFamily{U}{pkelch}{}
  \DeclareFontShape{U}{pkelch}{m}{n}{<-> s * [13] pkelch10}{}
\fi

\newif\ifACTANG
\newcommand\ACTANG{\pkgname{actuarialangle}}
\IfStyFileExists{actuarialangle}
  {\ACTANGtrue
   \savesymbol{lift}
   \usepackage{actuarialangle}
   \restoresymbol{ACTANG}{lift}
  }
  {}

% lilyglyphs currently works only with LuaLaTeX and XeLaTeX, not
% pdfLaTeX.  We therefore modify lilyglyphs's internals to use graphics
% instead of fonts.  Unfortunately, some lilyglyphs glyphs are provided
% by the package only as PDF files so we disable lilyglyphs entirely
% when not producing PDF output.
\newif\ifLILY
\DeclareRobustCommand{\lilylogo}{\textsf{lilyglyphs}}
\newcommand\LILY{\pkgname{lilyglyphs}}
\setpkgnameopts{lilyglyphs}{pkg=lilyglyphs,fmt={\noexpand\lilylogo}}
\IfStyFileExists{lilyglyphs}
  {\LILYtrue
   \savesymbol{flat}
   \savesymbol{natural}
   \savesymbol{sharp}
   % lilyglyphs does a \renewcommand on the following predefined LaTeX symbols.
   \def\flat{}
   \def\natural{}
   \def\sharp{}
   \usepackage{lilyglyphs}
   \restoresymbol{LILY}{flat}
   \restoresymbol{LILY}{natural}
   \restoresymbol{LILY}{sharp}
  }
  {}
\ifLILY
  \DeclareRobustCommand{\lilylogo}{%
    % I'm not sure why \searchAs can't be given an \includegraphics, but
    % the following hack seems to work.
    \hspace*{40.252bp}%   % Width of lilyglyphs_logo
    \llap{\searchAs{\textcolor{white}{lilyglyphs}}{lilyglyphs}}%
    \llap{\raisebox{-2.8pt}{\includegraphics{lilyglyphs/lilyglyphs_logo}}}%
  }
  \ifpdftex
    \renewcommand*{\lilyPrint}[2][]{%
      \interpretLilyOptions{#1}%
      #2%
    }
    \def\lilyGetGlyph#1{\includegraphics[scale=0.013151]{lilyglyphs/#1.pdf}}
    \DeclareRobustCommand{\LILYdyn}[2]{\raisebox{#1}{\lilyGetGlyph{#2}}}
    \renewcommand*{\lilyRF}{\LILYdyn{0pt}{r}\kern-2pt\LILYdyn{-2pt}{f}}
    \renewcommand*{\lilyRFZ}{\lilyRF\kern-1.5pt\LILYdyn{0pt}{z}}
    \DeclareGraphicsRule{*}{pdf}{*}{}  % Needed to support files containing multiple extensions (e.g., "clefs.C.pdf")
  \else
    \newcommand*{\LILYdyn}[2]{\lilyDynamics{#2}}
  \fi
\fi

% knot has no LaTeX support so we fabricate it ourselves.
\newif\ifKNOT
\newcommand\KNOT{\pkgname{knot}}
\IfPackageFileExists{knot}{knot7.mf}{\KNOTtrue}{}
\ifKNOT
  \DeclareFontFamily{U}{knot1}{}
  \DeclareFontShape{U}{knot1}{m}{n}{<-> sfixed * knot1}{}
  \DeclareFontFamily{U}{knot2}{}
  \DeclareFontShape{U}{knot2}{m}{n}{<-> sfixed * knot2}{}
  \DeclareFontFamily{U}{knot3}{}
  \DeclareFontShape{U}{knot3}{m}{n}{<-> sfixed * knot3}{}
  \DeclareFontFamily{U}{knot4}{}
  \DeclareFontShape{U}{knot4}{m}{n}{<-> sfixed * knot4}{}
  \DeclareFontFamily{U}{knot5}{}
  \DeclareFontShape{U}{knot5}{m}{n}{<-> sfixed * knot5}{}
  \DeclareFontFamily{U}{knot6}{}
  \DeclareFontShape{U}{knot6}{m}{n}{<-> sfixed * knot6}{}
  \DeclareFontFamily{U}{knot7}{}
  \DeclareFontShape{U}{knot7}{m}{n}{<-> sfixed * knot7}{}
\fi

\newif\ifBCLOGO
\newcommand\BCLOGO{\pkgname{bclogo}}
\IfStyFileExists{bclogo}
  {\BCLOGOtrue\usepackage[tikz]{bclogo}}
  {}

\newif\ifBULL
\newcommand\BULL{\pkgname{bullcntr}}
\IfStyFileExists{bullcntr}
  {\BULLtrue
   \usepackage{bullcntr}
   \newcounter{CLSLbull}
   \newcommand{\showbullcntr}[1]{%
     \setcounter{CLSLbull}{##1}%
     \bullcntr{CLSLbull}%
   }
  }
  {}

\newif\ifRUBIK
\newcommand\RUBIK{\pkgname{rubikcube}}
\IfStyFileExists{rubikcube}
  {\RUBIKtrue
   \let\orignewcommand=\newcommand
   \let\newcommand=\DeclareRobustCommand
   \usepackage{rubikcube}
   \let\newcommand=\orignewcommand
  }
  {}

% We have no math alphabets left so we trick svrsymbols.sty into defining
% all of its characters in text mode.
\newif\ifSVR
\newcommand\SVR{\pkgname{svrsymbols}}
\makeatletter
\IfStyFileExists{svrsymbols}
  {\SVRtrue
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \let\origDeclareMathSymbol=\DeclareMathSymbol
   \let\origSetSymbolFont=\SetSymbolFont
   \renewcommand{\DeclareSymbolFont}[5]{}
   \renewcommand{\SetSymbolFont}[6]{}
   \renewcommand{\DeclareMathSymbol}[4]{%
     \let##1=\relax%  \photon and \antiproton are defined repeatedly.
     \newcommand{##1}{{\usefont{OML}{svr}{m}{it}\char##4}}%
   }
   \usepackage{svrsymbols}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \let\DeclareMathSymbol=\origDeclareMathSymbol
   \let\SetSymbolFont=\origSetSymbolFont
  }
  {}

\newif\ifHWMATH
\newcommand\HWMATH{\pkgname{halloweenmath}}
\IfStyFileExists{halloweenmath}
  {\HWMATHtrue\usepackage{halloweenmath}}
  {}

% Use a faked version of old-arrows.sty so as not to waste a math alphabet.
\newif\ifOLDARR
\newcommand\OLDARR{\pkgname{old-arrows}}
\IfStyFileExists{old-arrows}
  {\OLDARRtrue\usefakepackage{old-arrows}}
  {}

% Use a faked version of allrunes.sty so as not to redefine existing symbols.
\newif\ifARUNE
\newcommand\ARUNE{\pkgname{allrunes}}
\IfStyFileExists{allrunes}
  {\ARUNEtrue\usefakepackage{allrunes}}
  {}

% If emf.sty exists, don't load it normally because that would
% consume any of a number of math alphabets.  Instead, we simply
% check that all of its dependent packages exist.
\newif\ifEMF
\newcommand\EMF{\pkgname{emf}}
\IfStyFileExists*{emf}
  {\IfStyFileExists*{BOONDOX-cal}
    {\IfStyFileExists*{calligra}
      {\IfStyFileExists*{frcursive}
        {\IfStyFileExists*{fourier}
          {\IfStyFileExists*{miama}
            {\IfStyFileExists*{tgchorus}
              {\IfStyFileExists*{rsfso}
                {\EMFtrue}
                {}
              }
              {}
            }
            {}
          }
          {}
        }
        {}
      }
      {}
    }
    {}
  }
  {}

% Only if all of emf's dependencies are met do we mark the package as included.
\makeatletter
  \ifEMF
    \@cons\foundpkgs{{emf}}
    \let\origRequirePackage=\RequirePackage
    \usepackage{emf}
    \let\RequirePackage=\origRequirePackage
    \DeclareRobustCommand{\emfboondox}{{\usefont{U}{BOONDOX-cal}{m}{n}E}}
    \DeclareRobustCommand{\emfcal}{\ensuremath{\mathcal{E}}}
    \DeclareRobustCommand{\emfcalligra}{{%
        $\mkern-7mu$%
        \usefont{T1}{calligra}{m}{n}\fontsize{7.43}{10}\selectfont E}%
    }
    \DeclareRobustCommand{\emfchorus}{{\usefont{OT1}{qzc}{m}{it}\fontsize{12.2}{10}\selectfont E}}
    \DeclareRobustCommand{\emfcmr}{{\usefont{OMS}{cmr}{m}{n}E}}
    \DeclareRobustCommand{\emffourier}{{\usefont{FMS}{futm}{m}{n}E}}
    \DeclareRobustCommand{\emffrcursive}{{\usefont{T1}{frc}{m}{sl}E}}
    \DeclareRobustCommand{\emfmiama}{{\usefont{OT1}{fmm}{m}{n}\fontsize{8.5}{10}\selectfont E}}
    \DeclareRobustCommand{\emfrsfs}{{\usefont{OMS}{rsfs}{m}{n}E}}
  \else
    \completefalse\@cons\missingpkgs{{emf}}
  \fi
\makeatother

% Define all of esrelation's symbols as text symbols to avoid consuming
% a math alphabet.
\newif\ifESR
\newcommand\ESR{\pkgname{esrelation}}
\makeatletter
\IfStyFileExists{esrelation}
   {\ESRtrue
    % Load the package with text-mode symbol replacements.
    \let\origDeclareSymbolFont=\DeclareSymbolFont
    \let\origDeclareMathSymbol=\DeclareMathSymbol
    \renewcommand{\DeclareSymbolFont}[5]{}
    \renewcommand{\DeclareMathSymbol}[4]{%
      \DeclareRobustCommand{##1}{\text{\usefont{U}{esrelation}{m}{n}\char##4}}%
    }
    \usepackage{esrelation}
    \let\DeclareSymbolFont=\origDeclareSymbolFont
    \let\DeclareMathSymbol=\origDeclareMathSymbol

    % esrelation extensible symbols get messed up when used with a center
    % environment.  Work around that limitation by typesetting them within
    % a box.
    \DeclareRobustCommand{\ESRrelationlifting}[1]{%
      \settowidth{\@tempdima}{##1}%
      \advance\@tempdima by 4pt%
      \begin{minipage}[b]{\@tempdima}%
        \ifdim\@tempdima<13pt
          $\relationlifting{\mkern2mu##1\mkern2mu}$%
        \else
          $\relationlifting{##1}$%
        \fi
      \end{minipage}%
    }
    \DeclareRobustCommand{\ESRrelationleftproject}[1]{%
      \settowidth{\@tempdima}{##1}%
      \advance\@tempdima by 4pt%
      \begin{minipage}[b]{\@tempdima}%
        \ifdim\@tempdima<13pt
          $\relationleftproject{\mkern2mu##1\mkern2mu}$%
        \else
          $\relationleftproject{##1}$%
        \fi
      \end{minipage}%
    }
    \DeclareRobustCommand{\ESRrelationrightproject}[1]{%
      \settowidth{\@tempdima}{##1}%
      \advance\@tempdima by 4pt%
      \begin{minipage}[b]{\@tempdima}%
        \ifdim\@tempdima<13pt
          $\relationrightproject{\mkern2mu##1\mkern2mu}$%
        \else
          $\relationrightproject{##1}$%
        \fi
      \end{minipage}%
    }
  }
  {}
\makeatother

\newif\ifOPLOT
\newcommand\OPLOT{\pkgname{oplotsymbl}}
\IfStyFileExists{oplotsymbl}
  {\OPLOTtrue\usepackage{oplotsymbl}}
  {}

% cmupint consumes a math alphabet and conflicts with a number of symbols
% appearing in other packages.  We use a faked version of the package that
% addresses both of these challenges.
\newif\ifCMUPINT
\newcommand\CMUPINT{\pkgname{cmupint}}
\IfStyFileExists{cmupint}
  {\CMUPINTtrue\usefakepackage{cmupint}}
  {}

% For convenience typesetting and indexing, we define a wrapper command for
% each optional argument to \hat.
\newif\ifRHATS
\newcommand\RHATS{\pkgname{realhats}}
\IfStyFileExists{realhats}
  {\RHATStrue
   \savesymbol{hat}
   \let\hat=\orighat  % realhats does a \renewcommand{\hat} so \hat must exist.
   \usepackage{realhats}
   \restoresymbol{RHAT}{hat}
   % Define a wrapper for each realhats command that takes a single,
   % mandatory argument.
   \DeclareRobustCommand{\RHATash}[1]{\RHAThat[ash]{##1}}
   \DeclareRobustCommand{\RHATberet}[1]{\RHAThat[beret]{##1}}
   \DeclareRobustCommand{\RHATbirthday}[1]{\RHAThat[birthday]{##1}}
   \DeclareRobustCommand{\RHATcowboy}[1]{\RHAThat[cowboy]{##1}}
   \DeclareRobustCommand{\RHATcrown}[1]{\RHAThat[crown]{##1}}
   \DeclareRobustCommand{\RHATdunce}[1]{\RHAThat[dunce]{##1}}
   \DeclareRobustCommand{\RHATfez}[1]{\RHAThat[fez]{##1}}
   \DeclareRobustCommand{\RHATmortarboard}[1]{\RHAThat[mortarboard]{##1}}
   \DeclareRobustCommand{\RHATpoliceman}[1]{\RHAThat[policeman]{##1}}
   \DeclareRobustCommand{\RHATsanta}[1]{\RHAThat[santa]{##1}}
   \DeclareRobustCommand{\RHATscottish}[1]{\RHAThat[scottish]{##1}}
   \DeclareRobustCommand{\RHATsombrero}[1]{\RHAThat[sombrero]{##1}}
   \DeclareRobustCommand{\RHATtileblue}[1]{\RHAThat[tile-blue]{##1}}
   \DeclareRobustCommand{\RHATtilegray}[1]{\RHAThat[tile-gray]{##1}}
   \DeclareRobustCommand{\RHATtilelightblue}[1]{\RHAThat[tile-light-blue]{##1}}
   \DeclareRobustCommand{\RHATtilewhite}[1]{\RHAThat[tile-white]{##1}}
   \DeclareRobustCommand{\RHATtophat}[1]{\RHAThat[tophat]{##1}}
   \DeclareRobustCommand{\RHATwitch}[1]{\RHAThat[witch]{##1}}
  }
  {}

\newif\ifEUFLAG
\newcommand\EUFLAG{\pkgname{euflag}}
\IfStyFileExists{euflag}
  {\EUFLAGtrue\usepackage{euflag}}
  {}

\newif\ifSCSNOW
\newcommand\SCSNOW{\pkgname{scsnowman}}
\IfStyFileExists{scsnowman}
  {\SCSNOWtrue
    \usepackage{scsnowman}
    % We use the following as an example.
    \newcommand*{\snowargs}{%
      eyes, mouth, nose, arms, hat, muffler, buttons, snow, broom%
    }
    \DeclareRobustCommand{\scsnowmanFANCY}[1][scale=1]{%
      \expandafter\scsnowman\expandafter[\snowargs, ##1]%
    }%
  }
  {}

% endofproofwd generally makes a mess of the document.  If the package
% exists we redefine its one command manually.
\newif\ifEOPROOF
\newcommand\EOPROOF{\pkgname{endofproofwd}}
\IfStyFileExists{endofproofwd}
  {\IfFileExists{endofproofwd.pdf}
    {\EOPROOFtrue
     \getversionstring{endofproofwd}
     \DeclareRobustCommand*{\wasserdicht}{%
       \includegraphics[width=10pt]{endofproofwd.pdf}%
     }
    }
    {}
  }
  {}

% mismath redefines a bunch of other commands.  All we really care
% about here are the textual operators so we redefine those manually.
\newif\ifMISMATH
\newcommand\MISMATH{\pkgname{mismath}}
\IfStyFileExists{mismath}
  {\ifESV\ifAMS
     \MISMATHtrue
     \getversionstring{mismath}
     \DeclareMathOperator{\MISMadj}{adj}
     \DeclareMathOperator{\MISMAut}{Aut}
     \DeclareMathOperator{\MISMConv}{Conv}
     \DeclareMathOperator{\MISMcov}{cov}
     \DeclareMathOperator{\MISMCov}{Cov}
     \DeclareMathOperator{\MISMcurl}{\vv{\text{curl}}}
     \DeclareMathOperator{\MISMdivg}{div}
     \DeclareMathOperator{\MISMEnd}{End}
     \DeclareMathOperator{\MISMerf}{erf}
     \DeclareMathOperator{\MISMgrad}{\vv{\text{grad}}}
     \DeclareMathOperator{\MISMid}{id}
     \DeclareMathOperator{\MISMId}{Id}
     \DeclareMathOperator{\MISMim}{im}
     \DeclareMathOperator{\MISMIm}{Im}
     \DeclareMathOperator{\MISMlb}{lb}
     \DeclareMathOperator{\MISMlcm}{lcm}
     \DeclareMathOperator{\MISMrank}{rank}
     \DeclareMathOperator{\MISMRe}{Re}
     \DeclareMathOperator{\MISMrot}{\vv{\text{rot}}}
     \DeclareMathOperator{\MISMsgn}{sgn}
     \DeclareMathOperator{\MISMspa}{span}
     \DeclareMathOperator{\MISMtr}{tr}
     \DeclareMathOperator{\MISMVar}{Var}
     \DeclareMathOperator{\MISMZu}{Z}
     \DeclareMathOperator{\MISMarccot}{arccot}
     \DeclareMathOperator{\MISMsech}{sech}
     \DeclareMathOperator{\MISMcsch}{csch}
     \DeclareMathOperator{\MISMarsinh}{arsinh}
     \DeclareMathOperator{\MISMarcosh}{arcosh}
     \DeclareMathOperator{\MISMartanh}{artanh}
     \DeclareMathOperator{\MISMarcoth}{arcoth}
     \DeclareMathOperator{\MISMarsech}{arsech}
     \DeclareMathOperator{\MISMarcsch}{arcsch}
     \DeclareMathOperator{\MISMbigO}{\mathcal{O}}
     \DeclareMathOperator{\MISMbigo}{O}
     \DeclareMathOperator{\MISMlito}{o}
   \fi\fi
  }
  {}

\newif\ifMUSICOG
\newcommand\MUSICOG{\pkgname{musicography}}
\IfStyFileExists{musicography}
  {\MUSICOGtrue\usepackage{musicography}}
  {}

% The latest (2020/10/25) version of rojud supports pdfLaTeX and XeLaTeX
% but not LuaLaTeX.  However, the XeLaTeX code seems to work just fine
% under LuaLaTeX.  As a workaround, if we're running LuaLaTeX we pretend
% we're running XeLaTeX, load rojud, then un-pretend.
\makeatletter
  \let\IFTEXlet=\IFTEX@let
\makeatother
\newif\ifROJUD
\newcommand\ROJUD{\pkgname{rojud}}
\IfStyFileExists{rojud}
  {\ROJUDtrue
   \ifluatex
     \IFTEXlet{xetex}{true}
   \fi
   \usepackage{rojud}
   \ifluatex
     \IFTEXlet{xetex}{false}
   \fi
  }
  {}

% utfsym renders symbols slowly.  In an attempt to speed it up we use
% a faked version of the package that uses a pre-rendered image for
% each symbol.
\newif\ifUTFSYM
\newcommand\UTFSYM{\pkgname{utfsym}}
\IfStyFileExists{utfsym}
  {\UTFSYMtrue
   \usefakepackage{utfsym}
  }
  {}

% worldflags defines a number of global names that interfere with
% other packages and the symbol list itself.  We use a faked version
% of the package that's more careful about namespaces and, as a side
% effect, renders symbols substantially faster.
%
% Note that we can't use \usefakepackage here because worldflags.sty
% never invokes \ProvidesPackage.
\newif\ifWFLAGS
\newcommand\WFLAGS{\pkgname{worldflags}}
\IfStyFileExists{worldflags}
  {\WFLAGStrue
   \usepackage{fakeworldflags}
  }
  {}

% We have no math alphabets left so we trick the package into declaring a
% text symbol.
\newif\ifPLIM
\newcommand\PLIM{\pkgname{plimsoll}}
\IfStyFileExists{plimsoll}
  {\PLIMtrue
   \let\origDeclareSymbolFont=\DeclareSymbolFont
   \renewcommand*{\DeclareSymbolFont}[5]{\endinput}
   \usepackage{plimsoll}
   \let\DeclareSymbolFont=\origDeclareSymbolFont
   \DeclareRobustCommand*{\plimsoll}{{\usefont{U}{plimsoll}{m}{n}\char"001}}
  }
  {}

% Use a faked version of twemojis that stores each symbol in a separate PDF
% file instead of extracting a symbol as a page from a complete list of
% twemojis symbols.
\newif\ifTWEM
\newcommand\TWEM{\pkgname{twemojis}}
\IfStyFileExists{twemojis}
  {\TWEMtrue
   \usefakepackage{twemojis}
   \newlength{\twemwidth}
   \settowidth{\twemwidth}{\texttt{.twemoji.1f574-1f3fb-200d-2640-fe0f.}}
  }
  {}

\newif\ifSACSYMB
\newcommand\SACSYMB{\pkgname{sacsymb}}
\IfStyFileExists{sacsymb}
  {\SACSYMBtrue
   % Conservatively save all symbols because sacsymb's two-letter symbol
   % names are bound to cause trouble.
   \savesymbol{ca} \savesymbol{cb} \savesymbol{cc} \savesymbol{cd}
   \savesymbol{ce} \savesymbol{cf} \savesymbol{cg} \savesymbol{ch}
   \savesymbol{ci} \savesymbol{cj} \savesymbol{ck} \savesymbol{cl}
   \savesymbol{cm} \savesymbol{cn} \savesymbol{co} \savesymbol{cq}
   \savesymbol{cs} \savesymbol{ct} \savesymbol{cu} \savesymbol{cv}
   \savesymbol{cw}
   \usepackage{sacsymb}
   \restoresymbol{SACSYMB}{ca} \restoresymbol{SACSYMB}{cb}
   \restoresymbol{SACSYMB}{cc} \restoresymbol{SACSYMB}{cd}
   \restoresymbol{SACSYMB}{ce} \restoresymbol{SACSYMB}{cf}
   \restoresymbol{SACSYMB}{cg} \restoresymbol{SACSYMB}{ch}
   \restoresymbol{SACSYMB}{ci} \restoresymbol{SACSYMB}{cj}
   \restoresymbol{SACSYMB}{ck} \restoresymbol{SACSYMB}{cl}
   \restoresymbol{SACSYMB}{cm} \restoresymbol{SACSYMB}{cn}
   \restoresymbol{SACSYMB}{co} \restoresymbol{SACSYMB}{cq}
   \restoresymbol{SACSYMB}{cs} \restoresymbol{SACSYMB}{ct}
   \restoresymbol{SACSYMB}{cu} \restoresymbol{SACSYMB}{cv}
   \restoresymbol{SACSYMB}{cw}
  }
  {}

\newif\ifOVARS
\newcommand\OVARS{\pkgname{overarrows}}
\IfStyFileExists{overarrows}
  {\OVARStrue
   \usepackage{renamed-overarrows}
  }
  {}

\newif\ifRESMES
\newcommand\RESMES{\pkgname{resmes}}
\IfStyFileExists{resmes}
  {\RESMEStrue
   \usepackage{resmes}
  }
  {}

\newif\ifPDFMSYM
\newcommand\PDFMSYM{\pkgname{pdfMsym}}
\IfPackageFileExists{pdfmsym}{pdfmsym.tex}
  {\PDFMSYMtrue
   \makeatletter
   \savesymbol{lightning}
   \input{pdfmsym}
   \pdfmsymsetscalefactor{10}
   \restoresymbol{PDFMSYM}{lightning}
   \makeatother
  }
  {}

\newif\ifSILLY
\newcommand\SILLY{\pkgname{sillypage}}
\IfStyFileExists{sillypage}
  {\SILLYtrue
   \usepackage{sillypage}
  }
  {}

% Older versions of academicons required XeLaTeX or LuaLaTeX.  Newer
% versions additionally support pdfLaTeX.
\newif\ifACICOS
\newcommand\ACICOS{\pkgname{academicons}}
\IfStyFileExists{academicons}
  {\ACICOStrue
   \usepackage{academicons}
  }
  {}

% typicons requires XeLaTeX or LuaLaTeX.  Use a faked version if we're
% running from pdfLaTeX.  Symbols with digits in their name -- \tiCss3
% and \tiHtml5 -- mess up the index because of the detokenization.  As
% a workaround we define robust \tiCssThree and \tiHtmlFive macros
% suitable for use in the index.
\newif\ifTYPICOS
\newcommand\TYPICOS{\pkgname{typicons}}
\makeatletter
\IfStyFileExists{typicons}
  {\TYPICOStrue
   \ifpdftex
     \usefakepackage{typicons}
     \DeclareRobustCommand*{\tiCssThree}{\tiCss3}
     \DeclareRobustCommand*{\tiHtmlFive}{\tiHtml5}
   \else
     \usepackage{typicons}
     \DeclareRobustCommand*{\tiCssThree}{{\TI\csname ticon@css3\endcsname}}
     \DeclareRobustCommand*{\tiHtmlFive}{{\TI\csname ticon@html5\endcsname}}
   \fi
  }
  {}
\makeatother

% figbas has no LaTeX support so we fabricate it ourselves.
\newif\ifFIGBAS
\newcommand\FIGBAS{\pkgname{figbas}}
\IfPackageFileExists{figbas}{cmrj.tfm}
  {\FIGBAStrue
   \DeclareFontFamily{U}{figbas}{}
   \DeclareFontShape{U}{figbas}{m}{n}{<-> cmrj}{}
  }
  {}

% asapsym requires XeLaTeX or LuaLaTeX.  Use a faked version if we're
% running from pdfLaTeX.
\newif\ifASAP
\newcommand\ASAP{\pkgname{asapsym}}
\IfStyFileExists{asapsym}
  {\ASAPtrue
   \ifpdftex
     \usefakepackage{asapsym}
   \else
     \usepackage{asapsym}
   \fi
  }
  {}

% fontmfizz requires XeLaTeX or LuaLaTeX.  Use a faked version if
% we're running from pdfLaTeX.
\newif\ifMFIZZ
\newcommand\MFIZZ{\pkgname{fontmfizz}}
\IfStyFileExists{fontmfizz}
  {\MFIZZtrue
   \ifpdftex
     \usefakepackage{fontmfizz}
   \else
     \usepackage{fontmfizz}
   \fi
  }
  {}

% hamnosys requires XeLaTeX or LuaLaTeX.  Use a faked version if
% we're running from pdfLaTeX.
\newif\ifHNS
\newcommand\HNS{\pkgname{hamnosys}}
\IfStyFileExists{hamnosys}
  {\HNStrue
   \ifpdftex
     \usefakepackage{hamnosys}
   \else
     \usepackage{hamnosys}
   \fi
  }
  {}

% Use a faked figchild in which each symbol appears in a pre-rendered
% graphics file.
\newif\ifCHILD
\newcommand\CHILD{\pkgname{figchild}}
\IfStyFileExists{figchild}
  {\CHILDtrue\usefakepackage{figchild}}
  {}

% logix requires XeLaTeX or LuaLaTeX.  Use a faked version if we're
% running from pdfLaTeX.
\newif\ifLOGIX
\newcommand\LOGIX{\pkgname{logix}}
\IfStyFileExists{logix}
  {\LOGIXtrue
   \savesymbol{Top}
   \savesymbol{Bot}
   \savesymbol{At}
   \ifpdftex
     \usefakepackage{logix}
   \else
     % logix loads unicode-math and mathtools (among others), which
     % conflict with various other math packages.  As we don't use
     % logix features that require those packages, we suppress their
     % loading.
     \let\origRequirePackage=\RequirePackage
     \renewcommand{\RequirePackage}[2][]{}
     \newcommand{\NewNegationCommand}[2]{}
     \let\origmeta=\meta
     \usepackage{logix}
     \let\RequirePackage=\origRequirePackage
     \let\NewNegationCommand=\undefined
     \let\meta=\origmeta
   \fi
   \restoresymbol{LOGIX}{Top}
   \restoresymbol{LOGIX}{Bot}
   \restoresymbol{LOGIX}{At}
  }
  {}

\newif\ifPGFORN
\newcommand\PGFORN{\pkgname{pgfornament}}
\IfStyFileExists{pgfornament}
  {\PGFORNtrue
   \DeclareRobustCommand*{\pgfornVec}[1]{%
     \raisebox{-7pt}{\includegraphics{pgfornament/vectorian##1}}%
   }%
   \DeclareRobustCommand*{\pgfornHan}[1]{%
     \raisebox{-8pt}{\includegraphics{pgfornament/pgfhan##1}}%
   }%
  }
  {}

% lcircuit has no LaTeX support so we fabricate it ourselves.
\newif\ifLCIRC
\newcommand\LCIRC{\pkgname{lcircuit}}
\IfPackageFileExists{lcircuit}{nexorw.mac}
  {\LCIRCtrue
   \input{ande.mac}
   \input{andn.mac}
   \input{ands.mac}
   \input{andw.mac}
   \input{capew.mac}
   \input{capns.mac}
   \input{exore.mac}
   \input{exorn.mac}
   \input{exors.mac}
   \input{exorw.mac}
   \input{nande.mac}
   \input{nandn.mac}
   \input{nands.mac}
   \input{nandw.mac}
   \input{nexore.mac}
   \input{nexorn.mac}
   \input{nexors.mac}
   \input{nexorw.mac}
   \input{nfete.mac}
   \input{nfetn.mac}
   \input{nfets.mac}
   \input{nfetw.mac}
   \input{nore.mac}
   \input{norn.mac}
   \input{nors.mac}
   \input{norw.mac}
   \input{note.mac}
   \input{notn.mac}
   \input{nots.mac}
   \input{notw.mac}
   \input{ore.mac}
   \input{orn.mac}
   \input{ors.mac}
   \input{orw.mac}
   \input{ote.mac}
   \input{otn.mac}
   \input{ots.mac}
   \input{otw.mac}
   \input{pfete.mac}
   \input{pfetn.mac}
   \input{pfets.mac}
   \input{pfetw.mac}
   \input{resew.mac}
   \input{resns.mac}
   \input{tgateew.mac}
   \input{tgatens.mac}
   \input{tje.mac}
   \input{tjn.mac}
   \input{tjs.mac}
   \input{tjw.mac}
   \input{vddpin.mac}
   \input{vsspin.mac}
   \newcommand{\uselcircuit}[1]{\usebox{\csname##1\endcsname}}
  }
  {}

% We don't actually load all of quantikz just for its few symbols.
% Instead, we load only enough to retrieve the package's version string
% then reproduce quantikz's symbol code almost verbatim.
\newif\ifQTIKZ
\newcommand\QTIKZ{\pkgname{quantikz}}
\IfStyFileExists{quantikz}
  {\QTIKZtrue
   \let\origRequirePackage=\RequirePackage
   \def\RequirePackage##1[##2]{\endinput}
   \usepackage{quantikz}
   \let\RequirePackage=\origRequirePackage
   \newcommand*{\QTIKZket}[1]{\ensuremath{\left|##1\right\rangle}}
   \newcommand*{\QTIKZbra}[1]{\ensuremath{\left\langle##1\right |}}
   \newcommand*{\QTIKZproj}[1]{\ensuremath{\QTIKZket{##1}\!\QTIKZbra{##1}}}
   \newcommand*{\QTIKZbraket}[2]{\ensuremath{\left\langle##1\middle|##2\right\rangle}}
  }
  {}

\newif\ifJCARTES
\newcommand\JCARTES{\pkgname{JeuxCartes}}
\IfStyFileExists{JeuxCartes}
  {\JCARTEStrue
   \usepackage{JeuxCartes}
   \DeclareRobustCommand*{\jccard}[2][Poker]{%
     \AffCarteJeu[TypeJeu=##1,Hauteur=1]{##2}%
   }
  }
  {}
\ifJCARTES
  \DeclareRobustCommand*{\AFCtinyP}[1]{%
    \AffCarteJeu[AlignementV=0.3, Hauteur=0.5]{#1}%
  }
  \DeclareRobustCommand*{\AFCtinyT}[1]{%
    \AffCarteJeu[AlignementV=0.3, Hauteur=0.5, TypeJeu=Tarot]{#1}%
  }
  \DeclareRobustCommand*{\AFCtinyU}[1]{%
    \AffCarteJeu[AlignementV=0.3, Hauteur=0.5, TypeJeu=Uno]{#1}%
  }
  \newcommand*{\indexcardnumber}[2][\index]{%
    #1{#2>playing cards=playing cards
      (\AFCtinyP{#2K}\,%
       \AFCtinyP{#2T}\,%
       \AFCtinyP{#2C}\,%
       \AFCtinyP{#2P})%
    }%
  }
  \newcommand*{\indextarotnumber}[2][\index]{%
    #1{#2>tarot cards=tarot cards (\AFCtinyT{#2AT})}%
  }
  \newcommand*{\indexunonumber}[2][\index]{%
    #1{#2>Uno cards=Uno cards
      (\AFCtinyU{#2B}\,%
       \AFCtinyU{#2R}\,%
       \AFCtinyU{#2J}\,%
       \AFCtinyU{#2V})%
    }%
  }
\else
  \newcommand*{\indexcardnumber}[2]{}
  \newcommand*{\indextarotnumber}[2]{}
  \newcommand*{\indexunonumber}[2]{}
\fi
\newcommand*{\ltindexcardnumber}{\indexcardnumber[\ltindex]}
\newcommand*{\ltindextarotnumber}{\indextarotnumber[\ltindex]}
\newcommand*{\ltindexunonumber}{\indexunonumber[\ltindex]}

\newif\ifMAHJONG
\newcommand\MAHJONG{\pkgname{mahjong}}
\IfStyFileExists{mahjong}
  {\MAHJONGtrue
   \usepackage{mahjong}
  }
  {}
\ifMAHJONG
  \newcommand*{\indexmahjong}[1]{%
    \index{#1>mahjong tiles=mahjong tiles (\mahjong{#1s}\,\mahjong{#1p}\,\mahjong{#1m})}%
  }
  \newcommand*{\ltindexmahjong}[1]{%
    \ltindex{#1>mahjong tiles=mahjong tiles (\mahjong{#1s}\,\mahjong{#1p}\,\mahjong{#1m})}%
  }
\else
  \newcommand*{\indexmahjong}[1]{}
  \newcommand*{\ltindexmahjong}[1]{}
\fi

\newif\ifVECLOG
\newcommand\VECLOG{\pkgname{vectorlogos}}
\IfStyFileExists{vectorlogos}
  {\VECLOGtrue
   \usepackage{vectorlogos}
  }
  {}

% symbats3 requires XeLaTeX or LuaLaTeX.  Use a faked version if we're
% running from pdfLaTeX.  Unfortunately, TeX distributions may provide
% symbats3.sty without also providing the underlying font,
% Symbats-Regular.otf.  We therefore check for our Makefile-generated
% Symbats-Regular.pfb rather than for symbats3.sty because the .pfb
% file exists if and only if both the .sty and the .otf file exist.
\newif\ifSYMBATS
\newcommand\SYMBATS{\pkgname{symbats3}}
\makeatletter
\IfPackageFileExists{symbats3}{Symbats-Regular.pfb}
  {\SYMBATStrue
   \ifpdftex
     \usefakepackage{symbats3}
   \else
     % Force every symbats3 command to begin with "SMBT", just like
     % fakesymbats3 does.
     \newcommand{\SY@getdesc}[1]{%
       \ifx\relax##1%
         \setlength{\SY@baselineadjust}{0pt}%
       \else
         \setlength{\SY@baselineadjust}{##1}%
       \fi
     }
     \setnewcommandprefix{SMBT}
     \usepackage{symbats3}
     \restorenewcommand
   \fi
  }
  {}
\makeatother

% casiofont requires XeLaTeX or LuaLaTeX.  Use a faked version if
% we're running from pdfLaTeX.  Unfortunately, TeX distributions may
% provide casiofont.sty without also providing the underlying font,
% CASIOClassWiz.ttf.  We therefore check for our Makefile-generated
% fakecasiofont.tfm rather than for casiofont.sty because the .tfm
% file exists if and only if both the .sty and the .ttf file exist.
\newif\ifCASIO
\newcommand\CASIO{\pkgname{casiofont}}
\IfPackageFileExists{casiofont}{fakecasiofont.tfm}
  {\CASIOtrue
   \ifpdftex
     \usefakepackage{casiofont}
   \else
     \setnewcommandprefix{CASIO}
     \usepackage{casiofont}
     \restorenewcommand
   \fi
  }
  {}

\newif\ifMTIME
\newcommand\MTIME{\pkgname{maritime}}
\IfStyFileExists{maritime}
  {\MTIMEtrue
   \usepackage{maritime}
  }
  {}
\ifMTIME
  \DeclareRobustCommand*{\mtimesmall}[1]{%
    \resizebox{!}{2ex}{\csname flag#1\endcsname}%
  }
\fi

\newif\ifBAHAI
\newcommand\BAHAI{\pkgname{bahaistar}}
\IfStyFileExists{bahaistar}
  {\BAHAItrue
   \usepackage{bahaistar}
  }
  {}

% Use a faked version of vscodeicons that stores each symbol in a separate
% PDF file instead of extracting a symbol as a page from a complete list of
% vscodeicons symbols.
\newif\ifVSCODE
\newcommand\VSCODE{\pkgname{vscodeicons}}
\IfStyFileExists{vscodeicons}
  {\VSCODEtrue
   \usefakepackage{vscodeicons}
  }
  {}

% At the time of this writing (6-Jan-2026), newcomputermodern does not
% provide a parseable version string ("<date> <version> <comment>").  We
% therefore load the faked package, to which we've assigned a proper date,
% and copy over its version string.
\newif\ifNEWCM
\newcommand\NEWCM{\pkgname{newcomputermodern}}
\IfStyFileExists{newcomputermodern}
  {\NEWCMtrue
   \usefakepackage{newcomputermodern}
  }
  {}
\ifNEWCM
  \makeatletter
  \expandafter\edef\csname ver@newcomputermodern.sty\endcsname{%
    \csname ver@fakenewcomputermodern.sty\endcsname
  }
  \makeatother
\fi

\newif\ifTKZLNGS
\newcommand\TKZLNGS{\pkgname{tikzlings}}
\IfStyFileExists{tikzlings}
  {\TKZLNGStrue\usepackage{tikzlings}
  }
  {}
\ifTKZLNGS
  \DeclareRobustCommand{\tkzlngs}[2][scale=0.3]{\tikz{#2[#1]}}
\fi
\DeclareRobustCommand{\tkzlngslogo}{\sffamily Ti\textit{k}Zlings}
\setpkgnameopts{tikzlings}{fmt={\noexpand\tkzlngslogo}}

\newif\ifTIKZCOOK
\newcommand\TIKZCOOK{\pkgname{tikz-cookingsymbols}}
\IfStyFileExists{tikz-cookingsymbols}
  {\TIKZCOOKtrue
   \usepackage{tikz-cookingsymbols}
  }
  {}

\newif\ifMETSYMB
\newcommand\METSYMB{\pkgname{metsymb}}
\IfStyFileExists{metsymb}
  {\METSYMBtrue
   \usepackage{metsymb}
  }
  {}

\newif\ifLUCICOS
\newcommand\LUCICOS{\pkgname{lucide-icons}}
\IfStyFileExists{lucide-icons}
  {\LUCICOStrue
   \usefakepackage{lucide-icons}
   \newlength{\lucidewidth}
   \settowidth{\lucidewidth}{\texttt{.lucideicon.align-horizontal-distribute-center.}}
  }
  {}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% If we have booktabs.sty, use it.  Otherwise, define all its line types
% in terms of \hline and \cline.
\IfStyFileExists*{booktabs}
  {\usepackage{booktabs}}
  {\newcommand{\toprule}{\hline}
   \newcommand{\midrule}{\hline}
   \newcommand{\bottomrule}{\hline}
   \def\cmidrule(##1)##2{\cline{##2}}
  }

% If we have cancel.sty, use it.
\newif\ifhavecancel
\IfStyFileExists*{cancel}
  {\havecanceltrue\usepackage{cancel}}
  {}

% If we have the accents package, use it (for an example in the section
% on constructing new symbols).
\makeatletter
\newif\ifACCENTS
\IfStyFileExists{accents}
  {\ACCENTStrue
   \savesymbol{undertilde}
   \savesymbol{dddot}
   \savesymbol{ddddot}
   \savesymbol{grave}
   \savesymbol{acute}
   \savesymbol{check}
   \savesymbol{breve}
   \savesymbol{bar}
   \savesymbol{hat}
   \savesymbol{dot}
   \savesymbol{tilde}
   \savesymbol{ddot}
   \savesymbol{vec}
   \savesymbol{ring}
   %
   \usepackage{accents}
   %
   \restoresymbol{ACCENTS}{undertilde}
   \restoresymbol{ACCENTS}{dddot}
   \restoresymbol{ACCENTS}{ddddot}
   \restoresymbol{ACCENTS}{grave}
   \restoresymbol{ACCENTS}{acute}
   \restoresymbol{ACCENTS}{check}
   \restoresymbol{ACCENTS}{breve}
   \restoresymbol{ACCENTS}{bar}
   \restoresymbol{ACCENTS}{hat}
   \restoresymbol{ACCENTS}{dot}
   \restoresymbol{ACCENTS}{tilde}
   \restoresymbol{ACCENTS}{ddot}
   \restoresymbol{ACCENTS}{vec}
   \restoresymbol{ACCENTS}{ring}
   \renewcommand*{\ACCENTStilde}{\protect\cc@accent{"\accentclass@ 07E}}
  }
  {}
\makeatother

% If we have the nicefrac package, use it (to show how to typeset fractions).
\newif\ifFRAC
\IfStyFileExists{nicefrac}
  {\FRACtrue
   \usepackage[nice]{nicefrac}
  }
  {}

% Load the bm package to show how to typeset bold math.  This needs to
% be loaded after some other math package (I'm not sure which) or it
% will consume a precious math alphabet.
\usepackage{bm}

% If we have the xfakebold package, use it (to show how to typeset bold math).
\newif\ifXFB
\IfStyFileExists{xfakebold}
  {\XFBtrue
   \usepackage{xfakebold}
  }
  {}

% If we have ot2enc.def, use it (to show how to produce a Cyrillic "sha").
\newif\ifOTII
\IfFileExists{ot2enc.def}
  {\OTIItrue\input{ot2enc.def}}
  {}

% If we have the Latin Modern fonts we can use those to show how to
% produce a long "s"
\newif\ifLATMOD
\IfFileExists{lmodern.sty}
  {\LATMODtrue
   \newcommand{\LMlongs}{{\usefont{TS1}{lmr}{m}{n}\char115}}}
  {}

% If we have t2aenc.def, use it (to show how to produce various Cyrillic
% accents.
\newif\ifTIIA
\IfFileExists{t2aenc.def}
  {\TIIAtrue\input{t2aenc.def}}
  {}

% If we have needspace.sty, use it.  Otherwise, replicate the \Needspace*
% macro's code verbatim.
\makeatletter
\IfStyFileExists*{needspace}
  {\usepackage{needspace}}
  {\newcommand{\Needspace}[2]{\par \penalty-100\begingroup
     \setlength{\dimen@}{##2}%
     \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
     \ifdim \dimen@>\dimen@ii
       \break
     \fi\endgroup}
  }
\makeatother

% If we have type1cm.sty, use it.
\IfStyFileExists*{type1cm}
  {\usepackage{type1cm}}
  {}

% If we have multirow.sty, use it.
\newif\ifhavemultirow
\IfStyFileExists*{multirow}
  {\havemultirowtrue\usepackage{multirow}}
  {}

% If we have simplewick.sty, use it.
\newif\ifhavesimplewick
\IfStyFileExists*{simplewick}
  {\havesimplewicktrue\usepackage{simplewick}}
  {}

% If we have placeins.sty, use it.
\newif\ifhaveplaceins
\IfStyFileExists*{placeins}
  {\haveplaceinstrue\usepackage{placeins}}
  {}

% If we have tocbibind.sty, use it.
\IfStyFileExists*{tocbibind}
  {\usepackage{tocbibind}}
  {}

% If we have spverbatim.sty, use it.
\newif\ifhavespverbatim
\IfStyFileExists*{spverbatim}
  {\havespverbatimtrue\usepackage{spverbatim}}
  {}

% If we have circledsteps.sty, use it.
\newif\ifhavecircledsteps
\IfStyFileExists*{circledsteps}
  {\havecircledstepstrue\usepackage{circledsteps}}
  {}

% If we have the Junicode font, use a few characters we extracted from
% it as graphics.
\newif\ifJUNI
\newcommand\JUNI{\pkgname{junicode}}
\IfPackageFileExists{junicode}{junicode/u2123.pdf}
  {\JUNItrue
   \getversionstring{junicode}
   \iftutex
     \font\junifont={Junicode Regular}
     \DeclareRobustCommand{\versicle}{{\junifont\char"2123}}
     \DeclareRobustCommand{\response}{{\junifont\char"211F}}
   \else
     \DeclareRobustCommand{\versicle}{%
       \raisebox{-2.72pt}{\includegraphics[height=10.32pt]{junicode/u2123}}%
     }
     \DeclareRobustCommand{\response}{%
       \raisebox{-2.72pt}{\includegraphics[height=9.38pt]{junicode/u211F}}%
     }
   \fi
  }
  {}

% Define our own \lesssim and \gtrsim with slanted \sim.  See
% https://tex.stackexchange.com/questions/429758/ams-inequalities-a-variant-of-gtrsim-and-lesssim
\let\TSElesssimslant=\relax
\let\TSEgtrsimslant=\relax
\IfStyFileExists*{stackengine}{%
  \IfStyFileExists*{scalerel}{%
    \usepackage{stackengine}
    \usepackage{scalerel}
    \DeclareRobustCommand{\TSElesssimslant}{%
      \mathrel{\ensurestackMath{\ThisStyle{%
            \stackengine{-.4\LMex}{\SavedStyle<}{%
              \rotatebox{-25}{$\SavedStyle\sim$}}{U}{r}{F}{T}{S}}}}}
    \DeclareRobustCommand{\TSEgtrsimslant}{%
      \mathrel{\ensurestackMath{\ThisStyle{%
            \stackengine{-.4\LMex}{\SavedStyle>}{%
              \rotatebox{25}{$\SavedStyle\sim$}}{U}{l}{F}{T}{S}}}}}
  }
  {}
}
{}

% Rather than load all of frenchmath, merely copy the definition of
% its \paral symbol.
\DeclareRobustCommand{\paral}{%
  \mathrel{\ooalign{$\mkern-1.75mu/\mkern1.75mu$\cr
      $\mkern1.75mu/\mkern-1.75mu$}}%
}

% Rather than load all of mismath, merely copy and adapt the
% definition of its \eqdef symbol.  Then define our own version which
% typesets the "def" using \tiny.
\DeclareRobustCommand{\mmeqdef}{\stackrel{\text{def}}{=}}
\DeclareRobustCommand{\tinyeqdef}{\stackrel{\text{\smaller[3]def}}{=}}

% Tell pdfLaTeX and LuaLaTeX to use the .pfb version of my lightbulb font.
\ifluatex
  \pdfextension mapfile {+lightbulb.map}
\else
  \ifpdftex
    \pdfmapfile{+lightbulb.map}
  \fi
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Because most (La)TeX builds are limited to 16 math alphabets, we       %
% define our own _text_ commands below instead of doing a \usepackage,   %
% because the latter would invoke a \DeclareMathAlphabet.                %
%                                                                        %

\IfStyFileExists{mathrsfs}
  {\getversionstring{mathrsfs}
   \newcommand{\mathscr}[1]{\mbox{\usefont{U}{rsfs}{m}{n}##1}}
  }
  {}

\IfStyFileExists{chancery}
  {\getversionstring{chancery}
   \newcommand{\mathpzc}[1]{\mbox{\usefont{OT1}{pzc}{m}{it}##1}}
  }
  {}
\setpkgnameopts{chancery}{pkg=psnfss}

\newif\ifCHAN
\newcommand\CHAN{\pkgname{urwchancal}}
\IfStyFileExists{urwchancal}
  {\CHANtrue
   \getversionstring{urwchancal}
   \newcommand{\CHANmathcal}[1]{\mbox{\usefont{U}{urwchancal}{m}{n}##1}}
  }
  {}

\IfStyFileExists{calligra}
  {\savesymbol{filename}
   \usepackage{calligra}
   \restoresymbol{CAL}{filename}
  }
  {}

\IfStyFileExists{bbold}
  {\getversionstring{bbold}
   \newcommand{\BBmathbb}[1]{\mbox{\usefont{U}{bbold}{m}{n}##1}}
   % We have to manually define all of the symbols we care about.
   \newcommand{\BBsym}[1]{\ensuremath{\BBmathbb{\char##1}}}
   \newcommand{\Langle}{\BBsym{`<}}
   \newcommand{\Lbrack}{\BBsym{`[}}
   \newcommand{\Lparen}{\BBsym{`(}}
   \newcommand{\bbalpha}{\BBsym{"0B}}
   \newcommand{\bbbeta}{\BBsym{"0C}}
   \newcommand{\bbgamma}{\BBsym{"0D}}
   \newcommand{\Rparen}{\BBsym{`)}}
   \newcommand{\Rbrack}{\BBsym{`]}}
   \newcommand{\Rangle}{\BBsym{"3E}}
  }
  {}

\IfStyFileExists{mbboard}
  {\newcommand{\MBBmathbb}[1]{\mbox{\usefont{OT1}{mbb}{m}{n}##1}}}
  {}
\ifx\MBBmathbb\undefined
\else
  % Define only the symbols we actually use.
  \newcommand{\bbnabla}{\MBBmathbb{\char"9A}}
  \newcommand{\bbdollar}{\MBBmathbb{\char"24}}
  \newcommand{\bbeuro}{\MBBmathbb{\char"FB}}
  \newcommand{\bbpe}{\MBBmathbb{\char"D4}}
  \newcommand{\bbqof}{\MBBmathbb{\char"D7}}
  \newcommand{\bbyod}{\MBBmathbb{\char"C9}}
  \newcommand{\bbfinalnun}{\MBBmathbb{\char"CF}}

  % The following was copied from mbboard.sty.
  \DeclareFontFamily{OT1}{mbb}{\hyphenchar\font45}
  \DeclareFontShape{OT1}{mbb}{m}{n}{
        <5> <6> <7> <8> <9> <10> gen * mbb
        <10.95> mbb10 <12> <14.4> mbb12 <17.28> <20.74> <24.88> mbb17
        }{}
\fi

\IfStyFileExists{dsfont}
  {\getversionstring{dsfont}
   \newcommand{\mathds}[1]{\mbox{\usefont{U}{dsrom}{m}{n}##1}}
   \newcommand{\mathdsss}[1]{\mbox{\usefont{U}{dsss}{m}{n}##1}}
  }
  {}
\setpkgnameopts{dsfont}{pkg=doublestroke}

\IfStyFileExists{bbm}
  {\getversionstring{bbm}
   \newcommand{\mathbbm}[1]{\mbox{\usefont{U}{bbm}{m}{n}##1}}
   \newcommand{\mathbbmss}[1]{\mbox{\usefont{U}{bbmss}{m}{n}##1}}
   \newcommand{\mathbbmtt}[1]{\mbox{\usefont{U}{bbmtt}{m}{n}##1}}}
  {}

% \mathfrak is defined by a number of packages, to check for it by name.
\ifx\mathfrak\undefined
\else
  \renewcommand{\mathfrak}[1]{\mbox{\fontencoding{U}\fontfamily{euf}\selectfont#1}}
\fi

% msym10 doesn't have a corresponding LaTeX package.  We establish its
% existence via the msym10.tfm file.  However, this file is not normally
% in LaTeX's input path, so be sure to point LaTeX to it (e.g., by
% copying it into the current directory).
\makeatletter
\IfFileExists{msym10.tfm}
  {\DeclareFontFamily{T1}{msym}{}
   \DeclareFontShape{T1}{msym}{m}{n}{ <-> msym10 }{}
   \newcommand{\MSYMmathbb}[1]{\mbox{\fontfamily{msym}\selectfont##1}}
  }
  {\completefalse
   \@cons\missingpkgs{{msym10.tfm}}     % Not really a package
  }
  \makeatother

\IfStyFileExists{dsserif}
  {\getversionstring{dsserif}
   \newcommand{\dsserifbb}[1]{\mbox{\usefont{U}{DSSerif}{m}{n}##1}}
   \newcommand{\dsserifbbb}[1]{\mbox{\usefont{U}{DSSerif}{b}{n}##1}}
  }
  {}

%                                                                        %
%                                                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Resolve the stmaryrd/wasysym \lightning conflict by defining \lightning
% to use stmaryrd in math mode and wasysym in text mode.
\DeclareRobustCommand{\lightning}{\ifmmode\STlightning\else\WASYlightning\fi}

% Index a symbol, which may or may not begin with a backslash.  (Is
% there a better way to do this?)  Also, if symbol is given as an
% optional argument is given, typeset that symbol in the index, as well.
% We define a related macro for indexing accents.  In a previous version
% of this file, \indexaccent additionally included "see also accents" in
% the index.  This became distracting so I made \indexaccent a synonym
% for \indexcommand for the time being.  Because punctuation marks can
% be problematic for makeindex, we define an \indexpunct macro that
% sorts its argument under the comparatively innocuous "_".
\begingroup
 \catcode`\|=0
 \catcode`\\=12
 |gdef|sanitize#1#2!!!{%
   |ifx#1\%
     #2%
   |else
     #1#2%
   |fi
}
|endgroup
\makeatletter
  \newcommand{\indexcommand}[2][]{%
    \edef\sanitized{\expandafter\sanitize\string#2!!!}%
    \def\first@arg{#1}%
    \ifhavespverbatim
      % Preferred approach: use \spverb.
      \ifx\first@arg\@empty
        \expandafter\index\expandafter{\sanitized=\string\spverb+\string#2+}%
      \else
        \expandafter\index\expandafter{\sanitized=\string\spverb+\string#2+ (#1)}%
      \fi
    \else
      % Backup approach: use \verb.
      \ifx\first@arg\@empty
        \expandafter\index\expandafter{\sanitized=\string\verb+\string#2+}%
      \else
        \expandafter\index\expandafter{\sanitized=\string\verb+\string#2+ (#1)}%
      \fi
    \fi
  }
  \let\indexaccent=\indexcommand
  \def\CLSLpipe{|}%
  \newcommand{\indexpunct}[2][]{%
    \def\first@arg{#1}%
    \def\second@arg{#2}%
    \ifx\first@arg\@empty
      \ifx\second@arg\CLSLpipe
        \index{_magicvertname=\magicvertname}%
      \else
        \index{_=\string\verb+\string#2+}%
      \fi
    \else
      \ifx\second@arg\CLSLpipe
        \index{_magicvertname=\magicvertname{} (#1)}%
      \else
        \index{_=\string\verb+\string#2+ (#1)}%
      \fi
    \fi
  }
\makeatother

% Locally disable indexing.  This is intended for tables of symbols
% containing exclusively non-descriptive names.  If \forceindexingon is
% predefined, make the indexingoff environment do nothing.  This is useful
% for producing a complete symbol index.
\ifx\forceindexingon\undefined
  \newenvironment{indexingoff}{\def\index##1{}}{}
\else
  \newenvironment{indexingoff}{}{}
\fi

% Typeset the index in three columns instead of the usual two.
\makeatletter
\renewenvironment{theindex}{%
  \clearpage
  \chapter*{\indexname}
  Similar-looking glyphs are compressed into a single index entry with
  a superscript ``\textcolor{Green}{$^+$}'' indicating that glyph
  variations exist.
\ifcomplete
  For example, the entry ``integral, contour
  ($\oint$)\textcolor{Green}{$^+$}\,'' presents only ``$\oint$'' but
  indicates that variations also are available.  In this case, those
  variations are ``$\WASYoint$'', ``$\ABXointop$'', ``\MNStoint'',
  ``\FDSYMtoint'', ``\STIXtointslop\,'', and ``\CMUPointT\,''---essentially
  font differences along the lines of ``A''
  vs.~``{\usefont{T1}{phv}{m}{n}A}'' vs.~``{\usefont{T1}{pzc}{m}{n}A}''\@.
\fi    % complete test
  Substantially different glyphs with the same name are not merged.
\ifcomplete
  For example, both ``$\varprod$'' and ``\FDSYMtvarprod'' are presented for
  ``product''.
\fi    % complete test

  Accents are shown over/under a gray box (e.g.,~``\,\blackacchack{\'}\,''
  for ``accents, acute'').  Symbols appearing in a table that spans pages
  sometimes are associated with all of the pages that table covers.  The
  author hopes to correct this issue in a future version of the \doctitle.

  \setlength{\columnsep}{1em}%
  \begin{multicols}{3}%
  \let\item\@idxitem
}{%
  \end{multicols}%
}
\makeatother

% Define a counter to keep track of how many symbols are listed.
% Output this counter to the log file at the end of each run.
% Define \prevtotalsymbols to be the total number of symbols from
% the previous run.
\newcounter{totalsymbols}
\newcommand{\incsyms}{\addtocounter{totalsymbols}{1}}
\makeatletter
\AtEndDocument{%
  \typeout{Number of symbols documented: \thetotalsymbols}
  \immediate\write\@auxout{%
    \noexpand\gdef\noexpand\prevtotalsymbols{\thetotalsymbols}}
}
\makeatother

% Define \prevtotalsymbols as "??" if this is our first run.  Define
% \approxcount as "~" unless explicitly defined otherwise in the .aux
% file.  To get a true count you should (externally to this file) count
% the number of lines in the .ind file that contain "\item \verb" and
% write an empty definition of \approxcount and the correct definition
% of \prevtotalsymbols to the .aux file.
\makeatletter
  \@ifundefined{prevtotalsymbols}{%
    \def\prevtotalsymbols{\textbf{??}}%
  }{}
  \@ifundefined{approxcount}{%
    \def\approxcount{\ensuremath{\sim}}%
  }{}
\makeatother

% If we have color.sty, use it to display accents atop gray boxes in the
% index.  (See below.)  If we don't have color.sty, use black boxes.
\IfStyFileExists*{color}
  {\usepackage{color}
   \DeclareRobustCommand*{\graybox}{\textcolor[gray]{0.7}{\rule[-\letteradp]{\letterawd}{\letteraht}}}}
  {\DeclareRobustCommand*{\graybox}{\rule[-\letteradp]{\letterawd}{\letteraht}}}

% Define \blackacc to display an accented box, given an accent command.
% Define \blackacchack to display an accented "a" and then black out
% the "a".
\newlength\letterawd
\newlength\letteraht
\newlength\letteradp
\settowidth{\letterawd}{a}
\settoheight{\letteraht}{a}
\settodepth{\letteradp}{a}
\advance\letteradp by 0.06pt    % In Computer Modern, "a" extends slightly below its bounding box.
\advance\letteraht by \letteradp
\DeclareRobustCommand*{\blackacchack}[1]{#1a\llap{\graybox}}
\DeclareRobustCommand*{\blackacc}[1]{#1{\graybox}}
\DeclareRobustCommand*{\blackacctwo}[1]{#1{\graybox}{\graybox}}

% Symbol+verbatim for various types of symbols
\def\E#1{%
  \begingroup
    \lccode`|=`\\
    \def\EStruename{ES#1T}%
    \ifhavespverbatim
      \lowercase{\incsyms\index{#1=\string\spverb+\string|#1+ (\string|\EStruename)}}%
    \else
      \lowercase{\incsyms\index{#1=\string\verb+\string|#1+ (\string|\EStruename)}}%
    \fi
  \endgroup
  \csname ES#1T\endcsname & \csname ES#1D\endcsname &
  \ttfamily\expandafter\string\csname#1\endcsname
}
\def\IGOb#1{\incsyms\indexcommand\blackstone
  \indexcommand[\string\igoblackstone{#1}]{#1}\igoblackstone{#1} &
  \ttfamily\string\blackstone[\string#1]}
\def\IGOw#1{\incsyms\indexcommand\whitestone
  \indexcommand[\string\igowhitestone{#1}]{#1}\igowhitestone{#1} &
  \ttfamily\string\whitestone[\string#1]}
\def\Jiv#1#2{\incsyms\indexcommand{#1}{\fontencoding{T4}\selectfont#1#2} &
  \ttfamily\string#1\string{#2\string}}
\makeatletter
  \def\K@opt@arg[#1]#2{%
    \incsyms\indexcommand[\noexpand\noexpand\noexpand#1]{#2}%
    #1 &\ttfamily\string#2%
  }
  \def\K@no@opt@arg#1{%
    \incsyms\indexcommand[\detokenize{#1}]{#1}%
    #1 &\ttfamily\string#1%
  }
  \def\K{\@ifnextchar[{\K@opt@arg}{\K@no@opt@arg}}
\makeatother
\def\KED[#1][#2][#3]#4{\incsyms\indexcommand[#1]{#2}#3 &\ttfamily\string#4}
\def\Kbull#1{%
  \incsyms
  \bgroup
    \lccode`\<=`\{%
    \lccode`\>=`\}%
    \lowercase{\index{bullcntr#1=\string\verb+\string\bullcntr<+\string\meta<#1>\string\verb+>+ (\string\showbullcntr<#1>)}}%
  \egroup
  \showbullcntr{#1} & \ttfamily\string\bullcntr\string{{\normalfont\meta{#1}}\string}%
}
\def\Kfeyn#1{\incsyms\indexcommand[\string\feyn{#1}]{\feyn{#1}}\feyn{#1} &\ttfamily\string\feyn\string{\string#1\string}}
\def\Kp#1{\incsyms\indexpunct[$#1$]{#1}#1 &\ttfamily\string#1}
\def\Kpig#1{%
  \incsyms
  \index{pigpenfont #1=\string\verb+{\string\pigpenfont\space#1}+\space(\string\CLSLpig{#1})}%
  \CLSLpig{#1} & \ttfamily\string{\string\pigpenfont\space\string#1\string}%
}
\def\Ks#1{\incsyms\indexcommand[\string\encone{\string#1}]{#1}{\encone{#1}} &\ttfamily\string#1$^*$}
\def\Kt#1{\incsyms\indexcommand[\string\encone{\string#1}]{#1}{\encone{#1}} &\ttfamily\string#1}
\def\Kv#1{\incsyms\indexcommand[\string\encfive{\string#1}]{#1}{\encfive{#1}} &\ttfamily\string#1}
\makeatletter
  \def\Kgr@opt@arg[#1]#2{\incsyms\indexcommand[\string\encgreek{\string#1}]{#2}{\encgreek{#1}} &\ttfamily\string#2}
  \def\Kgr@no@opt@arg#1{\incsyms\indexcommand[\string\encgreek{\string#1}]{#1}{\encgreek{#1}} &\ttfamily\string#1}
  \def\Kgr{\@ifnextchar[{\Kgr@opt@arg}{\Kgr@no@opt@arg}}
\makeatother
\def\KN[#1][#2]#3{\incsyms\indexcommand[\string#1]{#3} #1 & #2 & \ttfamily\string#3}
\def\KNbig[#1][#2]#3{\incsyms\indexcommand[\string#2]{#3} #1 & #2 & \ttfamily\string#3}
\def\Knoidx#1{\incsyms#1 &\ttfamily\string#1}
\def\Kcoe#1{%
  \incsyms\indexcommand[\string{\string\countriesofeuropefamily\string#1\string}]{#1}%
  \fontsize{72}{72}\countriesofeuropefamily#1 & \ttfamily\string#1
}
\iftutex
  % XeLaTeX or LuaLaTeX
  \def\Krojud#1{%
    \incsyms\indexcommand[\string{\string\usefont{TU}{rojud}{m}{n}\string#1\string}]{#1}%
    \fontsize{36}{36}\usefont{TU}{rojud}{m}{n}#1 & \ttfamily\string#1
  }
\else
  % Other TeX engines
  \def\Krojud#1{%
    \incsyms\indexcommand[\string{\string\usefont{OT1}{rojud}{m}{n}\string#1\string}]{#1}%
    \fontsize{36}{36}\usefont{OT1}{rojud}{m}{n}#1 & \ttfamily\string#1
  }
\fi
\iftutex
  % XeLaTeX or LuaLaTeX
  \def\Khns#1{%
    \incsyms\indexcommand[\string{\string\encuni\detokenize{#1}\string}]{#1}%
    \encuni#1 &\ttfamily\string#1%
  }
\else
  % Other TeX engines
  \let\Khns=\K
\fi
\def\KfaReg#1{%
  \incsyms
  \indexcommand[{\string#1[regular]}]{#1[regular]}#1[regular] & \ttfamily\string#1[regular]%
}
\def\Klcirc#1{%
  \incsyms
  \indexcommand[\protect\uselcircuit\string{#1\string}]{\usebox{\csname#1\endcsname}}%
  \uselcircuit{#1}
  & \ttfamily\string\usebox\string{\expandafter\string\csname#1\endcsname\string}
}
\def\KfaIcon#1{%
  \incsyms
  \indexcommand[\string\faIcon{#1}]{\faIcon{#1}}\faIcon{#1} &
  \ttfamily\string\faIcon\string{#1\string}%
}
\makeatletter
  \def\N@opt@arg[#1]#2{\incsyms\indexcommand[$\string#1$]{#2}$#1$ & $\Big#1$ &\ttfamily\string#2}
  \def\N@no@opt@arg#1{\incsyms\indexcommand[$\string#1$]{#1}$#1$ & $\Big#1$ &\ttfamily\string#1}
  \def\N{\@ifnextchar[{\N@opt@arg}{\N@no@opt@arg}}
  \def\Nn[#1]#2{%
    \incsyms\indexcommand[$\string\nathdouble\string#1$]{#2}%
    $\nathdouble#1$ & $\nathdouble{\Big#1}$ & \ttfamily\string#2}
  \def\Nnt#1[#2]#3{%
    \incsyms\indexcommand{\triple}%
    $\nathtriple#2$ & $\nathtriple{\Big#2}$ &
    \ttfamily\expandafter\string\csname#1triple\endcsname\string#3}
  \def\Np@opt@args[#1]{\@ifnextchar[{\Np@two@opt@args[#1]}{\Np@one@opt@arg[#1]}}
  \def\Np@two@opt@args[#1][#2]#3{\incsyms\index{_=\string#2{} ($\string#1$)}$#1$ & $\Big#1$ &\ttfamily\string#3}
  \def\Np@one@opt@arg[#1]#2{\incsyms\indexpunct[$\string#1$]{#2}$#1$ & $\Big#1$ &\ttfamily\string#2}
  \def\Np@no@opt@args#1{\incsyms\indexpunct[$\string#1$]{#1}$#1$ & $\Big#1$ &\ttfamily\string#1}
  \def\Np{\@ifnextchar[{\Np@opt@args}{\Np@no@opt@args}}
  \def\Nbig[#1]#2{\incsyms\indexcommand[$\string\Big\string#1$]{#2}$#1$ & $\Big#1$ &\ttfamily\string#2}
\makeatother
\def\Nlogix#1{%
  \incsyms
  \bgroup
    \expandafter\let\csname#1\endcsname=\relax
    \edef\next{\noexpand\indexcommand[\csname#1\endcsname]{\csname#1\endcsname}}%
    \next
  \egroup
  \csname#1\endcsname
  & \csname#1Big\endcsname
  & \ttfamily\expandafter\string\csname#1\endcsname
}
\def\Nlogixii#1{\Nlogix{Opn#1} & \Nlogix{Cls#1}}
\def\Mt#1{\incsyms\indexcommand[\string\metra\string#1]{#1}\metra#1 &\ttfamily\string#1}
\makeatletter
  \def\Q@opt@arg[#1]#2{\incsyms\indexaccent[\string\blackacchack{\string#1}]{#2}#1{A}#1{a} &
           \ttfamily\string#2\string{A\string}\string#2\string{a\string}}
  \def\Q@no@opt@arg#1{\incsyms\indexaccent[\string\blackacchack{\string#1}]{#1}#1{A}#1{a} &
           \ttfamily\string#1\string{A\string}\string#1\string{a\string}}
  \def\Q{\@ifnextchar[{\Q@opt@arg}{\Q@no@opt@arg}}
\makeatother
\def\Qc#1{\incsyms\indexaccent[\string\blackacc{\string#1}]{#1}#1{A}#1{a} &
         \ttfamily\string#1\string{A\string}\string#1\string{a\string}}
\def\Qe[#1][#2]#3{%
  \incsyms\incsyms\index{_=\string#2{} (\string\blackacchack{\string#1})}%
  #3{A}#3{a} &
  \ttfamily\string#3\string{A\string}\string#3\string{a\string}}
\def\Qt#1#2{\incsyms\indexaccent[\string#1{\string\blackacchack{\string#2}}]{#2}{#1{#2{A}#2{a}}} &
          \ttfamily\string#2\string{A\string}\string#2\string{a\string}}
\def\Qpc#1#2{\incsyms\indexcommand{#2}{\raisebox{1pt}{\tiny[#1]}} &
             \ttfamily\string#2\string{A\string}\string#2\string{a\string}}
\def\Qpfc[#1]#2{\incsyms\indexaccent[\string\encfour{\string\blackacchack{\string#1}}]{#2}\encfour{#1{A}#1{a}} &
           \ttfamily\string#2\string{A\string}\string#2\string{a\string}}
\ifFC
  \def\Qiv#1#2{\incsyms\indexaccent[\string\encfour{\string\blackacchack{\string#1}}]{#1}\encfour{#1{A}#1{a}} &
               \ttfamily\string#1\string{A\string}\string#1\string{a\string}$^#2$}
  \def\QivBAR#1{\incsyms\index{_magicVertname=\string\magicVertname{}
                (\string\encfour{\string\blackacchack{\string\FCbar}})}
                \encfour{\FCbar{A}\FCbar{a}} &
                \ttfamily\string\|\string{A\string}\string\|\string{a\string}$^#1$}
\else
  \def\Qiv#1#2{\Qpc{T4}{#1}$^#2$}
  \def\QivBAR#1{\incsyms\index{_magicVertname=\string\magicVertname{}}
                \raisebox{1pt}{\tiny[T1]} &
                \ttfamily\string\|\string{A\string}\string\|\string{a\string}$^#1$}
\fi
\ifVIET
  \def\Qv#1#2{\incsyms\indexaccent[\string\encfive{\string\blackacchack{\string#1}}]{#1}{\encfive{#1{A}#1{a}}} &
              \ttfamily\string#1\string{A\string}\string#1\string{a\string}$^#2$}
\else
  \def\Qv#1#2{\Qpc{T5}{#1}$^#2$}
\fi
\makeatletter
  % We use \displaystyle so that variable-sized symbols will be big.
  \def\R@opt@arg[#1]#2{\incsyms\indexcommand[$\string#1$]{#2}$#1$ & $\displaystyle#1$ &\ttfamily\string#2}
  \def\R@no@opt@arg#1{\incsyms\indexcommand[$\string#1$]{#1}$#1$ & $\displaystyle#1$ &\ttfamily\string#1}
  \def\R{\@ifnextchar[{\R@opt@arg}{\R@no@opt@arg}}
\makeatother
\def\Tm#1{\incsyms\indexcommand{\maya}$\mayadigit{#1}$ &\ttfamily\string\maya\string{#1\string}}
\def\Tmoon#1{%
  \incsyms\indexcommand[\noexpand\noexpand\noexpand\MoonPha{#1}]{\MoonPha{#1}}\MoonPha{#1} &
  \ttfamily\string\MoonPha\string{#1\string}}
\def\Tarr#1#2{%
  \incsyms\indexcommand[\csname adfarrow#1\endcsname#2]{\adfarrow#1#2}\csname adfarrow#1\endcsname{#2} &
  \ttfamily\string\adfarrow#1#2%
}
\def\Tast#1{%
  \incsyms\indexcommand[\noexpand\noexpand\noexpand\adfast{#1}]{\adfast{#1}}\adfast{#1} &
  \ttfamily\string\adfast\string{#1\string}%
}
\def\Tbul#1{%
  \incsyms\indexcommand[\noexpand\noexpand\noexpand\adfbullet{#1}]{\adfbullet{#1}}%
  \adfbullet{#1} &
  \ttfamily\string\adfbullet\string{#1\string}%
}
\def\Tding#1{%
  \incsyms
  \indexcommand[\protect\ding{#1}]{\ding{#1}}%
  \indexcommand{\ding}%
  \ding{#1}
  & \ttfamily\string\ding\string{#1\string}%
}
\def\Tknit#1{%
  \incsyms\indexcommand[\protect\textknit{#1}]{\textknit{#1}}\textknit{#1}\indexcommand{\textknit} &
  \ttfamily\string\textknit\string{#1\string}%
}
\def\Tpi#1#2{%
  \incsyms\indexcommand[\protect\Pisymbol{#1}{#2}]{\Pisymbol{#1}{#2}}\Pisymbol{#1}{#2}%
  \indexcommand{\Pisymbol} &
  \ttfamily\string\Pisymbol\string{#1\string}\string{#2\string}%
}
\def\Tutf#1{%
  \incsyms\indexcommand[\usym{#1}]{\usym{#1}}\usym{#1}\indexcommand{\usym} &
  \ttfamily\string\usym\string{#1\string}%
}
\def\Tutfw#1{%
  \incsyms\indexcommand[\usymW{#1}{0.75em}]{\usym{#1}}\usymW{#1}{0.75em}\indexcommand{\usym} &
  \ttfamily\string\usym\string{#1\string}%
}
\def\Tutfsym#1#2{%
  \incsyms
  \indexcommand{\usym}%
  \indexcommand[\usym{#1}]{\usym{#1}}%
  \index{#2=#2 (\usym{#1})}%
  \usym{#1} &
  \ttfamily\string\usym\string{#1\string} &
  \textit{#2}%
}
\def\Tutfsymw#1#2{%
  \incsyms
  \indexcommand{\usym}%
  \indexcommand[\usymW{#1}{0.75em}]{\usymW{#1}{0.75em}}%
  \index{#2=#2 (\usymW{#1}{0.75em})}%
  \usymW{#1}{0.75em} &
  \ttfamily\string\usym\string{#1\string} &
  \textit{#2}%
}
\def\Tld#1#2{%
  \incsyms
  \indexcommand[\protect\LILYdyn{#1}{#2}]{\lilyDynamics{#2}}
  \LILYdyn{#1}{#2}%
  & \ttfamily\string\lilyDynamics\string{#2\string}%
}
\def\Twflag#1{%
  \incsyms\indexcommand[\protect\worldflag{#1}]{\worldflag{#1}}%
  \worldflag{#1}\indexcommand{\worldflag} &
  \ttfamily\string\worldflag\string{#1\string}%
}
\def\Ttwem#1#2{%
  \incsyms
  \xdef\twemname{\detokenize{#1}}%
  \index{\twemname=\twemname\space (\twemoji{#2})}%
  \indexcommand[\twemoji{#2}]{\twemoji{\twemname}}%
  \indexcommand{\twemoji}%
  \twemoji{#2} &
  \frenchspacing\ttfamily\string\twemoji\string{#1\string}%
}
\def\Tsilly#1{%
  \incsyms
  \ifnum#1<10
    \index{sillystep{0#1}=\string\verb+\string\sillystep{#1}+\space(\string\sillystep{#1})}%
  \else
    \index{sillystep{#1}=\string\verb+\string\sillystep{#1}+\space(\string\sillystep{#1})}%
  \fi
  \sillystep{#1} & \ttfamily\string\sillystep\string{#1\string}%
}
\def\TpgfornV#1{%
  \incsyms
  \indexcommand[\protect\pgfornVec{#1}]{\pgfornament{#1}}%
  \pgfornVec{#1}%
  \indexcommand{\pgfornament} &
  \ttfamily\string\pgfornament\string{#1\string}%
}
\def\TpgfornVwide#1{%
  \incsyms
  \includegraphics[height=10pt]{pgfornament/vectorian#1}
  \indexcommand{\pgfornament} &
  \ttfamily\string\pgfornament\string{#1\string}%
}
\def\TpgfornH#1{%
  \incsyms
  \indexcommand[\protect\pgfornHan{#1}]{\pgfornament{#1}}%
  \pgfornHan{#1}%
  \indexcommand{\pgfornament} &
  \ttfamily\string\pgfornament\string{#1\string}%
}
\def\Tjccard#1{%
  \incsyms
  \jccard{#1}\indexcommand{\AffCarteJeu} &
  \ttfamily\string\AffCarteJeu\string{#1\string}%
}
\def\Tjcany#1#2{%
  \incsyms
  \jccard[#1]{#2}\indexcommand{\AffCarteJeu} &
  \ttfamily\string\AffCarteJeu[TypeJeu=#1]\string{#2\string}%
}
\def\Tmj#1{%
  \incsyms
  \mahjong{#1}\indexcommand{\mahjong} &
  \ttfamily\string\mahjong\string{#1\string}%
}
\makeatletter
  % Allow underscores in the argument to \lilyGlyph.
  \def\Tlg{\CLSLcleanarg\Tlg@helper}
  \def\Tlg@helper#1{%
    \incsyms
    \indexcommand[\protect\lilyGlyph{#1}]{\lilyGlyph{#1}}%
    \lilyGlyph{#1}%
    & \ttfamily\string\lilyGlyph\string{#1\string}%
  }
\newcommand*{\Tveclog}[2][]{%
  \incsyms
  \gdef\first@arg{#1}%
  \ifx\first@arg\@empty
    \indexcommand[\protect\vectorlogo{#2}]{\logo#2}%
    \vectorlogo{#2}
  \else
    \indexcommand[{\protect\vectorlogo[#1]{#2}}]{\logo#2[#1]}%
    \vectorlogo[#1]{#2}
  \fi
  &
  \ifx\first@arg\@empty
    \ttfamily\expandafter\string\csname logo#2\endcsname
  \else
    \ttfamily\expandafter\string\csname logo#2\endcsname[#1]%
  \fi
}
\newcommand*{\TVSCgen}[1]{%
  \incsyms
  \vscodeicon{#1}\indexcommand[\protect\vscodeicon{#1}]{\vscodeicon{#1}}%
  & \ttfamily\string\vscodeicon\string{#1\string}%
}
\newcommand*{\TVSCfile}[1]{%
  \incsyms
  \vscodeicon[filetype]{#1}%
  \indexcommand[{\protect\vscodeicon[filetype]{#1}}]{\vscodeicon[filetype]{#1}}%
  & \ttfamily#1%
}
\newcommand*{\TVSCfolder}[1]{%
  \incsyms
  \vscodeicon[foldertype]{#1}%
  \indexcommand[{\protect\vscodeicon[foldertype]{#1}}]{\vscodeicon[foldertype]{#1}}%
  & \vscodeicon[foldertype]{#1-opened}%
  & \ttfamily#1%
}
\newcommand*{\TLUC}[1]{%
  \incsyms
  \lucideicon{#1}\indexcommand[\lucideicon{#1}]{\lucideicon{#1}}
  & \ttfamily\string\lucideicon\string{#1\string}%
}
\makeatletter
\newcommand*{\TNCMfa}[3][]{%
  \incsyms
  \indexcommand[\csname NCM#3\endcsname]{\texttt{\string\char"#2}}%
  \csname NCM#3\endcsname
  & \ttfamily\string\textsf\string{\string\char"#2\string}%
  & \def\TNCMarg{#1}\textit{\ifx\TNCMarg\@empty#3\else#1\fi}%
}
\makeatother
\newcommand*{\TNCMbr}[3]{%
  % Usage: <hex> <name_suffix> <meaning>
  \incsyms
  \indexcommand[\csname NCMbraille#2\endcsname]{\texttt{\string\char"#1}}%
  \csname NCMbraille#2\endcsname
  & \ttfamily\string\char"#1
  & \itshape#3
}
\newcommand*{\Ttkzlngs}[1]{%
  \incsyms
  \indexcommand[\tkzlngs{#1}]{#1}
  \tkzlngs{#1} & \ttfamily\string#1
}
\newcommand{\V}[2][]{%
  \incsyms
  \def\first@arg{#1}%
  \ifx\first@arg\@empty
  \else
    \indexcommand[#1]{#2}#1%
  \fi
  & \indexcommand[#2]{#2}#2%
  & \ttfamily\string#2%
}
\makeatother
\newcommand{\Vl}[1]{\incsyms\indexcommand[#1]{#1}#1 & & \ttfamily\string#1}
\newcommand{\Vpl}[1]{\incsyms\indexpunct[$#1$]{#1}#1 & & \ttfamily\string#1}
\makeatletter
  \newcommand{\VV}[2]{%
    \incsyms\indexaccent[$\string\blackacc{\string\vv}$]{\vv}%
    \expandafter\let\expandafter\fldrVV\csname fldr#1\endcsname
    \def\vectfill@{\traitfill@\relbaredd\relbareda\fldrVV}%
    $\vv{#2}$ & \texttt{\string\vv\string{#2\string}}
    with package option \optname{esvect}{#1}
  }
  \def\W@opt@arg[#1]#2#3{%
    \incsyms\indexaccent[$\string\blackacc{\string#1}$]{#2}%
    $#1{#3}$ &\ttfamily\string#2\string{#3\string}}
  \def\W@no@opt@arg#1#2{%
    \incsyms\indexaccent[$\string\blackacc{\string#1}$]{#1}%
    $#1{#2}$ &\ttfamily\string#1\string{#2\string}}
  \def\W{\@ifnextchar[{\W@opt@arg}{\W@no@opt@arg}}
\makeatother
\def\Wstar#1#2{%
  \incsyms\indexaccent[$\string\blackacc{\string#1*}$]{#1*}%
  $#1*{#2}$ &\ttfamily\string#1*\string{#2\string}
}
\def\Wf#1#2{\incsyms\indexcommand{#1}$#1{#2}$ &\ttfamily\string#1\string{#2\string}}
\def\Ww#1#2#3{\incsyms\indexcommand{#2}$#1{#3}$ &\ttfamily\string#2\string{#3\string}}
\makeatletter
  \def\Wul@no@opt@arg#1#2#3{%
    \incsyms\indexaccent[$\string\blackacctwo{\string#1}$]{#1}%
    $#1{#2}{#3}$ &\ttfamily\string#1\string{#2\string}\string{#3\string}}
  \def\Wul@opt@arg[#1]#2#3#4{%
    \incsyms\indexaccent[$\string\blackacctwo{\string#1}$]{#2}%
    $#1{#3}{#4}$ &\ttfamily\string#2\string{#3\string}\string{#4\string}}
  \def\Wul{\@ifnextchar[{\Wul@opt@arg}{\Wul@no@opt@arg}}
  \def\X@opt@arg[#1]#2{\incsyms\indexcommand[$\string#1$]{#2}$#1$ &\ttfamily\string#2}
  \def\X@no@opt@arg#1{\incsyms\indexcommand[$\string#1$]{#1}$#1$ &\ttfamily\string#1}
  \def\X{\@ifnextchar[{\X@opt@arg}{\X@no@opt@arg}}
\makeatother
\def\Xstar#1{\incsyms\indexcommand[$\string#1*$]{#1*}$#1*$ &\ttfamily\string#1*}
\def\Y#1{\incsyms\indexcommand[$\string\big\string#1$]{#1}$\big#1$ & $\Bigg#1$ &\ttfamily\string#1}
\def\Z#1{\incsyms\indexcommand[$\string#1$]{#1}\ttfamily\string#1}

% Display and index a command, but not its symbol (\cmd).  \cmdI shows
% the symbol in the index, with optional explicit formatting.  \cmdX is
% the same as \cmdI, but with the optional argument hardwired to the
% command displayed in math mode.  \cmdW indexes an accent.  \cmdIp is
% also similar to \cmdI but formats its argument with \indexpunct
% instead of \indexcommand.
\makeatletter
\def\cmd#1{\texttt{\string#1}\indexcommand{#1}}
\newcommand{\cmdI}[2][]{%
  \def\first@arg{#1}%
  \ifx\first@arg\@empty
    \texttt{\string#2}\indexcommand[#2]{#2}%
  \else
    \texttt{\string#2}\indexcommand[#1]{#2}%
  \fi
}
\newcommand{\cmdX}[1]{\cmdI[$\string#1$]{#1}}
\newcommand{\cmdW}[1]{\cmdI[$\string\blackacc{\string#1}$]{#1}}
\newcommand{\cmdIp}[2][]{%
  \def\first@arg{#1}%
  \ifx\first@arg\@empty
    \texttt{\string#2}\indexpunct[#2]{#2}%
  \else
    \texttt{\string#2}\indexpunct[#1]{#2}%
  \fi
}
\makeatother


% Redefine the LaTeX commands that are replaced by textcomp.
% This was swiped right out of ltoutenc.dtx, but with "\text..."
% changed to "\ltext...".
\DeclareTextCommandDefault{\ltextcopyright}{\textcircled{c}}
\DeclareTextCommandDefault{\ltextordfeminine}{\textsuperscript{a}}
\DeclareTextCommandDefault{\ltextordmasculine}{\textsuperscript{o}}
\DeclareTextCommandDefault{\ltextregistered}{\textcircled{\scshape r}}
\DeclareTextCommandDefault{\ltexttrademark}{\textsuperscript{TM}}
\DeclareTextCommand{\ltextdollar}{OT1}{\char`\$}
\DeclareTextCommandDefault{\ltextpertenthousand}{{%
  \fontencoding{T1}\selectfont\%\char 24\char 24 }}
\DeclareTextCommandDefault{\ltextperthousand}{{%
  \fontencoding{T1}\selectfont\%\char 24 }}
\DeclareTextCommand{\ltextsterling}{OT1}{\textit{\char`\$}}
\DeclareTextSymbolDefault{\ltextasteriskcentered}{OMS}
\DeclareTextSymbolDefault{\ltextbardbl}{OMS}
\DeclareTextSymbolDefault{\ltextbigcircle}{OMS}
\DeclareTextSymbolDefault{\ltextbullet}{OMS}
\DeclareTextSymbolDefault{\ltextdaggerdbl}{OMS}
\DeclareTextSymbolDefault{\ltextdagger}{OMS}
\DeclareTextSymbolDefault{\ltextdollar}{OT1}
\DeclareTextSymbolDefault{\ltextparagraph}{OMS}
\DeclareTextSymbolDefault{\ltextperiodcentered}{OMS}
\DeclareTextSymbolDefault{\ltextsection}{OMS}
\DeclareTextSymbolDefault{\ltextsterling}{OT1}
\DeclareTextSymbol{\ltextasteriskcentered}{OMS}{3}
\DeclareTextSymbol{\ltextbardbl}{OMS}{107}
\DeclareTextSymbol{\ltextbigcircle}{OMS}{13}
\DeclareTextSymbol{\ltextbullet}{OMS}{15}
\DeclareTextSymbol{\ltextdaggerdbl}{OMS}{122}
\DeclareTextSymbol{\ltextdagger}{OMS}{121}
\DeclareTextSymbol{\ltextparagraph}{OMS}{123}
\DeclareTextSymbol{\ltextperiodcentered}{OMS}{1}
\DeclareTextSymbol{\ltextsection}{OMS}{120}

% The following definition is needed in the References section.  This
% code was copy&pasted from ltlogos.dtx.
\makeatletter
\DeclareRobustCommand{\LaT}{L\kern-.36em%
        {\sbox\z@ T%
         \vbox to\ht\z@{\hbox{\check@mathfonts
                              \fontsize\sf@size\z@
                              \math@fontsfalse\selectfont
                              A}%
                        \vss}%
        }%
        \kern-.15em T%
}
\makeatother

% The following definition is used both in the discussion of disjoint
% union and in the "Joining and overlapping existing symbols" section.
\newcommand{\dotcup}{\ensuremath{\mathaccent\cdot\cup}}

% The following definition is used in the "Additional Information"
% chapter and in the index.
\makeatletter
\DeclareRobustCommand*{\baddottedi}{\encOone{\add@accent{127}{i}}}%
\makeatother

% Display a metavariable.
\newcommand{\meta}[1]{$\langle$\textit{#1}$\rangle$}

% Many tables have notes beneath them.  Define an environment in which to
% display such a note, with an optional, superscripted math symbol
% preceding it.
\newenvironment{tablenote}[1][]{
  \makebox[1em]{\ensuremath{^{#1}}}%
  \begin{minipage}[t]{0.75\textwidth}%
  \setlength{\parskip}{2ex}
}{%
  \end{minipage}%
}

% Define an environment in which to write a single table of symbols.  The
% environment looks a lot like a table, but it doesn't float, and it gets
% an entry in the table of contents as opposed to the list of tables.
%
% The first argument is a conditional.  The table will appear only if
% the value of the conditional is true.  The second argument is the
% table's caption.
\makeatletter
\def\fnum@table{\textsc{\tablename}~\thetable}
\newlength{\normalparindent}           % minipage zeroes out \parindent.
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\newenvironment{symtable}[2][true]{%
  \expandafter\global\expandafter\let
    \expandafter\ifshowsymtable\csname if#1\endcsname
  \ifshowsymtable
    \noindent
    \begin{minipage}[t]{\linewidth}    % Prevent page breaks.
    \begin{center}
    \refstepcounter{table}%
    \phantomsection
    \addcontentsline{toc}{section}{%
      \protect\numberline{\tablename~\thetable:}{#2}}%
    \@makecaption{\fnum@table}{#2}\medskip
    \let\next=\relax
  \else
    % The following was taken verbatim from verbatim.sty.
    \let\do\@makeother\dospecials\catcode`\^^M\active
    \let\verbatim@startline\relax
    \let\verbatim@addtoline\@gobble
    \let\verbatim@processline\relax
    \let\verbatim@finish\relax
    \let\next=\verbatim@
  \fi
  \next
}{%
  \ifshowsymtable
    \end{center}
    \end{minipage}
    \vskip 8ex minus 2ex
  \fi
}
\makeatother

% Same as the above, but allows page breaks.
\makeatletter
\newenvironment{longsymtable}[2][true]{%
  \expandafter\global\expandafter\let
    \expandafter\ifshowsymtable\csname if#1\endcsname
  \ifshowsymtable
    \mbox{}%
    \Needspace*{13\baselineskip}%
    \mbox{}%
    \begin{center}%
    \phantomsection
    \refstepcounter{table}%
%
    % Inhibit longtable's implicit increment of the table counter.
    \let\refstepcounter=\@gobble
    \let\LT@array=\origLT@array
    \let\LT@start=\origLT@start
%
    \addcontentsline{toc}{section}{%
      \protect\numberline{\tablename~\thetable:}{#2}}%
    \@makecaption{\fnum@table}{#2}%
    \gdef\lt@indexed{}%
    \let\next=\relax
  \else
    % The following was taken verbatim from verbatim.sty.
    \let\do\@makeother\dospecials\catcode`\^^M\active
    \let\verbatim@startline\relax
    \let\verbatim@addtoline\@gobble
    \let\verbatim@processline\relax
    \let\verbatim@finish\relax
    \let\next=\verbatim@
  \fi
  \next
}{%
  \ifshowsymtable
    \end{center}
    \let\@elt=\index\lt@indexed  % Close our index ranges.
    \gdef\lt@indexed{}%
    \vskip 8ex minus 2ex
  \fi
}
\makeatother

% Define \index-like commands for use with longsymtable that
% automatically apply to the entire table, not just the start of it.
\makeatletter
\newcommand{\ltindex}[1]{%
  \index{\detokenize{#1}|(}%
  \@cons{\lt@indexed}{{\detokenize{#1|)}}}%
}
\newcommand{\ltidxboth}[2]{\ltindex{#1 #2}\ltindex{#2>#1}}
\makeatother

% Define a table environment that's similar to symtable except that it
% floats and it doesn't write an entry into the Table of Contents.  This
% is used for tables that contain something other than symbol lists.
\newenvironment{nonsymtable}[1]{%
  \begin{table}[htbp]
  \centering
  \caption{#1}\medskip
}{%
  \end{table}
}

% Do the same as the above, but typeset the table in landscape mode.
\newenvironment{nonsymtableL}[1]{%
  \begin{sidewaystable}[htbp]
  \centering
  \caption{#1}\medskip
}{%
  \end{sidewaystable}
}

% Define a table environment that's just like nonsymtable except that
% it allows page breaks.
\makeatletter
\newenvironment{longnonsymtable}[1]{%
  \centering
  \refstepcounter{table}%
  \@makecaption{\fnum@table}{#1}%
}{%
}
\makeatother

% Do not reset table numbers across chapters boundaries.
\counterwithout{table}{chapter}

% Format sections numbers and table numbers differently in the table of
% contents (because table numbers are prefixed with "Table").
\newcommand{\tablesections}{%
  \addtocontents{toc}{%
    \settowidth{\cftsecnumwidth}{Table 9999:~}%
  }%
}
\newcommand{\realsections}{%
  \addtocontents{toc}{%
    \settowidth{\cftsecnumwidth}{99.99~}%
  }%
}

% Paragraphs with tall symbols should get a little extra interline spacing.
\newenvironment{morespacing}[1]{\advance\baselineskip by #1\relax}{\par}

% Sometimes, we need a little more horizontal spacing, too.
\newcommand{\qqquad}{\qquad\quad}

% The following are needed later on for various examples.
\ifAMS
  \DeclareMathOperator{\newlogsym}{newlogsym}
  \DeclareMathOperator*{\newlogsymSTAR}{newlogsym}
  \DeclareMathOperator{\atan}{atan}
  \DeclareMathOperator*{\lcm}{lcm}
  \DeclareMathOperator*{\plim}{plim}
\fi
\DeclareFontFamily{U}{lightbulb}{}
\DeclareFontShape{U}{lightbulb}{m}{n}{<-> lightbulb10}{}
\newcommand{\lightbulb}{{\usefont{U}{lightbulb}{m}{n}A}}
\newcommand{\closure}[2][3]{{}\mkern#1mu\overline{\mkern-#1mu#2}}

% I prefer \vpageref to say "on the previous page" than its default message.
\def\reftextbefore{on the previous page}

% Use Donald Arseneau's improved float parameters.
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}

% Tell pdfLaTeX that all .eps files were produced by MetaPost.
\ifpdf
  \DeclareGraphicsExtensions{.png,.pdf,.jpg,.mps,.tif,.eps}
  \DeclareGraphicsRule{.eps}{mps}{*}{}
\fi

% Define a metavariable for "operating-system prompt".
\newcommand{\osprompt}{\textrm{\textit{prompt}}{\small$>$}\xspace}

% Typeset small, superscripted registered trademarks.
\newcommand{\regtm}{\textsuperscript{\textregistered}\xspace}

% Define an environment for typesetting code samples.
\newsavebox{\codebox}
\newenvironment{codesample}{%
  \begin{lrbox}{\codebox}%
  \begin{minipage}{0.9\linewidth}%
}{%
  \end{minipage}%
  \end{lrbox}%
  \fbox{\usebox{\codebox}}%
}

% Store copies of some of longtable's internal macros before hyperref
% redefines them.
\makeatletter
\let\origLT@array=\LT@array
\let\origLT@start=\LT@start
\makeatother

% The hyperref package should be loaded last because it redefines various
% internal LaTeX macros.
\IfStyFileExists*{hyperref}
  {\usepackage{hyperref}
   \pdfstringdefDisableCommands{%
     \def\AmS{AMS}%
     \def\Chinasym{china2e}%
     \def\lilylogo{lilyglyphs}%
     \def\pkgname{}%     % hyperref can't handle fragile commands here; .out file must be postprocessed.
   }
   \AtBeginDocument{%
     \hypersetup{%
       pdftitle={The Comprehensive LaTeX Symbol List},
       pdfauthor={Scott Pakin},
       pdfsubject={List of \prevtotalsymbols\ symbols that can be typeset using LaTeX},
       pdfkeywords={LaTeX, symbols, glyphs, characters, fonts, typesetting, macros,
         commands, accents, phonetics, mathematics, operators, arrows, harpoons,
         astronomy, dingbats, geometry},
       baseurl={https://mirror.ctan.org/info/symbols/comprehensive/}
     }
   }
  }
  {\let\phantomsection=\relax
   \newcommand{\href}[2]{##2}
  }

% If we have the hyperxmp package, use it to include additional metadata.
\IfStyFileExists*{hyperxmp}
  {\usepackage{hyperxmp}
    \hypersetup{%
     pdfcaptionwriter={Scott Pakin},
     pdfcontactemail={scott+clsl@pakin.org},
     pdfcontacturl={https://www.pakin.org/\xmptilde scott/},
     pdfcopyright={Copyright (C) 2007-\the\year, Scott Pakin},
     pdflicenseurl={https://www.latex-project.org/lppl/},
     pdfversionid={16.0},
     pdflang={en-US},
     pdfmetalang={en-US}
   }
  }
  {}

% Enable the use of our symbols.ist index style.
% Some of the following definitions are swiped from doc.dtx (for gind.ist).
\makeatletter
\def\efill{\hfill\nopagebreak}%
\def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill}%
\def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hfil}%
\def\pfill{\unskip~\dotfill\penalty500\strut\nobreak
           \dotfil~\ignorespaces}%
\@ifundefined{pdfbookmark}{\def\pdfbookmark[#1]#2#3{}}{}
\newcommand{\indexheading}[1]{%
  \pdfbookmark[1]{#1}{indexheading.#1}%
  {\centering\bfseries#1\nopagebreak\par}%
}
\makeatother

% Don't number subsubsections or include them in the Table of Contents.
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}

% Include "Figure", "Table", and "Section" within hyperlinks.
\labelformat{figure}{Figure~#1}
\labelformat{table}{Table~#1}
\labelformat{chapter}{Chapter~#1}
\labelformat{section}{Section~#1}
\labelformat{subsection}{Section~#1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Define various messages we reuse repeatedly.
\newcommand{\twosymbolmessage}[2][ (if \TC\ redefines it)]{%
  \begin{tablenote}
    The first symbol column represents the---sometimes
    ``faked''---symbol that \latexE provides by default.  The second
    symbol column represents the symbol as redefined by \TC#1.  The
    \TC\ package is generally required to typeset Table~\thetable's
    symbols in \italic#2.\strut
  \end{tablenote}
}

\newcommand{\notpredefinedmessage}{%
  \begin{tablenote}[*]
    Not predefined by the \latexE\ core.  Use the \pkgname{latexsym}
    package to expose this symbol.
  \end{tablenote}
}

\newcommand{\usetextmathmessage}[1][]{%
  \begin{tablenote}[#1]
    It's generally preferable to use the corresponding symbol from
    \vref{math-text} because the symbols in that table work
    properly in both text mode and math mode.
  \end{tablenote}
}

\newcommand{\seedocs}[1]{%
  See the #1 documentation for more information%
}

\newcommand{\usefontcmdmessage}[3][These]{%
  #1 symbols must appear either within the argument to \cmd{#2} or
  following the \cmd{#3} font-selection command within a scope%
}

\newcommand{\greekfontmessage}{%
  Greek body text can be typeset using the
  \pkgname{babel} package's \optname{babel}{greek} (or
  \optname{babel}{polutonikogreek}\idxboth{polytonic}{Greek})
  option---and, of course, a font that provides the glyphs for the
  Greek alphabet%
}

\newcommand{\niceframemessage}[1]{%
  The \pkgname{niceframe} package can be used to typeset decorative
  frames using fonts such as #1%
}

\newcommand{\luaxemessage}[1]{%
  #1 requires either \lualatex or \xelatex%
}

\newcommand{\seepackagenote}[3][]{%
  See #1the \csname#2\endcsname\ package note \vpageref{note-#3}%
}

\newcommand{\utfsymmessage}[1][]{%
  \seepackagenote[#1]{UTFSYM}{utfsym}%
}

\newcommand{\tikzsymbolsmessage}[1][]{%
  \seepackagenote[#1]{TIKZSYM}{tikzsymbols}%
}

\newcommand{\twemojismessage}[1][]{%
  \seepackagenote[#1]{TWEM}{twemojis}%
}

\newcommand{\pdfmsymmessage}[1][]{%
  \seepackagenote[#1]{PDFMSYM}{pdfmsym}%
}

\newcommand{\childmessage}[1][]{%
  \seepackagenote[#1]{CHILD}{figchild}%
}

\newcommand{\worldflagsmessage}[1][]{%
  \seepackagenote[#1]{WFLAGS}{worldflags}%
}

\newcommand{\symbatsmessage}[1][]{%
  \seepackagenote[#1]{SYMBATS}{symbats}%
}

\newcommand{\tikznotfontmessage}[1]{%
  All #1\ symbols are implemented with \TikZ\ graphics, not with a font%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\sloppy

% For consistency between pdfLaTeX and LuaLaTeX/XeLaTeX, explicitly
% set the font to T1-encoded Computer Modern.
\usefont{T1}{cmr}{m}{n}

% Import the title-page contents from either title-letter or title-a4,
% as specified by \titlefile.  If \titlefile is undefined, include a
% placeholder title.
\begin{titlepage}
  \makeatletter
  \@ifundefined{titlefile}{%
    \maketitle
  }{%
    \input{\titlefile}%
  }%
\end{titlepage}

\begin{abstract}
  This document lists \approxcount\prevtotalsymbols{} symbols and the
  corresponding \latex{} commands that produce them.  Some of these
  symbols are guaranteed to be available in every \latexE{} system;
  others require fonts and packages that may not accompany a given
  distribution and that therefore need to be installed.  All of the
  fonts and packages used to prepare this document---as well as this
  document itself---are freely available from the \CTANfull
  (\url{https://www.ctan.org/}).
\end{abstract}

% Typeset a table of contents, temporarily disabling nested hyperlinks
% caused by hyperlinked package names appearing within hyperlinked table
% names.
\begingroup
\def\pkgnameopts{nolink,index=false}
\tableofcontents
\endgroup

% Define an integral containing a dash or a double-dash.
\def\Xint#1{\mathchoice
   {\XXint\displaystyle\textstyle{#1}}%
   {\XXint\textstyle\scriptstyle{#1}}%
   {\XXint\scriptstyle\scriptscriptstyle{#1}}%
   {\XXint\scriptscriptstyle\scriptscriptstyle{#1}}%
   \!\int}
\def\XXint#1#2#3{{\setbox0=\hbox{$#1{#2#3}{\int}$}
     \vcenter{\hbox{$#2#3$}}\kern-.5\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}

% Many symbols are merely alphanumerics typeset with a math alphabet.
% Guide the user from the most common of these to the Math Alphabets
% table.
%
% QUESTION: How standard are the following?
%    * action (script A)
%    * Bernoulli (script B)
%    * path integral measure (script D)
%    * domain (script D)
%    * expected value (script E)
%    * energy per symbol [communications theory] (script E)
%    * imaginary line (script I)
%    * identity matrix (blackboard bold I)
%    * likelihood (script L)
%    * M matrix (script M)
%    * null space (script N)
%    * order of (script o)
%    * radius (script r)
%    * real line (script R)
%    * Schwartz class (script S)
%    * volume (script V)
%    * everything listed at https://en.wikipedia.org/wiki/Blackboard_bold
%
\ifcomplete
  \makeatletter
  \newcommand{\indexMA}[2][]{%
    \def\first@arg{#1}%
    \ifx\first@arg\@empty
      \index{#2|see{alphabets, math}}%
    \else
      \index{#2=#2 (\string#1)|see{alphabets, math}}%
    \fi
  }
  \makeatother
\else
  \newcommand{\indexMA}[2][]{%
    \index{#2|see{alphabets, math}}%
}
\fi
\DeclareRobustCommand{\AMSmcal}[1]{\ensuremath{\CMcal{#1}}}
\indexMA[\mathbbm{1}]{unity}
\indexMA[\mathbbm{A}]{adeles}
\indexMA[\mathbbm{B}]{Boolean domain}
\indexMA[\mathbbm{C}]{complex numbers}
\indexMA[\mathbbm{D}]{open unit disk}
\indexMA[\mathbbm{D}]{unit disk}
\ifEMF
\else
  \indexMA[\mathscr{E}]{electromotive force}
\fi
\indexMA[\mathbbm{F}]{field}
\indexMA[\mathbbm{F}]{finite field}
\indexMA[\mathscr{F}]{Fourier transform}
\indexMA[\mathscr{H}]{Hamiltonian}
\indexMA[\mathscr{H}]{Hilbert space}
\indexMA[\mathbbm{H}]{quaternions}
\indexMA[\mathbbm{J}]{irrational numbers}
\indexMA[\mathscr{L}]{Lagrangian}
\indexMA[\mathscr{L}]{Laplace transform}
\indexMA[\mathscr{L}]{Lefschetz motive}
\indexMA[\AMSmcal{L}]{Lie derivative}
\indexMA[\AMSmcal{M}]{Mellin transform}
\indexMA[\mathbbm{M}]{Minkowski space}
\indexMA[\mathbbm{N}]{natural numbers}
\indexMA[\AMSmcal{O}]{local ring}
\indexMA[\mathbbm{O}]{octonions}
\indexMA[\mathbbm{P}]{projective space}
\indexMA[\mathbbm{Q}]{rational numbers}
\indexMA[\mathbbm{R}]{real numbers}
\indexMA[\mathbbm{S}]{sedenions}
\indexMA[\mathbbm{T}]{torus}
\indexMA[\mathbbm{Z}]{integers}
%\indexMA{imaginary numbers}
%\indexMA{prime numbers}
\indexMA{blackboard bold}
\indexMA{fraktur}
\indexMA{moduli space}
\indexMA{null infinity}
\indexMA{number sets}
\indexMA{power set}
\indexMA{Schwartz distribution spaces}
\indexMA{script letters}

% Provide "see ..."s for various logical and set operators.
\index{logical operators>and|see{\texttt{\string\wedge}}}
\index{logical operators>or|see{\texttt{\string\vee}}}
\index{logical operators>not|see{\texttt{\string\neg} \emph{and} \texttt{\string\sim}}}
\index{logical operators>xor|see{\texttt{\string\oplus}}}
\index{operators>logical|see{logical operators}}
\index{and|see{\texttt{\string\wedge}}}
\index{or|see{\texttt{\string\vee}}}
\index{not|see{\texttt{\string\neg}}}
\index{xor|see{\texttt{\string\oplus}}}
\index{conjunction, logical|see{\texttt{\string\wedge} \emph{and} \texttt{\string\&}}}
\index{disjunction|see{\texttt{\string\vee}}}
\index{negation|see{\texttt{\string\neg} \emph{and} \texttt{\string\sim}}}
\index{set operators>union|see{\texttt{\string\cup}}}
\index{set operators>intersection|see{\texttt{\string\cap}}}
\index{set operators>membership|see{\texttt{\string\in}}}
\index{operators>set|see{set operators}}
\index{union|see{\texttt{\string\cup}}}
\index{intersection|see{\texttt{\string\cap}}}
\index{membership|see{\texttt{\string\in}}}
\index{element of|see{\texttt{\string\in}}}
\index{tautology|see{\texttt{\string\top}}}
\index{alternative denial|see{\texttt{\string\uparrow} \emph{and} \magicvertname}}
\index{joint denial|see{\texttt{\string\downarrow}}}
\index{material implication|see{\texttt{\string\rightarrow} \emph{and} \texttt{\string\supset}}}
\index{material equivalence|see{\texttt{\string\leftrightarrow} \emph{and} \texttt{\string\equiv}}}
\index{material conditional|see{\texttt{\string\rightarrow} \emph{and} \texttt{\string\supset}}}
\index{material biconditional|see{\texttt{\string\leftrightarrow} \emph{and} \texttt{\string\equiv}}}
\index{converse implication|see{\texttt{\string\leftarrow} \emph{and} \texttt{\string\subset}}}
  \index{biconditional|see{\texttt{\string\leftrightarrow} \emph{and} \texttt{\string\equiv}}}
\index{interior|see{\texttt{\string\mathring}}}
\index{set interior|see{\texttt{\string\mathring}}}
\ifcomplete
  \index{material nonimplication|see{\texttt{\string\nrightarrow} \emph{and} \texttt{\string\nsupset}}}
  \index{converse nonimplication|see{\texttt{\string\nleftarrow} \emph{and} \texttt{\string\nsubset}}}
  \index{exclusive disjunction|see{\texttt{\string\nleftrightarrow} \texttt{\string\nequiv}, \emph{and} \texttt{\string\oplus}}}
  \index{par|see{\texttt{\string\bindnasrepma}, \texttt{\string\invamp}, and \texttt{\string\parr}}}
  \index{multiplicative disjunction|see{\texttt{\string\bindnasrepma}, \texttt{\string\invamp}, and \texttt{\string\parr}}}
\fi    % complete test

% Provide "see ..."s for various delimiters.
\index{angle brackets|see{delimiters}}
\index{brackets|see{delimiters}}
\index{braces|see{delimiters}}
\index{parentheses|see{delimiters}}
\index{square brackets|see{delimiters}}

% Provide "see ..."s for various punctuation marks.
\index{paragraph mark|see{\texttt{\string\P}}}
\index{pilcrow|see{\texttt{\string\P}}}
\index{percent sign|see{\texttt{\string\%}}}
\index{dollar sign|see{\texttt{\string\$}}}
\index{cents|see{\texttt{\string\textcent}}}
\index{hash mark|see{\texttt{\string\#} \textit{and} \texttt{\string\hash}}}
\index{ampersand=ampersand (\&)|see{\texttt{\string\&}}}
\index{section mark|see{\texttt{\string\S}}}
\index{caret|see{\texttt{\string\^}}}
\index{swung dash|see{\texttt{\string\sim}}}
\index{underscore|see{underline}}
\index{less-than signs|see{inequalities}}
\index{greater-than signs|see{inequalities}}
\index{plus-or-minus sign|see{\texttt{\string\pm}}}
\index{space>visible|see{\texttt{\string\textvisiblespace}}}
\index{twiddle|see{tilde}}
\index{falsum|see{\texttt{\string\bot}}}

% Provide "see ..."s for various musical terms.
\index{accidentals|see{musical symbols}}
\index{sharp=sharp ($\sharp$)|see{musical symbols}}
\index{flat=flat ($\flat$)|see{musical symbols}}
\index{natural=natural ($\natural$)|see{musical symbols}}
\index{rests|see{musical symbols}}
\index{articulations|see{musical symbols}}
\ifLILY
  \index{whole note=whole note (\wholeNote)|see{musical symbols}}
  \index{half note=half note (\halfNote)|see{musical symbols}}
  \index{quarter note=quarter note (\quarterNote)|see{musical symbols}}
  \index{eighth note=eighth note (\eighthNote)|see{musical symbols}}
  \index{sixteenth note=sixteenth note (\sixteenthNote)|see{musical symbols}}
  \index{thirty-second note=thirty-second note (\thirtysecondNote)|see{musical symbols}}
  \index{quaver=quaver (\quaver)|see{musical symbols}}
  \index{semiquaver=semiquaver (\semiquaver)|see{musical symbols}}
  \index{demisemiquaver=demisemiquaver (\demisemiquaver)|see{musical symbols}}
  \index{semibreve=semibreve (\semibreve)|see{musical symbols}}
  \index{minim=minim (\minim)|see{musical symbols}}
  \index{crotchet=crotchet (\crotchet)|see{musical symbols}}
  \index{breve=breve (\lilyGlyph{noteheads.sM1double})|see{musical symbols}}
  \index{fermata=fermata (\fermata)|see{musical symbols}}
\else % LILY test
  \index{whole note|see{musical symbols}}
  \index{half note|see{musical symbols}}
  \index{quarter note|see{musical symbols}}
  \index{eighth note|see{musical symbols}}
  \index{sixteenth note|see{musical symbols}}
  \index{thirty-second note|see{musical symbols}}
  \index{quaver|see{musical symbols}}
  \index{semiquaver|see{musical symbols}}
  \index{demisemiquaver|see{musical symbols}}
  \index{semibreve|see{musical symbols}}
  \index{minim|see{musical symbols}}
  \index{crotchet|see{musical symbols}}
  \index{breve|see{musical symbols}}
  \index{fermata|see{musical symbols}}
\fi   % LILY test
\ifMSX
  \index{shake=shake (\MSXshake)|see{musical symbols}}
  \index{alla breve=alla breve (\MSXallabreve)|see{musical symbols}}
  \index{cut time=cut time (\MSXallabreve)|see{alla breve}}
\else
  \index{shake|see{musical symbols}}
  \index{alla breve|see{musical symbols}}
  \index{cut time|see{alla breve}}
\fi   % MSX test
\ifMUSICOG
  \index{segno=segno (\musSegno)|see{musical symbols}}
\fi   % MUSICOG test

% Provide a number of other useful "see ..."s.
\index{diamonds|see{rhombuses}}
\index{lozenges|see{rhombuses}}
\index{CTAN|see{Comprehensive \TeX{} Archive Network}}
\index{letters|see{alphabets}}
\index{digits|see{numerals}}
\index{numbers|see{numerals}}
\index{degrees|see{\texttt{\string\textdegree}}}
\index{pomega|see{\texttt{\string\varpi}}}
\index{curly pi|see{\texttt{\string\varpi}}}
\index{Cedi|see{\texttt{\string\textcolonmonetary}}}
\index{iff=\texttt{\string\iff}|see{\texttt{\string\Longleftrightarrow}}}
\index{derivative, partial|see{\texttt{\string\partial}}}
\index{to=\texttt{\string\to}|see{\texttt{\string\rightarrow}}}
%\index{adjoint=adjoint (\dag)|see{\texttt{\string\dag}}}
\index{Cartesian product|see{\texttt{\string\times}}}
\index{tick marks|see{check marks}}
\index{supremum|see{\texttt{\string\sup}}}
\ifAMS
  \index{implies=\texttt{\string\implies}|see{\texttt{\string\Longrightarrow}
    \emph{and} \texttt{\string\vdash}}}
  \index{impliedby=\texttt{\string\impliedby}|see{\texttt{\string\Longleftarrow}}}
  \index{division times|see{\texttt{\string\divideontimes}}}
  \index{does not exist|see{\texttt{\string\nexists}}}
  \index{ring equal to|see{\texttt{\string\circeq}}}
  \index{ring in equal to|see{\texttt{\string\eqcirc}}}
  \index{does not divide|see{\texttt{\string\nmid}}}
  \index{transversal intersection|see{\texttt{\string\pitchfork}}}
  \index{absolute value|see{\texttt{\string\lvert} \emph{and} \texttt{\string\rvert}}}
  \index{norm|see{\texttt{\string\lVert} \emph{and} \texttt{\string\rVert}}}
  \index{proper subset/superset|see{\texttt{\string\subsetneq}\slash\texttt{\string\supsetneq}}}
  \index{probability limit=probability limit ($\displaystyle\plim_{n \to \infty}$)|see{\texttt{\string\DeclareMathOperator}}}
\fi    % AMS test
\index{abzuglich=abz\"uglich|see{\texttt{\string\textdiscount}}}
\index{diacritics|seealso{accents}}
\index{parts per thousand|see{\texttt{\string\textperthousand}}}
\index{thousandths|see{\texttt{\string\textperthousand}}}
\index{millesimal sign|see{\texttt{\string\textperthousand}}}
\index{prescription|see{\texttt{\string\textrecipe}}}
\index{pharmaceutical prescription|see{\texttt{\string\textrecipe}}}
\index{cross ratio|see{\texttt{\string\textrecipe}}}
\ifMARV
  \index{Deleatur=\texttt{\string\Deleatur}|see{\texttt{\string\Denarius}}}
%  \index{mouse|see{\texttt{\string\ComputerMouse}}}
\fi    % MARV test
%\index{playing cards|see{card suits}}
\ifABX
  \index{nibar=\texttt{\string\nibar}|see{\texttt{\string\ownsbar}}}
  \index{ring equal to|see{\texttt{\string\circeq}}}
  \index{ring in equal to|see{\texttt{\string\eqcirc}}}
  \index{cutoff subtraction|see{\texttt{\string\dotdiv}}}
  \index{monus|see{\texttt{\string\dotdiv}}}
  \index{lsemantic=\texttt{\string\lsemantic}|see{\texttt{\string\ldbrack}}}
  \index{rsemantic=\texttt{\string\rsemantic}|see{\texttt{\string\rdbrack}}}
\fi    % ABX test
\index{rationalized Planck constant|see{\texttt{\string\hbar}}}
\index{options|see{package options}}
\index{cardinality|see{\texttt{\string\aleph}}}
%\index{wreath product|see{\texttt{\string\wr}}}
\index{reverse solidus|see{\texttt{\string\textbackslash}}}
\index{radicals|see{square root}}
\index{roots|see{square root}}
\index{cube root=cube root ($\blackacc{\sqrt[3]}$)|see{square root}}
\ifcomplete
  \index{return|see{carriage return}}
\fi
\ifTX
  \index{fish hook|see{\texttt{\string\strictif}}}
  \index{gaffing hook|see{\texttt{\string\strictif}}}
  \index{strict implication|see{\texttt{\string\strictif}}}
  \index{parallel lines, slanted|see{\texttt{\string\varparallel}}}
\fi    % TX test
\index{stochastic independence|see{\texttt{\string\bot}}}
\index{independence>stochastic|see{\texttt{\string\bot}}}
\index{orthogonal to|see{\texttt{\string\bot}}}
\index{entails|see{\texttt{\string\models}}}
\index{satisfies|see{\texttt{\string\models}}}
\index{micro|see{\texttt{\string\textmu}}}
\index{Angstrom unit=\AA{}ngstr\"om unit>math mode|see{\texttt{\string\mathring}}}
\index{Angstrom unit=\AA{}ngstr\"om unit>text mode|see{\texttt{\string\AA}}}
%\index{yen|see{\texttt{\string\textyen}}}
\index{equilibrium|see{\texttt{\string\rightleftharpoons}}}
\index{number sign|see{\texttt{\string\textnumero}}}
\index{ditto marks|see{\texttt{\string\textquotedbl}}}
\index{Weierstrass p function=Weierstrass $\wp$ function|see{\texttt{\string\wp}}}
\index{inexact differential|see{\texttt{\string\dbar}}}
\index{reduced quadrupole moment|see{\texttt{\string\rqm}}}
\ifST
  \index{banana brackets|see{delimiters}}
  \index{catamorphism|see{delimiters}}
\fi    % ST test
\ifOTII
  \index{impulse train|see{sha}}
  \index{Tate-Shafarevich group|see{sha}}
\fi
\index{differential, inexact|see{\texttt{\string\dbar}}}
\ifcomplete
  \index{equivalence|see{\texttt{\string\equiv}, \texttt{\string\leftrightarrow}, \emph{and} \texttt{\string\threesim}}}
\else
  \index{equivalence|see{\texttt{\string\equiv} \emph{and} \texttt{\string\leftrightarrow}}}
\fi
\index{vinculum|see{\texttt{\string\overline}}}
\index{eszett|see{\texttt{\string\ss}}}
\index{Maxwell-Stefan diffusion coefficient|see{\texttt{\string\DH}}}
\index{Laplacian=Laplacian ($\nabla^2$)|see{\texttt{\string\nabla}}}
\index{Laplacian=Laplacian ($\Delta$)|see{\texttt{\string\Delta}}}
%\index{infinity=infinity ($\infty$)|see{\texttt{\string\infty}}}
%\ifx\BBmathbb\undefined\else
%  \index{double summation=double summation ({\usefont{U}{bbold}{m}{n}\char"06})|see{alphabets, math}}
%  \index{summation, double=summation, double ({\usefont{U}{bbold}{m}{n}\char"06})|see{alphabets, math}}
%\fi
\index{evaluated at|see{\texttt{\string\vert}}}
\index{CP1252|see{code page 1252}}
\index{CP437|see{code page 437}}
\ifSIMP
  \index{nuclear power plant|see{\texttt{\string\SNPP}}}
\fi    % SIMP test
\ifcomplete    % Really only needs to be ARK or DING or PI.
  \index{hands|see{fists}}
  \index{printer's fist|see{fists}}
  \index{pointing finger|see{fists}}
  \index{finger, pointing|see{fists}}
\fi    % complete test
\index{tensor product|see{\texttt{\string\otimes}}}
\index{Kronecker product|see{\texttt{\string\otimes}}}
\index{Kronecker sum|see{\texttt{\string\oplus}}}
\index{ring sum|see{\texttt{\string\oplus}}}
\index{congruent|see{\texttt{\string\equiv}}}
\index{centigrade|see{\texttt{\string\textcelsius}}}
\index{greatest lower bound|see{\texttt{\string\sqcap}}}
\index{infimum|see{\texttt{\string\inf} \emph{and} \texttt{\string\sqcap}}}
\index{printer's flowers|see{fleurons \emph{and} flowers}}
\ifcomplete    % Really only needs to be CHINA or MARV.
  \index{Green Dot|see{\texttt{\string\Greenpoint} \emph{and} \texttt{\string\PackingWaste}}}
  \index{Grune Punkt=Gr\"une Punkt|see{\texttt{\string\Greenpoint} \emph{and} \texttt{\string\PackingWaste}}}
\fi
\index{minus, double-dotted=minus, double-dotted ($\div$)|see{\texttt{\string\div}}}
\ifcomplete    % Really only needs to be AMS or ABX or MNS or FDSYM
  \index{Quine corners=Quine corners ($\ulcorner$\graybox$\urcorner$)|see{\texttt{\string\ulcorner} \emph{and} \texttt{\string\urcorner}}}
  \index{quasi-quotation marks=quasi-quotation marks ($\ulcorner$\graybox$\urcorner$)|see{\texttt{\string\ulcorner} \emph{and} \texttt{\string\urcorner}}}
\fi
\ifMNS
  \ifFDSYM
    \index{Descartes's equal sign=Descartes's equal sign (\FDSYMbackpropto)|see{\texttt{\string\rightpropto} \emph{and} \texttt{\string\backpropto}}}
  \fi   % FDSYM test
\fi   % MNS test
\ifSTIX
  \index{d'Alembert operator|see{\texttt{\string\laplac}}}
\fi
\ifcomplete   % Really, any of a number of math packages
  % The following are derived from the multiobjective package's definitions.
  \index{dominance|see{\texttt{\string\prec}}}
  \index{dominance>negative|see{\texttt{\string\nprec}}}
  \index{dominance>weak|see{\texttt{\string\preccurlyeq}}}
  \index{dominance>negative weak|see{\texttt{\string\npreccurlyeq}}}
  \index{dominance>strict|see{\texttt{\string\Prec}}}
%  \index{dominance>negative strict|see{\texttt{\string\Prec}}}  %  Doesn't exist?
  \index{better|see{\texttt{\string\triangleleft}}}
\fi    % complete test
\ifARUNE
  \index{long-branch runes|see{normal runes}}
  \index{Danish runes|see{normal runes}}
  \index{Swedo-Norwegian runes|see{short-twig runes}}
  \index{H\"alsinge runes|see{staveless runes}}
  %
  \subindex{runes}{long-branch|see{normal runes}}
  \subindex{runes}{Danish|see{normal runes}}
  \subindex{runes}{Swedo-Norwegian|see{short-twig runes}}
  \subindex{runes}{H\"alsinge|see{staveless runes}}
\fi   % ARUNE test
\index{guillemotleft=\texttt{\string\guillemotleft}|see{\texttt{\string\guillemetleft}}}
\index{guillemotright=\texttt{\string\guillemotright}|see{\texttt{\string\guillemetright}}}
\ifWASY
  \index{tailed z|see{\texttt{\string\roundz}}}
  \index{ezh|see{\texttt{\string\roundz}}}
\fi
\ifcomplete   % Many packages define globes.
  \index{world|see{globe}}
\fi    % complete test
\ifFNTAWE
  \index{Dungeons and Dragons|see{D\&D}}
\fi    % FNTAWE test
\index{bullets|see{circles, squares, rhombuses, etc.}}
\ifcomplete   % Many packages define \sqint or \smallsqint
  \index{integrals>quaternion|see{integrals, square}}
\fi    % complete test
\ifcomplete   % Really just TWEM and WFLAGS
  \index{flags>Democratic Republic of the Congo|see{flags, Congo--Kinshasa}}
  \index{flags>Republic of the Congo|see{flags, Congo--Brazzaville}}
  \index{flags>Maldives|see{flags, Falkland Islands}}
  \index{flags>Ivory Coast|see{flags, C\^ote d'Ivoire}}
  \index{flags>pirate|see{flags, Jolly Roger}}
  \index{flags>skull and crossbones|see{flags, Jolly Roger}}
\fi    % complete test
\ifcomplete   % Really just typicons, twemojis, and a few others
  \index{cell phone|see{mobile phone}}
  \index{wheel of dharma|see{dharmachakra}}
\fi    % complete test
\index{vector notation|see{accents}}

% Multiple packages define \multimap.
\makeatletter
  \@ifundefined{multimap}{}{%
    \index{linear implication|see{\texttt{\string\string\string\multimap}}}
    \index{lollipop (mathematics)|see{\texttt{\string\string\string\multimap}}}}
\makeatother

% Minutes/seconds and feet/inches are normally formed with superscripted
% primes.
\index{arcminutes|see{\texttt{\string\prime}}}
\index{angular minutes|see{\texttt{\string\prime}}}
\index{minutes, angular|see{\texttt{\string\prime}}}
\index{feet|see{\texttt{\string\prime} \emph{and}
  \texttt{\string\textquotesingle}}}
\ifABX
  \index{arcseconds|see{\texttt{\string\second}}}
  \index{angular seconds|see{\texttt{\string\second}}}
  \index{seconds, angular|see{\texttt{\string\second}}}
  \index{inches|see{\texttt{\string\second} \emph{and}
    \texttt{\string\textquotedbl}}}
\else
  \index{arcseconds|see{\texttt{\string\prime}}}
  \index{angular seconds|see{\texttt{\string\prime}}}
  \index{seconds, angular|see{\texttt{\string\prime}}}
  \index{inches|see{\texttt{\string\prime} \emph{and}
    \texttt{\string\textquotedbl}}}
\fi

% \notowns can be mapped to various things depending on package availability.
\ifABX
  \ifTX
    \index{notowns=\texttt{\string\notowns}|see{\texttt{\string\notowner}
      \emph{and} \texttt{\string\notni}}}
  \else
    \index{notowns=\texttt{\string\notowns}|see{\texttt{\string\notowner}}}
  \fi
\else
  \ifTX
    \index{notowns=\texttt{\string\notowns}|see{\texttt{\string\notni}}}
  \fi
\fi

% The following were generated automatically from txfonts.sty.
\ifTX
  \index{circledplus=\texttt{\string\circledplus}|see{\texttt{\string\oplus}}}
  \index{circledminus=\texttt{\string\circledminus}|see{\texttt{\string\ominus}}}
  \index{circledtimes=\texttt{\string\circledtimes}|see{\texttt{\string\otimes}}}
  \index{circledslash=\texttt{\string\circledslash}|see{\texttt{\string\oslash}}}
  \index{circleddot=\texttt{\string\circleddot}|see{\texttt{\string\odot}}}
  \index{le=\texttt{\string\le}|see{\texttt{\string\leq}}}
  \index{ge=\texttt{\string\ge}|see{\texttt{\string\geq}}}
  \index{gets=\texttt{\string\gets}|see{\texttt{\string\leftarrow}}}
  \index{to=\texttt{\string\to}|see{\texttt{\string\rightarrow}}}
  \index{owns=\texttt{\string\owns}|see{\texttt{\string\ni}}}
  \index{lnot=\texttt{\string\lnot}|see{\texttt{\string\neg}}}
  \index{land=\texttt{\string\land}|see{\texttt{\string\wedge}}}
  \index{lor=\texttt{\string\lor}|see{\texttt{\string\vee}}}
  \index{doublecup=\texttt{\string\doublecup}|see{\texttt{\string\Cup}}}
  \index{doublecap=\texttt{\string\doublecap}|see{\texttt{\string\Cap}}}
  \index{llless=\texttt{\string\llless}|see{\texttt{\string\lll}}}
  \index{gggtr=\texttt{\string\gggtr}|see{\texttt{\string\ggg}}}
  %\index{Box=\texttt{\string\Box}|see{\texttt{\string\square}}}
  \index{ne=\texttt{\string\ne}|see{\texttt{\string\neq}}}
  %\index{notowns=\texttt{\string\notowns}|see{\texttt{\string\notni}}}
  \index{lrJoin=\texttt{\string\lrJoin}|see{\texttt{\string\Join}}}
  %\index{bowtie=\texttt{\string\bowtie}|see{\texttt{\string\lrtimes}}}
  \index{dasharrow=\texttt{\string\dasharrow}|see{\texttt{\string\dashrightarrow}}}
  \index{circledotright=\texttt{\string\circledotright}|see{\texttt{\string\circleddotright}}}
  \index{circledotleft=\texttt{\string\circledotleft}|see{\texttt{\string\circleddotleft}}}
\fi    % TX test

% The following were generated semi-automatically from SYMLIST using:
%   egrep '\text' SYMLIST | sed 's/\\text//' | xargs -i egrep '^{}$' /usr/share/dict/words | xargs -i sh -c 'egrep -q "^\\\\{}$" SYMLIST || echo "\\index{{}|see{\\texttt{\\string\\text{}}}}"' \;
% then editing the result.
\index{blank|see{\texttt{\string\textblank}}}
\index{born|see{\texttt{\string\textborn}}}
\index{died|see{\texttt{\string\textdied}}}
\index{discount|see{\texttt{\string\textdiscount}}}
\index{divorced|see{\texttt{\string\textdivorced}}}
\index{dollar|see{\texttt{\string\textdollar}}}
%\index{ellipsis|see{\texttt{\string\textellipsis}}}
\index{estimated|see{\texttt{\string\textestimated}}}
\index{florin|see{\texttt{\string\textflorin}}}
%\index{greater|see{\texttt{\string\textgreater}}}
\index{leaf|see{\texttt{\string\textleaf}}}
%\index{less|see{\texttt{\string\textless}}}
\index{married|see{\texttt{\string\textmarried}}}
%\index{minus|see{\texttt{\string\textminus}}}
%\index{ohm|see{\texttt{\string\textohm}}}
%\index{paragraph|see{\texttt{\string\textparagraph}}}
\index{recipe|see{\texttt{\string\textrecipe}}}
%\index{registered|see{\texttt{\string\textregistered}}}
%\index{section|see{\texttt{\string\textsection}}}
\index{sterling|see{\texttt{\string\pounds}}}
%\index{style|see{\texttt{\string\textstyle}}}
%\index{superscript|see{\texttt{\string\textsuperscript}}}
%\index{underscore|see{\texttt{\string\textunderscore}}}
\index{won|see{\texttt{\string\textwon}}}
\ifTIPA
  \index{advancing|see{\texttt{\string\textadvancing}}}
  \index{bullseye|see{\texttt{\string\textbullseye}}}
  \index{lowering|see{\texttt{\string\textlowering}}}
  \index{pipe|see{\texttt{\string\textpipe}}}
  \index{raising|see{\texttt{\string\textraising}}}
  \index{retracting|see{\texttt{\string\textretracting}}}
  \index{seagull|see{\texttt{\string\textseagull}}}
\fi    % TIPA test
%\index{swab|see{\texttt{\string\textswab}}}
\index{ohm|see{omega}}


% Include each chapter of categorized symbols.
\include{sym-intro}
\include{sym-body}
\include{sym-math}
\include{sym-sci}
\include{sym-ding}
\include{sym-lang}
\include{sym-music}
\include{sym-game}
\include{sym-geog}
\include{sym-logos}
\include{sym-other}
\include{sym-minsup}
\include{sym-addl}


\begin{thebibliography}{Knu86b}

\bibitem[AMS99]{AMS1999:amsmath}
  American Mathematical Society.
  \emph{User's Guide for the \textsf{amsmath} Package (Version~2.0)},
  December~13, 1999.
  Available from \url{ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf}.

\bibitem[Ber01]{Berry:fontname}
  Karl Berry.\index{Berry, Karl}
  Fontname: Filenames for \tex fonts,
  June 2001.
  Available from \url{https://www.ctan.org/pkg/fontname}.

\bibitem[Che98]{Chen1998}
  Raymond Chen.\index{Chen, Raymond}
  A \MFlogo\ of `Simpsons' characters.
  \emph{Baskerville}, 4(4):19, February 1998.
  ISSN~\mbox{1354-5930}.
  Available from
  \url{https://uk.tug.org/wp-installed-content/uploads/2008/12/44.pdf}.

\bibitem[Dow00]{Downes:smg}
  Michael Downes.\index{Downes, Michael J.}
  Short math guide for {\latex},
  July~19, 2000.
  Version~1.07.
  Available from \url{https://www.ams.org/tex/short-math-guide.html}.

\bibitem[Gib97]{Gibbons:longdiv}
  Jeremy Gibbons.\index{Gibbons, Jeremy}
  Hey---it works!
  \emph{\TUGboat}, 18(2):75--78, June 1997.
  Available from \url{https://www.tug.org/TUGboat/Articles/tb18-2/tb55works.pdf}.

\bibitem[Gre09]{Gregorio2009:latex-book}
  Enrico Gregorio.
  \emph{Appunti di programmazione in \latex e \TeX},
  second edition, June 2009.  Available from
    \url{https://profs.sci.univr.it/~gregorio/introtex.pdf}.

\bibitem[Knu86a]{Knuth:ct-a}
  Donald~E. Knuth.\index{Knuth, Donald E.}
  \emph{The {\TeX}book},
  volume~A of \emph{Computers and Typesetting}.
  Ad{\-d}i{\-s}on-Wes{\-l}ey,
  Reading, MA, USA,
  1986.

\bibitem[Knu86b]{Knuth:ct-c}
  Donald~E. Knuth.\index{Knuth, Donald E.}
  \emph{The {\MFlogo}book},
  volume~C of \emph{Computers and Typesetting}.
  Ad{\-d}i{\-s}on-Wes{\-l}ey,
  Reading, MA, USA,
  1986.

\bibitem[Lam86]{Lamport:latex}
  Leslie Lamport.\index{Lamport, Leslie}
  \emph{\latex: A document preparation system}.
  Ad{\-d}i{\-s}on-Wes{\-l}ey,
  Reading, MA, USA,
  1986.

\bibitem[\LaT{}98]{ltnews09}
  \latex{}3~Project Team.
  A new math accent.
  \emph{\latex News}. Issue~9, June~1998.
  Available from
  \url{https://www.latex-project.org/news/latex2e-news/ltnews09.pdf}
  and also included in many \tex{} distributions.

\bibitem[\LaT{}19]{fntguide}
  \latex{}3~Project Team.
  \latexE font selection,
  October 2019.
  Available from
  \url{https://mirrors.ctan.org/macros/latex/base/fntguide.pdf}
  and also included in many \tex{} distributions.
\end{thebibliography}

% "See also"s should appear after all page references.
\providecommand*\seealso[2]{\emph{\alsoname}#1}
\providecommand*\alsoname{see also}
\index{carriage return|seealso{\texttt{\string\hookleftarrow}}}
\index{transforms|seealso{alphabets, math}}
\ifKEYS
  \index{enter|seealso{carriage return}}
\else
  \index{enter|see{carriage return}}
\fi
\index{asterisks|seealso{stars}}
\ifMISMATH
  \index{asymptotic complexity|seealso{alphabets, math}}
  \index{big O notation|seealso{alphabets, math}}
\else
  \index{asymptotic complexity|see{alphabets, math}}
  \index{big O notation|see{alphabets, math}}
\fi
\ifcomplete
  \index{Earth|seealso{globe}}
\fi

% Typeset the index.
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\markboth{Index}{Index}
\fancyhead[L]{\scshape Index}
\newcommand{\showindexrange}{%
  % Show a range if the first and last entries differ, otherwise just the
  % single entry.
  \ifx\firstmark\botmark
    \rightmark
  \else
    \rightmark--\leftmark
  \fi
}
\fancyhead[C]{\itshape\showindexrange}
\bgroup
  \def\pkgnameopts{index=false}%
  \small
  \printindex
\egroup

\end{document}
