% -*-tex-*-
% The following macros are used in TUGboat tables of contents.
% This file may be automatically extended by tugboat.awk.
% It may be used by plain TeX, LaTeX, or AmSTeX.
% [20-Feb-2023] -- improve fallback \url definition.
% [25-Sep-2022] -- provide missing macros used in tugboat.bib.
% [24-Sep-2022] -- define \td@provide; protect all definitions in some way.
% [19-Sep-2022] -- alphabetize.
% [18-Sep-2022] -- remove duplicate definitions.
% [06-Aug-2020] -- minor tweaks, and one addition: \LuaLaTeX
% [23-May-2015] -- update for up to TUGboat volume 35 (2014)
% [04-Jun-1999] -- original version

\ifx\makeatletter\undefined
    \def\makeatletter{\catcode`\@=11\relax}
    \def\makeatother{\catcode`\@=12\relax}
\fi

\makeatletter

% We'll define these count register csnames unconditionally; seems
% unnecessary to redo \newcount as a non-\outer control sequence.
\newcount\td@TestCount
\newcount\td@@TestCount

% use like \def, e.g., \td@provide\foo{defn} or \td@provide\bar#1{baz#1}.
% 
\ifx\td@provide\undefined % tugboat.def provide; allow overriding just in case.
  % #1 must be a control sequence.
  \def\td@provide#1{%
    \begingroup
      \ifx#1\undefined
        \aftergroup\def \aftergroup#1% not present, so define it
      \else
        \aftergroup\def \aftergroup\td@scratch % throw defn away
      \fi
    \endgroup
  }% the definition must follow from the input
\fi

\td@provide\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
\td@provide\{{\relax\ifmmode\lbrace\else\char`\{ \fi}
\td@provide\}{\relax\ifmmode\rbrace\else\char`\} \fi}
\td@provide\<#1>{$\langle\hbox{\rm#1}\rangle$}
\td@provide\Abstract{{\rm[}Abstract\/{\rm]}}
\td@provide\acro#1{{\small #1}}
\td@provide\AcroFLeX{Acro\acro{FL}eX}
\td@provide\acrosl{\small \sl}
\td@provide\AllTeX{(\La)\TeX}
\td@provide\AMS{American Mathematical Society}
\td@provide\AmS{{\the\textfont2 A}\kern-.1667em\lower.5ex\hbox
        {\the\textfont2 M}\kern-.125em{\the\textfont2 S}}
\td@provide\AMSTeX{\leavevmode\hbox{$\cal A\kern-.2em\lower.376ex
	\hbox{$\cal M$}\kern-.2em\cal S$-\TeX}}
\ifx\AmSTeX\undefined \let\AmSTeX=\AMSTeX \fi
\td@provide\archiTeX{\lower.5ex\hbox{A}\kern-.18em rch\i\kern-.1em \TeX}
\td@provide\BaSiX{{B\kern-.18em\lower.45ex\hbox{A}\kern-.15em S
           \kern-.4em\lower.45ex\hbox{I}\kern-.1em X}}
\td@provide\Bib{Bib}
\td@provide\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025emb}\kern-.08em\TeX}}
\td@provide\bibtexcpp{{\sl \BibTeX{\raise.25ex\hbox{\sl c++}}}}
\ifx\bs\undefined \chardef\bs=`\\ \fi
\td@provide\bull{\vrule height 1ex width .8ex depth -.2ex } % square bullet
\td@provide\cents{{\rm\raise.2ex\rlap{\kern.05em$\scriptstyle/$}c}}
\td@provide\CTAN{{\SMC CTAN}\spacefactor1000 }
\td@provide\comment#1\endcomment{}		   % AMS-TeX not loaded
\td@provide\ConTeXt{Con{\TeX}t}
\td@provide\CONTEXT{\ConTeXt}
\td@provide\CS{{\the\textfont2 C\kern-.1em\lower.4ex\hbox{S}\kern.1em}}
\td@provide\cs#1{{\tt \char`\\#1}}
\td@provide\CSS{\acro{CSS}}
\td@provide\CSTUG{{\tensy C\kern-.1emS\kern-.05em}TUG}
\td@provide\curve{{\bf C}\kern-.32ex\raise-.3ex\hbox{u}\kern-.2ex r%
                  \kern-.25ex{\bf V}\kern-.6ex\raise-.3ex\hbox{e}}
\td@provide\Dash{\d@sh{---}}
\td@provide\d@sh#1{\nobreak\thinspace#1\penalty0\thinspace}
\td@provide\dash{\d@sh{--}}
\td@provide\dots{\hbox{.\kern\fontdimen3\font % better to use text 
                      .\kern\fontdimen3\font
                      .\kern\fontdimen3\font}}
