diff options
Diffstat (limited to 'macros/latex/contrib')
24 files changed, 2068 insertions, 225 deletions
diff --git a/macros/latex/contrib/fixdif/README.md b/macros/latex/contrib/fixdif/README.md new file mode 100644 index 0000000000..ce9fba1dca --- /dev/null +++ b/macros/latex/contrib/fixdif/README.md @@ -0,0 +1,19 @@ +# The `fixdif` Package + +The `fixdif` package provides an interface for defining the style of differential operators. + +The basic commands are: + +- `\d`: for differential operator "d" in math mode and under-dot accent in text; +- `\partial`: a "fixed" partial differential operator command; +- `\letdif`: an interface for defining new commands for differential operators. + +See `fixdif.pdf` for more. Happy TeXing! + +## License + +This work may be distributed and/or modified under the conditions of the [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), either version 1.3c of this license or (at your option) any later version. + +------ + +Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>. diff --git a/macros/latex/contrib/fixdif/fixdif.dtx b/macros/latex/contrib/fixdif/fixdif.dtx new file mode 100644 index 0000000000..95099c0b74 --- /dev/null +++ b/macros/latex/contrib/fixdif/fixdif.dtx @@ -0,0 +1,579 @@ +% \iffalse meta-comment +% +% 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. +% +%<*internal> +\iffalse +%</internal> +% +%<*readme> +# The `fixdif` Package + +The `fixdif` package provides an interface for defining the style of differential operators. + +The basic commands are: + +- `\d`: for differential operator "d" in math mode and under-dot accent in text; +- `\partial`: a "fixed" partial differential operator command; +- `\letdif`: an interface for defining new commands for differential operators. + +See `fixdif.pdf` for more. Happy TeXing! + +## License + +This work may be distributed and/or modified under the conditions of the [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), either version 1.3c of this license or (at your option) any later version. + +------ + +Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>. +%</readme> +% +%<*internal> +\fi +\begingroup + \def\NameOfLaTeXe{LaTeX2e} +\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else +\csname fi\endcsname +%</internal> +% +%<*install> +\input docstrip.tex +\keepsilent + +\preamble + + 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. + +\endpreamble + +\generate{ + \usedir{tex/latex/fixdif} + \file{\jobname.sty} {\from{\jobname.dtx}{package}} +%</install> +%<*internal> + \usedir{source/latex/fixdif} + \file{\jobname.ins} {\from{\jobname.dtx}{install}} +%</internal> +%<*install> + \usedir{doc/latex/fixdif} + \nopreamble\nopostamble + \file{README.md} {\from{\jobname.dtx}{readme}} +} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* fixdif.sty *} +\Msg{* *} +\Msg{* The recommended directory is *} +\Msg{* TDS:tex/latex/fixdif *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* fixdif.dtx through pdfLaTeX/XeLaTeX/LuaLaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile +%</install> +% +%<*internal> +\fi +%</internal> +% +%<*driver> +\ProvidesFile{fixdif.dtx}[2022/05/27 (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} +\MakeShortVerb| + +\usepackage{hologo} +\def\XeTeX{\hologo{XeTeX}} +\def\LuaTeX{\hologo{LuaTeX}} + +\def\pkg{\textsf} +\def\opt{\texttt} + +\title{The \pkg{fixdif} Package} +\author{Zhang Tingxuan} +\date{2022/05/27\quad Version 1.0\thanks{\url{https://github.com/AlphaZTX/fixdif}}} + +\usepackage{hyperref} +\hypersetup{ + pdftitle = {The fixdif Package}, + pdfauthor = {Zhang Tingxuan}, + pdfcreator = {pdfLaTeX/XeLaTeX/LuaLaTeX}, + hidelinks, +} +\def\pkg{\textsf} + +\makeatletter +\renewcommand\section{\@startsection{section}{1}{\z@}% + {-2.5ex plus -1ex minus -.2ex}% + {1ex plus .2ex}% + {\normalfont\Large\bfseries\color{titlecolor}}} +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% + {-2ex plus -1ex minus -.2ex}% + {.5ex plus .2ex}% + {\normalfont\normalsize\bfseries\color{titlecolor}}} +\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% + {.8ex plus .4ex minus .2ex}% + {-1em}% + {\normalfont\normalsize\bfseries\color{titlecolor}}} +\def\UrlAlphabet{% + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j% + \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t% + \do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D% + \do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N% + \do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X% + \do\Y\do\Z} +\def\UrlDigits{\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0} +\g@addto@macro{\UrlBreaks}{\UrlOrds} +\g@addto@macro{\UrlBreaks}{\UrlAlphabet} +\g@addto@macro{\UrlBreaks}{\UrlDigits} +\ifdefined\Umathcode + \usepackage{unicode-math} + \setmathfont{Latin Modern Math} +\fi +\makeatother + +\usepackage{fixdif} + + +\linespread{1.05} +\parskip5pt plus 2pt minus 1pt +\parindent3em + +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \maketitle +% +% \begin{abstract} +% The \pkg{fixdif} package redefines the \cs{d} command in \LaTeX{} +% and provides an interface to define commands for differential operators. +% +% The package is compatible with pdf\TeX, \XeTeX{} and \LuaTeX. +% Furthermore, the package is compatible with \pkg{unicode-math} package +% in \XeTeX{} and \LuaTeX. +% \end{abstract} +% +% \tableofcontents +% +% \section{The background} +% It's usually recommended that one should reserve a small skip between +% the differential operator and the expression before it\footnote{See +% \url{https://tex.stackexchange.com/questions/14821/whats-the-proper-way-to-typeset-a-differential-operator}.}. +% Take the following cases as an example: +% \[f(x)\mathrm{d}x\qquad\mbox{and}\qquad f(x)\d x.\] +% We usually consider that the example on the right side is better than the +% one on the left side. The little skip between $f(x)$ and $\d x$ can be +% regarded as a symbol of the product of $f(x)$ and $\d x$. +% +% So some users prefer to define a macro like this: +% \begin{Verbatim} +% \renewcommand\d{\mathop{\mathrm{d}}\!} +% \end{Verbatim} +% This macro works well in ``display math'' and ``text math'', but we still +% face three problems: +% \begin{enumerate} +% \item The skip before ``d'' would still be reserved in ``text fraction'', +% which is regarded bad. For example, |$\d y/\d x$| produces +% $\mathrm{d}y/\,\mathrm{d}x$; +% +% \item This |\d| command cannot be used out of math mode. In another word, +% |\d{o}| would not produce ``\d{o}'' in text; +% +% \item The skip between ``d'' and the expression before it can be regarded +% as a product operator. A product operator is definitely a binary operator. +% +% Take |\cdot| ($\cdot$) as an example. +% A binary operator reserves small skips before and after itself when in +% ``display math'' or ``text math'' such as $x\cdot y$, but the skips will +% disappear in ``script math'' or ``script script math'' such as $a^{x\cdot y}$. +% Thus the small skip should also disappear in script, but |$a^{f(x)\d x}$| +% still produces $a^{f(x)\,\mathrm{d}x}$ but not $a^{f(x)\d x}$. +% \end{enumerate} +% To solve these problems, you can try this package. +% +% \section{Introduction} +% To load this package, write +% \begin{Verbatim} +% \usepackage{fixdif} +% \end{Verbatim} +% in the preamble. 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} +% 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 \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} +% 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 +% operator ``d'' in math mode. When in the text, \cs{d} behaves +% just like the old \cs{d} command in \LaTeX{} or plain \TeX{} as an +% accent command. For example, +% \begin{Verbatim} +% $\d x$ and \d x +% \end{Verbatim} +% will produce ``$\d x$ and \d x''. +% +% \paragraph{Set the font of \cs{d}} +% There are two basic package options to control the \cs{d}'s style in math +% mode~--- \opt{rm} and \opt{normal}. The default option is \opt{rm}, in whose +% case |$f(x)\d x$| produces $f(x)\d x$. If you chose the \opt{normal} option, +% for example +% \begin{Verbatim} +% \usepackage[normal]{fixdif} +% \end{Verbatim} +% |$f(x)\d x$| would produces $f(x)\,dx$. +% +% \DescribeMacro{\resetdfont} +% Besides the previous two optional fonts, you can reset the font of +% differential operator ``d'' through \cs{resetdfont} command: +% \begin{Verbatim} +% \resetdfont{\mathsf} +% \end{Verbatim} +% then |\d x| will produce $\mathsf{d}x$. +% +% \paragraph{Control the behavior of \cs{partial}} +% \DescribeMacro{\partial} +% In default, \cs{partial} will also be regarded as a differential operator +% in this package. If you don't like this default setting, you can use the +% \opt{nopartial} option: +% \begin{Verbatim} +% \usepackage[nopartial]{fixdif} +% \end{Verbatim} +% +% \section{Define commands for differential operators} +% \noindent\emph{Attention! The commands in this section +% can be used in preamble only!} +% +% \subsection{Define commands with a single command name} +% \noindent\textbf{\cs{letdif}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif} +% \hfill(preamble only) +% +% The \cs{letdif} command has two arguments~--- the first is the newly-defined +% command and the second is the \emph{name} of a \emph{single} character +% command (without the backslash on the front). For example, +% \begin{Verbatim} +% \letdif{\vr}{delta} +% \end{Verbatim} +% then the |\vr| will produce a $\delta$ (|\delta|) with automatic skip +% before it. +% +% Through the \cs{letdif} command, we can redefine a math character command +% by its name. For example, +% \begin{Verbatim} +% \letdif{\delta}{delta} +% \end{Verbatim} +% then |\delta| itself will be a differential operator. +% +% The second argument \meta{csname} of \cs{letdif} command can be used +% repeatedly. +% +% \noindent\textbf{\cs{letdif*}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif*} +% \hfill(preamble only) +% +% This command is basically the same as \cs{letdif}, but this command will +% patch a correction after the differential operator. This is very useful +% when a math font is setted through \pkg{unicode-math} package. For example, +% \begin{Verbatim} +% \usepackage{unicode-math} +% \setmathfont{TeX Gyre Termes Math} +% \usepackage{fixdif} +% \letdif{\vr}{updelta} +% \end{Verbatim} +% this will cause bad negative skip after |\vr|, but if you change the last +% line into +% \begin{Verbatim} +% \letdif*{\vr}{updelta} +% \end{Verbatim} +% you will get the result correct. +% +% \subsection{Define commands with multi commands or a string} +% +% \noindent\textbf{\cs{newdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif} +% \hfill(without correction, preamble only)\\ +% \noindent\textbf{\cs{newdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*} +% \hfill(with correction, preamble only) +% +% The first argument of these commands is the newly-defined command; and the +% second argument should contain \emph{more than one commands} or +% \emph{a string}. For example, if you have loaded the \pkg{xcolor} package, +% you can use the following line: +% \begin{Verbatim} +% \newdif{\redsfd}{\textsf{\color{red}d}} +% \end{Verbatim} +% Then you get the |\redsfd| as a differential operator. Take another example, +% \begin{Verbatim} +% \newdif{\D}{\mathrm{D}} +% \end{Verbatim} +% 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. +% +% These two commands will check whether \meta{cmd} has been defined already. +% If so, an error message will be given. +% +% \noindent\textbf{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif} +% \hfill(without correction, preamble only)\\ +% \noindent\textbf{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*} +% \hfill(with correction, preamble only) +% +% These two commands are basically the same as \cs{newdif} and \cs{newdif*}. +% The only difference is that \cs{renewdif} and \cs{renewdif*} will check +% whether \meta{cmd} has \emph{not} been defined yet. If so, an error message +% will be given. +% +% \section{The source code} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% Check the \TeX{} format and provides the package name. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fixdif}[2022/05/26 Interface for defining the differential operator.] +% \end{macrocode} +% +% \subsection{Control the skip between slash 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}{ +% \end{macrocode} +% If the \pkg{unicode-math} package has been loaded, use the \XeTeX/\LuaTeX{} primitive +% \cs{Umathcode} to change the type of slashes. The numeral ``4'' stands for ``open''. +% \begin{macrocode} + \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 +}{ +% \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. +% \begin{macrocode} + \mathcode`\/="413D + \mathcode`\\="426E % \backslash + \def\backslash{\delimiter"426E30F\relax} +} +% \end{macrocode} +% +% \subsection{Patch the skips around the differential operator} +% \DescribeMacro{\mup@tch} +% The following \cs{mup@tch} patches the skip after the differential operator. +% \begin{macrocode} +\def\mup@tch{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}} +% \end{macrocode} +% The \cs{s@beforep@tch} patches the commands with star (\cs{letdif*}, etc). +% \begin{macrocode} +\def\s@beforep@tch{\mathchoice{}{}{\mbox{}}{\mbox{}}} +% \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{partial}{\def\fixdif@partial@bool{1}} +\DeclareOption{nopartial}{\def\fixdif@partial@bool{0}} +\ExecuteOptions{rm,partial} +\ProcessOptions\relax +% \end{macrocode} +% Control the behavior of \cs{partial}. +% \begin{macrocode} +\def\fixdif@partial@true{1} +\ifx\fixdif@partial@bool\fixdif@partial@true + \AtEndOfPackage{\letdif{\partial}{partial}} +\fi +% \end{macrocode} +% \DescribeMacro{\resetdfont} +% Define the \cs{resetdfont} command. +% \begin{macrocode} +\gdef\resetdfont#1{\let\@@dif\relax% + \def\@@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. +% Here we prefer \cs{mathinner} to |\mathbin| to make the skip. +% \begin{macrocode} +\def\@dif{\ifmmode% + \mathinner{\@@dif}\mup@tch% +\fi} +% \end{macrocode} +% \DescribeMacro{\d@accent} +% Restore the \cs{d} command in text by \cs{d@accent} with the \cs{let} +% primitive. +% \begin{macrocode} +\let\d@accent\d +% \end{macrocode} +% \DescribeMacro{\d} +% Redefine the \cs{d} command. In text, we need to expand the stuffs after \cs{d} +% \begin{macrocode} +\gdef\d{\ifmmode\@dif\else\expandafter\d@accent\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@letdif}. +% \begin{macrocode} +\def\@letdif#1#2{\AtBeginDocument{ +% \end{macrocode} +% |#1| is the final command; |#2| is the ``control sequence name'' of |#1|'s initial definition. +% Here we create a command (\cs{csname}|#2@old|\cs{endcsname}) to restore |#2|. +% \begin{macrocode} + \ifcsname #2@old\endcsname\else + \expandafter\let\csname #2@old\expandafter\endcsname% + \csname #2\endcsname + \fi +% \end{macrocode} +% Finally let |#1| be the new command. +% \begin{macrocode} + \gdef#1{\mathinner{\csname #2@old\endcsname}\mup@tch} +}} +% \end{macrocode} +% The definition of \cs{s@letdif} is similar, but with the patch for negative skips. +% \begin{macrocode} +\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} +% \end{macrocode} +% \DescribeMacro{\newdif}\DescribeMacro{\newdif*} +% Define the \cs{newdif} and \cs{newdif*} commands. |#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.} + {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} +% \end{macrocode} +% \DescribeMacro{\renewdif}\DescribeMacro{\renewdif*} +% Define the \cs{renewdif} and \cs{renewdif*} commands. +% \begin{macrocode} +\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} +%</package> +% \end{macrocode} +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/fixdif/fixdif.ins b/macros/latex/contrib/fixdif/fixdif.ins new file mode 100644 index 0000000000..eb8171c866 --- /dev/null +++ b/macros/latex/contrib/fixdif/fixdif.ins @@ -0,0 +1,89 @@ +%% +%% This is file `fixdif.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fixdif.dtx (with options: `install') +%% +%% 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. +%% +\input docstrip.tex +\keepsilent + +\preamble + + 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. + +\endpreamble + +\generate{ + \usedir{tex/latex/fixdif} + \file{\jobname.sty} {\from{\jobname.dtx}{package}} + \usedir{doc/latex/fixdif} + \nopreamble\nopostamble + \file{README.md} {\from{\jobname.dtx}{readme}} +} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* fixdif.sty *} +\Msg{* *} +\Msg{* The recommended directory is *} +\Msg{* TDS:tex/latex/fixdif *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* fixdif.dtx through pdfLaTeX/XeLaTeX/LuaLaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile +\endinput +%% +%% End of file `fixdif.ins'. diff --git a/macros/latex/contrib/fixdif/fixdif.pdf b/macros/latex/contrib/fixdif/fixdif.pdf Binary files differnew file mode 100644 index 0000000000..fd3208d669 --- /dev/null +++ b/macros/latex/contrib/fixdif/fixdif.pdf diff --git a/macros/latex/contrib/postnotes/CHANGELOG.md b/macros/latex/contrib/postnotes/CHANGELOG.md index 27ebf1ab31..384af1bb2e 100644 --- a/macros/latex/contrib/postnotes/CHANGELOG.md +++ b/macros/latex/contrib/postnotes/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/postnotes/compare/v0.1.2...HEAD) +## [Unreleased](https://github.com/gusbrs/postnotes/compare/v0.1.3...HEAD) + +## [v0.1.3](https://github.com/gusbrs/postnotes/compare/v0.1.2...v0.1.3) (2022-05-28) + +### Fixed +- Prevent spurious space after `\post@note` in `.aux` file. ## [v0.1.2](https://github.com/gusbrs/postnotes/compare/v0.1.1...v0.1.2) (2022-04-27) diff --git a/macros/latex/contrib/postnotes/postnotes-code.pdf b/macros/latex/contrib/postnotes/postnotes-code.pdf Binary files differindex 8271b11509..b1af0cc1e0 100644 --- a/macros/latex/contrib/postnotes/postnotes-code.pdf +++ b/macros/latex/contrib/postnotes/postnotes-code.pdf diff --git a/macros/latex/contrib/postnotes/postnotes.dtx b/macros/latex/contrib/postnotes/postnotes.dtx index 703466554b..7124ed7d70 100644 --- a/macros/latex/contrib/postnotes/postnotes.dtx +++ b/macros/latex/contrib/postnotes/postnotes.dtx @@ -147,7 +147,7 @@ % % % \begin{macrocode} -\ProvidesExplPackage {postnotes} {2022-04-27} {0.1.2} +\ProvidesExplPackage {postnotes} {2022-05-28} {0.1.3} {Endnotes for LaTeX} % \end{macrocode} % @@ -300,19 +300,19 @@ \cs_new_protected:Npn \@@_set_mark_page_label:n #1 { \iow_shipout_x:Nn \@auxout - { \post@note { mark@ #1 } { \thepage } } + { \token_to_str:N \post@note { mark@ #1 } { \thepage } } } \cs_generate_variant:Nn \@@_set_mark_page_label:n { x } \cs_new_protected:Npn \@@_set_text_page_label:n #1 { \iow_shipout_x:Nn \@auxout - { \post@note { text@ #1 } { \int_use:N \c@page } } + { \token_to_str:N \post@note { text@ #1 } { \int_use:N \c@page } } } \cs_generate_variant:Nn \@@_set_text_page_label:n { x } \cs_new_protected:Npn \@@_set_print_page_label:n #1 { \iow_shipout_x:Nn \@auxout - { \post@note { print@ #1 } { \int_use:N \c@page } } + { \token_to_str:N \post@note { print@ #1 } { \int_use:N \c@page } } } \cs_generate_variant:Nn \@@_set_print_page_label:n { x } % \end{macrocode} diff --git a/macros/latex/contrib/postnotes/postnotes.pdf b/macros/latex/contrib/postnotes/postnotes.pdf Binary files differindex 69960a6f33..af17232cc1 100644 --- a/macros/latex/contrib/postnotes/postnotes.pdf +++ b/macros/latex/contrib/postnotes/postnotes.pdf diff --git a/macros/latex/contrib/prettytok/DEPENDS.txt b/macros/latex/contrib/prettytok/DEPENDS.txt new file mode 100644 index 0000000000..5e0ae3b076 --- /dev/null +++ b/macros/latex/contrib/prettytok/DEPENDS.txt @@ -0,0 +1,2 @@ +expl3 +filecontentsdef diff --git a/macros/latex/contrib/prettytok/README b/macros/latex/contrib/prettytok/README new file mode 100644 index 0000000000..cefd81b493 --- /dev/null +++ b/macros/latex/contrib/prettytok/README @@ -0,0 +1,23 @@ +prettytok -- Pretty-print token list + +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt + +Report bugs at https://github.com/user202729/TeXlib + +======== + +Copyright 2022 user202729 + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this license or +(at your option) any later version. The latest version of this license is in +the file: + + http://www.latex-project.org/lppl.txt + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is user202729. + +This work consists of the files prettytok.sty. diff --git a/macros/latex/contrib/prettytok/prettytok.pdf b/macros/latex/contrib/prettytok/prettytok.pdf Binary files differnew file mode 100644 index 0000000000..76ca759f67 --- /dev/null +++ b/macros/latex/contrib/prettytok/prettytok.pdf diff --git a/macros/latex/contrib/prettytok/prettytok.sty b/macros/latex/contrib/prettytok/prettytok.sty new file mode 100644 index 0000000000..e17eb204c6 --- /dev/null +++ b/macros/latex/contrib/prettytok/prettytok.sty @@ -0,0 +1,669 @@ +% File: prettytok.sty +% Copyright 2022 user202729 +% +% This work may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this license or +% (at your option) any later version. The latest version of this license is in +% the file: +% +% http://www.latex-project.org/lppl.txt +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is user202729. +\RequirePackage{expl3} +\ProvidesExplPackage{prettytok}{2022/05/28}{0.0.0}{Pretty-print token list} + + + + + +\@ifpackagelater{expl3}{2022/04/10} % https://github.com/latex3/latex3/blob/main/l3kernel/CHANGELOG.md#2022-04-10 + { + } + + { + +\cs_set_protected:Npn \tl_analysis_map_inline:Nn #1 + { \exp_args:No \tl_analysis_map_inline:nn #1 } +\cs_set_protected:Npn \tl_analysis_map_inline:nn #1 + { + \__tl_analysis:n {#1} + \int_gincr:N \g__kernel_prg_map_int + \exp_args:Nc \__tl_analysis_map:Nn + { _tl_analysis_map_inline_ \int_use:N \g__kernel_prg_map_int :wNw } + } +\cs_set_protected:Npn \__tl_analysis_map:Nn #1#2 + { + \cs_gset_protected:Npn #1 ##1##2##3 {#2} + \exp_after:wN \__tl_analysis_map:NwNw \exp_after:wN #1 + \g__tl_analysis_result_tl + \s__tl { ? \tl_map_break: } \s__tl + \prg_break_point:Nn \tl_map_break: + { \int_gdecr:N \g__kernel_prg_map_int } + } +\cs_set_protected:Npn \__tl_analysis_map:NwNw #1 #2 \s__tl #3 #4 \s__tl + { + \use_none:n #3 + #1 {#2} {#4} {#3} + \__tl_analysis_map:NwNw #1 + } + + } + +\cs_generate_variant:Nn \EI_append:n {x} +\cs_generate_variant:Nn \int_compare:nNnTF {VNnTF} +\cs_generate_variant:Nn \tl_set:Nn {Nx} +\cs_generate_variant:Nn \int_compare:nNnT {VNnT} +\cs_generate_variant:Nn \cs_if_exist_use:NT {cT} + +% ======== define handler functions. +% a few things it can do: +% • \tl_build_gput_right:Nn to \_EIresult (content being put there must be wrapped in \unexpanded i.e. x-expand to the desired result + +\cs_set_protected:Npn \EI_append_raw:n #1 { + \tl_build_gput_right:Nn \_EIresult {#1} +} + +\cs_set_protected:Npn \EI_append:n #1 { + \EI_append_raw:n {\exp_not:n {#1}} +} + + +% handler can call this to collect following tokens in the input stream as argument. +% #1: the function to pass argument in. (arguments are passed as brace-hack-included) +% #2: number of arguments +\cs_set_protected:Npn \EI_collect_arg:Nn #1 #2 { + \def \_EIcollecting_balanced {#2} + \def \_EIbalance_level {0} + \tl_build_gbegin:N \_EIbalanced_content + \tl_build_gput_right:Nn \_EIbalanced_content {\noexpand #1} +} + +\cs_set_protected:Npn \EIhandler_EIexpand { + \EI_collect_arg:Nn \EI_append:x {1} +} + +\cs_set_protected:Npn \EIhandler_EIexecute { + \EI_collect_arg:Nn \use:n {1} +} + +\cs_set_protected:Npn \execinsideprepare:n #1 { + \tl_build_gbegin:N \_EIresult + \def \_EIcollecting_balanced {0} + + \tl_analysis_map_inline:nn {#1} { + % reminder: ##1: token, ##2: char code (int), ##3: cat code (hex digit) + + \int_compare:VNnTF \_EIcollecting_balanced > 0 { + % collecting content. + + \tl_build_gput_right:Nn \_EIbalanced_content {##1} + \str_case:nn {##3} { + {1} { \tl_set:Nx \_EIbalance_level {\_EIbalance_level+1} } + {2} { \tl_set:Nx \_EIbalance_level {\_EIbalance_level-1} } + } + + % we check this every time instead of only after egroup tokens... + % so that if there's exactly one token to be collected it's still correctly passed through + \int_compare:nNnT {\_EIbalance_level} = {0} { + + % done, call handler function and revert to normal mode. + + \tl_set:Nx \_EIcollecting_balanced {\int_eval:n{\_EIcollecting_balanced-1}} + \int_compare:VNnT \_EIcollecting_balanced = 0 { + \tl_build_gend:N \_EIbalanced_content + \tl_set:Nx \_EIbalanced_content {\_EIbalanced_content} + %\pretty:V \_EIbalanced_content + \_EIbalanced_content % ← the handler function is embedded in here + %\pretty:n {done} + } + } + } { + \let \_EIprocessed \c_false_bool + + % check for \EIexecute etc. and handle accordingly. + \int_compare:nNnT {##2} = {-1} { + \cs_if_exist_use:cT { + EIhandler_ \expandafter \cs_to_str:N ##1 + } { + \let \_EIprocessed \c_true_bool + } + } + + % if not, just append to result. + \bool_if:NF \_EIprocessed { + \tl_build_gput_right:Nn \_EIresult {##1} + } + } + } + + \tl_build_gend:N \_EIresult + \tl_set:Nx \_EIresult {\_EIresult} +} + +\cs_set_protected:Npn \execinside:n #1 { + \execinsideprepare:n {#1} + \_EIresult +} +\let\execinside\execinside:n % normal-catcode alias + +\cs_set_protected:Npn \execinside_set:Nn #1 #2 { + \execinsideprepare:n {#2} + \let #1 \_EIresult +} +\let\execinsideSet\execinside_set:Nn + +\cs_set_protected:Npn \execinside_gset:Nn #1 #2 { + \execinsideprepare:n {#2} + \global \let #1 \_EIresult +} +\let\execinsideGset\execinside_gset:Nn + +\cs_generate_variant:Nn \exp_args:NN {Nc} +\cs_generate_variant:Nn \EI_append:n {x} +\cs_generate_variant:Nn \exp_args:Nn {No} +\cs_generate_variant:Nn \EI_append:n {o} +\cs_generate_variant:Nn \tl_put_right:Nn {Nx} +\cs_generate_variant:Nn \use:nn {nV} +\cs_generate_variant:Nn \execinside_set:Nn {NV} + + +\def \_precattlappend_space #1 { + \begingroup + \lccode `\ =#1 + \lowercase{ + \def\_precattltmp{\endgroup \EI_append:n {~}} + } + \_precattltmp +} + +\begingroup + + +\global\def \_precattlappend_begin #1 { + \begingroup + \lccode `\{=#1 + \lowercase{\endgroup \EI_append_raw:n { \iftrue { \else } \fi }} +} +\global\def \_precattlappend_end #1 { + \begingroup + \lccode `\}=#1 + \lowercase{\endgroup \EI_append_raw:n { \iffalse { \else } \fi }} +} +\endgroup + +\def \_precattldo_special_cC #1 { \exp_args:Nc \EI_append:n {#1} } +\def \_precattldo_special_cB #1 { \str_map_inline:nn {#1} { \_precattlappend_begin {`##1} } } +\def \_precattldo_special_cE #1 { \str_map_inline:nn {#1} { \_precattlappend_end {`##1} } } +\def \_precattldo_special_cM #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {3}} } } +\def \_precattldo_special_cT #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {4}} } } +\def \_precattldo_special_cP #1 { \str_map_inline:nn {#1} { \exp_args:No \EI_append:o {\char_generate:nn {`##1} {6}} } } +\def \_precattldo_special_cU #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {7}} } } +\def \_precattldo_special_cD #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {8}} } } +\def \_precattldo_special_cS #1 { \str_map_inline:nn {#1} { \_precattlappend_space {`##1} } } +\def \_precattldo_special_cL #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {11}} } } +\def \_precattldo_special_cO #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {12}} } } +\def \_precattldo_special_cA #1 { \str_map_inline:nn {#1} { + \exp_args:No \EI_append:o {\char_generate:nn {`##1} {13}} +} } + + + +\def \_precattldo_special #1 #2 { + % given #1 e.g. \cO, #2 e.g. {abc}, append <abc> in OTHER catcode to EI. + { + \escapechar=-1 + + % let \_precattltmp be the concatenation of \string of all tokens within #2. + \def \_precattltmp {} + \tl_analysis_map_inline:nn {#2} { + \tl_put_right:Nx \_precattltmp {\exp_after:wN \string ##1} + } + + % then pass it to the specific handler. + \exp_args:Nc \exp_args:NV {_precattldo_special_\string #1} \_precattltmp + } +} + +\def \_precattldo_special_cC_outer { \_precattldo_special\cC } +\def \_precattldo_special_cB_outer { \_precattldo_special\cB } +\def \_precattldo_special_cE_outer { \_precattldo_special\cE } +\def \_precattldo_special_cM_outer { \_precattldo_special\cM } +\def \_precattldo_special_cT_outer { \_precattldo_special\cT } +\def \_precattldo_special_cP_outer { \_precattldo_special\cP } +\def \_precattldo_special_cU_outer { \_precattldo_special\cU } +\def \_precattldo_special_cD_outer { \_precattldo_special\cD } +\def \_precattldo_special_cS_outer { \_precattldo_special\cS } +\def \_precattldo_special_cL_outer { \_precattldo_special\cL } +\def \_precattldo_special_cO_outer { \_precattldo_special\cO } +\def \_precattldo_special_cA_outer { \_precattldo_special\cA } + +\def \_precattl_tmp_help #1 { + \def \_precattl_do_frozen_relax { \EI_append:n {#1} } + % #1 here will be substituted by the frozen relax +} +\expandafter \_precattl_tmp_help \ifnum0=0\fi +\let \_precattl_tmp_help \undefined + + + +\def \precattl_prepare:n #1 { + \begingroup + \let \EIhandler_EIexpand \undefined + \let \EIhandler_EIexecute \undefined + \def \EIhandler_cC { \EI_collect_arg:Nn \_precattldo_special_cC_outer 1 } + \def \EIhandler_cB { \EI_collect_arg:Nn \_precattldo_special_cB_outer 1 } + \def \EIhandler_cE { \EI_collect_arg:Nn \_precattldo_special_cE_outer 1 } + \def \EIhandler_cM { \EI_collect_arg:Nn \_precattldo_special_cM_outer 1 } + \def \EIhandler_cT { \EI_collect_arg:Nn \_precattldo_special_cT_outer 1 } + \def \EIhandler_cP { \EI_collect_arg:Nn \_precattldo_special_cP_outer 1 } + \def \EIhandler_cU { \EI_collect_arg:Nn \_precattldo_special_cU_outer 1 } + \def \EIhandler_cD { \EI_collect_arg:Nn \_precattldo_special_cD_outer 1 } + \def \EIhandler_cS { \EI_collect_arg:Nn \_precattldo_special_cS_outer 1 } + \def \EIhandler_cL { \EI_collect_arg:Nn \_precattldo_special_cL_outer 1 } + \def \EIhandler_cO { \EI_collect_arg:Nn \_precattldo_special_cO_outer 1 } + \def \EIhandler_cA { \EI_collect_arg:Nn \_precattldo_special_cA_outer 1 } + \let \EIhandler_cFrozenRelax \_precattl_do_frozen_relax + \execinside_gset:Nn \_precattlvalueg {#1} + \endgroup + \let \_precattlvalue \_precattlvalueg +} + +\def \precattl_set:Nn #1 #2 { + \precattl_prepare:n {#2} + \tl_set_eq:NN #1 \_precattlvalue +} +\let\precattlSet\precattl_set:Nn + +\def \precattl_exec:n #1 { + \precattl_prepare:n {#1} + \_precattlvalue +} +\let\precattlExec\precattl_exec:n + + + + + +\RequirePackage{filecontentsdef} + +%\sys_if_engine_luatex:T{\directlua{require("prettytok")}} + +% usage: \pretty:n, etc. + +\cs_generate_variant:Nn \exp_args:NNn {NNx} +\cs_generate_variant:Nn \iow_open:Nn {NV} +\cs_generate_variant:Nn \exp_args:NNn {NNV} +\cs_generate_variant:Nn \iow_now:Nn {Nx} +\cs_generate_variant:Nn \tl_if_eq:nnF {xoF} +\cs_generate_variant:Nn \use:N {c} +\cs_generate_variant:Nn \str_map_inline:nn {xn} +\cs_generate_variant:Nn \tl_build_put_right:Nn {Nx} +\cs_generate_variant:Nn \iow_now:Nn {NV} + +\iow_new:N \__prettyh_file +\exp_args:NNx \providecommand \prettyfilename {pretty-\jobname.html} +\providecommand \prettyrefreshstrategy {4} +\providecommand \prettyrefreshduration {1000} + + +\cs_new_protected:Npn \pretty:n #1 { + + % ======== first write out the preamble if it isn't written. Only do once. Delete the preamble macro if it's already written. + \cs_if_exist:NT \prettypreamble { + \iow_open:NV \__prettyh_file \prettyfilename + { + \str_set:NV \prettypreamble \prettypreamble + \precattl_exec:n { + \str_replace_all:Nnn \prettypreamble {\cO\^^M} {\cO\^^J} + } + \iow_now:NV \__prettyh_file \prettypreamble + \iow_now:Nx \__prettyh_file {set_refresh_strategy(\prettyrefreshstrategy,\prettyrefreshduration)} + } + \cs_undefine:N \prettypreamble + } + + % ======== the actual content. Collect to one \write to put them on the same line (also maybe for efficiency???) + \tl_build_begin:N \__prettyh_content + \tl_build_put_right:Nn \__prettyh_content {print_tl(} + \tl_analysis_map_inline:nn {#1} { + % by documentation of \tl_analysis_map_inline:nn: #1=token, #2=char code, #3=catcode + \int_compare:nNnTF {##2} = {-1} { + % token is control sequence + \tl_build_put_right:Nn \__prettyh_content {cs(} + \tl_if_eq:xoF {\use:c {}} {##1} { + \str_map_inline:xn {\exp_after:wN \cs_to_str:N ##1} { % side note, must use str here to preserve spaces + \tl_build_put_right:Nx \__prettyh_content {\int_eval:n {`####1},} + } + } + \tl_build_put_right:Nn \__prettyh_content {),} + } + { + % token is not control sequence + \tl_build_put_right:Nn \__prettyh_content {token(##2, "##3"),} + } + } + \tl_build_put_right:Nn \__prettyh_content {)//</script><script>} + \tl_build_end:N \__prettyh_content + \iow_now:NV \__prettyh_file \__prettyh_content +} + +\cs_new_protected:Npn \pretty:w #1 \prettystop { + \pretty:n {#1} +} + +\cs_generate_variant:Nn \pretty:n {x, o, V} +\let \pretty:N \pretty:n + +% normal-catcode alias +\let\prettyN\pretty:n +\let\prettyX\pretty:x +\let\prettyO\pretty:o +\let\prettyV\pretty:V + +\cs_generate_variant:Nn \pretty:N {c} + +\cs_new_protected:Nn \pretty:nn { + \pretty:n {#1} + \pretty:n {#2} +} + +\cs_new_protected:Nn \pretty:nnn { + \pretty:n {#1} + \pretty:n {#2} + \pretty:n {#3} +} + +\cs_new_protected:Nn \pretty:nnnn { + \pretty:n {#1} + \pretty:n {#2} + \pretty:n {#3} + \pretty:n {#4} +} + +\cs_new_protected:Nn \prettyshow:N { + \exp_args:No \pretty:n {\meaning #1} +} +\let\prettyshowN\prettyshow:N + + + + + +\ExplSyntaxOff +\begin{filecontentsdefmacro}{\prettypreamble} +<!doctype html> +<html lang="en"> +<head> +<meta charset="utf-8"> +<link rel="icon" href="data:,"> +<style> +body{ + background-color: black; + color: white; +} + +/* https://stackoverflow.com/questions/7011602/stretching-iframe-in-html5 */ +#wrap_all { display: none; position:fixed; width:100%; height:100%; top: 0px; left: 0px; } + + +iframe{ + position: absolute; + width: 100%; + height: 100%; + display: none; +} +#status{ + flex: 0 0 1.3em; +} + +#display_wrap{ + flex: 1 0 auto; +} +#controller{ + flex: 0 0 50px; +} + +.control-button{ +} + + + +.tokenlist, .fileline{ + border: 1px solid gray; + height: 2em; + overflow: scroll; + white-space: nowrap; +} +.tokenlist::-webkit-scrollbar, .fileline::-webkit-scrollbar { width: 0 !important } + +.fileline{ + background-color: #404040; +} + +.explicit_char_target{ + background-color: #FF8080; +} +.explicit_char{ + background-color: #606060; +} + + +.cs, .active_char{ + color: #FFFF00; +} +.cs::before{ + content: "\\"; +} +.cs::after{ + content: " "; +} + +#popup{ + display: none; + position: absolute; + border: 1px solid gray; + background-color: #000080ff; +} + +.cmd__left_brace_cmd, .cmd__right_brace_cmd, .cmd__mac_param_cmd{ + color: #FFAAAA; +} +.cmd__out_param_cmd{ + border: 1px solid #FFAAAA; +} +.out_param_expansion{ + border: 1px solid #FFAAAA; + background-color: #000080; +} +.cmd__out_param_cmd::before{ + content: "#"; +} + +.cmd__letter_cmd{ + color: #AAFFAA; +} + +.cmd__spacer_cmd{ + color: #808080; +} + + +input[type=button]{ + color: white; + background-color: #0000ff; + border: 0; +} + +#log{ + display: flex; + flex-direction: column-reverse; + flex: 0 0 30%; + overflow: scroll; +} +</style> +</head> +<body> + + <div id=output></div> + <div id=wrap_all> + <iframe id=iframe src="about:blank" frameborder=0></iframe> + <iframe id=iframe2 src="about:blank" frameborder=0></iframe> + </div> + <script> +"use strict" +function show_html(s){ + return s.replace(/ /g, "␣") + .replace(/\r|\n/g, "↵") + .replace(/\t/g, "⇥") +} + +output.innerHTML="" + +function print_tl(...tokens){ + const tl_div=document.createElement("div") + tl_div.className="tokenlist" + for(let token of tokens){ + tl_div.appendChild(token) + } + output.appendChild(tl_div) +} + +function token(charcode /* single character string in hex */, catcode /* integer */){ + const token_span=document.createElement("span") + const ch=String.fromCodePoint(charcode) + token_span.innerText=show_html(ch) + if(catcode==='D'){ + token_span.className="active_char" + token_span.title=`active ${ch} # ${charcode}` + }else{ + const cls={ + 1: 'cmd__left_brace_cmd', + 2: 'cmd__right_brace_cmd', + 3: 'cmd__math_shift_cmd', + 4: 'cmd__tab_mark_cmd', + 6: 'cmd__mac_param_cmd', + 7: 'cmd__sup_mark_cmd', + 8: 'cmd__sub_mark_cmd', + A: 'cmd__spacer_cmd', + B: 'cmd__letter_cmd', + C: 'cmd__other_char_cmd', + }[catcode] + token_span.className="token "+cls + token_span.title=`${cls} ${ch} # ${charcode}` + } + return token_span +} + +function cs(...codepoints){ + const token_span=document.createElement("span") + + const control_sequence_name=String.fromCodePoint(...codepoints) + //const meaning_str=readstr() + + token_span.innerText=show_html(control_sequence_name) + //token_span.title=`cs '${control_sequence_name}' → ${meaning_str}` + token_span.className="cs" + + return token_span +} + +var refresh_strategy_already_set=false +function set_refresh_strategy(strategy, duration){ + if(refresh_strategy_already_set) return + refresh_strategy_already_set=true + + switch(strategy){ + case 0: // do nothing + return + + case 1: // refresh the sub-iframe + if(window.parent===window){ + print_tl=function(...x) {} + //output.style.display="none" + iframe.src=location.href + iframe.style.display="block" + wrap_all.style.display="block" + setInterval(function(){ + iframe.src=iframe.src + }, duration) + } + return + + case 2: // refresh two sub-iframes + if(window.parent===window){ + print_tl=function(...x) {} + //output.style.display="none" + iframe.src=iframe2.src=location.href + iframe.style.display="block" + iframe2.style.display="block" + wrap_all.style.display="block" + async function sleep(ms){ + await new Promise(resolve=>setTimeout(resolve, ms)) + } + (async function(){ + while(true){ + await sleep(duration/2) + iframe.src=iframe.src + + await sleep(duration/2) + iframe2.style.zIndex=1 + iframe.style.zIndex=2 + + await sleep(duration/2) + iframe2.src=iframe2.src + + await sleep(duration/2) + iframe.style.zIndex=1 + iframe2.style.zIndex=2 + } + })() + } + return + + case 3: // refresh whole page + setTimeout(function(){ + location.reload() + }, duration) + return + + case 4: // request own file + window.addEventListener("load", async function(){ + async function get_code(){ + //let text=await (await fetch(location.href)).text() + let text=await new Promise(function(resolve){ + let request = new XMLHttpRequest(); + request.responseType = "text" + request.onload = function() { + resolve(request.responseText) + } + request.onerror = function() { + console.log("Error happened. Read documentation for more details.") + } + request.open("GET", location.href, true) + request.send() + }) + return text.replace(/.*?-end-template()-/s, "") + } + let text=await get_code() + output.innerHTML="" + try{ eval(text) }catch(e) {} + setInterval(async function(){ + let text2=await get_code() + if(text2!==text){ + output.innerHTML="" + try{ eval(text2) }catch(e) {} + text=text2 + } + }, duration) + }) + return + } +} + </script> + +<script> +// -end-template- +\end{filecontentsdefmacro} +\ExplSyntaxOn diff --git a/macros/latex/contrib/prettytok/prettytok.tex b/macros/latex/contrib/prettytok/prettytok.tex new file mode 100644 index 0000000000..d21af2d0fe --- /dev/null +++ b/macros/latex/contrib/prettytok/prettytok.tex @@ -0,0 +1,139 @@ +%! TEX program = lualatex +\ProvidesFile{prettytok.tex} [2022/05/28 v0.0.0 Pretty-print token lists] +% yes, this is not dtx +\documentclass{l3doc} +%\usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry} +%\usepackage[numbered]{hypdoc} +%\usepackage{\jobname} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} +\GetFileInfo{\jobname.tex} +\DoNotIndex{\newcommand,\newenvironment} + +\title{\textsf{prettytok} --- Pretty-print token lists\thanks{This file + describes version \fileversion, last revised \filedate.} +} +\author{user202729% +%\thanks{E-mail: (not set)} +} +\date{Released \filedate} + +\maketitle + +\changes{v0.0.0}{2022/05/18}{First public release} + +\begin{abstract} + Pretty-print token lists. +\end{abstract} + +\section{Usage} + +\subsection{Main function} +\begin{function}{\pretty:n,\pretty:x,\pretty:o,\pretty:V} + \begin{syntax} + \cs{pretty:n} \Arg{token list} \\ + \end{syntax} + Print the content of \meta{token list}. +\end{function} + +\begin{function}{\pretty:N,\pretty:c} + \begin{syntax} + \cs{pretty:N} \meta{token} \\ + \cs{pretty:c} \Arg{control sequence name} \\ + \end{syntax} + Print \meta{token}. \\ + This function is not very useful. Usually it's preferable to use |\pretty:V| to print a token list variable's value, + or |\prettyshow:N| to print a control sequence's meaning. +\end{function} + +\subsection{View result} + +The result is printed to a HTML file named |pretty-|\meta{jobname}|.html| by default. +Open the file in any browser to view the result. + +Note that the HTML file will not be touched if nothing is printed, as such it's encouraged to add a line such as |\pretty:n {start}| right after loading the file. + +Why HTML file? + +\begin{itemize} + \item Because if the TeX program stops with error / has some error that corrupts the PDF output, the output will even with corrupted more by the debug print. + \item Printing to the console is extremely limited (difficult syntax highlighting/scrolling/line wrapping), and most likely cluttered with the traceback/other TeX default output. + \item Output to another \TeX\ file to be compiled is a bit absurd, and compiling \TeX\ file takes longer than loading a HTML file. +\end{itemize} + +By default, the output refreshes whenever the TeX file is recompiled. The behavior +can be customized with \cs{prettyrefreshstrategy} and \cs{prettyrefreshduration}. + +\subsection{\LaTeX2 interface} + + +\begin{function}{\prettyN,\prettyX,\prettyO,\prettyV} + \begin{syntax} + \cs{prettyN} \Arg{token list} \\ + \end{syntax} + Alias of the correspondingly-named commands. +\end{function} + +\subsection{Additional functions} + +There are also these functions, for convenience. + +\begin{function}{\pretty:nn, \pretty:nnn} + \begin{syntax} + \cs{pretty:nn} \Arg{token list} \Arg{token list} + \cs{pretty:nnn} \Arg{token list} \Arg{token list} \Arg{token list} + \end{syntax} + Print multiple token lists. +\end{function} + +\begin{function}{\pretty:w} + \begin{syntax} + \cs{pretty:w} \meta{token list} \cs{prettystop} + \end{syntax} + Print the content of \meta{token list}. For now, it must be brace-balanced. +\end{function} + +\begin{function}{\prettyshow:N} + \begin{syntax} + \cs{prettyshow:N} \meta{token} + \end{syntax} + Show the meaning of a |N|-type argument. +\end{function} + +\subsection{Customization} + +These variables can be redefined before the +first call to |\pretty:n| to customize the behavior. + +\begin{variable}{\prettyfilename} + The output file name. Defaults to |pretty-|\meta{jobname}|.html|, as mentioned above. +\end{variable} + +\begin{variable}{\prettyrefreshstrategy} + The auto-refresh strategy. Allowed values are 0-4. 0 is no refresh. \\ + Which value works best depends on the particular browser. \\ + On Google Chrome, passing |--allow-file-access-from-files| may be useful. +\end{variable} + +\begin{variable}{\prettyrefreshduration} + The duration between two consecutive refresh check, in milliseconds. Defaults to 1000. +\end{variable} + +\begin{variable}{\prettypreamble} + The HTML source code preamble. This can be redefined to change styles, but the + behavior is not guaranteed. +\end{variable} + +\section{Implementation} + +Unfortunately, the implementation is not typesetted in \TeX. Read the |.sty| file. + +\StopEventually{^^A + \PrintChanges + \PrintIndex +} + +\Finale +\end{document} diff --git a/macros/latex/contrib/pxcjkcat/LICENSE b/macros/latex/contrib/pxcjkcat/LICENSE index fbe40a0146..71f0e1f5a2 100644 --- a/macros/latex/contrib/pxcjkcat/LICENSE +++ b/macros/latex/contrib/pxcjkcat/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2018 Takayuki YATO (aka. "ZR") +Copyright (c) 2010-2022 Takayuki YATO (aka. "ZR") Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/macros/latex/contrib/pxcjkcat/README-ja.md b/macros/latex/contrib/pxcjkcat/README-ja.md index c9e3530afe..accb5faf0d 100644 --- a/macros/latex/contrib/pxcjkcat/README-ja.md +++ b/macros/latex/contrib/pxcjkcat/README-ja.md @@ -30,6 +30,11 @@ pxcjkcat パッケージ ー 本体 更新履歴 -------- + * Version 1.2 〈2022/05/25〉 + - 最新の upTeX に対応させる。 + - `nomode` オプションを追加。 + - `ccv+` オプションの別名 `real` を追加。 + * Version 1.1 〈2018/04/01〉 - upTeX 1.23 版以降に対応する CCV 3(`ccv3` オプション)を追加した。 - `ccv+` オプションを追加。 diff --git a/macros/latex/contrib/pxcjkcat/README.md b/macros/latex/contrib/pxcjkcat/README.md index fcf31a0b7a..719a3e3396 100644 --- a/macros/latex/contrib/pxcjkcat/README.md +++ b/macros/latex/contrib/pxcjkcat/README.md @@ -90,6 +90,7 @@ document must in encoded in UTF-8. Revision History ---------------- + * Version 1.2 〈2022/05/25〉 * Version 1.1 〈2018/04/01〉 * Version 1.0 〈2012/09/22〉 diff --git a/macros/latex/contrib/pxcjkcat/pxcjkcat.pdf b/macros/latex/contrib/pxcjkcat/pxcjkcat.pdf Binary files differindex 07ad5c54fa..58eae044f8 100644 --- a/macros/latex/contrib/pxcjkcat/pxcjkcat.pdf +++ b/macros/latex/contrib/pxcjkcat/pxcjkcat.pdf diff --git a/macros/latex/contrib/pxcjkcat/pxcjkcat.sty b/macros/latex/contrib/pxcjkcat/pxcjkcat.sty index b6e57056c5..ae11b02fde 100644 --- a/macros/latex/contrib/pxcjkcat/pxcjkcat.sty +++ b/macros/latex/contrib/pxcjkcat/pxcjkcat.sty @@ -1,134 +1,219 @@ -% -% pxcjkcat.sty -% -%%%% package declaration +%% +%% This is file 'pxcjkcat.sty'. +%% +%% Copyright (c) 2010-2022 Takayuki YATO (aka. "ZR") +%% GitHub: https://github.com/zr-tex8r +%% Twitter: @zr_tex8r +%% +%% This package is distributed under the MIT License. +%% + +%% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxcjkcat}[2018/04/01 v1.1 PX cjk-category mode] -%\RequirePackage{ifuptex}[2008/03/14]\RequirenativeupTeX +\ProvidesPackage{pxcjkcat}[2022/05/25 v1.2 PX cjk-category mode] +\def\pxkc@pkgname{pxcjkcat} +%--------------------------------------- general -%%%% error messages -\def\pxkc@pkgname{pxcjkcat} +%% error messages \def\pxkc@error{\PackageError\pxkc@pkgname} -\def\pxkc@err@ivcsy#1{\pxkc@error - {Invalid name (#1) for cjk-category}% - {It was replaced by 18(cjk).}} -\def\pxkc@err@ivbsy#1{\pxkc@error - {Invalid name (#1) for Unicode block}\@eha} -\def\pxkc@err@ivmsy#1{\pxkc@error - {Invalid name (#1) for cjk-category mode}\@eha} +\def\pxkc@err@ivcsy#1{% + \PackageError\pxkc@pkgname + {Invalid name (#1) for cjk-category}% + {It was replaced by 18(cjk).\MessageBreak + \@ehc}} +\def\pxkc@err@ivbsy#1{% + \PackageError\pxkc@pkgname + {Invalid name (#1) for Unicode block}% + {\@eha}} +\def\pxkc@err@ivmsy#1{% + \PackageError\pxkc@pkgname + {Invalid name (#1) for cjk-category mode}% + {\@eha}} \def\pxkc@warn@dfblk#1{% \PackageWarning\pxkc@pkgname {Defunct Unicode block '#1' is\MessageBreak specified}} + +%% \pxkc@debug{<message>} \ifx\bxUseDebug\@undefined \let\pxkc@debug\@gobble \else \def\pxkc@debug#1{\typeout{**[\pxkc@pkgname] #1}} \fi -%%%% environment check -\@tempswafalse -\ifx\ucs\@undefined\else \ifnum\ucs"3000="3000 - \@tempswatrue -\fi\fi -\if@tempswa\else - \pxkc@error{Native upTeX is required.}% - {Package loading is aborted.} -\expandafter\endinput\fi\relax - -%--------------------------------------- general +%% unique tokens +\def\pxkc@end{\pxkc@end@} +\let\pxkc@mk\indent %% variables \newif\ifpxkc@ok \newif\ifpxkc@warn@defunct \pxkc@warn@defuncttrue +\let\pxkc@good@mccv\relax +\let\pxkc@mccv\relax +\let\pxkc@ccmode@opt\relax \let\pxkc@arg\relax \let\pxkc@blk\relax -\let\pxkc@grp\relax -\let\pxkc@cc\relax +\let\pxkc@cp\relax %% \pxkc@letcs\CSa{<csname-b>} \def\pxkc@letcs#1#2{% \expandafter\let\expandafter#1\csname#2\endcsname} + %% \pxkc@expanded{<text>} \def\pxkc@expanded#1{% - \edef\pxkc@nxt{#1}\pxkc@nxt} + \edef\pxkc@next{#1}\pxkc@next} -%--------------------------------------- +%--------------------------------------- package options -%%%% option handler -\chardef\pxkc@mccv=1 +%% mode CCV options \DeclareOption{ccv1}{\chardef\pxkc@mccv=1 } \DeclareOption{ccv2}{\chardef\pxkc@mccv=2 } \DeclareOption{ccv3}{\chardef\pxkc@mccv=3 } \DeclareOption{ccv+}{\chardef\pxkc@mccv=0 } -\let\pxkc@ccmode\relax -\DeclareOption*{\edef\pxkc@ccmode{\CurrentOption}} +\DeclareOption{real}{\chardef\pxkc@mccv=0 } +%% mode options +% NB. \[pxkc@M@@...] is later redefined. +\def\pxkc@M@@forcecjk {1} +\def\pxkc@M@@prefercjk {1} +\def\pxkc@M@@prefercjkvar {1} +\def\pxkc@M@@japanese {3} +\def\pxkc@M@@japanesevar {3} +\def\pxkc@M@@prefernoncjk {1} +\def\pxkc@M@@default {1} +\def\pxkc@M@@nomode {0}% special +\chardef\pxkc@good@mccv=0 +\DeclareOption*{% + \@ifundefined{pxkc@M@@\CurrentOption}{\@unknownoptionerror}{% + \chardef\pxkc@good@mccv=\@nameuse{pxkc@M@@\CurrentOption}\relax + \edef\pxkc@ccmode@opt{\CurrentOption}}} +%% dispatch \ProcessOptions\relax +%% clear up +\ifnum\pxkc@good@mccv=0 + \let\pxkc@ccmode@opt\relax +\fi +\let\pxkc@M@@nomode\@undefined + +%% set default mode CCV (ccv1) +\ifx\pxkc@mccv\relax + \chardef\pxkc@mccv=1 +\else + \chardef\pxkc@good@mccv=0 % disable check +\fi + +%--------------------------------------- environment check + +%% check engine +\def\pxkc@tmpa{Native upTeX is required} +\ifx\ucs\@undefined\else \ifnum\ucs"3000="3000 + \ifx\forcecjktoken\@undefined + \def\pxkc@tmpa{This upTeX is too old} + \else \let\pxkc@tmpa\relax + \fi +\fi\fi +\ifx\pxkc@tmpa\relax\else + \PackageError\pxkc@pkgname + {\pxkc@tmpa}% + {Package loading is aborted.\MessageBreak + \@ehc} +\expandafter\endinput\fi\relax + %%-------- classification version check -%% \pxkc@issameblock -\def\pxkc@issameblock#1#2{% - \pxkc@okfalse{\kcatcode#1=16\kcatcode#2=17\relax - \ifnum\kcatcode#1=17 \aftergroup\pxkc@oktrue\fi}} -\pxkc@issameblock{"FF01}{"FF11}\ifpxkc@ok +%% \pxkc@is@same@block +\def\pxkc@is@same@block#1#2{% + \pxkc@okfalse + \begingroup + \kcatcode#1=16\kcatcode#2=17\relax + \ifnum\kcatcode#1=17 \aftergroup\pxkc@oktrue\fi + \endgroup} + +%% \pxkc@ccv : real CCV +\pxkc@is@same@block{"FF01}{"FF11}\ifpxkc@ok \chardef\pxkc@ccv=1 % v0.11+ \else - \pxkc@issameblock{"A0}{"C0}\ifpxkc@ok + \pxkc@is@same@block{"A0}{"C0}\ifpxkc@ok \chardef\pxkc@ccv=2 % v0.29+ \else \chardef\pxkc@ccv=3 % v1.23+ \fi \fi -\ifx\bxDebugCcv\@undefined\else +\ifx\bxDebugCcv\@undefined\else % override \chardef\pxkc@ccv=\bxDebugCcv\relax \fi -\ifnum\pxkc@mccv=\z@ \let\pxkc@mccv\pxkc@ccv \fi \pxkc@debug{CJK category version \number\pxkc@ccv} -% -\ifnum\pxkc@mccv>\pxkc@ccv - \pxkc@error{Invalid mode-CCV option (ccv\number\pxkc@mccv)}% - {The mode-CCV value given (\number\pxkc@mccv) is - larger than the real CCV (\number\pxkc@ccv).\MessageBreak - I assume the mode-CCV equals the real CCV.} + +%% Here show warning for mode CCV recommendation. +%% (No warning if the good mode CCV is unavailable.) +\ifnum\pxkc@good@mccv>\pxkc@mccv \ifnum\pxkc@good@mccv>\pxkc@ccv\else + \PackageWarningNoLine\pxkc@pkgname + {Mode CCV \number\pxkc@good@mccv\space + (option 'ccv\number\pxkc@good@mccv') is recommended\MessageBreak + for the use of category mode '\pxkc@ccmode@opt'!\MessageBreak + Or you can simply suppress this warning by giving\MessageBreak + option 'ccv\number\pxkc@mccv' explicitly} +\fi\fi + +%% set mode CCV if 'ccv+' is given +\ifnum\pxkc@mccv=\z@ \let\pxkc@mccv\pxkc@ccv \fi -%%------ \setcjkcategory, etc. +%% mode CCV cannot be newer than real CCV +\ifnum\pxkc@mccv>\pxkc@ccv + \PackageError\pxkc@pkgname + {Bad mode-CCV option (ccv\number\pxkc@mccv) is given!\MessageBreak + The mode-CCV (\number\pxkc@mccv) is newer than + the real CCV (\number\pxkc@ccv)} + {I assume the mode-CCV equals the real CCV.\MessageBreak + \@ehc} + \let\pxkc@mccv\pxkc@ccv +\fi %% \pxkc@kcatcode \ifx\bxUseDebug\@undefined \def\pxkc@kcatcode#1#2{\kcatcode#1=#2\relax} \else -\def\pxkc@kcatcode#1#2{\kcatcode#1=#2\relax - \chardef\pxkc@xa=#1\chardef\pxkc@xb=#2\relax - \expandafter\pxkc@kcatcode@a\meaning\pxkc@xa\@nil} -\def\pxkc@kcatcode@a#1"#2\@nil{% - \pxkc@debug{\string\kcatcode"#2 set to \number\pxkc@xb}} +\def\pxkc@kcatcode#1#2{% + \kcatcode#1=#2\relax + \chardef\pxkc@tmpa=#1\relax + \expandafter\pxkc@kcatcode@a\meaning\pxkc@tmpa\pxkc@end} +\def\pxkc@kcatcode@a#1"#2\pxkc@end{% + \pxkc@debug{\string\kcatcode"#2 set to \number\kcatcode\pxkc@tmpa}} \fi %--------------------------------------- data tables -%%%% table +%% variables +%\[pxkc@B@@<block>] : start codepoint of the block +%\[pxkc@G@@<block>] : members of the group block +%\[pxkc@C@@<category>] : kcatcode value of the category + +%% \pxkc@bslst +\def\pxkc@bslst{\@gobble} +%% \pxkc@bval{<min_ccv>}{<block>}{<ucs>}{<full_name>} \def\pxkc@bval#1#2#3#4{% #4 is unused for now \ifnum#1>\pxkc@ccv\else \ifnum#1<\tw@ \pxkc@okfalse \else - \@tempcnta=#3\relax \@tempcntb\@tempcnta \advance\@tempcntb\m@ne - \pxkc@issameblock\@tempcnta\@tempcntb + \@tempcnta=#3\relax + \@tempcntb\@tempcnta \advance\@tempcntb\m@ne + \pxkc@is@same@block\@tempcnta\@tempcntb \fi \ifpxkc@ok \pxkc@debug{defunct: #2}% - \@namedef{pxkc@B@@#2}{-1}% invalid + \@namedef{pxkc@B@@#2}{-1}% defunct \else \@namedef{pxkc@B@@#2}{#3}% - \edef\pxkc@bslst{\pxkc@bslst\pxkc@sep#2}\def\pxkc@sep{,}% + \edef\pxkc@bslst{\pxkc@bslst,#2}% \fi \fi} -\def\pxkc@bslst{}\def\pxkc@sep{} -\def\pxkc@cval#1#2{\@namedef{pxkc@C@@#1}{#2}} +%% \pxkc@gval{<gblock>}{<block>,...}{<full_name>} \def\pxkc@gval#1#2#3{\@namedef{pxkc@G@@#1}{#2}} +%% \pxkc@cval{<category>}{<value>} +\def\pxkc@cval#1#2{\@namedef{pxkc@C@@#1}{#2}} \pxkc@cval{noncjk}{15} \pxkc@cval{kanji}{16} \pxkc@cval{han}{16} @@ -136,9 +221,8 @@ \pxkc@cval{cjk}{18} \pxkc@cval{hangul}{19} -%--------------------------------------- block tables - -%======================================= +%% Basic blocks +%B====================================== \pxkc@bval{1}{latn}{"0} {Basic Latin} \pxkc@bval{1}{latn1}{"80} {Latin-1 Supplement} \pxkc@bval{1}{latnA}{"100} {Latin Extended-A} @@ -202,6 +286,7 @@ \pxkc@bval{2}{lepc}{"1C00} {Lepcha} \pxkc@bval{2}{olck}{"1C50} {Ol Chiki} \pxkc@bval{2}{cyrlC}{"1C80} {Cyrillic Extended-C} +\pxkc@bval{3}{geor2}{"1C90} {Georgian Extended} \pxkc@bval{2}{sund1}{"1CC0} {Sundanese Supplement} \pxkc@bval{2}{sym38}{"1CD0} {Vedic Extensions} \pxkc@bval{1}{latn4}{"1D00} {Phonetic Extensions} @@ -341,7 +426,13 @@ \pxkc@bval{2}{phlp}{"10B80} {Psalter Pahlavi} \pxkc@bval{2}{orkh}{"10C00} {Old Turkic} \pxkc@bval{2}{hung}{"10C80} {Old Hungarian} +\pxkc@bval{3}{rohg}{"10D00} {Hanifi Rohingya} \pxkc@bval{2}{sym42}{"10E60} {Rumi Numeral Symbols} +\pxkc@bval{3}{yezi}{"10E80} {Yezidi} +\pxkc@bval{3}{sogo}{"10F00} {Old Sogdian} +\pxkc@bval{3}{sogd}{"10F30} {Sogdian} +\pxkc@bval{3}{chrs}{"10FB0} {Chorasmian} +\pxkc@bval{3}{elym}{"10FE0} {Elymaic} \pxkc@bval{2}{brah}{"11000} {Brahmi} \pxkc@bval{2}{kthi}{"11080} {Kaithi} \pxkc@bval{2}{sora}{"110D0} {Sora Sompeng} @@ -360,41 +451,58 @@ \pxkc@bval{2}{mong1}{"11660} {Mongolian Supplement} \pxkc@bval{2}{takr}{"11680} {Takri} \pxkc@bval{2}{ahom}{"11700} {Ahom} +\pxkc@bval{3}{dogr}{"11800} {Dogra} \pxkc@bval{2}{wara}{"118A0} {Warang Citi} +\pxkc@bval{3}{diak}{"11900} {Dives Akuru} +\pxkc@bval{3}{nand}{"119A0} {Nandinagari} \pxkc@bval{3}{zanb}{"11A00} {Zanabazar Square} \pxkc@bval{3}{soyo}{"11A50} {Soyombo} \pxkc@bval{2}{pauc}{"11AC0} {Pau Cin Hau} \pxkc@bval{2}{bhks}{"11C00} {Bhaiksuki} \pxkc@bval{2}{marc}{"11C70} {Marchen} \pxkc@bval{3}{gonm}{"11D00} {Masaram Gondi} +\pxkc@bval{3}{gong}{"11D60} {Gunjala Gondi} +\pxkc@bval{3}{maka}{"11EE0} {Makasar} +\pxkc@bval{3}{lisu1}{"11FB0} {Lisu Supplement} +\pxkc@bval{3}{taml1}{"11FC0} {Tamil Supplement} \pxkc@bval{1}{xsux}{"12000} {Cuneiform} \pxkc@bval{1}{xsux1}{"12400} {Cuneiform Numbers and Punctuation} \pxkc@bval{2}{xsux2}{"12480} {Early Dynastic Cuneiform} \pxkc@bval{2}{egyp}{"13000} {Egyptian Hieroglyphs} +\pxkc@bval{3}{egyp1}{"13430} {Egyptian Hieroglyph Format Controls} \pxkc@bval{2}{hluw}{"14400} {Anatolian Hieroglyphs} \pxkc@bval{2}{bamu1}{"16800} {Bamum Supplement} \pxkc@bval{2}{mroo}{"16A40} {Mro} \pxkc@bval{2}{bass}{"16AD0} {Bassa Vah} \pxkc@bval{2}{hmng}{"16B00} {Pahawh Hmong} +\pxkc@bval{3}{medf}{"16E40} {Medefaidrin} \pxkc@bval{2}{plrd}{"16F00} {Miao} \pxkc@bval{2}{cjk14}{"16FE0} {Ideographic Symbols and Punctuation} \pxkc@bval{2}{tang}{"17000} {Tangut} \pxkc@bval{2}{tang1}{"18800} {Tangut Components} +\pxkc@bval{3}{kits}{"18B00} {Khitan Small Script} +\pxkc@bval{3}{tang2}{"18D00} {Tangut Supplement} \pxkc@bval{2}{kana2}{"1B000} {Kana Supplement} \pxkc@bval{3}{kanaA}{"1B100} {Kana Extended-A} +\pxkc@bval{3}{kana3}{"1B130} {Small Kana Extension} \pxkc@bval{3}{nshu}{"1B170} {Nushu} \pxkc@bval{2}{dupl}{"1BC00} {Duployan} \pxkc@bval{2}{sym53}{"1BCA0} {Shorthand Format Controls} \pxkc@bval{1}{sym32}{"1D000} {Byzantine Musical Symbols} \pxkc@bval{1}{sym33}{"1D100} {Musical Symbols} \pxkc@bval{1}{sym34}{"1D200} {Ancient Greek Musical Notation} +\pxkc@bval{3}{sym58}{"1D2E0} {Mayan Numerals} \pxkc@bval{1}{sym35}{"1D300} {Tai Xuan Jing Symbols} \pxkc@bval{1}{sym36}{"1D360} {Counting Rod Numerals} \pxkc@bval{1}{sym37}{"1D400} {Mathematical Alphanumeric Symbols} \pxkc@bval{2}{sgnw}{"1D800} {Sutton SignWriting} \pxkc@bval{2}{glag1}{"1E000} {Glagolitic Supplement} +\pxkc@bval{3}{hmnp}{"1E100} {Nyiakeng Puachue Hmong} +\pxkc@bval{3}{wcho}{"1E2C0} {Wancho} \pxkc@bval{2}{mend}{"1E800} {Mende Kikakui} \pxkc@bval{2}{adlm}{"1E900} {Adlam} +\pxkc@bval{3}{sym59}{"1EC70} {Indic Siyaq Numbers} +\pxkc@bval{3}{sym61}{"1ED00} {Ottoman Siyaq Numbers} \pxkc@bval{2}{sym51}{"1EE00} {Arabic Mathematical Alphabetic Symbols} \pxkc@bval{2}{sym43}{"1F000} {Mahjong Tiles} \pxkc@bval{2}{sym44}{"1F030} {Domino Tiles} @@ -409,17 +517,22 @@ \pxkc@bval{2}{sym55}{"1F780} {Geometric Shapes Extended} \pxkc@bval{2}{sym56}{"1F800} {Supplemental Arrows-C} \pxkc@bval{2}{sym57}{"1F900} {Supplemental Symbols and Pictographs} +\pxkc@bval{3}{sym60}{"1FA00} {Chess Symbols} +\pxkc@bval{3}{sym62}{"1FA70} {Symbols and Pictographs Extended-A} +\pxkc@bval{3}{sym63}{"1FB00} {Symbols for Legacy Computing} \pxkc@bval{1}{haniB}{"20000} {CJK Unified Ideographs Extension B} \pxkc@bval{2}{haniC}{"2A700} {CJK Unified Ideographs Extension C} \pxkc@bval{2}{haniD}{"2B740} {CJK Unified Ideographs Extension D} \pxkc@bval{2}{haniE}{"2B820} {CJK Unified Ideographs Extension E} \pxkc@bval{3}{haniF}{"2CEB0} {CJK Unified Ideographs Extension F} \pxkc@bval{1}{hani2}{"2F800} {CJK Compatibility Ideographs Supplement} +\pxkc@bval{3}{haniG}{"30000} {CJK Unified Ideographs Extension G} \pxkc@bval{1}{spc07}{"E0000} {Tags} \pxkc@bval{1}{spc08}{"E0100} {Variation Selectors Supplement} \pxkc@bval{1}{spc09}{"F0000} {Supplementary Private Use Area-A} \pxkc@bval{1}{spc10}{"100000} {Supplementary Private Use Area-B} %======================================= +%% Block subdivisions \ifnum\pxkc@ccv<2 \else \pxkc@gval{cjk12}{cjk1a,cjk1b,cjk1c}{Halfwidth and Fullwidth Forms} \pxkc@bval{0}{cjk1a}{"FF01}{Halfwidth and Fullwidth Forms/Other} @@ -431,9 +544,16 @@ \pxkc@bval{0}{latnx}{"00A0}{Latin-1 Supplement/Other} \pxkc@bval{0}{latny}{"00C0}{Latin-1 Supplement/Latin} \fi - % -\edef\pxkc@foreachblk{\noexpand\@for\noexpand\x:={\pxkc@bslst}} -\let\pxkc@bval\relax\let\pxkc@cval\relax\let\pxkc@bslst\relax + +%% \pxkc@foreach@blocks +\edef\pxkc@foreach@blocks{% + \noexpand\@for\noexpand\pxkc@blk:={\pxkc@bslst}} + +%% clean up +\let\pxkc@bval\relax +\let\pxkc@cval\relax +\let\pxkc@gval\relax +\let\pxkc@bslst\relax %--------------------------------------- public interfaces @@ -442,75 +562,86 @@ % Here <block> is given as a block name or a single character in the % block to be specified; <category> is given as a category name or % a number ranged in 15--19. -\def\cjkcategory{% - \bgroup\forcecjktoken\pxkc@cjkcategory@oa} -\def\pxkc@cjkcategory@oa#1{% - \gdef\pxkc@nxt{\pxkc@cjkcategory@ob{#1}}% - \egroup\pxkc@nxt} -\def\pxkc@cjkcategory@ob#1#2{% - \ifnum2<1#2 \edef\pxkc@arg{#2}% - \else\@ifundefined{pxkc@C@@#2}% - {\pxkc@err@ivcsy{#2}\def\pxkc@arg{18}}% - {\edef\pxkc@arg{\@nameuse{pxkc@C@@#2}}}\fi +\newcommand*\cjkcategory{% + \begingroup + \forcecjktoken + \expandafter\endgroup\pxkc@cjkcategory@}% read args +\def\pxkc@cjkcategory@#1#2{% + \ifnum2<1#2 % <category> is a number + \edef\pxkc@arg{#2}% + \else + \@ifundefined{pxkc@C@@#2}{% + \pxkc@err@ivcsy{#2}\def\pxkc@arg{18}% + }{%else + \edef\pxkc@arg{\@nameuse{pxkc@C@@#2}}% + }% + \fi \pxkc@cjkcategory@a{#1}} -\chardef\pxkc@la="7F -\def\pxkc@cjkcategory@a#1{% - \@for\pxkc@x:={#1}\do{% - \expandafter\pxkc@cjkcategory@b\expandafter{\pxkc@x}}} +\def\pxkc@cjkcategory@a#1{%{<block>} + \@for\pxkc@blk:={#1}\do{% + \expandafter\pxkc@cjkcategory@b\expandafter{\pxkc@blk}}} \def\pxkc@cjkcategory@b#1{% - \pxkc@chkchr{#1}\ifnum\pxkc@cc>\pxkc@la - \pxkc@kcatcode{\pxkc@cc}{\pxkc@arg}% + \pxkc@get@cp{#1}\ifnum\pxkc@cp>"7F + \pxkc@kcatcode{\pxkc@cp}{\pxkc@arg}% FIXME: consider group \else - \pxkc@cjkcategory@c{#1}% + \edef\pxkc@blk{#1}% + \pxkc@set@cjkcategory \fi} -\def\pxkc@cjkcategory@c#1{% - \pxkc@letcs\pxkc@grp{pxkc@G@@#1}% - \ifx\pxkc@grp\relax - \pxkc@letcs\pxkc@blk{pxkc@B@@#1}% - \ifx\pxkc@blk\relax - \pxkc@err@ivbsy{#1}% - \else\ifnum\pxkc@blk<\z@ - \ifpxkc@warn@defunct \pxkc@warn@dfblk{#1}\fi + +%% \pxkc@set@cjkcategory +% Sees \pxkc@blk and \pxkc@arg. +\def\pxkc@set@cjkcategory{% + \pxkc@letcs\pxkc@tmpa{pxkc@G@@\pxkc@blk}% + \ifx\pxkc@tmpa\relax + \pxkc@letcs\pxkc@cp{pxkc@B@@\pxkc@blk}% + \ifx\pxkc@cp\relax + \pxkc@err@ivbsy{\pxkc@blk}% + \else\ifnum\pxkc@cp<\z@ % defunct + \ifpxkc@warn@defunct \pxkc@warn@dfblk{\pxkc@blk}\fi \else - \pxkc@kcatcode{\pxkc@blk}{\pxkc@arg}% + \pxkc@kcatcode{\pxkc@cp}{\pxkc@arg}% \fi\fi \else - \pxkc@expanded{\noexpand\pxkc@cjkcategory@a{\pxkc@grp}}% + \pxkc@expanded{\noexpand\pxkc@cjkcategory@a{\pxkc@tmpa}}% \fi} %%<*> \pxkc@cjkcategory{<block>}{<kcatcode>} -%%<*> \pxkc@cjkcategory@mccv{<mccv>}{<block>}{<kcatcode>} -% Another entry point for internal use. +%%<*> \pxkc@cjkcategory@mccv{<minmccv>}{<maxmccv>}{<block>}{<kcatcode>} +% Other entry points for internal use. \def\pxkc@cjkcategory#1#2{% - \edef\pxkc@arg{#2}% - \pxkc@cjkcategory@c{#1}} + \def\pxkc@blk{#1}\edef\pxkc@arg{#2}% + \pxkc@set@cjkcategory} \def\pxkc@cjkcategory@mccv#1#2#3#4{% \ifnum#1>\pxkc@mccv\else \ifnum#2<\pxkc@mccv\else \pxkc@cjkcategory{#3}{#4}% \fi\fi} -%% \pxkc@chkchr{<arg>} -\def\pxkc@chkchr#1{% - \afterassignment\pxkc@chkchr@a\chardef\pxkc@cc=`#1?\relax} -\def\pxkc@chkchr@a#1\relax{} +%% \pxkc@get@cp{<arg>} +\def\pxkc@get@cp#1{% + \afterassignment\pxkc@get@cp@a\chardef\pxkc@cp=`#1?\pxkc@mk} +\def\pxkc@get@cp@a#1\pxkc@mk{} %%<*> \cjkcategorymode{<mode>} % Invokes the cjk-category mode <mode>. -\def\cjkcategorymode#1{% - \pxkc@letcs\pxkc@nxt{pxkc@M@@#1}% - \ifx\pxkc@nxt\relax - \pxkc@err@ivmsy +\newcommand*\cjkcategorymode[1]{% + \pxkc@letcs\pxkc@next{pxkc@M@@#1}% + \ifx\pxkc@next\relax + \pxkc@err@ivmsy{#1}% \else \pxkc@warn@defunctfalse - \pxkc@nxt + \pxkc@next \pxkc@warn@defuncttrue \fi} %--------------------------------------- CJK category modes -%% Invariant blocks +%% variables +\let\pxkc@cat\relax +\let\pxkc@base@cat\relax + +%% \[pxkc@K@@<block>] : Invariant blocks \def\do#1#2{\expandafter\chardef\csname pxkc@K@@#1\endcsname=#2 } -%======================================= +%C====================================== \do{latn} {15} % Basic Latin \do{hang1} {19} % Hangul Jamo \do{sym15} {18} % Enclosed Alphanumerics @@ -546,8 +677,11 @@ \do{cjk14} {18} % Ideographic Symbols and Punctuation \do{tang} {18} % Tangut \do{tang1} {18} % Tangut Components +\do{kits} {18} % Khitan Small Script +\do{tang2} {18} % Tangut Supplement \do{kana2} {17} % Kana Supplement \do{kanaA} {17} % Kana Extended-A +\do{kana3} {17} % Small Kana Extension \do{nshu} {18} % Nushu \do{sym45} {18} % Enclosed Alphanumeric Supplement \do{cjk13} {18} % Enclosed Ideographic Supplement @@ -557,23 +691,24 @@ \do{haniE} {16} % CJK Unified Ideographs Extension E \do{haniF} {16} % CJK Unified Ideographs Extension F \do{hani2} {16} % CJK Compatibility Ideographs Supplement +\do{haniG} {16} % CJK Unified Ideographs Extension G %======================================= -%%%% cjkcategory modes -\def\pxkc@resetcjkcat#1{% +%% \pxkc@reset@all{<kcatcode>} +\def\pxkc@reset@all#1{% \chardef\pxkc@base@cat=#1\relax - \pxkc@foreachblk\do{% - \pxkc@letcs\pxkc@cat{pxkc@K@@\x}% + \pxkc@foreach@blocks\do{% + \pxkc@letcs\pxkc@cat{pxkc@K@@\pxkc@blk}% \ifx\pxkc@cat\relax \let\pxkc@cat\pxkc@base@cat \fi - \pxkc@kcatcode{\@nameuse{pxkc@B@@\x}}{\pxkc@cat}}% + \pxkc@kcatcode{\@nameuse{pxkc@B@@\pxkc@blk}}{\pxkc@cat}}% \ifnum\pxkc@mccv<2 \pxkc@cjkcategory{cjk12}{18}% \fi} -%======================================= +%P====================================== %% 'forcecjk' \def\pxkc@M@@forcecjk{% - \pxkc@resetcjkcat{18}% + \pxkc@reset@all{18}% } %% 'prefercjk' \def\pxkc@M@@prefercjk{% @@ -627,7 +762,7 @@ } %% 'prefernoncjk' \def\pxkc@M@@prefernoncjk{% - \pxkc@resetcjkcat{15}% + \pxkc@reset@all{15}% } %======================================= %% 'default' @@ -637,64 +772,110 @@ \pxkc@cjkcategory@mccv{3}{3}{latnA}{15}% } -%%%% \showcjkcategory -\def\showcjkcategory{% - \pxkc@foreachblk\do{% - \expandafter\ifx\csname pxkc@G@@\x\endcsname\relax - \typeout{\x\space= \the\kcatcode\@nameuse{pxkc@B@@\x}}% - \fi}} +%--------------------------------------- miscellaneous accessories -%%-------- \withcjktokendisabled, etc. +%%<*> \showcjkcategory +\newcommand*\showcjkcategory{% + \pxkc@foreach@blocks\do{% + \@ifundefined{pxkc@B@@\pxkc@blk}{}{%else + \typeout{\pxkc@blk\space= \the\kcatcode\@nameuse{pxkc@B@@\pxkc@blk}}% + }}} -%% \pxkc@genprobe -\def\pxkc@genprobe{% +%--------------------------------------- get current cjktoken state + +%% variables +\let\pxkc@ctmode\relax + +\ifx\currentcjktoken\@undefined %<*!e-pTeX> + +%% \pxkc@make@probe +\def\pxkc@make@probe{% \edef\pxkc@tmpa{\expandafter\string\csname pxkc@@\string ^^e3\string ^^81\string ^^82% \string ^^e3\string ^^82\string ^^a2\endcsname}} -\bgroup \kcatcode"3040=15\kcatcode"30A0=18 - \disablecjktoken\pxkc@genprobe \global\let\pxkc@prb@d\pxkc@tmpa - \enablecjktoken\pxkc@genprobe \global\let\pxkc@prb@e\pxkc@tmpa - \forcecjktoken\pxkc@genprobe \global\let\pxkc@prb@f\pxkc@tmpa -\egroup - -%% \pxkc@getcjktokmod\CS -\def\pxkc@getcjktokmod#1{% - \bgroup \kcatcode"3040=15\kcatcode"30A0=18\pxkc@genprobe +\begingroup \kcatcode"3040=15 \kcatcode"30A0=18 + \disablecjktoken\pxkc@make@probe \global\let\pxkc@prb@d\pxkc@tmpa + \enablecjktoken\pxkc@make@probe \global\let\pxkc@prb@e\pxkc@tmpa + \forcecjktoken\pxkc@make@probe \global\let\pxkc@prb@f\pxkc@tmpa +\endgroup + +%% \pxkc@get@cjktoken@mode\CS +\def\pxkc@get@cjktoken@mode#1{% + \begingroup + \kcatcode"3040=15 \kcatcode"30A0=18 \pxkc@make@probe \ifx\pxkc@tmpa\pxkc@prb@d \global\chardef\pxkc@gtmpa\z@ \else\ifx\pxkc@tmpa\pxkc@prb@e \global\chardef\pxkc@gtmpa\@ne \else\ifx\pxkc@tmpa\pxkc@prb@f \global\chardef\pxkc@gtmpa\tw@ - \else \global\let\pxkc@gtmpa\m@ne \fi\fi\fi - \egroup \let#1\pxkc@gtmpa} + \else \global\chardef\pxkc@gtmpa\@cclv + \fi\fi\fi + \endgroup + \let#1\pxkc@gtmpa} + +% The method does not work on new upTeX, but running LaTeX +% on new upTeX without e-TeX is highly improbable.... +\ifx\pxkc@prb@d\pxkc@prb@e + \def\pxkc@get@cjktoken@mode#1{% + \chardef#1\@cclv} % always fail +\fi + +\else %<*e-pTeX> + +\def\pxkc@get@cjktoken@mode#1{% + \chardef#1\ifcase\currentcjktoken + \@ne \or \z@ \or \tw@ \or \@cclv + \fi} + +\fi %</e-pTeX> -%%<+> \getcjktokenmode +%%<*> \getcjktokenmode % Returns the value showing current mode to \thecjktokenmode % 0: \disablecjktoken % 1: \enablecjktoken % 2: \forcecjktoken -\def\getcjktokenmode{\pxkc@getcjktokmod\thecjktokenmode} - -%%<*> \setcjktokenmode{<val>} -\def\pxkc@setcjktokmod#1{% - \ifcase#1\disablecjktoken\or\enablecjktoken\or\forcecjktoken\fi} +% 255: failure +\newcommand*\getcjktokenmode{% + \pxkc@get@cjktoken@mode\thecjktokenmode} + +%%<*> \setcjktokenmode{<value>} +\newcommand*\setcjktokenmode[1]{% + \ifcase#1\disablecjktoken + \or \enablecjktoken + \or \forcecjktoken + \fi} %%<*> \withcjktokendisabled, etc. -\def\withcjktokendisabled{\pxkc@withcjktokmod\disablecjktoken\@iden} -\def\withcjktokenenabled{\pxkc@withcjktokmod\enablecjktoken\@iden} -\def\withcjktokenforced{\pxkc@withcjktokmod\forcecjktoken\@iden} -\def\withcjktokendisabledex{\pxkc@withcjktokmod\disablecjktoken} -\def\withcjktokenenabledex{\pxkc@withcjktokmod\enablecjktoken} -\def\withcjktokenforcedex{\pxkc@withcjktokmod\forcecjktoken} -\def\pxkc@withcjktokmod#1{% - \pxkc@getcjktokmod\pxkc@tokmod #1\pxkc@withcjktokmod@a} -\def\pxkc@withcjktokmod@a#1#2{% - #1{#2}\pxkc@setcjktokmod\pxkc@tokmod} - -%%------ initial setup - -\ifx\pxkc@ccmode\relax\else -\cjkcategorymode{\pxkc@ccmode} +\newcommand*\withcjktokendisabled{% + \pxkc@with@cjktoken@mode\disablecjktoken\@iden} +\newcommand*\withcjktokenenabled{% + \pxkc@with@cjktoken@mode\enablecjktoken\@iden} +\newcommand*\withcjktokenforced{% + \pxkc@with@cjktoken@mode\forcecjktoken\@iden} +\newcommand*\withcjktokendisabledex{% + \pxkc@with@cjktoken@mode\disablecjktoken} +\newcommand*\withcjktokenenabledex{% + \pxkc@with@cjktoken@mode\enablecjktoken} +\newcommand*\withcjktokenforcedex{% + \pxkc@with@cjktoken@mode\forcecjktoken} +\def\pxkc@with@cjktoken@mode#1{% + \pxkc@get@cjktoken@mode\pxkc@ctmode + \ifnum\pxkc@ctmode=\@cclv \pxkc@with@cjktoken@mode@b \fi + #1% + \pxkc@with@cjktoken@mode@a} +\def\pxkc@with@cjktoken@mode@a#1#2{% + #1{#2}% + \setcjktokenmode\pxkc@ctmode} +\def\pxkc@with@cjktoken@mode@b{% + \global\let\pxkc@with@cjktoken@mode@b\relax + \PackageWarning\pxkc@pkgname + {Failed in getting current cjktoken mode,\MessageBreak + reported}} + +%--------------------------------------- initial setup + +\ifx\pxkc@ccmode@opt\relax\else + \cjkcategorymode{\pxkc@ccmode@opt} \fi -%%------ all done +%--------------------------------------- all done \endinput %% EOF diff --git a/macros/latex/contrib/pxcjkcat/pxcjkcat.tex b/macros/latex/contrib/pxcjkcat/pxcjkcat.tex index cb63c6ff79..4173f25a44 100644 --- a/macros/latex/contrib/pxcjkcat/pxcjkcat.tex +++ b/macros/latex/contrib/pxcjkcat/pxcjkcat.tex @@ -1,20 +1,26 @@ % upLaTeX 文書; 文字コードは UTF-8 \documentclass[uplatex,dvipdfmx,a4paper]{jsarticle} +\renewcommand{\headfont}{\gtfamily\romanseries{sbc}\sffamily} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{geometry} \usepackage{xcolor} \usepackage[colorlinks,hyperfootnotes=false]{hyperref} \usepackage{pxjahyper} -\hypersetup{linkcolor=blue!75!black,urlcolor=green!45!black} +\hypersetup{linkcolor=blue!75!black,urlcolor=green!45!black, + pdftitle={pxcjkcatパッケージ}, + pdfauthor={八登崇之}} +\usepackage{bxtexlogo} +\bxtexlogoimport{*} +\usepackage[verb]{bxghost} \usepackage{shortvrb} \MakeShortVerb{\|} \usepackage{verbatim} \newenvironment{myverbatim} {\quote\small\verbatim} {\endverbatim\endquote} -\newcommand{\PkgVersion}{1.1} -\newcommand{\PkgDate}{2018/04/01} +\newcommand{\PkgVersion}{1.2} +\newcommand{\PkgDate}{2022/05/25} \newcommand{\Pkg}[1]{\textsf{#1}} \newcommand{\Meta}[1]{$\langle$\mbox{}#1\mbox{}$\rangle$} \newcommand{\Note}{\par\noindent ※} @@ -22,10 +28,6 @@ \newcommand{\strong}{\textsf} \newcommand{\wbr}{\linebreak[0]} \newcommand{\Code}[1]{{\usefont{T1}{lmtt}{l}{n}#1}} -\providecommand{\pTeX}{p\TeX} -\providecommand{\upTeX}{u\pTeX} -\providecommand{\pLaTeX}{p\LaTeX} -\providecommand{\upLaTeX}{u\pLaTeX} %----------------------------------------------------------- \begin{document} \title{\Pkg{pxcjkcat} パッケージ} @@ -52,19 +54,30 @@ オプションとして以下のものが指定できる。 \begin{itemize} -\item |ccv1|\Means - 「モードCCV」を1({\upTeX} v0.11~0.28と互換)とする。 -\item |ccv2|\Means - 「モードCCV」を2({\upTeX} v0.29~1.22と互換)とする。 -\item |ccv3|\Means - 「モードCCV」を3({\upTeX} v1.23以降と互換)とする。 -\item |ccv+|\Means - 「モードCCV」をエンジンの実のCCVと一致させる。 - \Note 「モードCCV」については\ref{sec:CCV}節を参照。 -\item |\cjkcategorymode| \strong{命令で有効なモード値}\Means +\item \strong{モードCCV指定}\Means + \<「モードCCV」の値を指定するオプション。 + \Note モードCCVについては\ref{sec:CCV}節を参照。 + \Note モードCCVの既定値は1であり、 + これは極めて古い版と互換にすることを意味する。 + モード設定(|prefernoncjk|等)を利用する場合には、 + 適切なモードCCVのオプションを指定するのが望ましい。 + \begin{itemize} + \item |ccv1|\Means + モードCCVを1({\upTeX} v0.11~0.28と互換)とする。 + \strong{既定値。} + \item |ccv2|\Means + モードCCVを2({\upTeX} v0.29~1.22と互換)とする。 + \item |ccv3|\Means + モードCCVを3({\upTeX} v1.23以降と互換)とする。 + \item |real|または|ccv+|\Means + モードCCVをエンジンの実のCCVと一致させる。 + \end{itemize} +\item |\cjkcategorymode|\strong{命令で有効なモード値}\Means 和文カテゴリがモードに従って設定される。 \Note モード値オプションが非指定の場合は、パッケージ読込時に 和文カテゴリが変更されることはない。 +\item |nomode|\Means + モード値オプションの効果を打ち消す。 \end{itemize} %=========================================================== @@ -82,6 +95,8 @@ %\item ブロック名 \item 非ASCII文字1つ\Means その文字の属するブロックを指す。 + \Note 文字による指定は「{\upTeX}の版によるブロック分割の差異」に + 影響されることに注意。 %\item 整数値\Means % その符号位置の属するブロックを指す。 \end{itemize} @@ -98,6 +113,7 @@ \end{itemize} 和文カテゴリの変更は局所的(グルーピングに従う)である。 + \Note モードCCVの指定は|\cjkcategory|の動作には影響を与えない。 \item |\cjkcategorymode{|\Meta{モード}|}|\Means 全てのブロックの和文カテゴリの一括設定(モード設定)を行う。 @@ -108,15 +124,17 @@ \begin{itemize} \item |forcecjk|\Means ASCII文字のみ欧文扱いで他のブロックは全て和文扱い - (|noncjk| 以外)とする。 + (|noncjk|以外)とする。 和文フォントの中のUnicode値の割当がある全ての文字を 和文文字として直接用いることができる。 \item |default|\Means 指定のモードCCVにおける既定の設定と一致させる。 - \Note モードCCVが2以下の場合は |forcecjk| と同一の設定になる。 - \Note モードCCVがエンジンの実のCCVと一致する場合 - (|ccv+| オプション指定の場合を含む)は、 - エンジンの既定の設定と一致する。 + \Note モードCCVが2以下の場合は|forcecjk|と同一の設定になる。 + %\Note モードCCVがエンジンの実のCCVと一致する場合は、 + % エンジンの既定の設定と一致する。 + \Note モードCCVが3の場合の\strong{仕様は未確定}である。 + 現状の動作は「v1.23の既定設定と一致させる」となっているが、 + この動作は\strong{将来変更される可能性がある}。 \item |prefercjk|\Means 和文扱いのブロックとして、「CJK中核セット」のものに加えて、 「Adobeの定めるCJK文字集合 @@ -124,7 +142,7 @@ の何れかと共通部分をもつ文字ブロック」を加えて、 残りを欧文扱いに設定する。 \item |prefercjkvar|\Means - |prefercjk| において、ギリシャ・キリル文字の + |prefercjk|において、ギリシャ・キリル文字の ブロックを欧文扱いに変更したもの。 \item |japanese|\Means 和文扱いのブロックとして、「CJK中核セット」のものに加えて、 @@ -132,7 +150,7 @@ の何れかと共通部分をもつ文字ブロック」を加えて、 残りを欧文扱いに設定する。 \item |japanesevar|\Means - |japanese| において、ギリシャ・キリル文字の + |japanese|において、ギリシャ・キリル文字の ブロックを欧文扱いに変更したもの。 \item |prefernoncjk|\Means 「CJK中核セット」のブロックのみを和文扱いとし、 @@ -141,13 +159,13 @@ ここで「CJK中核セット」の内容は以下のとおりである。 \begin{itemize} - \item 漢字・部首・注音字母\Means |kanji| に設定。 - \item ひらがな・カタカナ\Means |kana| に設定。 + \item 漢字・部首・注音字母\Means |kanji|に設定。 + \item ひらがな・カタカナ\Means |kana|に設定。 \item CJK記号の一部・全角半角互換形・彝文字 - ・西夏文字・女書文字\Means |cjk| に設定 - \footnote{モードCCVが2の場合、|cjk12| の再分割の - 中の |cjk1b|、|cjk1c| は |kana| に変更される。}。 - \item ハングル完成形・ハングル字母\Means |hangul| に設定。 + ・西夏文字・女書文字・契丹文字\Means |cjk|に設定。 + \Note モードCCVが2以上の場合、|cjk12|の再分割の|cjk1b|、 + |cjk1c|は|kana|に設定される。 + \item ハングル完成形・ハングル字母\Means |hangul|に設定。 \end{itemize} \Note 各モードでの具体的な設定値については\ref{sec:Values}節を参照。 @@ -157,6 +175,14 @@ \section{文字分類バージョン(CCV)} \label{sec:CCV} +\noindent \strong{注意}\Means +この節に述べられている説明は現状の仕様と食い違っている部分があり、 +大幅な改訂が必要な状態である。 +現状の仕様では、モードCCVの影響を受けるのはモード設定の定義のみであり、 +ブロック分割は常に実際のエンジンのものに一致させている。 + +\bigskip + {\upTeX}エンジンでの文字ブロックの分割および各ブロックの 和文カテゴリの既定値は改版時に変更され、 これが互換性の問題を起こす可能性がある。 @@ -236,18 +262,19 @@ \subsection{Unicodeブロックの一覧} 以下は、Unicodeが定めるブロックと直接に対応するブロックの一覧である。 -この表の「ブロックID」の欄が、|\cjkcategory| 命令で指定する +この表の「ブロックID」の欄が、|\cjkcategory|命令で指定する ブロックIDを示す。 -「CCV」の欄は、そのブロックがサポートされるモードCCVの +「CCV」の欄は、そのブロックがサポートされる実CCVの 範囲の下限を表す。 -\footnote{ここで示すサポート範囲は「必要条件」であることに注意。 - 先述の通り、エンジンの改版でブロックが(分割変更でなく) - 新規追加された場合には以前のCCVの値を引き継ぐ。 - このため、サポート範囲が「2」のブロックは、 - モードCCVが2であっても“実際には使えない”可能性がある。 - (モードCCVが3以上なら必ず使えて、1なら必ず使えない。) - “実際には使えない”ブロックに設定を試みた場合は、 - 警告が出て設定が無視される。} +\footnote{これは参考情報であり、現状の仕様ではあまり意味をもたない。} +%\footnote{ここで示すサポート範囲は「必要条件」であることに注意。 +% 先述の通り、エンジンの改版でブロックが(分割変更でなく) +% 新規追加された場合には以前のCCVの値を引き継ぐ。 +% このため、サポート範囲が「2」のブロックは、 +% モードCCVが2であっても“実際には使えない”可能性がある。 +% (モードCCVが3以上なら必ず使えて、1なら必ず使えない。) +% “実際には使えない”ブロックに設定を試みた場合は、 +% 警告が出て設定が無視される。} \begin{quote} \renewcommand{\baselinestretch}{0.9}\small @@ -258,9 +285,8 @@ ~~~\makebox[3em][r]{\Code{#2}}\hspace*{1em}\ignorespaces} \newcommand*\xN[1]{#1} \hspace*{-1em}%header-line -\makebox[5em][l]{ブロック\mbox{}ID}\makebox[2em][c]{CCV}% +\makebox[5em][l]{ブロック\mbox{}ID}\makebox[2em][c]{~~CCV}% \makebox[10em][c]{符号値範囲}\makebox{ブロック名称}\par -\xI{latn} \xV{1} \xR {0000} {007F} \xN{Basic Latin}\par %///////////////////////////// \xI{latn} \xV{1} \xR {0000} {007F} \xN{Basic Latin}\par \xI{latn1} \xV{1} \xR {0080} {00FF} \xN{Latin-1 Supplement}\par @@ -325,6 +351,7 @@ \xI{lepc} \xV{2} \xR {1C00} {1C4F} \xN{Lepcha}\par \xI{olck} \xV{2} \xR {1C50} {1C7F} \xN{Ol Chiki}\par \xI{cyrlC} \xV{2} \xR {1C80} {1C8F} \xN{Cyrillic Extended-C}\par +\xI{geor2} \xV{3} \xR {1C90} {1CBF} \xN{Georgian Extended}\par \xI{sund1} \xV{2} \xR {1CC0} {1CCF} \xN{Sundanese Supplement}\par \xI{sym38} \xV{2} \xR {1CD0} {1CFF} \xN{Vedic Extensions}\par \xI{latn4} \xV{1} \xR {1D00} {1D7F} \xN{Phonetic Extensions}\par @@ -464,7 +491,13 @@ \xI{phlp} \xV{2} \xR {10B80} {10BAF} \xN{Psalter Pahlavi}\par \xI{orkh} \xV{2} \xR {10C00} {10C4F} \xN{Old Turkic}\par \xI{hung} \xV{2} \xR {10C80} {10CFF} \xN{Old Hungarian}\par +\xI{rohg} \xV{3} \xR {10D00} {10D3F} \xN{Hanifi Rohingya}\par \xI{sym42} \xV{2} \xR {10E60} {10E7F} \xN{Rumi Numeral Symbols}\par +\xI{yezi} \xV{3} \xR {10E80} {10EBF} \xN{Yezidi}\par +\xI{sogo} \xV{3} \xR {10F00} {10F2F} \xN{Old Sogdian}\par +\xI{sogd} \xV{3} \xR {10F30} {10F6F} \xN{Sogdian}\par +\xI{chrs} \xV{3} \xR {10FB0} {10FDF} \xN{Chorasmian}\par +\xI{elym} \xV{3} \xR {10FE0} {10FFF} \xN{Elymaic}\par \xI{brah} \xV{2} \xR {11000} {1107F} \xN{Brahmi}\par \xI{kthi} \xV{2} \xR {11080} {110CF} \xN{Kaithi}\par \xI{sora} \xV{2} \xR {110D0} {110FF} \xN{Sora Sompeng}\par @@ -482,42 +515,59 @@ \xI{modi} \xV{2} \xR {11600} {1165F} \xN{Modi}\par \xI{mong1} \xV{2} \xR {11660} {1167F} \xN{Mongolian Supplement}\par \xI{takr} \xV{2} \xR {11680} {116CF} \xN{Takri}\par -\xI{ahom} \xV{2} \xR {11700} {1173F} \xN{Ahom}\par +\xI{ahom} \xV{2} \xR {11700} {1174F} \xN{Ahom}\par +\xI{dogr} \xV{3} \xR {11800} {1184F} \xN{Dogra}\par \xI{wara} \xV{2} \xR {118A0} {118FF} \xN{Warang Citi}\par +\xI{diak} \xV{3} \xR {11900} {1195F} \xN{Dives Akuru}\par +\xI{nand} \xV{3} \xR {119A0} {119FF} \xN{Nandinagari}\par \xI{zanb} \xV{3} \xR {11A00} {11A4F} \xN{Zanabazar Square}\par \xI{soyo} \xV{3} \xR {11A50} {11AAF} \xN{Soyombo}\par \xI{pauc} \xV{2} \xR {11AC0} {11AFF} \xN{Pau Cin Hau}\par \xI{bhks} \xV{2} \xR {11C00} {11C6F} \xN{Bhaiksuki}\par \xI{marc} \xV{2} \xR {11C70} {11CBF} \xN{Marchen}\par \xI{gonm} \xV{3} \xR {11D00} {11D5F} \xN{Masaram Gondi}\par +\xI{gong} \xV{3} \xR {11D60} {11DAF} \xN{Gunjala Gondi}\par +\xI{maka} \xV{3} \xR {11EE0} {11EFF} \xN{Makasar}\par +\xI{lisu1} \xV{3} \xR {11FB0} {11FBF} \xN{Lisu Supplement}\par +\xI{taml1} \xV{3} \xR {11FC0} {11FFF} \xN{Tamil Supplement}\par \xI{xsux} \xV{1} \xR {12000} {123FF} \xN{Cuneiform}\par \xI{xsux1} \xV{1} \xR {12400} {1247F} \xN{Cuneiform Numbers and Punctuation}\par \xI{xsux2} \xV{2} \xR {12480} {1254F} \xN{Early Dynastic Cuneiform}\par \xI{egyp} \xV{2} \xR {13000} {1342F} \xN{Egyptian Hieroglyphs}\par +\xI{egyp1} \xV{3} \xR {13430} {1343F} \xN{Egyptian Hieroglyph Format Controls}\par \xI{hluw} \xV{2} \xR {14400} {1467F} \xN{Anatolian Hieroglyphs}\par \xI{bamu1} \xV{2} \xR {16800} {16A3F} \xN{Bamum Supplement}\par \xI{mroo} \xV{2} \xR {16A40} {16A6F} \xN{Mro}\par \xI{bass} \xV{2} \xR {16AD0} {16AFF} \xN{Bassa Vah}\par \xI{hmng} \xV{2} \xR {16B00} {16B8F} \xN{Pahawh Hmong}\par +\xI{medf} \xV{3} \xR {16E40} {16E9F} \xN{Medefaidrin}\par \xI{plrd} \xV{2} \xR {16F00} {16F9F} \xN{Miao}\par \xI{cjk14} \xV{2} \xR {16FE0} {16FFF} \xN{Ideographic Symbols and Punctuation}\par \xI{tang} \xV{2} \xR {17000} {187FF} \xN{Tangut}\par \xI{tang1} \xV{2} \xR {18800} {18AFF} \xN{Tangut Components}\par +\xI{kits} \xV{3} \xR {18B00} {18CFF} \xN{Khitan Small Script}\par +\xI{tang2} \xV{3} \xR {18D00} {18D7F} \xN{Tangut Supplement}\par \xI{kana2} \xV{2} \xR {1B000} {1B0FF} \xN{Kana Supplement}\par \xI{kanaA} \xV{3} \xR {1B100} {1B12F} \xN{Kana Extended-A}\par +\xI{kana3} \xV{3} \xR {1B130} {1B16F} \xN{Small Kana Extension}\par \xI{nshu} \xV{3} \xR {1B170} {1B2FF} \xN{Nushu}\par \xI{dupl} \xV{2} \xR {1BC00} {1BC9F} \xN{Duployan}\par \xI{sym53} \xV{2} \xR {1BCA0} {1BCAF} \xN{Shorthand Format Controls}\par \xI{sym32} \xV{1} \xR {1D000} {1D0FF} \xN{Byzantine Musical Symbols}\par \xI{sym33} \xV{1} \xR {1D100} {1D1FF} \xN{Musical Symbols}\par \xI{sym34} \xV{1} \xR {1D200} {1D24F} \xN{Ancient Greek Musical Notation}\par +\xI{sym58} \xV{3} \xR {1D2E0} {1D2FF} \xN{Mayan Numerals}\par \xI{sym35} \xV{1} \xR {1D300} {1D35F} \xN{Tai Xuan Jing Symbols}\par \xI{sym36} \xV{1} \xR {1D360} {1D37F} \xN{Counting Rod Numerals}\par \xI{sym37} \xV{1} \xR {1D400} {1D7FF} \xN{Mathematical Alphanumeric Symbols}\par \xI{sgnw} \xV{2} \xR {1D800} {1DAAF} \xN{Sutton SignWriting}\par \xI{glag1} \xV{2} \xR {1E000} {1E02F} \xN{Glagolitic Supplement}\par +\xI{hmnp} \xV{3} \xR {1E100} {1E14F} \xN{Nyiakeng Puachue Hmong}\par +\xI{wcho} \xV{3} \xR {1E2C0} {1E2FF} \xN{Wancho}\par \xI{mend} \xV{2} \xR {1E800} {1E8DF} \xN{Mende Kikakui}\par \xI{adlm} \xV{2} \xR {1E900} {1E95F} \xN{Adlam}\par +\xI{sym59} \xV{3} \xR {1EC70} {1ECBF} \xN{Indic Siyaq Numbers}\par +\xI{sym61} \xV{3} \xR {1ED00} {1ED4F} \xN{Ottoman Siyaq Numbers}\par \xI{sym51} \xV{2} \xR {1EE00} {1EEFF} \xN{Arabic Mathematical Alphabetic Symbols}\par \xI{sym43} \xV{2} \xR {1F000} {1F02F} \xN{Mahjong Tiles}\par \xI{sym44} \xV{2} \xR {1F030} {1F09F} \xN{Domino Tiles}\par @@ -532,12 +582,16 @@ \xI{sym55} \xV{2} \xR {1F780} {1F7FF} \xN{Geometric Shapes Extended}\par \xI{sym56} \xV{2} \xR {1F800} {1F8FF} \xN{Supplemental Arrows-C}\par \xI{sym57} \xV{2} \xR {1F900} {1F9FF} \xN{Supplemental Symbols and Pictographs}\par +\xI{sym60} \xV{3} \xR {1FA00} {1FA6F} \xN{Chess Symbols}\par +\xI{sym62} \xV{3} \xR {1FA70} {1FAFF} \xN{Symbols and Pictographs Extended-A}\par +\xI{sym63} \xV{3} \xR {1FB00} {1FBFF} \xN{Symbols for Legacy Computing}\par \xI{haniB} \xV{1} \xR {20000} {2A6DF} \xN{CJK Unified Ideographs Extension B}\par \xI{haniC} \xV{2} \xR {2A700} {2B73F} \xN{CJK Unified Ideographs Extension C}\par \xI{haniD} \xV{2} \xR {2B740} {2B81F} \xN{CJK Unified Ideographs Extension D}\par \xI{haniE} \xV{2} \xR {2B820} {2CEAF} \xN{CJK Unified Ideographs Extension E}\par \xI{haniF} \xV{3} \xR {2CEB0} {2EBEF} \xN{CJK Unified Ideographs Extension F}\par \xI{hani2} \xV{1} \xR {2F800} {2FA1F} \xN{CJK Compatibility Ideographs Supplement}\par +\xI{haniG} \xV{3} \xR {30000} {3134F} \xN{CJK Unified Ideographs Extension G}\par \xI{spc07} \xV{1} \xR {E0000} {E007F} \xN{Tags}\par \xI{spc08} \xV{1} \xR {E0100} {E01EF} \xN{Variation Selectors Supplement}\par \xI{spc09} \xV{1} \xR {F0000} {FFFFF} \xN{Supplementary Private Use Area-A}\par @@ -575,7 +629,7 @@ CCV~1ではUnicodeブロックの再分割が存在しないので、 サポートされるブロックの全体は以下のようになる。 \begin{itemize} -\item 前掲の通常ブロックの表で「CCV」欄が「1」の +\item 前掲の通常ブロックの表で「CCV」欄が1の ブロック全て。 \end{itemize} @@ -633,7 +687,7 @@ CCV~3では |latn1|“Latin-1 Supplement”のブロックが 従って、サポートされるブロックの全体は以下のようになる。 \begin{itemize} -\item 前掲の通常ブロックの表で「CCV」欄が2以下のブロック全て。 +\item 前掲の通常ブロックの表にあるブロック全て。 \Note |cjk12|、|latn1| のブロックも使用可能。 \item |cjk12| の下位ブロック\Means |cjk1a|、|cjk1b|、|cjk1c| の3つ。 @@ -645,7 +699,7 @@ CCV~3では |latn1|“Latin-1 Supplement”のブロックが \section{各モードにおける和文カテゴリの設定} \label{sec:Values} -(あとで書く) +(やっぱりあとで書く) \end{document} diff --git a/macros/latex/contrib/zref-clever/CHANGELOG.md b/macros/latex/contrib/zref-clever/CHANGELOG.md index 2a3f9bdbc4..ae677ca311 100644 --- a/macros/latex/contrib/zref-clever/CHANGELOG.md +++ b/macros/latex/contrib/zref-clever/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.3.0...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.3.1...HEAD) + +## [v0.3.1](https://github.com/gusbrs/zref-clever/compare/v0.3.0...v0.3.1) (2022-05-28) + +### Added +- "`zref-clever` for the impatient" section to User manual. ## [v0.3.0](https://github.com/gusbrs/zref-clever/compare/v0.2.2-alpha...v0.3.0) (2022-04-22) diff --git a/macros/latex/contrib/zref-clever/zref-clever-code.pdf b/macros/latex/contrib/zref-clever/zref-clever-code.pdf Binary files differindex de4ac178cf..ae52fa41e2 100644 --- a/macros/latex/contrib/zref-clever/zref-clever-code.pdf +++ b/macros/latex/contrib/zref-clever/zref-clever-code.pdf diff --git a/macros/latex/contrib/zref-clever/zref-clever.dtx b/macros/latex/contrib/zref-clever/zref-clever.dtx index 79eb3dd285..e0d04a1264 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.dtx +++ b/macros/latex/contrib/zref-clever/zref-clever.dtx @@ -165,7 +165,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-clever} {2022-04-22} {0.3.0} +\ProvidesExplPackage {zref-clever} {2022-05-28} {0.3.1} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -7979,8 +7979,10 @@ % actually responsible for setting the labels inside \pkg{amsmath}'s math % environments. And, after that, redefine it to be \cs{@@_ltxlabel:n} % instead. We must handle \pkg{hyperref} here, which comes very late in the -% preamble, and which loads \pkg{nameref} at \texttt{begindocument}, which in -% turn, lets \cs{ltx@label} be \cs{label}. This has to come after +% preamble, and which loads \pkg{nameref} at \texttt{begindocument} (though +% this has changed recently 2022-05-16, see +% \url{https://github.com/latex3/hyperref/commit/a011ba9308a1b047dc151796de557da0bb22abaa}), +% which in turn, lets \cs{ltx@label} be \cs{label}. This has to come after % \pkg{nameref}. Other classes packages also redefine \cs{ltx@label}, which % may cause some trouble. A \texttt{grep} on \texttt{texmf-dist} returns hits % for: \file{thm-restate.sty}, \file{smartref.sty}, \file{jmlrbook.cls}, diff --git a/macros/latex/contrib/zref-clever/zref-clever.pdf b/macros/latex/contrib/zref-clever/zref-clever.pdf Binary files differindex 213e51bf6b..5a6aadba29 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.pdf +++ b/macros/latex/contrib/zref-clever/zref-clever.pdf diff --git a/macros/latex/contrib/zref-clever/zref-clever.tex b/macros/latex/contrib/zref-clever/zref-clever.tex index ee00821c16..2ebf1b6739 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.tex +++ b/macros/latex/contrib/zref-clever/zref-clever.tex @@ -300,6 +300,74 @@ priority over backward compatibility. So, if you choose to use this package, you should be ready to accommodate to eventual upstream changes. +\section{\pkg{zref-clever} for the impatient} + +\pkg{zref-clever} is based on \pkg{zref}'s referencing system which, though +independent of the standard one, is very similar to it in its user interface. +Indeed, to use \pkg{zref}, instead of setting a \cs{label} and making a +\cs{ref}, one would set a \cs{zlabel} and make \cs{zref}s to it, in pretty +much the same way as for the standard system. \pkg{zref-clever} introduces +the more featureful \cs{zcref} for making references, but relies on +\pkg{zref}'s \cs{zlabel} for label setting. + +A basic document using \pkg{zref-clever} is shown in \zcref{how:basic} which, +despite the small necessary adjustments, should feel very familiar to any +\LaTeX{} user acquainted with the standard referencing system: + +\begin{zchowto}[caption={Basic usage},label={how:basic}] +\documentclass{article} +\usepackage{zref-clever} +\usepackage{hyperref} +\begin{document} +\section{Section 1} +\zlabel{sec:section-1} +\begin{figure} + A figure. + \caption{Figure 1} + \zlabel{fig:figure-1} +\end{figure} +A reference to \zcref{sec:section-1}. \zcref[S]{fig:figure-1} shows some +interesting information. +A page reference can be done with either \zcpageref{sec:section-1} or with +\zcref[page]{sec:section-1}. +A reference can also be made to multiple labels, as in \zcref{sec:section-1, + fig:figure-1}. +\end{document} +\end{zchowto} + +The references in the document of \zcref{how:basic} illustrate one of the main +features of \pkg{zref-clever}, which is to include an appropriate ``type +name'' of the reference, alongside of the reference itself. The document +renders its references as: +\begin{quote} + A reference to section 1. Figure 1 shows some interesting information. A + page reference can be done with either page 1 or with page 1. A reference + can also be made to multiple labels, as in section 1 and figure 1. +\end{quote} + +\zcref[S]{how:basic} also illustrates the use the optional argument of +\cs{zcref} to modulate the behavior of the reference. In particular, the +\opt{S} option is one you should get acquainted with from the start, as it +ensures that the type name of a reference is properly capitalized and not +abbreviated, and it is meant to be used in references made at the beginning of +a sentence. + +But \pkg{zref-clever} is highly customizable, and several other options exist, +and multiple places where you can set them: + +\begin{itemize} +\item The optional argument of \cs{zcref}: for individual references. +\item \cs{zcsetup}: for settings meant to affect all references. +\item \cs{zcRefTypeSetup}: to customize the behavior of each reference type. +\item \cs{zcLanguageSetup}: for language-specific settings. +\end{itemize} + +For the list of available options, and for these different scopes in which +they can be used, see \zcref{sec:user-interface, sec:options, + sec:reference-format, sec:internationalization}. Other usage examples are +available at \zcref{sec:how-tos}. + + \section{Loading the package} \zlabel{sec:loading-package} @@ -1520,6 +1588,7 @@ it's up to you. \section{How-tos} +\zlabel{sec:how-tos} This section gathers some usage examples, or ``how-tos'', of cases which may require some \pkg{zref-clever} setup, or usage adjustments, and each item is @@ -2185,16 +2254,17 @@ use of \pkg{zref}'s \cs{zlabel} and thus of \pkg{zref-clever} may occasionally require some adjustments, since it does not enjoy the universal support the standard referencing system does. The compatibility modules presented in \zcref{sec:comp-modules} go a long way in ensuring the user has to worry very -little about it, but they cannot hopefully go all the way. Not only because -this kind of support will never be exhaustive, but also since, sometimes, -given the way certain features are implemented by packages or document -classes, there may not be a reasonable way to provide this support, from our -side. But, still, most of the time, it is still ``viable'' to get there, if -one really wishes to do so. So, this section keeps track of some known -recipes, which I don't think belong in \pkg{zref-clever} itself, but which you -may choose to use. Note that this list is intended to spare users from having -to reinvent the wheel every time someone needs something of the sort, but from -\pkg{zref-clever}'s perspective, their status is ``not supported''. +little about it, but they cannot be expected to go all the way. Not only +because this kind of support will never be exhaustive, but also since, +sometimes, given the way certain features are implemented by packages or +document classes, there may not be a reasonable way to provide this support, +from our side. But, still, most of the time, it is still ``viable'' to get +there, if one really wishes to do so. So, this section keeps track of some +known recipes, which I don't think belong in \pkg{zref-clever} itself, but +which you may choose to use. Note that this list is intended to spare users +from having to reinvent the wheel every time someone needs something of the +sort, but from \pkg{zref-clever}'s perspective, their status is ``not +supported''. \subsection*{\pkg{breqn}} |