summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-14 20:18:31 +0000
committerKarl Berry <karl@freefriends.org>2022-07-14 20:18:31 +0000
commit7d2efac48cf5aec47ad938fa44e752b5f9733228 (patch)
tree85bc0e09018b0583c31631c4bf5280c25ddc7455 /Master/texmf-dist/source
parent4511617ba4d27fca8d4a6135b9d2c05a4300d978 (diff)
fixdif (14jul22)
git-svn-id: svn://tug.org/texlive/trunk@63892 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/fixdif/fixdif.dtx82
1 files changed, 70 insertions, 12 deletions
diff --git a/Master/texmf-dist/source/latex/fixdif/fixdif.dtx b/Master/texmf-dist/source/latex/fixdif/fixdif.dtx
index bced2e43bf9..43337e7f88f 100644
--- a/Master/texmf-dist/source/latex/fixdif/fixdif.dtx
+++ b/Master/texmf-dist/source/latex/fixdif/fixdif.dtx
@@ -126,14 +126,14 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
%</internal>
%
%<*driver>
-\ProvidesFile{fixdif.dtx}[2022/07/09 (c) Copyright 2022 by Zhang Tingxuan]
+\ProvidesFile{fixdif.dtx}[2022/07/14 (c) Copyright 2022 by Zhang Tingxuan]
\documentclass{ltxdoc}
\usepackage{xcolor}
\definecolor{titlecolor}{RGB}{0,12,160}
\usepackage{doc}
\usepackage{fancyvrb}
-\fvset{xleftmargin=2em,fontsize=\small,gobble=2}
+\fvset{xleftmargin=2.5em,fontsize=\small,gobble=2}
\MakeShortVerb|
\usepackage{hologo}
@@ -145,14 +145,15 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
\title{The \pkg{fixdif} Package}
\author{Zhang Tingxuan}
-\date{2022/07/09\quad Version 1.2\thanks{\url{https://github.com/AlphaZTX/fixdif}}}
+\date{2022/07/14\quad Version 1.3\thanks{\url{https://github.com/AlphaZTX/fixdif}}}
\usepackage{hyperref}
\hypersetup{
pdftitle = {The fixdif Package},
pdfauthor = {Zhang Tingxuan},
pdfcreator = {pdfLaTeX/XeLaTeX/LuaLaTeX},
- hidelinks,
+ linkcolor = black,
+ urlcolor = titlecolor!80!black,
}
\def\pkg{\textsf}
@@ -188,10 +189,9 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
\usepackage{fixdif}
-
\linespread{1.05}
-\parskip5pt plus 2pt minus 1pt
-\parindent3em
+\parskip6pt plus 2pt minus 1pt
+\parindent2.5em
\begin{document}
\DocInput{\jobname.dtx}
@@ -391,14 +391,14 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% Then you get |\D| for an uppercase upright ``D'' as a differential operator.
%
% If your second argument contains only one command like |\Delta|,
-% you should use \cs{letdif} or \cs{letdif*} instead.
+% it's recommended to use \cs{letdif} or \cs{letdif*} instead.
%
% These two commands will check whether \meta{cmd} has been defined already.
% If so, an error message will be given.
%
-% \noindent\textcolor{titlecolor}{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif}
+% \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{\newdif*}
+% \noindent\textcolor{titlecolor}{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\renewdif*}
% \hfill(with correction, preamble only)
%
% These two commands are basically the same as \cs{newdif} and \cs{newdif*}.
@@ -406,6 +406,55 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% whether \meta{cmd} has \emph{not} been defined yet. If so, an error message
% will be given.
%
+% \section{Using differential operators temporarily}
+%
+% \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*}
+% \hfill(with correction, in math mode only)
+%
+% These two commands can be used in math mode only, more specifically,
+% after \verb|\begin{document}|. For example, \verb|$x\mathdif{\Delta}\psi$|
+% will get $x\mathdif{\Delta}\psi$.
+%
+% \section{Examples}
+%
+% This section shows how to use this package properly in your document.
+%
+% Take the two examples below:
+% \begin{Verbatim}
+% \letdif{\Delta}{Delta} % Example 1, in preamble
+% \letdif{\nabla}{nabla} % Example 2, in preamble
+% \end{Verbatim}
+% Actually, the second example is more reasonable.
+% Sometimes, we take ``$\Delta$'' as laplacian (equivalent to $\nabla^2$),
+% while ``$\Delta$'' can also be regarded as a variable
+% or function at some other times. Consequently, it's better to save
+% a different command for ``$\Delta$'' as laplacian while reserve
+% \verb|\Delta| as a command for an ordinary math symbol ``$\Delta$''.
+% However, in the vast majority of cases, ``$\nabla$'' is regarded as
+% nabla operator so there is no need to save a different command for
+% ``$\nabla$''. Then we can correct the code above:
+% \begin{Verbatim}
+% \letdif{\laplacian}{Delta} % Example 1, corrected, in preamble
+% \end{Verbatim}
+% With the \pkg{xparse} package, we can define the command in another method:
+% \begin{Verbatim}
+% \letdif{\nabla}{nabla}
+% \DeclareDocumentCommand{ \laplacian }{ s }{
+% \IfBooleanTF{#1}{\mathdif{\Delta}}{\nabla^2}
+% }
+% \end{Verbatim}
+% Then \verb|\laplacian| produces $\nabla^2$ and \verb|\laplacian*|
+% produces $\Delta$.
+%
+% \paragraph{Dealing with ``$+$'' and ``$-$''}
+% If you input \verb|$-\d x$|, you'll get ``$-\d x$'' in your document,
+% but compared to ``$-\d x$'', ``$-{\d x}$'' is better. To get ``$-{\d x}$'',
+% you can input \verb|-{\d x}|. The ``\verb|\d x|'' in a \emph{group} will be
+% regarded \textsl{ordinary} but not \textsl{inner}
+% so that the small skip will disappear.
+%
% \section{The source code}
% \begin{macrocode}
%<*package>
@@ -413,10 +462,10 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% Check the \TeX{} format and provides the package name.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fixdif}[2022/05/29 Interface for defining the differential operator.]
+\ProvidesPackage{fixdif}[2022/07/14 Interface for defining the differential operators.]
% \end{macrocode}
%
-% \subsection{Control the skip between slash and differential operator}
+% \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}
@@ -572,6 +621,15 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
\fi%
}}
\def\renewdif{\@ifstar\s@renewdif\@renewdif}
+% \end{macrocode}
+% \subsection{In-document commands: \cs{mathdif} and \cs{mathdif*}}
+% \begin{macrocode}
+\def\@mathdif#1{\mathinner{#1}\mup@tch}
+\def\s@mathdif#1{\s@beforep@tch\mathinner{#1\mbox{}}\mup@tch}
+\DeclareRobustCommand\mathdif{\@ifstar\s@mathdif\@mathdif}
+% \end{macrocode}
+% End of the package.
+% \begin{macrocode}
%</package>
% \end{macrocode}
\endinput \ No newline at end of file