texlive[65658] Master/texmf-dist: fixdif (28jan23)

commits+karl at tug.org commits+karl at tug.org
Sat Jan 28 22:06:36 CET 2023


Revision: 65658
          http://tug.org/svn/texlive?view=revision&revision=65658
Author:   karl
Date:     2023-01-28 22:06:35 +0100 (Sat, 28 Jan 2023)
Log Message:
-----------
fixdif (28jan23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fixdif/fixdif-zh-cn.pdf
    trunk/Master/texmf-dist/doc/latex/fixdif/fixdif-zh-cn.tex
    trunk/Master/texmf-dist/doc/latex/fixdif/fixdif.pdf
    trunk/Master/texmf-dist/source/latex/fixdif/fixdif.dtx
    trunk/Master/texmf-dist/tex/latex/fixdif/fixdif.sty

Modified: trunk/Master/texmf-dist/doc/latex/fixdif/fixdif-zh-cn.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/fixdif/fixdif-zh-cn.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fixdif/fixdif-zh-cn.tex	2023-01-28 21:06:15 UTC (rev 65657)
+++ trunk/Master/texmf-dist/doc/latex/fixdif/fixdif-zh-cn.tex	2023-01-28 21:06:35 UTC (rev 65658)
@@ -1,10 +1,12 @@
 \documentclass[letterpaper,11pt]{article}
-\date{2023/01/27\quad Version 1.6%
+\usepackage{fixdif}
+\date{2023/01/31\quad Version 2.0%
   \thanks{源代码见~\hyperref{https://github.com/AlphaZTX/fixdif}{}{}{GitHub} 
   或~\hyperref{https://www.ctan.org/pkg/fixdif}{}{}{CTAN}。}
 }
 \ifcsname XeTeXversion\endcsname\else\errmessage{本文档需使用 xelatex 编译}\fi
-\usepackage{indentfirst,enumitem}
+\usepackage{indentfirst,enumitem,multicol}
+\columnsep20pt\columnseprule.4pt
 \usepackage{manfnt,marginnote}
 \newcounter{fixdifattention}
 \newcommand\attention[1][1]{\setcounter{fixdifattention}{1}%
@@ -27,8 +29,8 @@
 \renewcommand\abstractname{摘\hskip.8em 要}
 \renewcommand\contentsname{目\hskip.8em 录}
 \DeclareRobustCommand\zhemph{\CJKunderdot}
-\usepackage{unicode-math}
-\setmathfont{STIX Two Math}
+%\usepackage{unicode-math}
+%\setmathfont{STIX Two Math}
 \usepackage{hyperref}
 \hypersetup{pdffitwindow,
   pdftitle   = {fixdif 宏包},
@@ -71,7 +73,6 @@
 \gdef\@author{\Uchar"5F20\Uchar"5EAD\Uchar"7444}
 \makeatother
 \pagestyle{plain}
-\usepackage{fixdif}
 \linespread{1.2}
 \parskip8pt plus 4pt minus 2pt
 \parindent2em
@@ -87,7 +88,11 @@
 本宏包在 \xelatex{} 和 \lualatex{} 下兼容 \pkg{unicode-math} 宏包。
 \end{abstract}
 
-{\parskip0pt\tableofcontents}
+\section*{\contentsname}
+\begin{multicols}{2}
+\parskip0pt
+\csname @starttoc\endcsname{toc}
+\end{multicols}
 
 \section{背景}
 我们一般更推荐在微分算符与前面的内容之间留出一个比较小的间距\footnote{%
@@ -94,7 +99,7 @@
 见 \hyperref{https://tex.stackexchange.com/questions/14821/whats-the-%
 proper-way-to-typeset-a-differential-operator}{}{}{\TeX.SX}。},比如在下面展示的
 两种情况中,右边的比左边的更好:
-\[f(x)\mathrm{d}x\qquad\text{\&}\qquad f(x)\d x.\]
+\[f(x)\mathrm{d}x \qquad\hbox{\&}\qquad f(x)\d x.\]
 微分算符 $\d{}$ 与其前面的表达式之间的间距可认为是乘积的一种表示。
 
 有些用户习惯使用下面的方法定义一个宏:
@@ -191,34 +196,9 @@
 会得到
 \[f(x)\d x,\quad \frac{\d y}{\d x},\quad \d y/\d x,\quad a^{y\d x}.\]
 
-\subsection{对 \pkg{unicode-math} 宏包的兼容}
-如果你在文档中使用了 \pkg{unicode-math} 宏包(编译方式为 \xelatex{} 或 
-\lualatex{}),需注意以下几点:
-\begin{itemize}
-\item 如需使用 \pkg{amsmath} 宏包,请在 \pkg{unicode-math} \zhemph{之前}%
-载入 \pkg{amsmath}。
-
-\item 在载入 \pkg{unicode-math} 后通过 \cs{setmathfont} 指定数学字体。
-若使用默认的数学字体,建议显式指明 |\setmathfont{Latin Modern Math}|,
-这样可以避免在用斜杠表示的分式中产生不好的间距;
-
-\item \pkg{fixdif} 宏包需要在 \pkg{unicode-math} 宏包\zhemph{后}载入。
-\end{itemize}
-从而,导言区正确的顺序是:
-\begin{Verbatim}
-\usepackage[..]{amsmath}
-\usepackage[..]{unicode-math}
-\setmathfont{...}[...]
-\usepackage{fixdif}
-\end{Verbatim}
-
-\subsection{对 \pkg{hyperref} 宏包的兼容}
-如果你使用了 \pkg{hyperref} 宏包,需注意 \pkg{fixdif} 宏包需要在 \pkg{hyperref} 
-之后载入,否则会引起冲突。
-
-\subsection{基本命令及宏包选项}
-\DescribeMacro{\d}
-\pkg{fixdif} 宏包提供了 \cs{d} 命令用于在数学模式中得到微分算符“$\d{}$”。
+\subsection{基本的 \cs{d} 命令}
+\DescribeMacro{\d}%
+\pkg{fixdif} 宏包提供了 \cs{d} 命令用于在数学模式中得到微分算符“$\d$”。
 在正文中,\cs{d} 会保留其原有的重音符号的功能。例如:
 \begin{Verbatim}
 $\d x$ 和 \d x
@@ -225,7 +205,7 @@
 \end{Verbatim}
 以上代码会得到“$\d x$ 和 \d x”。
 
-\paragraph{设置 \cs{d} 的字体}
+\subsection{设置 \cs{d} 的字体}
 本宏包提供了两个选项来控制 \cs{d} 的字体,分别为 \opt{rm} 和 \opt{normal}。
 其中,\opt{rm} 为默认值,表示 \cs{d} 的字体为罗马体(\cs{mathrm});
 \opt{normal} 表示 \cs{d} 的字体为数学模式下的常规体(\cs{mathnormal}),
@@ -243,8 +223,8 @@
 \end{Verbatim}
 在此设置下,正文中的 |\d x| 会得到 $\mathsf{d}x$。
 
-\paragraph{\cs{partial} 的行为}
-\DescribeMacro{\partial}
+\subsection{\cs{partial} 的行为}
+\DescribeMacro{\partial}%
 \pkg{fixdif} 宏包将 \cs{partial} 归为微分算符,正文中的 \cs{partial} 前面也会有
 自动的间距。例如 |$\partial x\partial y$| 会得到 $\partial x\partial y$。
 若不需要将 \cs{partial} 视为微分算符,可以开启 \opt{nopartial} 选项:
@@ -310,7 +290,7 @@
 \noindent\textcolor{titlecolor}{\cs{newdif}\marg{cmd}\marg{multi-cmd}}%
 \DescribeMacro{\newdif}\hfill(仅限在导言区使用,后无矫正)\\
 \noindent\textcolor{titlecolor}{\cs{newdif*}\marg{cmd}\marg{multi-cmd}}%
-\DescribeMacro{\newdif*}\hfill(仅限在导言区使用,后有矫正)
+\hfill(仅限在导言区使用,后有矫正)
 
 上面两个命令的第一个参数 \meta{cmd} 是新定义的微分算符命令,第二个参数 
 \meta{multi-cmd} 是超过一个字(token)的命令组合或字符串。举个例子,在 
@@ -331,9 +311,9 @@
 \cs{newdif}(\texttt{*}) 会检查第一个参数 \meta{cmd} 是否已经被定义,若 \meta{cmd} 
 已被定义,则会报错。
 
-\noindent\textcolor{titlecolor}{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\renewdif}
-\hfill(仅限在导言区使用,后无矫正)\\
-\noindent\textcolor{titlecolor}{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\renewdif*}
+\noindent\textcolor{titlecolor}{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}%
+\DescribeMacro{\renewdif}\hfill(仅限在导言区使用,后无矫正)\\
+\noindent\textcolor{titlecolor}{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}%
 \hfill(仅限在导言区使用,后有矫正)
 
 这两个命令用于将 \meta{cmd} 重定义为微分算符命令。
@@ -343,7 +323,7 @@
 \noindent\textcolor{titlecolor}{\cs{mathdif}\marg{symbol}}%
 \DescribeMacro{\mathdif}\hfill(仅限在数学模式使用,后无矫正)\\ 
 \noindent\textcolor{titlecolor}{\cs{mathdif*}\marg{symbol}}%
-\DescribeMacro{\mathdif*}\hfill(仅限在数学模式使用,后有矫正)
+\hfill(仅限在数学模式使用,后有矫正)
 
 如需在正文中少量使用某一数学符号作为微分算符,可以使用上面的两个命令。
 例如,\verb|$x\mathdif{\Delta}\psi$| 会得到 $x\mathdif{\Delta}\psi$。
@@ -367,15 +347,6 @@
 \begin{Verbatim}
 \letdif{\laplacian}{Delta}
 \end{Verbatim}
-如果你比较擅长使用 \pkg{xparse} 宏包(2020 年 10 月后已被集成进 \LaTeXe{} 内核)
-的接口,你也可以采用下面的方法:
-\begin{Verbatim}
-\letdif{\nabla}{nabla}
-\DeclareDocumentCommand{ \laplacian }{ s }{
-  \IfBooleanTF { #1 } { \mathdif{\Delta} } { \nabla^2 }
-}
-\end{Verbatim}
-这样,|\laplacian| 会得到 $\nabla^2$,|\laplacian*| 会得到 $\Delta$。
 
 \paragraph{处理正负号与微分算符之间的间距}
 输入 |$-\d x$| 会得到 $-\d x$。如果你不希望在正负号与微分算符之间保留

Modified: trunk/Master/texmf-dist/doc/latex/fixdif/fixdif.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/fixdif/fixdif.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fixdif/fixdif.dtx	2023-01-28 21:06:15 UTC (rev 65657)
+++ trunk/Master/texmf-dist/source/latex/fixdif/fixdif.dtx	2023-01-28 21:06:35 UTC (rev 65658)
@@ -131,7 +131,7 @@
 %</internal>
 %
 %<*driver>
-\ProvidesFile{fixdif.dtx}[2023/01/27 (c) Copyright 2022-2023 by Zhang Tingxuan]
+\ProvidesFile{fixdif.dtx}[2023/01/31 (c) Copyright 2022-2023 by Zhang Tingxuan]
 \documentclass{ltxdoc}
 
 \usepackage{xcolor}
@@ -150,7 +150,7 @@
 
 \title{The \pkg{fixdif} Package}
 \author{Zhang Tingxuan}
-\date{2023/01/27\quad Version 1.6\thanks{\url{https://github.com/AlphaZTX/fixdif}}}
+\date{2023/01/31\quad Version 2.0\thanks{\url{https://github.com/AlphaZTX/fixdif}}}
 
 \usepackage{hyperref}
 \hypersetup{
@@ -188,7 +188,6 @@
 \g at addto@macro{\UrlBreaks}{\UrlDigits}
 \ifdefined\Umathcode
   \usepackage{unicode-math}
-  \setmathfont{Latin Modern Math}
 \fi
 \makeatother
 
@@ -215,7 +214,7 @@
 % in \XeTeX{} and \LuaTeX.
 % \end{abstract}
 %
-% \tableofcontents
+% {\parskip1pt plus 1pt\tableofcontents}
 %
 % \section{The background}
 % It's usually recommended that one should reserve a small skip between 
@@ -258,7 +257,8 @@
 % \begin{Verbatim}
 % \usepackage{fixdif}
 % \end{Verbatim}
-% in the preamble. In your document, 
+% in the preamble (\pkg{fixdif} allows you to write this line anywhere in the
+% preamble since version 2.0). In your document, 
 % \begin{Verbatim}
 % \[ f(x)\d x,\quad\frac{\d y}{\d x},\quad\d y/\d x,\quad a^{y\d x}. \]
 % \end{Verbatim}
@@ -265,32 +265,6 @@
 % will produce
 % \[f(x)\d x,\quad \frac{\d y}{\d x},\quad \d y/\d x,\quad a^{y\d x}.\]
 %
-% \subsection{When using \pkg{unicode-math}}
-% If you are using \pkg{unicode-math} package with \XeTeX/\LuaTeX{} 
-% in your document, you must pay attention to the following items:
-% \begin{itemize}
-% \item If you want to use \pkg{amsmath} package, make sure that the 
-% \pkg{unicode-math} package is loaded \emph{after} \pkg{amsmath}. 
-%
-% \item You had better specify the math font through the \cs{setmathfont} 
-% command provided by \pkg{unicode-math} in order to avoid bad skip in  
-% text fraction like $\d y/\d x$.
-%
-% \item Load the \pkg{fixdif} package \emph{after} \pkg{unicode-math}.
-% \end{itemize}
-% Therefore the correct order is
-% \begin{Verbatim}
-% \usepackage{amsmath}
-% \usepackage{unicode-math}
-% \setmathfont{...}[...]
-% \usepackage{fixdif}
-% \end{Verbatim}
-%
-% \subsection{When using \pkg{hyperref}}
-% If you want to use the \pkg{hyperref} package simultaneously, 
-% remember to load \pkg{hyperref} \emph{before} the \pkg{fixdif} package, 
-% otherwise the \pkg{hyperref} package will cause conflicts.
-%
 % \subsection{Basic commands and package options}
 % \DescribeMacro{\d}
 % The \pkg{fixdif} package provides a \cs{d} command for the differential 
@@ -362,7 +336,7 @@
 % For example, in default, \DescribeMacro{\partialnondif}\cs{partialnondif} 
 % yields the old partial symbol ``$\partialnondif$''.
 %
-% \noindent\textcolor{titlecolor}{\cs{letdif*}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif*}
+% \noindent\textcolor{titlecolor}{\cs{letdif*}\marg{cmd}\marg{csname}}
 % \hfill(preamble only)
 %
 % This command is basically the same as \cs{letdif}, but this command will 
@@ -385,7 +359,7 @@
 %
 % \noindent\textcolor{titlecolor}{\cs{newdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif}
 % \hfill(without correction, preamble only)\\
-% \noindent\textcolor{titlecolor}{\cs{newdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*}
+% \noindent\textcolor{titlecolor}{\cs{newdif*}\marg{cmd}\marg{multi-cmd}}
 % \hfill(with correction, preamble only)
 %
 % The first argument of these commands is the newly-defined command; and the 
@@ -409,7 +383,7 @@
 %
 % \noindent\textcolor{titlecolor}{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\renewdif}
 % \hfill(without correction, preamble only)\\
-% \noindent\textcolor{titlecolor}{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\renewdif*}
+% \noindent\textcolor{titlecolor}{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}
 % \hfill(with correction, preamble only)
 %
 % These two commands are basically the same as \cs{newdif} and \cs{newdif*}. 
@@ -421,7 +395,7 @@
 %
 % \noindent\textcolor{titlecolor}{\cs{mathdif}\marg{symbol}}\DescribeMacro{\mathdif}
 % \hfill(without correction, in math mode only)\\ 
-%\noindent\textcolor{titlecolor}{\cs{mathdif*}\marg{symbol}}\DescribeMacro{\mathdif*}
+%\noindent\textcolor{titlecolor}{\cs{mathdif*}\marg{symbol}}
 % \hfill(with correction, in math mode only)
 %
 % These two commands can be used in math mode only, more specifically, 
@@ -473,62 +447,68 @@
 % Check the \TeX{} format and provides the package name.
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fixdif}[2023/01/27 Interface for defining differential operators.]
+\ProvidesPackage{fixdif}[2023/01/31 Interface for defining differential operators.]
 %    \end{macrocode}
 % 
 % \subsection{Control the skip between slashes and differential operator}
 % Change the math code of slash ($/$) and backslash ($\backslash$) so that the skip 
 % between slashes and differential operators can be ignored.
-%    \begin{macrocode}
-\@ifpackageloaded{unicode-math}{\AtBeginDocument{%
-%    \end{macrocode}
-% If the \pkg{unicode-math} package has been loaded, use the \XeTeX/\LuaTeX{} primitive 
+% 
+% If the \pkg{unicode-math} package was loaded, use the \XeTeX/\LuaTeX{} primitive 
 % \cs{Umathcode} to change the type of slashes. The numeral ``4'' stands for ``open''.
+% If \pkg{unicode-math} was not loaded but \pkg{fontspec} loaded, check if
+% \pkg{fontspec} had reset math fonts, that is to say, the |no-math| option.
 %    \begin{macrocode}
-  \Umathcode`\/="4 \symoperators "002F
-  \Umathcode"2044="4 \symoperators "2044
-  \Umathcode"2215="4 \symoperators "2215
-  \Umathcode"2F98="4 \symoperators "2F98
-  \Umathcode`\\="4 \symoperators "005C
-  \Umathcode"2216="4 \symoperators "2216
-  \Umathcode"29F5="4 \symoperators "29F5
-  \Umathcode"29F9="4 \symoperators "29F9
-}}{
+\AtBeginDocument{%
+\ifcsname symbf\endcsname%
+  \csname bool_if:cF\endcsname{g__um_main_font_defined_bool}%
+    {\csname __um_load_lm:\endcsname}%
+  \Umathcode`\/="4 \symoperators "002F%
+  \Umathcode"2044="4 \symoperators "2044%
+  \Umathcode"2215="4 \symoperators "2215%
+  \Umathcode"2F98="4 \symoperators "2F98%
+  \Umathcode`\\="4 \symoperators "005C%
+  \Umathcode"2216="4 \symoperators "2216%
+  \Umathcode"29F5="4 \symoperators "29F5%
+  \Umathcode"29F9="4 \symoperators "29F9%
+\else\ifcsname fontspec\endcsname
+  \csname bool_if:cT\endcsname{g__fontspec_math_bool}%
+    {%
+      \everymath{\mathcode`\/="413D\relax}%
+      \PackageWarning{fixdif}{Requires `no-math' option of fontspec!\MessageBreak}%
+    }% fontspec only influences "/"
+\fi\fi}
 %    \end{macrocode}
-% If the \pkg{unicode-math} package has not been loaded, use the \TeX{} primitive 
-% \cs{mathcode} to change the type of slashes. The \cs{backslash} needs to be redefined 
-% through \cs{delimiter} primitive too.
+% Use \cs{mathcode} to change the type of slashes. The \cs{backslash} needs to be
+% redefined through \cs{delimiter} too.
 %    \begin{macrocode}
-  \mathcode`\/="413D
-  \mathcode`\\="426E % \backslash
-  \def\backslash{\delimiter"426E30F\relax}
-}
+\mathcode`\/="413D
+\mathcode`\\="426E% \backslash
+\protected\def\backslash{\delimiter"426E30F\relax}
 %    \end{macrocode}
 % 
 % \subsection{Patch the skips around the differential operator}
-% \DescribeMacro{\mup at tch}
-% The following \cs{mup at tch} patches the skip after the differential operator.
+% \DescribeMacro{\fd at mu@p}
+% The following \cs{fd at mu@p} patches the skip after the differential operator.
 %    \begin{macrocode}
-\def\mup at tch{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}{}}
+\def\fd at mu@p{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}{}}
 %    \end{macrocode}
-% The \cs{s at beforep@tch} patches the commands with star (\cs{letdif*}, etc).
+% The \cs{s at fd@mu at p} patches the commands with star (\cs{letdif*}, etc).
 %    \begin{macrocode}
-\def\s at beforep@tch{\mathchoice{}{}{\mbox{}}{\mbox{}}}
+\def\s at fd@mu at p{\mathchoice{}{}{\hbox{}}{\hbox{}}}
 %    \end{macrocode}
 % 
 % \subsection{Declare the package options}
-% Declare the options of the package and execute them.
 %    \begin{macrocode}
-\DeclareOption{rm}{\@ifpackageloaded{unicode-math}
-  {\def\@@dif{\symrm{d}}}{\def\@@dif{\mathrm{d}}}}
-\DeclareOption{normal}{\def\@@dif{d}}
+\DeclareOption{rm}{%
+  \AtBeginDocument{\ifcsname symbf\endcsname%
+    \gdef\@fd at dif{\symrm{d}}\fi}%
+  \gdef\@fd at dif{\mathrm{d}}}
+\DeclareOption{normal}{\gdef\@fd at dif{d}}
 \DeclareOption{partial}{\@tempswatrue}
 \DeclareOption{nopartial}{\@tempswafalse}
 \ExecuteOptions{rm,partial}
 \ProcessOptions\relax
-%    \end{macrocode}
-% Control the behavior of \cs{partial}.
-%    \begin{macrocode}
 \if at tempswa
   \AtEndOfPackage{\letdif{\partial}{partial}}
 \fi
@@ -536,47 +516,41 @@
 % \DescribeMacro{\resetdfont}
 % Define the \cs{resetdfont} command.
 %    \begin{macrocode}
-\gdef\resetdfont#1{\let\@@dif\relax%
-  \def\@@dif{#1{d}}}
+\gdef\resetdfont#1{\AtBeginDocument{\let\@fd at dif\relax\gdef\@fd at dif{#1{d}}}}
 %    \end{macrocode}
 % 
 % \subsection{Deal with the \cs{d} command}
-% \DescribeMacro{\@dif}
-% \cs{@dif} is the differential operator produced by \cs{d} in math mode. 
+% \DescribeMacro{\fd at dif}
+% \cs{fd at dif} is the differential operator produced by \cs{d} in math mode. 
 % Here we prefer \cs{mathinner} to |\mathbin| to make the skip.
 %    \begin{macrocode}
-\def\@dif{\mathinner{\@@dif}\mup at tch}
+\def\fd at dif{\mathinner{\@fd at dif}\fd at mu@p}
 %    \end{macrocode}
-% \DescribeMacro{\d at accent}
-% Restore the \cs{d} command in text by \cs{d at accent} with the \cs{let} 
-% primitive.
+% \DescribeMacro{\fd at d@acc}
+% Restore the \cs{d} command in text by \cs{fd at d@acc} with \cs{let}.
 %    \begin{macrocode}
-\AtBeginDocument{\let\d at accent\d
+\AtBeginDocument{\let\fd at d@acc\d
 %    \end{macrocode}
 % \DescribeMacro{\d}
 % Redefine the \cs{d} command. In text, we need to expand the stuffs after \cs{d}
 %    \begin{macrocode}
-  \DeclareRobustCommand\d{\ifmmode\@dif\else\expandafter\d at accent\fi}}
+  \DeclareRobustCommand\d{\ifmmode\fd at dif\else\expandafter\fd at d@acc\fi}}
 %    \end{macrocode}
 % 
 % \subsection{User's interface for defining new differential operators}
-% \DescribeMacro{\letdif}\DescribeMacro{\letdif*}
-% Define the \cs{letdif} and \cs{letdif*} command. The internal version of \cs{letdif} 
-% is \cs{@letdif}, of \cs{letdif*} is \cs{s at letdif}.
-%    \begin{macrocode}
-\def\@letdif#1#2{\AtBeginDocument{%
-%    \end{macrocode}
+% \DescribeMacro{\letdif}
+% Define the \cs{letdif} command. The internal version of \cs{letdif} 
+% is \cs{@letdif} and \cs{s at letdif}.
+% 
 % |#1| is the final command; |#2| is the ``control sequence name'' of |#1|'s initial definition.
 % Here we create a command (\cs{csname}|#2nonfif|\cs{endcsname}) to restore |#2|.
 %    \begin{macrocode}
+\def\@letdif#1#2{\AtBeginDocument{%
   \ifcsname #2nondif\endcsname\else%
   \expandafter\let\csname #2nondif\expandafter\endcsname
     \csname #2\endcsname%
   \fi%
-%    \end{macrocode}
-% Finally let |#1| be the new command.
-%    \begin{macrocode}
-  \gdef#1{\mathinner{\csname #2nondif\endcsname}\mup at tch}%
+  \DeclareRobustCommand#1{\mathinner{\csname #2nondif\endcsname}\fd at mu@p}%
 }}
 %    \end{macrocode}
 % The definition of \cs{s at letdif} is similar, but with the patch for negative skips.
@@ -586,56 +560,59 @@
   \expandafter\let\csname #2nondif\expandafter\endcsname
     \csname #2\endcsname%
   \fi%
-  \gdef#1{\mathinner{\s at beforep@tch\csname #2nondif\endcsname\hbox{}}\mup at tch}%
+  \DeclareRobustCommand#1{\mathinner{\s at fd@mu at p\csname #2nondif\endcsname\hbox{}}\fd at mu@p}%
 }}
-\def\letdif{\@ifstar\s at letdif\@letdif}
+\DeclareRobustCommand\letdif{\@ifstar\s at letdif\@letdif}
+\@onlypreamble\letdif
 %    \end{macrocode}
-% \DescribeMacro{\newdif}\DescribeMacro{\newdif*}
-% Define the \cs{newdif} and \cs{newdif*} commands. |#1| is the final command; |#2| is the ``long'' argument.
+% \DescribeMacro{\newdif}
+% Define the \cs{newdif} command. |#1| is the final command; |#2| is the ``long'' argument.
 %    \begin{macrocode}
 \long\def\@newdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-    \PackageError{fixdif}{\string#1 is already defined.}
+    \PackageError{fixdif}{\string#1 is already defined}
       {Try another command instead of \string#1.}%
   \else
-    \long\gdef#1{\mathinner{#2}\mup at tch}%
+    \DeclareRobustCommand#1{\mathinner{#2}\fd at mu@p}%
   \fi%
 }}
 \long\def\s at newdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-  \PackageError{fixdif}{\string#1 is already defined.}
+  \PackageError{fixdif}{\string#1 is already defined}
     {Try another command instead of \string#1.}%
   \else
-    \long\gdef#1{\s at beforep@tch\mathinner{#2\mbox{}}\mup at tch}%
+    \DeclareRobustCommand#1{\s at fd@mu at p\mathinner{#2\hbox{}}\fd at mu@p}%
   \fi%
 }}
-\def\newdif{\@ifstar\s at newdif\@newdif}
+\DeclareRobustCommand\newdif{\@ifstar\s at newdif\@newdif}
+\@onlypreamble\newdif
 %    \end{macrocode}
-% \DescribeMacro{\renewdif}\DescribeMacro{\renewdif*}
-% Define the \cs{renewdif} and \cs{renewdif*} commands.
+% \DescribeMacro{\renewdif}
+% Define the \cs{renewdif} command.
 %    \begin{macrocode}
 \long\def\@renewdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-    \long\gdef#1{\mathinner{#2}\mup at tch}%
+    \DeclareRobustCommand#1{\mathinner{#2}\fd at mu@p}%
   \else
-    \PackageError{fixdif}{\string#1 has not been defined yet.}
+    \PackageError{fixdif}{\string#1 has not been defined yet}
       {You should use \string\newdif instead of \string\renewdif.}%
   \fi%
 }}
 \long\def\s at renewdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-    \long\gdef#1{\s at beforep@tch\mathinner{#2\mbox{}}\mup at tch}%
+    \DeclareRobustCommand#1{\s at fd@mu at p\mathinner{#2\hbox{}}\fd at mu@p}%
   \else
-    \PackageError{fixdif}{\string#1 has not been defined yet.}
+    \PackageError{fixdif}{\string#1 has not been defined yet}
       {You should use \string\newdif instead of \string\renewdif.}%
   \fi%
 }}
-\def\renewdif{\@ifstar\s at renewdif\@renewdif}
+\DeclareRobustCommand\renewdif{\@ifstar\s at renewdif\@renewdif}
+\@onlypreamble\renewdif
 %    \end{macrocode}
-% \subsection{In-document commands: \cs{mathdif} and \cs{mathdif*}}
+% \subsection{In-document commands: \cs{mathdif}}
 %    \begin{macrocode}
-\def\@mathdif#1{\mathinner{#1}\mup at tch}
-\def\s at mathdif#1{\s at beforep@tch\mathinner{#1\mbox{}}\mup at tch}
+\def\@mathdif#1{\mathinner{#1}\fd at mu@p}
+\def\s at mathdif#1{\s at fd@mu at p\mathinner{#1\mbox{}}\fd at mu@p}
 \DeclareRobustCommand\mathdif{\@ifstar\s at mathdif\@mathdif}
 %    \end{macrocode}
 % End of the package.

Modified: trunk/Master/texmf-dist/tex/latex/fixdif/fixdif.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fixdif/fixdif.sty	2023-01-28 21:06:15 UTC (rev 65657)
+++ trunk/Master/texmf-dist/tex/latex/fixdif/fixdif.sty	2023-01-28 21:06:35 UTC (rev 65658)
@@ -29,26 +29,36 @@
 %%                               and README.md.
 %% 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fixdif}[2023/01/27 Interface for defining differential operators.]
-\@ifpackageloaded{unicode-math}{\AtBeginDocument{%
-  \Umathcode`\/="4 \symoperators "002F
-  \Umathcode"2044="4 \symoperators "2044
-  \Umathcode"2215="4 \symoperators "2215
-  \Umathcode"2F98="4 \symoperators "2F98
-  \Umathcode`\\="4 \symoperators "005C
-  \Umathcode"2216="4 \symoperators "2216
-  \Umathcode"29F5="4 \symoperators "29F5
-  \Umathcode"29F9="4 \symoperators "29F9
-}}{
-  \mathcode`\/="413D
-  \mathcode`\\="426E % \backslash
-  \def\backslash{\delimiter"426E30F\relax}
-}
-\def\mup at tch{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}{}}
-\def\s at beforep@tch{\mathchoice{}{}{\mbox{}}{\mbox{}}}
-\DeclareOption{rm}{\@ifpackageloaded{unicode-math}
-  {\def\@@dif{\symrm{d}}}{\def\@@dif{\mathrm{d}}}}
-\DeclareOption{normal}{\def\@@dif{d}}
+\ProvidesPackage{fixdif}[2023/01/31 Interface for defining differential operators.]
+\AtBeginDocument{%
+\ifcsname symbf\endcsname%
+  \csname bool_if:cF\endcsname{g__um_main_font_defined_bool}%
+    {\csname __um_load_lm:\endcsname}%
+  \Umathcode`\/="4 \symoperators "002F%
+  \Umathcode"2044="4 \symoperators "2044%
+  \Umathcode"2215="4 \symoperators "2215%
+  \Umathcode"2F98="4 \symoperators "2F98%
+  \Umathcode`\\="4 \symoperators "005C%
+  \Umathcode"2216="4 \symoperators "2216%
+  \Umathcode"29F5="4 \symoperators "29F5%
+  \Umathcode"29F9="4 \symoperators "29F9%
+\else\ifcsname fontspec\endcsname
+  \csname bool_if:cT\endcsname{g__fontspec_math_bool}%
+    {%
+      \everymath{\mathcode`\/="413D\relax}%
+      \PackageWarning{fixdif}{Requires `no-math' option of fontspec!\MessageBreak}%
+    }% fontspec only influences "/"
+\fi\fi}
+\mathcode`\/="413D
+\mathcode`\\="426E% \backslash
+\protected\def\backslash{\delimiter"426E30F\relax}
+\def\fd at mu@p{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}{}}
+\def\s at fd@mu at p{\mathchoice{}{}{\hbox{}}{\hbox{}}}
+\DeclareOption{rm}{%
+  \AtBeginDocument{\ifcsname symbf\endcsname%
+    \gdef\@fd at dif{\symrm{d}}\fi}%
+  \gdef\@fd at dif{\mathrm{d}}}
+\DeclareOption{normal}{\gdef\@fd at dif{d}}
 \DeclareOption{partial}{\@tempswatrue}
 \DeclareOption{nopartial}{\@tempswafalse}
 \ExecuteOptions{rm,partial}
@@ -56,17 +66,16 @@
 \if at tempswa
   \AtEndOfPackage{\letdif{\partial}{partial}}
 \fi
-\gdef\resetdfont#1{\let\@@dif\relax%
-  \def\@@dif{#1{d}}}
-\def\@dif{\mathinner{\@@dif}\mup at tch}
-\AtBeginDocument{\let\d at accent\d
-  \DeclareRobustCommand\d{\ifmmode\@dif\else\expandafter\d at accent\fi}}
+\gdef\resetdfont#1{\AtBeginDocument{\let\@fd at dif\relax\gdef\@fd at dif{#1{d}}}}
+\def\fd at dif{\mathinner{\@fd at dif}\fd at mu@p}
+\AtBeginDocument{\let\fd at d@acc\d
+  \DeclareRobustCommand\d{\ifmmode\fd at dif\else\expandafter\fd at d@acc\fi}}
 \def\@letdif#1#2{\AtBeginDocument{%
   \ifcsname #2nondif\endcsname\else%
   \expandafter\let\csname #2nondif\expandafter\endcsname
     \csname #2\endcsname%
   \fi%
-  \gdef#1{\mathinner{\csname #2nondif\endcsname}\mup at tch}%
+  \DeclareRobustCommand#1{\mathinner{\csname #2nondif\endcsname}\fd at mu@p}%
 }}
 \def\s at letdif#1#2{\AtBeginDocument{%
   \ifcsname #2nondif\endcsname\else%
@@ -73,45 +82,48 @@
   \expandafter\let\csname #2nondif\expandafter\endcsname
     \csname #2\endcsname%
   \fi%
-  \gdef#1{\mathinner{\s at beforep@tch\csname #2nondif\endcsname\hbox{}}\mup at tch}%
+  \DeclareRobustCommand#1{\mathinner{\s at fd@mu at p\csname #2nondif\endcsname\hbox{}}\fd at mu@p}%
 }}
-\def\letdif{\@ifstar\s at letdif\@letdif}
+\DeclareRobustCommand\letdif{\@ifstar\s at letdif\@letdif}
+\@onlypreamble\letdif
 \long\def\@newdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-    \PackageError{fixdif}{\string#1 is already defined.}
+    \PackageError{fixdif}{\string#1 is already defined}
       {Try another command instead of \string#1.}%
   \else
-    \long\gdef#1{\mathinner{#2}\mup at tch}%
+    \DeclareRobustCommand#1{\mathinner{#2}\fd at mu@p}%
   \fi%
 }}
 \long\def\s at newdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-  \PackageError{fixdif}{\string#1 is already defined.}
+  \PackageError{fixdif}{\string#1 is already defined}
     {Try another command instead of \string#1.}%
   \else
-    \long\gdef#1{\s at beforep@tch\mathinner{#2\mbox{}}\mup at tch}%
+    \DeclareRobustCommand#1{\s at fd@mu at p\mathinner{#2\hbox{}}\fd at mu@p}%
   \fi%
 }}
-\def\newdif{\@ifstar\s at newdif\@newdif}
+\DeclareRobustCommand\newdif{\@ifstar\s at newdif\@newdif}
+\@onlypreamble\newdif
 \long\def\@renewdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-    \long\gdef#1{\mathinner{#2}\mup at tch}%
+    \DeclareRobustCommand#1{\mathinner{#2}\fd at mu@p}%
   \else
-    \PackageError{fixdif}{\string#1 has not been defined yet.}
+    \PackageError{fixdif}{\string#1 has not been defined yet}
       {You should use \string\newdif instead of \string\renewdif.}%
   \fi%
 }}
 \long\def\s at renewdif#1#2{\AtBeginDocument{%
   \ifdefined#1
-    \long\gdef#1{\s at beforep@tch\mathinner{#2\mbox{}}\mup at tch}%
+    \DeclareRobustCommand#1{\s at fd@mu at p\mathinner{#2\hbox{}}\fd at mu@p}%
   \else
-    \PackageError{fixdif}{\string#1 has not been defined yet.}
+    \PackageError{fixdif}{\string#1 has not been defined yet}
       {You should use \string\newdif instead of \string\renewdif.}%
   \fi%
 }}
-\def\renewdif{\@ifstar\s at renewdif\@renewdif}
-\def\@mathdif#1{\mathinner{#1}\mup at tch}
-\def\s at mathdif#1{\s at beforep@tch\mathinner{#1\mbox{}}\mup at tch}
+\DeclareRobustCommand\renewdif{\@ifstar\s at renewdif\@renewdif}
+\@onlypreamble\renewdif
+\def\@mathdif#1{\mathinner{#1}\fd at mu@p}
+\def\s at mathdif#1{\s at fd@mu at p\mathinner{#1\mbox{}}\fd at mu@p}
 \DeclareRobustCommand\mathdif{\@ifstar\s at mathdif\@mathdif}
 \endinput
 %%



More information about the tex-live-commits mailing list.