summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-18 21:45:46 +0000
committerKarl Berry <karl@freefriends.org>2017-11-18 21:45:46 +0000
commit9746eec6f52784c17ea0fdd0c1d47e8deb9ca0f8 (patch)
tree093bb019d314b4b6e27f3f9dca5f69308ac68fb8 /Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx
parentff1a4fd0b6a85c7280ae498ad531d5397bedea87 (diff)
unicode-math (18nov17)
git-svn-id: svn://tug.org/texlive/trunk@45845 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx')
-rw-r--r--Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx142
1 files changed, 142 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx
new file mode 100644
index 00000000000..9cdbb3b6add
--- /dev/null
+++ b/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx
@@ -0,0 +1,142 @@
+%%^^A%% um-code-mathtext.dtx -- part of UNICODE-MATH <wspr.io/unicode-math>
+
+% \section{Maths text commands}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% \subsection{\cs{setmathfontface}}
+%
+% \begin{macro}{\@@_setmathfontface:Nnn}
+% \begin{macrocode}
+\keys_define:nn {@@_mathface}
+ {
+ version .code:n =
+ { \tl_set:Nn \l_@@_mversion_tl {#1} }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_set:Nn \@@_setmathfontface:Nnn
+ {
+ \tl_clear:N \l_@@_mversion_tl
+
+ \keys_set_known:nnN {@@_mathface} {#2} \l_@@_keyval_clist
+
+ \exp_args:Nnx \fontspec_set_family:Nxn \l_@@_tmpa_tl
+ { ItalicFont={}, BoldFont={}, \exp_not:V \l_@@_keyval_clist } {#3}
+
+ \tl_if_empty:NT \l_@@_mversion_tl
+ {
+ \tl_set:Nn \l_@@_mversion_tl {normal}
+ \DeclareMathAlphabet #1 {\g_fontspec_encoding_tl} {\l_@@_tmpa_tl} {\mddefault} {\updefault}
+ }
+
+ \SetMathAlphabet #1 {\l_@@_mversion_tl} {\g_fontspec_encoding_tl} {\l_@@_tmpa_tl} {\mddefault} {\updefault}
+
+ % integrate with fontspec's \setmathrm etc:
+ \tl_case:Nn #1
+ {
+ \mathrm { \cs_set_eq:NN \g__fontspec_mathrm_tl \l_@@_tmpa_tl }
+ \mathsf { \cs_set_eq:NN \g__fontspec_mathsf_tl \l_@@_tmpa_tl }
+ \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l_@@_tmpa_tl }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Hooks into \pkg{fontspec}}
+%
+% Historically, \cs{mathrm} and so on were completely overwritten by \pkg{unicode-math}, and \pkg{fontspec}'s methods for setting these fonts in the classical manner were bypassed.
+%
+% While we could now re-activate the way that \pkg{fontspec} does the following, because we can now change maths fonts whenever it's better to define new commands in \pkg{unicode-math} to define the \cs{mathXYZ} fonts.
+%
+% \subsubsection{Text font}
+% \begin{macrocode}
+\cs_generate_variant:Nn \tl_if_eq:nnT {o}
+\cs_set:Nn \__fontspec_setmainfont_hook:nn
+ {
+ \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
+ {
+%<XE> \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
+ \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
+ \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
+ \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
+ }
+ }
+
+\cs_set:Nn \__fontspec_setsansfont_hook:nn
+ {
+ \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
+ {
+%<XE> \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
+ \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
+ \SetMathAlphabet\mathsf{bold} \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
+ }
+ }
+
+\cs_set:Nn \__fontspec_setmonofont_hook:nn
+ {
+ \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
+ {
+%<XE> \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
+ \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
+ \SetMathAlphabet\mathtt{bold} \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
+ }
+ }
+% \end{macrocode}
+%
+% \subsubsection{Maths font}
+% If the maths fonts are set explicitly, then the text commands above will not execute their branches to set the maths font alphabets.
+% \begin{macrocode}
+\cs_set:Nn \__fontspec_setmathrm_hook:nn
+ {
+ \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
+ \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
+ \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
+ }
+\cs_set:Nn \__fontspec_setboldmathrm_hook:nn
+ {
+ \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
+ \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
+ \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
+ }
+\cs_set:Nn \__fontspec_setmathsf_hook:nn
+ {
+ \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
+ \SetMathAlphabet\mathsf{bold} \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
+ }
+\cs_set:Nn \__fontspec_setmathtt_hook:nn
+ {
+ \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
+ \SetMathAlphabet\mathtt{bold} \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
+ }
+% \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
+% ------------------------------------------------
+%
+% ©/