Skip to content

Commit

Permalink
add special "double mapping" for better keyoption definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Aug 5, 2012
1 parent 5e70535 commit 2cedf8b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 62 deletions.
4 changes: 4 additions & 0 deletions README.markdown
Expand Up @@ -153,6 +153,10 @@ standard behaviour.
CHANGE HISTORY
--------------

- v0.7a (2012/07/28)

* Keep in sync with expl3 changes.

- v0.7 (2012/05/30): The TeX Live 2012 release.

* Most changes (and all significant ones) in this release thanks to Khaled
Expand Down
134 changes: 72 additions & 62 deletions unicode-math.dtx
Expand Up @@ -60,7 +60,7 @@ This work is "author-maintained" by Will Robertson.
%<preamble&XE>\ProvidesPackage{unicode-math-xetex}
%<preamble&LU>\ProvidesPackage{unicode-math-luatex}
%<*preamble>
[2012/07/26 v0.7a Unicode maths in XeLaTeX and LuaLaTeX]
[2012/07/28 v0.7a Unicode maths in XeLaTeX and LuaLaTeX]
%</preamble>
%<*internal>
\documentclass[a4paper]{ltxdoc}
Expand Down Expand Up @@ -1215,109 +1215,120 @@ This work is "author-maintained" by Will Robertson.
% \end{macro}
%
% \begin{macrocode}
\cs_new:Nn \um_tl_map_dbl:nN
{
\__um_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop
}
\cs_new:Nn \__um_tl_map_dbl:Nnn
{
\quark_if_recursion_tail_stop:n {#2}
\quark_if_recursion_tail_stop:n {#3}
#1 {#2} {#3}
\__um_tl_map_dbl:Nnn #1
}
\cs_new:Nn \um_keys_choices:nn
{
\cs_set:Npn \um_keys_choices_fn:n ##1 { \um_keys_choices_aux:nnn {#1} ##1 , }
\cs_set:Npn \um_keys_choices_fn:nn { \um_keys_choices_aux:nnn {#1} }
\use:x
{
\exp_not:N \keys_define:nn {unicode-math}
{
#1 .choice: ,
\tl_map_function:nN {#2} \um_keys_choices_fn:n
\um_tl_map_dbl:nN {#2} \um_keys_choices_fn:nn
}
}
}
\cs_new:Nn \um_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } }
\cs_new:Nn \um_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } , }
% \end{macrocode}
%
% \paragraph{math-style}
% \begin{macrocode}
\um_keys_choices:nn {normal-style}
{
{ {ISO} {
{ISO} {
\bool_set_false:N \g_um_literal_bool
\bool_set_false:N \g_um_upGreek_bool
\bool_set_false:N \g_um_upgreek_bool
\bool_set_false:N \g_um_upLatin_bool
\bool_set_false:N \g_um_uplatin_bool } }
{ {TeX} {
\bool_set_false:N \g_um_uplatin_bool }
{TeX} {
\bool_set_false:N \g_um_literal_bool
\bool_set_true:N \g_um_upGreek_bool
\bool_set_false:N \g_um_upgreek_bool
\bool_set_false:N \g_um_upLatin_bool
\bool_set_false:N \g_um_uplatin_bool } }
{ {french} {
\bool_set_false:N \g_um_uplatin_bool }
{french} {
\bool_set_false:N \g_um_literal_bool
\bool_set_true:N \g_um_upGreek_bool
\bool_set_true:N \g_um_upgreek_bool
\bool_set_true:N \g_um_upLatin_bool
\bool_set_false:N \g_um_uplatin_bool } }
{ {upright} {
\bool_set_false:N \g_um_uplatin_bool }
{upright} {
\bool_set_false:N \g_um_literal_bool
\bool_set_true:N \g_um_upGreek_bool
\bool_set_true:N \g_um_upgreek_bool
\bool_set_true:N \g_um_upLatin_bool
\bool_set_true:N \g_um_uplatin_bool } }
{ {literal} {
\bool_set_true:N \g_um_literal_bool } }
\bool_set_true:N \g_um_uplatin_bool }
{literal} {
\bool_set_true:N \g_um_literal_bool }
}
% \end{macrocode}
%
% \begin{macrocode}
\um_keys_choices:nn {math-style}
{
{ {ISO} {
{ISO} {
\unimathsetup { nabla=upright, partial=italic,
normal-style=ISO, bold-style=ISO, sans-style=italic } } }
{ {TeX} {
normal-style=ISO, bold-style=ISO, sans-style=italic } }
{TeX} {
\unimathsetup { nabla=upright, partial=italic,
normal-style=TeX, bold-style=TeX, sans-style=upright } } }
{ {french} {
normal-style=TeX, bold-style=TeX, sans-style=upright } }
{french} {
\unimathsetup { nabla=upright, partial=upright,
normal-style=french, bold-style=upright, sans-style=upright } } }
{ {upright} {
normal-style=french, bold-style=upright, sans-style=upright } }
{upright} {
\unimathsetup { nabla=upright, partial=upright,
normal-style=upright, bold-style=upright, sans-style=upright } } }
{ {literal} {
normal-style=upright, bold-style=upright, sans-style=upright } }
{literal} {
\unimathsetup { colon=literal, nabla=literal, partial=literal,
normal-style=literal, bold-style=literal, sans-style=literal } } }
normal-style=literal, bold-style=literal, sans-style=literal } }
}
% \end{macrocode}
%
% \paragraph{bold-style}
% \begin{macrocode}
\um_keys_choices:nn {bold-style}
{
{{ISO} {
{ISO} {
\bool_set_false:N \g_um_bfliteral_bool
\bool_set_false:N \g_um_bfupGreek_bool
\bool_set_false:N \g_um_bfupgreek_bool
\bool_set_false:N \g_um_bfupLatin_bool
\bool_set_false:N \g_um_bfuplatin_bool }}
{{TeX} {
\bool_set_false:N \g_um_bfuplatin_bool }
{TeX} {
\bool_set_false:N \g_um_bfliteral_bool
\bool_set_true:N \g_um_bfupGreek_bool
\bool_set_false:N \g_um_bfupgreek_bool
\bool_set_true:N \g_um_bfupLatin_bool
\bool_set_true:N \g_um_bfuplatin_bool }}
{{upright} {
\bool_set_true:N \g_um_bfuplatin_bool }
{upright} {
\bool_set_false:N \g_um_bfliteral_bool
\bool_set_true:N \g_um_bfupGreek_bool
\bool_set_true:N \g_um_bfupgreek_bool
\bool_set_true:N \g_um_bfupLatin_bool
\bool_set_true:N \g_um_bfuplatin_bool }}
{{literal} {
\bool_set_true:N \g_um_bfliteral_bool }}
\bool_set_true:N \g_um_bfuplatin_bool }
{literal} {
\bool_set_true:N \g_um_bfliteral_bool }
}
% \end{macrocode}
%
% \paragraph{sans-style}
% \begin{macrocode}
\um_keys_choices:nn {sans-style}
{
{ {italic} { \bool_set_false:N \g_um_upsans_bool } }
{ {upright} { \bool_set_true:N \g_um_upsans_bool } }
{ {literal} { \bool_set_true:N \g_um_sfliteral_bool } }
{italic} { \bool_set_false:N \g_um_upsans_bool }
{upright} { \bool_set_true:N \g_um_upsans_bool }
{literal} { \bool_set_true:N \g_um_sfliteral_bool }
}
% \end{macrocode}
%
Expand All @@ -1326,50 +1337,50 @@ This work is "author-maintained" by Will Robertson.
% \begin{macrocode}
\um_keys_choices:nn {nabla}
{
{ {upright} { \bool_set_false:N \g_um_literal_Nabla_bool
\bool_set_true:N \g_um_upNabla_bool } }
{ {italic} { \bool_set_false:N \g_um_literal_Nabla_bool
\bool_set_false:N \g_um_upNabla_bool } }
{ {literal} { \bool_set_true:N \g_um_literal_Nabla_bool } }
{upright} { \bool_set_false:N \g_um_literal_Nabla_bool
\bool_set_true:N \g_um_upNabla_bool }
{italic} { \bool_set_false:N \g_um_literal_Nabla_bool
\bool_set_false:N \g_um_upNabla_bool }
{literal} { \bool_set_true:N \g_um_literal_Nabla_bool }
}
% \end{macrocode}
%
% \begin{macrocode}
\um_keys_choices:nn {partial}
{
{ {upright} { \bool_set_false:N \g_um_literal_partial_bool
\bool_set_true:N \g_um_uppartial_bool } }
{ {italic} { \bool_set_false:N \g_um_literal_partial_bool
\bool_set_false:N \g_um_uppartial_bool } }
{ {literal} { \bool_set_true:N \g_um_literal_partial_bool } }
{upright} { \bool_set_false:N \g_um_literal_partial_bool
\bool_set_true:N \g_um_uppartial_bool }
{italic} { \bool_set_false:N \g_um_literal_partial_bool
\bool_set_false:N \g_um_uppartial_bool }
{literal} { \bool_set_true:N \g_um_literal_partial_bool }
}
% \end{macrocode}
%
% \paragraph{Epsilon and phi shapes}
% \begin{macrocode}
\um_keys_choices:nn {vargreek-shape}
{
{{unicode} {\bool_set_false:N \g_um_texgreek_bool}}
{{TeX} {\bool_set_true:N \g_um_texgreek_bool}}
{unicode} {\bool_set_false:N \g_um_texgreek_bool}
{TeX} {\bool_set_true:N \g_um_texgreek_bool}
}
% \end{macrocode}
%
% \paragraph{Colon style}
% \begin{macrocode}
\um_keys_choices:nn {colon}
{
{{literal} {\bool_set_true:N \g_um_literal_colon_bool}}
{{TeX} {\bool_set_false:N \g_um_literal_colon_bool}}
{literal} {\bool_set_true:N \g_um_literal_colon_bool}
{TeX} {\bool_set_false:N \g_um_literal_colon_bool}
}
% \end{macrocode}
%
% \paragraph{Slash delimiter style}
% \begin{macrocode}
\um_keys_choices:nn {slash-delimiter}
{
{{ascii} {\tl_set:Nn \g_um_slash_delimiter_usv {"002F}}}
{{frac} {\tl_set:Nn \g_um_slash_delimiter_usv {"2044}}}
{{div} {\tl_set:Nn \g_um_slash_delimiter_usv {"2215}}}
{ascii} {\tl_set:Nn \g_um_slash_delimiter_usv {"002F}}
{frac} {\tl_set:Nn \g_um_slash_delimiter_usv {"2044}}
{div} {\tl_set:Nn \g_um_slash_delimiter_usv {"2215}}
}
% \end{macrocode}
%
Expand All @@ -1378,7 +1389,7 @@ This work is "author-maintained" by Will Robertson.
% \begin{macrocode}
\um_keys_choices:nn {active-frac}
{
{{small}
{small}
{
\cs_if_exist:NTF \tfrac
{
Expand All @@ -1388,12 +1399,13 @@ This work is "author-maintained" by Will Robertson.
\bool_set_false:N \l_um_smallfrac_bool
}
\use:c {um_setup_active_frac:}
}}
{{normalsize}
}

{normalsize}
{
\bool_set_false:N \l_um_smallfrac_bool
\use:c {um_setup_active_frac:}
}}
}
}
% \end{macrocode}
%
Expand All @@ -1414,19 +1426,17 @@ This work is "author-maintained" by Will Robertson.
% \begin{macrocode}
\um_keys_choices:nn {trace}
{
{ {on} {} } % default
{ {debug} { \msg_redirect_module:nnn { unicode-math } { log } { warning } } }
{ {off} { \msg_redirect_module:nnn { unicode-math } { log } { none } } }
{on} {} % default
{debug} { \msg_redirect_module:nnn { unicode-math } { log } { warning } }
{off} { \msg_redirect_module:nnn { unicode-math } { log } { none } }
}
% \end{macrocode}
%
% \begin{macrocode}
\unimathsetup {math-style=TeX}
\unimathsetup {slash-delimiter=ascii}
\unimathsetup {trace=off}
\cs_if_exist:NT \tfrac {
\unimathsetup {active-frac=small}
}
\cs_if_exist:NT \tfrac { \unimathsetup {active-frac=small} }
\ProcessKeysOptions {unicode-math}
% \end{macrocode}
%
Expand Down

0 comments on commit 2cedf8b

Please sign in to comment.