summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex')
-rw-r--r--Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex115
1 files changed, 94 insertions, 21 deletions
diff --git a/Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex b/Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex
index 7b385c34ccf..61fe577cede 100644
--- a/Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex
+++ b/Master/texmf-dist/doc/latex/unicode-math-input/unicode-math-input.tex
@@ -1,5 +1,6 @@
%! TEX program = lualatex
-\ProvidesFile{unicode-math-input.tex} [2023/05/12 v0.0.0 ]
+\ProvidesFile{unicode-math-input.tex} [2024/01/18 v0.1.0 ]
+\PassOptionsToPackage{hyphens}{url}
\RequirePackage{fvextra}
\documentclass{l3doc}
\usepackage[svgnames]{xcolor}
@@ -15,7 +16,12 @@
\tracinglostchars=3
\newcommand\csref[1]{\texttt{\hyperref[doc/function//#1]{\textbackslash #1}}}
\newcommand\varref[1]{\texttt{\hyperref[doc/function//#1]{#1}}}
+\usepackage{precattl}
\begin{document}
+\precattlExec{
+\NewDocumentEnvironment{option}{v}{\begin{variable}{#1\cO\}\iffalse}\fi Package option.\par}{\end{variable}}
+}
+
\hfuzz=1pt
\GetFileInfo{\jobname.tex}
@@ -45,6 +51,15 @@ they does not cover a lot of characters and/or does not handle several issues we
We compare the situation with several existing packages:
\begin{itemize}
+ \item \pkg{commonunicode}:
+ \begin{itemize}
+ \item defines all characters to be active, which means it breaks usage of |α| in \pkg{fancyvrb}'s |Verbatim| environment for example.
+ \item changes the behavior of e.g. |½| in text mode in PDF\LaTeX.
+ \item does not always select best option, for example |∄| always get mapped to |\not\exists| even though the outcome is worse than |\nexists|.
+ \item fakes several symbols such as |≝| even when there's better option e.g. |\eqdef|,
+ \item uses |\ensuremath| extensively, which means no error message when it's used in text mode,
+ \item not as good symbol coverage.
+ \end{itemize}
\item \pkg{unixode}:
\begin{itemize}
\item defines |′| to be |\prime| which is big and not usable, it should be |^{\prime}|
@@ -177,6 +192,13 @@ We need to get the following things correct:
corresponding Unicode character (|π|) will also change. This will incur a small loss in efficiency however.
(modulo the issue with |\Udelcode| mentioned above)
+
+ \item The character |⋯| is mapped to |\cdots| and |…| is mapped to |\ldots|. Note that |\dots| behaves
+ the same as |\ldots| without \pkg{amsmath} package loaded, but with it it smartly detect which variant to use
+ depends on the following character, for example |$\dots +$| prints $\dots +$ but |$\dots ,$| prints $\dots ,$.
+
+ There's another discrepancy with the spacing around these 2 characters,
+ see \url{https://github.com/wspr/unicode-math/issues/571}.
\end{itemize}
There are some issues however:
@@ -227,6 +249,8 @@ Because by default the \pkg{unicode-math} package will already allow entering Un
For example you can |\renewcommand\umiMathbf[1]{\mathbf{#1}}| which is the default behavior.
+ Or you can execute, for example, |\renewcommand\umiMathscr[1]{\mathcal{#1}}| to use the calligraphic instead of the script alphabet for script characters.
+
More usefully, you may want to |\renewcommand\umiMathbf{\bm}| to make entered characters such as
$𝐚$ appear bold italic in the output, remember to load package \pkg{bm} if you want to do so (which is |unicode-math| behavior
with |[bold-style=ISO]| package option).
@@ -240,27 +264,27 @@ Because by default the \pkg{unicode-math} package will already allow entering Un
|\let\umiFrac\tfrac| (or more clearly, |\renewcommand\umiFrac[2]{\tfrac{#1}{#2}}|)
to customize the appearance of Unicode characters like |½|.
- If you want to customize the appearance of individual symbols, consider using \csref{umiDefineMathChar}.
+ If you want to customize the appearance of individual symbols, consider using \csref{umiDeclareMathChar}.
\end{function}
-\begin{function}{\umiDefineMathChar}
+\begin{function}{\umiDeclareMathChar}
\begin{syntax}
- |\umiDefineMathChar {α} {\alpha}|
+ |\umiDeclareMathChar {α} {\alpha}|
\end{syntax}
- Does what it says.
+ Does what it says. Will override existing definitions, if any.
Note that the Unicode character must be braced.
- (You may choose to call \csref{umiPatchCmdUnicodeArg}| \umiDefineMathChar|
+ (You may choose to call \csref{umiPatchCmdUnicodeArg}| \umiDeclareMathChar|
beforehand so bracing is not necessary, but this is not really recommended)
This might or might not destroy the existing text-mode definition. For now,
- one way to preserve it is |\umiDefineMathChar {²} {\TextOrMath{\texttwosuperior}{^2}}|.
+ one way to preserve it is |\umiDeclareMathChar {²} {\TextOrMath{\texttwosuperior}{^2}}|.
\end{function}
-\begin{function}{\umiDefineMathDelimiter}
+\begin{function}{\umiDeclareMathDelimiter}
\begin{syntax}
- |\umiDefineMathDelimiter {⟨} \langle|
+ |\umiDeclareMathDelimiter {⟨} \langle|
\end{syntax}
You must use this in order to use the Unicode character with |\left|, |\big|, |\bigl| etc.
(because of the internal detail being that in Xe\LaTeX\ and Lua\LaTeX,
@@ -269,9 +293,14 @@ Because by default the \pkg{unicode-math} package will already allow entering Un
In that case the second argument must be a single token.
- Unfortunately, the command does not always work.
+ Unfortunately, the command does not always work -- it must detect the second argument to be a delimiter, but
+ if the detection fails it may not work.
\end{function}
+\emph{Note}: There's no need to provide |\umiDeclareMathAlphabet|, |\umiDeclareMathAccent| or |\umiDeclareMathRadical|, for |\umiDeclareMathChar| suffices.
+It's not supported to define \emph{control sequences}, for that the typical |\RenewDocumentCommand|
+or |\RenewCommandCopy| suffices.
+
\begin{function}{\umiRefreshDelimiterList}
\begin{syntax}
|\umiRefreshDelimiterList|
@@ -282,17 +311,15 @@ Because by default the \pkg{unicode-math} package will already allow entering Un
This command will check all the normal delimiter Unicode characters. In PDF\LaTeX\ this command does nothing.
- Another way is to use \csref{umiDefineMathDelimiter} to manually refresh individual Unicode characters,
+ Another way is to use \csref{umiDeclareMathDelimiter} to manually refresh individual Unicode characters,
this is also useful if you define an Unicode character that is not "normally" a delimiter.
\end{function}
-\begin{variable}{ignore-refresh-delimiter-list}
- Package option.
-
+\begin{option}{ignore-refresh-delimiter-list}
\csref{umiRefreshDelimiterList} will be run |\AtBeginDocument|. Pass this to disable it running.
Only needed if there's some package clash or if there's spurious warning on "not determined to be a delimiter" etc.
-\end{variable}
+\end{option}
\begin{function}{\umiPatchCmdUnicodeArg,\umiUnpatchCmdUnicodeArg}
\begin{syntax}
@@ -336,12 +363,14 @@ Because by default the \pkg{unicode-math} package will already allow entering Un
The command being patched must take exactly one argument.
This is useful because some \TeX\ primitives such as |^| or |\mathopen|
- requires either a single "character" or a group braced with |{...}| / |\bgroup...\egroup|.
+ requires either a single "character" or a group braced with |{...}| / |\bgroup...\egroup| --
+ in particular, |\Big|'s original definition is such that |\Bigl| being defined
+ as |\mathopen \Big| can work, and we must ensure it still work after the patch.
\end{function}
-\begin{variable}{ignore-patch-delimiter-commands}
- Package option. Pass this to avoid patching |\Big| etc. with the command above (only needed if there's some package clash).
-\end{variable}
+\begin{option}{ignore-patch-delimiter-commands}
+ Pass this to avoid patching |\Big| etc. with the command above (only needed if there's some package clash).
+\end{option}
\begin{function}{\umiBraceNext}
\begin{syntax}
@@ -362,11 +391,11 @@ Because by default the \pkg{unicode-math} package will already allow entering Un
then |\big⟨| will eventually execute |\oldbig{⟨}| which is the desired behavior (that |\oldbig| expects one braced argument).
\end{function}
-\begin{variable}{ignore-patch-prime}
+\begin{option}{ignore-patch-prime}
Do not patch the default definition of |'| in math mode.
By default it's patched to allow |G'²| and |G²'| to work. Only use this when there's some package clash.
-\end{variable}
+\end{option}
\begin{function}{\umiPatchPrime,\umiUnpatchPrime}
\begin{syntax}
@@ -384,6 +413,50 @@ then |\big⟨| will eventually execute |\oldbig{⟨}| which is the desired behav
This package should have tested with various \TeX\ distribution versions on Overleaf.
+\section{Advanced remarks}
+
+As mentioned before, by design this package defines the Unicode character in math mode to do whatever the corresponding
+\LaTeX\ command does \emph{at the time of use}, so if you redefine the meaning of |\alpha|, then the Unicode character |α|
+will change as well.
+
+The other "standard" way to define commands in \LaTeX\ is to assign the mathcode to the character/control sequence directly,
+using |\DeclareMathSymbol| etc. which is used to define almost all the standard control sequences.
+For efficiency reasons or other reasons, you may want to \emph{copy} the definition of an existing control sequence
+(this way the definition of the Unicode character is not changed when the control sequence changes),
+you can do that by:
+
+\begin{function}{\umiDeclareMathCharCopy}
+ \begin{syntax}
+ |\umiDeclareMathCharCopy {±} \pm|
+ \end{syntax}
+ Does what it says.
+
+ The second argument must be a single control sequence.
+\end{function}
+
+\begin{function}{\umiDeclareMathDelimiterCopy}
+ \begin{syntax}
+ |\umiDeclareMathDelimiterCopy {‖} \Vert|
+ \end{syntax}
+ Does what it says. Refer to \csref{umiDeclareMathDelimiter} for difference between this command and \csref{umiDeclareMathCharCopy}.
+\end{function}
+
+In case you want to explicitly specify a font/slot pair for an Unicode character, you can use |\DeclareMathSymbol| etc.
+directly, then use one of the commands above to copy it to the Unicode character.
+
+Useful resources:
+
+\begin{sloppypar}
+ \hbadness=10000
+\begin{itemize}
+ \item \url{https://tex.stackexchange.com/questions/98781/create-a-font-table-for-all-available-characters-for-a-particular-font}
+ \item \url{https://tex.stackexchange.com/questions/380775/font-table-for-opentype-truetype-fonts}
+ \item \url{https://ctan.org/pkg/fonttable} (need double quotes if font name has spaces: \url{https://tex.stackexchange.com/a/506246/250119})
+ \item Although there's always |texdoc encguide| for the default (non-Unicode) encodings.
+\end{itemize}
+\end{sloppypar}
+
+
\PrintChanges
\PrintIndex
\Finale