%%
%% This is file `fixdif.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fixdif.dtx  (with options: `package')
%% 
%%   Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the LaTeX Project Public License, either
%%   version 1.3c of this license or (at your option) any later
%%   version. The latest version of this license is in:
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%%   and version 1.3 or later is part of all distributions of
%%   LaTeX version 2005/12/01 or later.
%% 
%%   This work has the LPPL maintenance status `maintained'.
%% 
%%   The Current Maintainer of this work is Zhang Tingxuan.
%% 
%%   This work consists of the files fixdif.dtx,
%%             and the derived files fixdif.ins,
%%                                   fixdif.sty,
%%                                   fixdef.pdf,
%%                               and README.md.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fixdif}[2022/05/29 Interface for defining the differential operator.]
\@ifpackageloaded{unicode-math}{
  \Umathcode`\/="4 "0 "002F
  \Umathcode"2044="4 "0 "2044
  \Umathcode"2215="4 "0 "2215
  \Umathcode"2F98="4 "0 "2F98
  \Umathcode`\\="4 "0 "005C
  \Umathcode"2216="4 "0 "2216
  \Umathcode"29F5="4 "0 "29F5
  \Umathcode"29F9="4 "0 "29F9
}{
  \mathcode`\/="413D
  \mathcode`\\="426E % \backslash
  \def\backslash{\delimiter"426E30F\relax}
}
\def\mup@tch{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}}
\def\s@beforep@tch{\mathchoice{}{}{\mbox{}}{\mbox{}}}
\DeclareOption{rm}{\@ifpackageloaded{unicode-math}
  {\def\@@dif{\symrm{d}}}{\def\@@dif{\mathrm{d}}}}
\DeclareOption{normal}{\def\@@dif{d}}
\DeclareOption{partial}{\def\fixdif@partial@bool{1}}
\DeclareOption{nopartial}{\def\fixdif@partial@bool{0}}
\ExecuteOptions{rm,partial}
\ProcessOptions\relax
\def\fixdif@partial@true{1}
\ifx\fixdif@partial@bool\fixdif@partial@true
  \AtEndOfPackage{\letdif{\partial}{partial}}
\fi
\gdef\resetdfont#1{\let\@@dif\relax%
  \def\@@dif{#1{d}}}
\def\@dif{\mathinner{\@@dif}\mup@tch}
\let\d@accent\d
\gdef\d{\relax\ifmmode\@dif\else\expandafter\d@accent\fi}
\def\@letdif#1#2{\AtBeginDocument{
  \ifcsname #2@old\endcsname\else
  \expandafter\let\csname #2@old\expandafter\endcsname%
    \csname #2\endcsname
  \fi
  \gdef#1{\mathinner{\csname #2@old\endcsname}\mup@tch}
}}
\def\s@letdif#1#2{\AtBeginDocument{
  \ifcsname #2@old\endcsname\else
  \expandafter\let\csname #2@old\expandafter\endcsname%
    \csname #2\endcsname
  \fi
  \gdef#1{\mathinner{\s@beforep@tch\csname #2@old\endcsname\mbox{}}\mup@tch}
}}
\def\letdif{\@ifstar\s@letdif\@letdif}
\long\def\@newdif#1#2{\AtBeginDocument{
  \ifdefined#1
    \PackageError{fixdif}{\string#1 is already defined.}
      {Try another command instead of \string#1.}
  \else
    \long\gdef#1{\mathinner{#2}\mup@tch}
  \fi
}}
\long\def\s@newdif#1#2{\AtBeginDocument{
  \ifdefined#1
  \PackageError{fixdif}{\string#1 is already defined.}
    {Try another command instead of \string#1.}
  \else
    \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}
  \fi
}}
\def\newdif{\@ifstar\s@newdif\@newdif}
\long\def\@renewdif#1#2{\AtBeginDocument{
  \ifdefined#1
    \long\gdef#1{\mathinner{#2}\mup@tch}
  \else
    \PackageError{fixdif}{\string#1 has not been defined yet.}
      {You should use \string\newdif instead of \string\renewdif.}
  \fi
}}
\long\def\s@renewdif#1#2{\AtBeginDocument{
  \ifdefined#1
    \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}
  \else
    \PackageError{fixdif}{\string#1 has not been defined yet.}
      {You should use \string\newdif instead of \string\renewdif.}
  \fi
}}
\def\renewdif{\@ifstar\s@renewdif\@renewdif}
\endinput
%%
%% End of file `fixdif.sty'.
