%%
%% This is file `thm-autoref.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% thm-autoref.dtx  (with options: `autoref')
%% This is a generated file.
%% 
%% This file is part of the `thmtools' package.
%% The `thmtools' package has the LPPL maintenance status: maintained.
%% Current Maintainer is Yukai Chou, muzimuzhi@gmail.com
%% 
%% Copyright (C) 2008-2014 by Ulrich M. Schwarz
%% Copyright (C) 2019      by Frank Mittelbach
%% Copyright (C) 2020-     by Yukai Chou
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, version 1.3c.
%% This version is obtainable at
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% 
%% 
\NeedsTeXFormat {LaTeX2e}
\ProvidesPackage {thm-autoref}[2020/08/01 v0.72]

\RequirePackage{thm-patch, aliasctr, parseargs, keyval}

\let\@xa=\expandafter
\let\@nx=\noexpand

\newcommand\thmt@autorefsetup{%
  \@xa\def\csname\thmt@envname autorefname\@xa\endcsname\@xa{\thmt@thmname}%
  \ifthmt@hassibling
    \@counteralias{\thmt@envname}{\thmt@sibling}%
    \@xa\def\@xa\thmt@autoreffix\@xa{%
      \@xa\let\csname the\thmt@envname\@xa\endcsname
        \csname the\thmt@sibling\endcsname
      \def\thmt@autoreffix{}%
    }%
    \protected@edef\thmt@sibling{\thmt@envname}%
  \fi
}
\g@addto@macro\thmt@newtheorem@predefinition{\thmt@autorefsetup}%
\g@addto@macro\thmt@newtheorem@postdefinition{\csname thmt@autoreffix\endcsname}%

\def\thmt@refnamewithcomma #1#2#3,#4,#5\@nil{%
  \@xa\def\csname\thmt@envname #1utorefname\endcsname{#3}%
  \ifcsname #2refname\endcsname
    \csname #2refname\@xa\endcsname\@xa{\thmt@envname}{#3}{#4}%
  \fi
}
\define@key{thmdef}{refname}{\thmt@trytwice{}{%
  \thmt@refnamewithcomma{a}{c}#1,\textbf{?? (pl. #1)},\@nil
}}
\define@key{thmdef}{Refname}{\thmt@trytwice{}{%
  \thmt@refnamewithcomma{A}{C}#1,\textbf{?? (pl. #1)},\@nil
}}

\ifcsname Autoref\endcsname\else
\let\thmt@HyRef@testreftype\HyRef@testreftype
\def\HyRef@Testreftype#1.#2\\{%
  \ltx@IfUndefined{#1Autorefname}{%
    \thmt@HyRef@testreftype#1.#2\\%
  }{%
    \edef\HyRef@currentHtag{%
      \expandafter\noexpand\csname#1Autorefname\endcsname
      \noexpand~%
    }%
  }%
}

\let\thmt@HyPsd@@autorefname\HyPsd@@autorefname
\def\HyPsd@@Autorefname#1.#2\@nil{%
  \tracingall
  \ltx@IfUndefined{#1Autorefname}{%
    \thmt@HyPsd@@autorefname#1.#2\@nil
  }{%
    \csname#1Autorefname\endcsname\space
  }%
}%
\def\Autoref{%
  \parse{%
  {\parseFlag*{\def\thmt@autorefstar{*}}{\let\thmt@autorefstar\@empty}}%
  {\parseMand{%
    \bgroup
    \let\HyRef@testreftype\HyRef@Testreftype
    \let\HyPsd@@autorefname\HyPsd@@Autorefname
    \@xa\autoref\thmt@autorefstar{##1}%
    \egroup
    \let\@parsecmd\@empty
  }}%
  }%
}
\fi % ifcsname Autoref

\AtBeginDocument{%
  \@ifpackageloaded{nameref}{%
    \addtotheorempostheadhook{%
      \expandafter\NR@gettitle\expandafter{\thmt@shortoptarg}%
  }}{}
}

\AtBeginDocument{%
  \@ifpackageloaded{cleveref}{%
    \@ifpackagelater{cleveref}{2010/04/30}{%
    % OK, new enough
    }{%
      \PackageWarningNoLine{thmtools}{%
        Your version of cleveref is too old!\MessageBreak
        Update to version 0.16.1 or later%
      }
    }
  }{}
}
\endinput
%%
%% End of file `thm-autoref.sty'.