\td@provide\DVD{{\acro{DVD}}}
\td@provide\DVI{\acro{DVI}}
\td@provide\dvitosvg{{{\acrosl DVI\/}}2\/{{\acrosl SVG}}}
\td@provide\DVItoVDU{DVIto\kern-.12em VDU}
\ifx\eightrm\undefined \font\eightrm=cmr8 \fi
\td@provide\eOmega{eOmega}
\td@provide\eTeX{e\TeX}
\td@provide\ExTeX{Ex\TeX}
\td@provide\FDNTeX{\acro{FDN}\TeX}
\td@provide\file#1{{{\tt #1}}}
\td@provide\gaelmhodh#1{%
 \if a#1\'a\else\if A#1\'A%
 \else\if e#1\'e\else\if E#1\'E%
 \else\if i#1\'{\char16}\else\if I#1\'I%
 \else\if o#1\'o\else\if O#1\'O%
 \else\if u#1\'u\else\if U#1\'U%
 \else\if .#1/\else\.#1%
 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\td@provide\GeX{G\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}
\td@provide\gmLaTeXplain{gm\LaTeX{}plain}
\td@provide\GNU{\acro{GNU}}
\td@provide\HTML{{\SMC HTML}\spacefactor1000 }
\td@provide\Java{\acro{JAVA}}
\td@provide\JemTeX{J\kern-.15em {\it{em}}\kern-.1em\TeX}
\td@provide\JoT{{\sl The Joy of \TeX}}
\td@provide\JTeX{\leavevmode\hbox{\lower.5ex\hbox{J}\kern-.18em\TeX}}
\td@provide\La{{\rm L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em}}
\td@provide\latex{\LaTeX}
\td@provide\LaTeX{\La\TeX}
\td@provide\LaTeXe{\LaTeX{}\kern.05em2$_{\textstyle\varepsilon}$}
\td@provide\ldots{\dots}
\td@provide\LexiTeX{{\rm\ \unskip\hbox{L%
 \kern-.06em\hbox{\smc e}%
 \kern-.05em\hbox{\smc x}%
 \kern-.05em\lower.5ex\hbox{I}%
 \kern-.18em\TeX}}}
\td@provide\lib{\texttt}
\td@provide\LuaLaTeX{Lua\LaTeX}
\td@provide\LuaTeX{Lua\TeX}
\td@provide\LyX{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\spacefactor1000}
\td@provide\MacOSX{{\sc Mac OS X}}
\ifx\manual\undefined
  \font\manual=manfnt \hyphenchar\manual=-1 \fi  % logo10 not enough
\ifx\manualsl\undefined \font\manualsl=logosl10 \fi
\td@provide\macro{\cs}
\td@provide\mathsPIC{\ssf maths\acro{PIC}}
\td@provide\Mc{\setbox0=\hbox{M}%
               \leavevmode\hbox{M\/\vbox to \ht0{\hbox{c}\vfil}}}
\td@provide\MF{{\manual META}\-{\manual FONT}\spacefactor1000 }
\td@provide\MP{{\manual META}\-{\manual POST}\spacefactor1000 }
\td@provide\mtex{T\kern-.1667em\lower.5ex\hbox{\^E}\kern-.125emX}
\td@provide\MTeX{M\TeX}
\td@provide\MTH{$}
\td@provide\NetBibTeX{{\smc Net}\BibTeX}
\td@provide\NexTeX{N\kern-.2em\lower0.5ex\hbox{E}\kern-0.1emX\kern-0.2em\TeX}
\td@provide\ninesmc{\small\sc}
\td@provide\noopsort#1{}
\td@provide\NTG{{\smc NTG}}
\td@provide\nth#1{\td@TestCount=#1\relax
    \ifnum\td@TestCount <0 \multiply\td@TestCount by\m@ne \fi % subdue negative
    \td@@TestCount=\td@TestCount
    \divide\td@@TestCount by 100 \multiply\td@@TestCount by 100
    \advance\td@TestCount by-\td@@TestCount     % n mod 100
    \ifnum\td@TestCount >20 \td@@TestCount=\td@TestCount
      \divide\td@@TestCount by 10 \multiply\td@@TestCount by 10
      \advance\td@TestCount by-\td@@TestCount   % n mod 10
    \fi
    \td@@TestCount=\the\fam\relax
    $\fam\td@@TestCount#1^{\fam\td@@TestCount
      \ifcase\td@TestCount th%    0th
      \or   st%                1st
      \or   nd%                2nd
      \or   rd%                3rd
      \else th%                nth
      \fi
     }$}
