diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx new file mode 100644 index 00000000000..0f681f52dee --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx @@ -0,0 +1,249 @@ +%%^^A%% um-code-opening.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> + +% \section{Start of the package code} +% +% The prefix for \pkg{unicode-math} is \texttt{um}: +% \begin{macrocode} +%<@@=um> +% \end{macrocode} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +%<*LU> +\RequirePackage{lualatex-math} +%</LU> +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOn +% \end{macrocode} +% +% \subsection{\pkg{expl3} variants} +% +% Variants needed from \pkg{expl3}: +% \begin{macrocode} +\cs_set_protected_nopar:Npn \exp_last_unbraced:NNx { \::N \::x_unbraced \::: } +% \end{macrocode} +% +% For \pkg{fontspec}: +% \begin{macrocode} +\cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx} +\cs_generate_variant:Nn \fontspec_set_fontface:NNnn {NNx} +% \end{macrocode} +% +% +% \subsection{Primitive font commands} +% +% What might end up being provided by the kernel. +% +% \begin{macro}{\@@_glyph_if_exist:NnTF} +% \begin{macrocode} +\prg_new_conditional:Nnn \@@_glyph_if_exist:Nn {p,TF,T,F} + { + \etex_iffontchar:D #1 #2 \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Mathcode and friends} +% +% \begin{macro}{\@@_set_mathcode:nnnn} +% \begin{macro}{\@@_set_mathcode:nnn} +% These are all wrappers for the primitive commands that take numerical +% input only. +% \begin{macrocode} +\cs_set:Npn \@@_set_mathcode:nnnn #1#2#3#4 + { + \Umathcode \int_eval:n {#1} = + \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_set:Npn \@@_set_mathcode:nnn #1#2#3 + { + \Umathcode \int_eval:n {#1} = + \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#1} \scan_stop: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_set_mathchar:NNnn} +% \begin{macro}{\@@_set_mathchar:cNnn} +% \begin{macrocode} +\cs_set:Npn \@@_set_mathchar:NNnn #1#2#3#4 + { + \Umathchardef #1 = + \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\cs_generate_variant:Nn \@@_set_mathchar:NNnn {c} +% \end{macrocode} +% +% \begin{macro}{\@@_set_delcode:nnn} +% \begin{macrocode} +\cs_new:Nn \@@_set_delcode:nnn + { + \Udelcode#2 = \csname sym#1\endcsname #3 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_radical:nn} +% \begin{macrocode} +\cs_new:Nn \@@_radical:nn + { + \Uradical \csname sym#1\endcsname #2 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_delimiter:Nnn} +% \begin{macrocode} +\cs_new:Nn \@@_delimiter:Nnn + { + \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_accent:nnn} +% \begin{macrocode} +\cs_new:Nn \@@_accent:nnn + { + \Umathaccent #1~ \mathchar@type\mathaccent \use:c { sym #2 } #3 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_char_gmake_mathactive:N} +% \begin{macro}{\@@_char_gmake_mathactive:n} +% \begin{macrocode} +\cs_new:Nn \@@_char_gmake_mathactive:N + { + \global\mathcode `#1 = "8000 \scan_stop: + } +\cs_new:Nn \@@_char_gmake_mathactive:n + { + \global\mathcode #1 = "8000 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{Font parameters} +% +% \begin{macro}{\@@_copy_fontparam:nnn} +% \begin{macrocode} +\cs_new:Nn \@@_copy_fontparam:nnn + { + \fontdimen #1 \font = \@@_get_fontparam:nn {#2} {#3} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_zero_fontparam:n} +% \begin{macrocode} +\cs_new:Nn \@@_zero_fontparam:n + { + \fontdimen #1 \font = 0pt\relax + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_fontparam:nn} +% \begin{macrocode} +\cs_new:Nn \@@_get_fontparam:nn + { +%<XE> \the\fontdimen#1\l_@@_font\relax +%<LU> \directlua{fontspec.mathfontdimen("l_@@_font","#2")} + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Alphabet Unicode positions (USVs)} +% +% Before we begin, let's define the positions of the various Unicode +% alphabets so that our code is a little more readable.\footnote{`\textsc{u.s.v.}' stands +% for `Unicode scalar value'.} +% +% \begin{macro}{\usv_set:nnn,\@@_to_usv:nn} +% Rather than `readable', in the end, this makes the code more extensible. +% \begin{macrocode} +\cs_new:Nn \usv_set:nnn { \tl_const:cn { c_@@_#1_#2_usv } {#3} } +\cs_new:Nn \@@_to_usv:nn { \use:c { c_@@_#1_#2_usv } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[TF]{\@@_usv_if_exist:nn} +% \begin{macrocode} +\prg_new_conditional:Nnn \@@_usv_if_exist:nn {T,F,TF} + { + \cs_if_exist:cTF { c_@@_#1_#2_usv } + \prg_return_true: \prg_return_false: + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Overcoming \texorpdfstring{\cmd\@onlypreamble}{\textbackslash @onlypreamble}} +% +% The requirement of only setting up the maths fonts in the preamble is lifted. +% (Perhaps unwisely.) +% \begin{macrocode} +\tl_map_inline:nn + { + \new@mathgroup\cdp@list\cdp@elt\DeclareMathSizes + \@DeclareMathSizes\newmathalphabet\newmathalphabet@@\newmathalphabet@@@ + \DeclareMathVersion\define@mathalphabet\define@mathgroup\addtoversion + \version@list\version@elt\alpha@list\alpha@elt + \restore@mathversion\init@restore@version\dorestore@version\process@table + \new@mathversion\DeclareSymbolFont\group@list\group@elt + \new@symbolfont\SetSymbolFont\SetSymbolFont@\get@cdp + \DeclareMathAlphabet\new@mathalphabet\SetMathAlphabet\SetMathAlphabet@ + \DeclareMathAccent\set@mathaccent\DeclareMathSymbol\set@mathchar + \set@mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter + \@DeclareMathDelimiter\@xDeclareMathDelimiter\set@mathdelimiter + \set@@mathdelimiter\DeclareMathRadical\mathchar@type + \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@ + } + { + \tl_remove_once:Nn \@preamblecmds {\do#1} + } +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} + +\endinput + +% /© +% +% ------------------------------------------------ +% The UNICODE-MATH package <wspr.io/unicode-math> +% ------------------------------------------------ +% This package is free software and may be redistributed and/or modified under +% the conditions of the LaTeX Project Public License, version 1.3c or higher +% (your choice): <http://www.latex-project.org/lppl/>. +% ------------------------------------------------ +% Copyright 2006-2017 Will Robertson, LPPL "maintainer" +% Copyright 2010-2017 Philipp Stephani +% Copyright 2011-2017 Joseph Wright +% Copyright 2012-2015 Khaled Hosny +% ------------------------------------------------ +% +% ©/ |