diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-07 23:46:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-07 23:46:58 +0000 |
commit | f15ab98da224024bdcb9d2b70a263c7f6143a91b (patch) | |
tree | 8368ce018ac0869d5d556cc47b29de4770ad3e62 /Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx | |
parent | 6c0d576e1d48613f952b56e99e4dd9d59e41a265 (diff) |
unicode-math (7jan18)
git-svn-id: svn://tug.org/texlive/trunk@46240 c570f23f-e606-0410-a88d-b1316a301751
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 | 162 |
1 files changed, 148 insertions, 14 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 index 0f681f52dee..95ef8dd2450 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx @@ -1,4 +1,5 @@ %%^^A%% um-code-opening.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> +%%^^A%% Assorted initialisation tasks, including some low-level function definitions. % \section{Start of the package code} % @@ -31,7 +32,18 @@ % For \pkg{fontspec}: % \begin{macrocode} \cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx} -\cs_generate_variant:Nn \fontspec_set_fontface:NNnn {NNx} +\cs_generate_variant:Nn \prop_get:NnNTF {cx} +\cs_generate_variant:Nn \tl_if_eq:nnF {o} +% \end{macrocode} +% +% +% \subsection{Low level commands} +% +% \begin{macrocode} +\cs_set_eq:NN \@@_group_begin: \group_begin: +\cs_set_eq:NN \@@_group_end: \group_end: +\cs_set_eq:NN \@@_group_begin_frozen: \@@_group_begin: +\cs_set_eq:NN \@@_group_end_frozen: \@@_group_end: % \end{macrocode} % % @@ -52,6 +64,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_fontface_gset_eq:NN} +% \begin{macrocode} +\cs_set_protected:Nn \@@_fontface_gset_eq:NN + { + \tex_global:D \tex_let:D #1 #2 + } +\cs_generate_variant:Nn \@@_fontface_gset_eq:NN {NV,cV} +% \end{macrocode} +% \end{macro} +% % \subsubsection{Mathcode and friends} % % \begin{macro}{\@@_set_mathcode:nnnn} @@ -133,43 +155,64 @@ % \begin{macrocode} \cs_new:Nn \@@_char_gmake_mathactive:N { - \global\mathcode `#1 = "8000 \scan_stop: + \tex_global:D \tex_mathcode:D `#1 = "8000 \scan_stop: } +% \end{macrocode} +% \begin{macrocode} \cs_new:Nn \@@_char_gmake_mathactive:n { - \global\mathcode #1 = "8000 \scan_stop: + \tex_global:D \tex_mathcode:D \int_eval:n {#1} = "8000 \scan_stop: } % \end{macrocode} % \end{macro} % \end{macro} % +% \begin{macro}{\@@_mathactive_remap:nn} +% Makes |#1| math-active and defines its meaning to be |#2|. +% This is a global operation. +% \begin{macrocode} +\cs_new:Nn \@@_mathactive_remap:nn + { + \group_begin: + \cs_set_protected:Npn \@@_tmp: {#2} + \@@_char_gmake_mathactive:n {#1} + \char_gset_active_eq:nN {#1} \@@_tmp: + \group_end: + } +% \end{macrocode} +% % \subsubsection{Font parameters} % -% \begin{macro}{\@@_copy_fontparam:nnn} +% \begin{macro}{\@@_copy_fontdimen:nnN} % \begin{macrocode} -\cs_new:Nn \@@_copy_fontparam:nnn +\cs_new:Nn \@@_copy_fontdimen:nnN { - \fontdimen #1 \font = \@@_get_fontparam:nn {#2} {#3} + \fontdimen #1 \font = \the \fontdimen #2 #3 \relax } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_zero_fontparam:n} +% \begin{macro}{\@@_zero_fontdimen:n} % \begin{macrocode} -\cs_new:Nn \@@_zero_fontparam:n +\cs_new:Nn \@@_zero_fontdimen:n { \fontdimen #1 \font = 0pt\relax } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_get_fontparam:nn} +% \begin{macro}{\@@_fontdimen_from_param:Nnn} +% This function extracts the math font dimen \verb|#3| from the font \verb|#1| +% and sets fontdimen \verb|#2| of the same font to that value. +% +% Use \XeTeX's fontdimen approach because it's tidy. We don't need bells and whistles here. % \begin{macrocode} -\cs_new:Nn \@@_get_fontparam:nn +%<*LU> +\cs_new_protected:Nn \@@_fontdimen_from_param:nn { -%<XE> \the\fontdimen#1\l_@@_font\relax -%<LU> \directlua{fontspec.mathfontdimen("l_@@_font","#2")} + \fontdimen #1 \font = \directlua{fontspec.mathfontdimen(font.current(),"#2")}\relax } +%</LU> % \end{macrocode} % \end{macro} % @@ -188,7 +231,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\@@_usv_if_exist:nn} +% \begin{macro}{\@@_usv_if_exist:nnTF} % \begin{macrocode} \prg_new_conditional:Nnn \@@_usv_if_exist:nn {T,F,TF} { @@ -225,12 +268,103 @@ } % \end{macrocode} % +% +% \subsection{Wrappers for message functions} +% +% Messages themselves are defined in \secref{codemsg}. +% +% \begin{macrocode} +\cs_new:Npn \@@_error:n { \msg_error:nn {unicode-math} } +\cs_new:Npn \@@_error:nx { \msg_error:nnx {unicode-math} } +\cs_new:Npn \@@_warning:n { \msg_warning:nn {unicode-math} } +\cs_new:Npn \@@_warning:nnn { \msg_warning:nnxx {unicode-math} } +\cs_new:Npn \@@_log:n { \msg_log:nn {unicode-math} } +\cs_new:Npn \@@_log:nx { \msg_log:nnx {unicode-math} } +% \end{macrocode} +% +% \begin{macrocode} +\cs_generate_variant:Nn \msg_new:nnn {nnx} +\cs_generate_variant:Nn \msg_new:nnnn {nnxx} +\cs_new:Nn \@@_msg_new:nn { \msg_new:nnx {unicode-math} {#1} { \tl_trim_spaces:n {#2} } } +% \end{macrocode} +% +% % \begin{macrocode} %</package> % \end{macrocode} \endinput + +% \subsection{Sow/reap} +% +% This might make it into the kernel; not sure. +% Not actually used yet in the package! +% +% \begin{macro}{\__@@_sow_item:Nn} +% Helper variables for constructing \verb|c|-type arguments. +% \begin{macrocode} +\cs_new:Nn \__@@_sow_item:Nn { l___sow___ \token_to_str:N #1 ___ #2 ___tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\__@@_sow_int:N} +% Helper variables for constructing \verb|c|-type arguments. +% \begin{macrocode} +\cs_new:Nn \__@@_sow_int:N { l___sow___ \token_to_str:N #1 ___int } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_sow_prepare:N} +% \begin{macrocode} +\cs_new:Nn \@@_sow_prepare:N + { + \tl_clear:N #1 + \int_zero_new:c { \__@@_sow_int:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_sow:Nn} +% \begin{macrocode} +\cs_new:Nn \@@_sow:Nn + { + \int_incr:c { \__@@_sow_int:N #1 } + \tl_clear_new:c + { + \__@@_sow_item:Nn #1 + { \int_use:c { \__@@_sow_int:N #1 } } + } + \tl_set:cn + { + \__@@_sow_item:Nn #1 + { \int_use:c { \__@@_sow_int:N #1 } } + } + { #2 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_sow_reap:N} +% \begin{macrocode} +\cs_new:Nn \@@_sow_reap:N + { + \cs_set:Npn \__@@_sow_tmp:n ##1 + { + \exp_not:v { \__@@_sow_item:Nn #1 {##1} } + } + \tl_set:Nx #1 + { + \int_step_function:nnnN {1} {1} + { \int_use:c { \__@@_sow_int:N #1 } } + \__@@_sow_tmp:n + } + + } +% \end{macrocode} +% \end{macro} + + % /© % % ------------------------------------------------ @@ -240,7 +374,7 @@ % 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 2006-2018 Will Robertson, LPPL "maintainer" % Copyright 2010-2017 Philipp Stephani % Copyright 2011-2017 Joseph Wright % Copyright 2012-2015 Khaled Hosny |