\td@provide\NTS{$\cal{N}$\lower.5ex\hbox{$\cal{T}$}$\cal{S}$}
\td@provide\OMEGA{{\sc OMEGA}}
\td@provide\origLaTeX{\LaTeX}
\td@provide\otr{{\smc otr}}
\td@provide\PDF{\acro{PDF}}
\td@provide\pdfTeX{pdf\TeX}
\td@provide\plain{{\tt plain}}
\td@provide\POBox{P.\thinspace O.~Box }
\td@provide\POBoxTUG{\POBox\unskip~9506, Providence, RI~02940}
\td@provide\Pas{Pascal}
\td@provide\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC}
\td@provide\PiCTeX{\PiC\kern-.11em\TeX}
\td@provide\PDF{{\sc PDF}}
\td@provide\pgm#1{{{\tt #1}}}
\td@provide\pkg#1{{{\small \sf #1}}}
\td@provide\PreTeX{Pre\kern -0.11em\-\TeX}
\td@provide\PS{Post\-Script}
\td@provide\r#1{\accent"17 #1\relax} % Michal R{\r{u}}{\v{z}}i{\v{c}}ka
\td@provide\ringhalfrighti{'}
\td@provide\sb{_}
\td@provide\SC{Steering Committee}
\td@provide\sf{\tenss}
\td@provide\SGML{{\SMC SGML}\spacefactor1000 }
\td@provide\slBibTeX{{\tensl B{\slc IB}\TeX}}
\ifx\slc\undefined \font\slc=cmsl9 at 8pt \fi % cmcscsl10 not avail. as type1
\td@provide\SliTeX{{\rm S\kern-.06em{\smc l\kern-.035emi}\kern-.06em\TeX}}
\td@provide\slMF{{\manualsl META}\-{\manualsl FONT}\spacefactor1000 }
\ifx\slnine\undefined \font\slnine = cmsl9 \fi
\ifx\sltt\undefined \let\sltt=\tt \fi
\ifx\smc\undefined \let\smc=\sc \fi
\td@provide\SP{{\tt\char"20 }}		% visible space
\td@provide\sp{^}
\ifx\ssf\undefined \let\ssf=\sf \fi
\ifx\tensl\undefined \font\tensl = cmsl10 \fi
\ifx\tenss\undefined \font\tenss=cmss10 \fi
\ifx\tensy\undefined \font\tensy=cmsy10 \fi
\td@provide\tex{\TeX}
\td@provide\TeXLive{\TeX{}Live}
\td@provide\TeXMaG{\TeX M\kern-.1667em\lower.5ex\hbox{A}\kern-.2267emG}
\td@provide\TeXML{\TeX\-\acro{ML}}
\td@provide\textsl#1{{\sl #1}}
\td@provide\texttt#1{{\tt #1}}
\td@provide\TeXtures{\td@TestCount=\the\fam\TeX\kern-.1em$\fam\td@TestCount
                     \scriptstyle TURES$}
\td@provide\TeXworks{{\TeX}works}
\td@provide\THANH{H{\`a}n Th\^e\llap{\raise 0.5ex\hbox{\'{\relax}}} Th{\`a}nh}
\td@provide\Thanh{\THANH}
\td@provide\Tib{\td@TestCount=\the\fam \leavevmode T\kern-.1667em
	$\fam\td@TestCount\scriptstyle I$b}
\td@provide\TikZ{Ti\emph{k}Z}
\td@provide\TUB{TUGboat}
\td@provide\tubissue#1#2{\TUB~#1, no.~#2}
\td@provide\TUG{\TeX\ \UG}
\td@provide\tug{{\acro{TUG}}}
\td@provide\UG{Users Group}
\td@provide\uktug{UK\,TUG}
\td@provide\UNIX{{\sc unix}}
\td@provide\UPSILON{$\Upsilon$}
\td@provide\url{\begingroup % simplistic \url just to avoid errors
    \catcode`\#=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^=12
    \catcode`\&=12 \catcode`\_=12 \catcode`\~=12
  \finish@td@url}
\td@provide\finish@td@url#1{\tt #1\endgroup}
\td@provide\VAX{\leavevmode\hbox{V\kern-.12em A\kern-.1em X}}
\td@provide\VnTeX{Vn\TeX}
\td@provide\VorTeX{V\kern-2.7pt\lower.5ex\hbox{O\kern-1.4pt R}\kern-2.6pt\TeX}
\td@provide\WARMreader{{\small\texttt{WARM}}\texttt{reader}}
\td@provide\warmreader{\WARMreader}
\td@provide\vrt{{\tt\char`\|}}
\td@provide\WEB{{\tt WEB}}
\td@provide\XML{\acro{XML}}
\td@provide\Xe{X\lower.5ex\hbox{E}}
\td@provide\XeLaTeX{\Xe{\LaTeX}}
\td@provide\XeTeX{\Xe\TeX}
\td@provide\Xy{{\smc Xy}}
\td@provide\XyM{X\kern-.25em\smash{\raise.50ex\hbox{\UPSILON}}\kern-.25em{M}}
\td@provide\XyMTeX{\XyM\kern-.1em\TeX}
\td@provide\XYMTeX{\XyMTeX}
\td@provide\Xypic{\Xy-pic}

% Define \SMC to work with plain TeX, LaTeX, and AmSTeX.
\ifx\small\undefined
  \ifx\ninerm\undefined
    \def\SMC{\rm}
  \else
    \def\SMC{\ninerm}
  \fi
\else  
    \def\SMC{\small}
\fi
\td@provide\small{\SMC}

\makeatother
