%%
%% This is file `unique.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% unique.dtx  (with options: `code')
%% 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 {unique}[2020/08/01 v0.72]

\DeclareOption{unq}{%
  \newwrite\uniq@channel
  \InputIfFileExists{\jobname.unq}{}{}%
  \immediate\openout\uniq@channel=\jobname.unq
  \AtEndDocument{%
    \immediate\closeout\uniq@channel%
  }
}
\DeclareOption{aux}{%
  \let\uniq@channel\@auxout
}

\newcommand\setuniqmark[1]{%
  \expandafter\ifx\csname uniq@now@#1\endcsname\relax
    \global\@namedef{uniq@now@#1}{\uniq@ONE}%
  \else
    \expandafter\ifx\csname uniq@now@#1\endcsname\uniq@MANY
    \else
      \immediate\write\uniq@channel{%
        \string\uniq@setmany{#1}%
      }%
      \ifuniq{#1}{%
        \uniq@warnnotunique{#1}%
      }{}%
    \fi
    \global\@namedef{uniq@now@#1}{\uniq@MANY}%
  \fi
}
\newcommand\ifuniq[1]{%
  \expandafter\ifx\csname uniq@last@#1\endcsname\uniq@MANY
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi
}
\def\uniq@ONE{\uniq@ONE}
\def\uniq@MANY{\uniq@MANY}
\newif\if@uniq@rerun
\def\uniq@setmany#1{%
  \global\@namedef{uniq@last@#1}{\uniq@MANY}%
  \AtEndDocument{%
    \uniq@warnifunique{#1}%
  }%
}
\def\uniq@warnifunique#1{%
  \expandafter\ifx\csname uniq@now@#1\endcsname\uniq@MANY\else
    \PackageWarningNoLine{uniq}{%
      `#1' is unique now.\MessageBreak
      Rerun LaTeX to pick up the change%
    }%
    \@uniq@reruntrue
  \fi
}
\def\uniq@warnnotunique#1{%
  \PackageWarningNoLine{uniq}{%
    `#1' is not unique anymore.\MessageBreak
    Rerun LaTeX to pick up the change%
  }%
  \@uniq@reruntrue
}
\def\uniq@maybesuggestrerun{%
  \if@uniq@rerun
    \PackageWarningNoLine{uniq}{%
      Uniquenesses have changed. \MessageBreak
      Rerun LaTeX to pick up the change%
    }%
  \fi
}
\AtEndDocument{%
  \immediate\write\@auxout{\string\uniq@maybesuggestrerun}%
}
\ExecuteOptions{aux}
\ProcessOptions\relax
\endinput
%%
%% End of file `unique.sty'.
