From 829b2c9c9c7e5f8ad2644f9d60b7d6c1c7c06776 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 15 Apr 2020 21:34:27 +0000 Subject: ccool (15apr20) git-svn-id: svn://tug.org/texlive/trunk@54753 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/ccool/ccool.sty | 467 ++++++++++++++++++++++++++++ 1 file changed, 467 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/ccool/ccool.sty (limited to 'Master/texmf-dist/tex/latex/ccool') diff --git a/Master/texmf-dist/tex/latex/ccool/ccool.sty b/Master/texmf-dist/tex/latex/ccool/ccool.sty new file mode 100644 index 00000000000..ec374d5dee4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ccool/ccool.sty @@ -0,0 +1,467 @@ +%% +%% This is file `ccool.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ccool.dtx (with options: `package') +%% ---------------------------------------------------------------------------- +%% ccool --- A tool for encoding mathematical notation +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------------------- +%% + \NeedsTeXFormat{LaTeX2e}[2020/02/02] + \RequirePackage{etoolbox}[2019/09/21] + \RequirePackage{l3keys2e}[2020/03/06] + \RequirePackage{xparse}[2020/03/06] + \ProvidesExplPackage + {ccool} % Package name + {2020/04/15} % Release date + {2.0} % Release version + {cool --- A tool for encoding mathematical notation} % Description +\ExplSyntaxOn +\cs_new_protected:Nn \@@_aux_inner_set:n +{ + \cs_gset:Npn \@@_aux_inner:n ##1 {#1} + \cs_generate_variant:Nn \@@_aux_inner:n { e } +} +\cs_new_protected:Npn \@@_aux_key:w #1 = #2 \q_stop +{ + \seq_gput_right:Nx \g@@_aux_key_seq { \tl_trim_spaces:n{#1} } +} +\cs_new_protected:Nn \@@_aux_key:n +{ + \@@_aux_key:w #1 \q_stop +} +\cs_new_protected:Nn \@@_aux_key:N +{ + \seq_gclear_new:N \g@@_aux_key_seq + \seq_map_function:NN #1 \@@_aux_key:n +} +\cs_new_protected:Nn \@@_aux_outer_set:n +{ + \cs_gset:Npn \@@_aux_outer:n ##1 {#1} +} +\prop_new:N \g@@_aux_prop +\cs_new_protected:Nn \@@_aux_prop:nn +{ + \prop_gput:Nnn \g@@_aux_prop{#1}{#2} +} +\cs_generate_variant:Nn \@@_aux_prop:nn { eo, ee, ex, xo, xe, xx } +\tl_new:N \g@@_option_expans_tl +\cs_new_protected:Npn \@@_aux_prop:w #1 = #2 \q_stop +{ + \exp_args:Nx + \use:c{@@_aux_prop:\g@@_option_expans_tl} + { \tl_trim_spaces:n{#1} } + { \@@_aux_inner:n{ \tl_trim_spaces:n{#2} } } +} +\cs_new_protected:Nn \@@_aux_prop:n +{ + \@@_aux_prop:w #1 \q_stop +} +\cs_new_protected:Nn \@@_aux_prop:N +{ + \prop_gclear_new:N \g@@_aux_prop + \seq_if_empty:NTF #1 + { \c_empty_tl } + { + \seq_map_function:NN #1 \@@_aux_prop:n + } +} +\cs_new:Nn \@@_aux_separ:nn +{ + \int_case:nnTF {#1} + { + {1} + { \prg_replicate:nn{ 3 }{#2} } + {2} + { + { \use_i:nn #2 } + { \use_ii:nn #2 } + { \use_i:nn #2 } + } + {3}{#2} + } + { \c_empty_tl } + { + \msg_error:nnnn { @@ } + { separ } + { \exp_not:N \_@@_aux_separ:nn } + {#2} + } +} +\cs_generate_variant:Nn \@@_aux_separ:nn { e } +\cs_new:Nn \@@_aux_separ:n +{ + \@@_aux_separ:en{ \tl_count:n{#1} }{#1} +} +\cs_new_protected:Nn \@@_aux_val:Nn +{ + \seq_gclear_new:N \g@@_aux_val_seq + \@@_seq_from_prop:NNn \g@@_aux_val_seq #1 { \@@_prop_name:n{#2} } +} +\cs_new_protected:Npn \@@_lambda:nn #1 #2 +{ + \exp_args:NNx + \DeclareDocumentCommand \@@_lambda_expression + { \prg_replicate:nn { #1 } { m } } + {#2} + \@@_lambda_expression +} +\iow_new:N \g@@_log_iow +\AtEndDocument{\iow_close:N \g@@_log_iow} +\bool_set_false:N \g@@_log_open_bool +\cs_new_protected:Nn \@@_log_close: +{ + \iow_close:N \g@@_log_iow + \bool_gset_false:N \g@@_log_open_bool +} +\tl_new:N \g@@_log_file_tl +\cs_new_protected:Nn \@@_log_open: +{ + \tl_gset:Nx \g@@_log_to_tl{\g@@_log_file_tl} + \iow_open:Nn \g@@_log_iow {\g@@_log_to_tl} + \bool_gset_true:N \g@@_log_open_bool +} +\cs_new_protected:Nn \@@_log_read:n +{ + \file_input:n{#1} + \tl_log:n{read~from~#1} +} +\cs_generate_variant:Nn \@@_log_read:n { e } +\cs_new_protected:Nn \@@_log_read: +{ + \@@_log_read:e{\g@@_log_to_tl} +} +\tl_new:N \g@@_log_to_tl +\cs_new_protected:Nn \@@_log_write:n +{ + \bool_if:nTF{ \g@@_log_open_bool } + { + \iow_now:Nn \g@@_log_iow {#1} + \tl_log:n{ write~to~#1 } + } + { \msg_error:nnn{ @@ }{ iow }{ \g@@_log_iow } } +} +\cs_generate_variant:Nn \@@_log_write:n { e } +\cs_new_protected:Nn \@@_make_key:Nn +{ + \exp_args:NNx + \ProvideDocumentCommand{#1} + { D<>{\g@@_option_name_tl} } + { + \@@_prop_item:nn{##1}{#2} + } +} +\cs_generate_variant:Nn \@@_make_key:Nn {c} +\cs_new_protected:Nn \@@_make_key:n +{ + \@@_make_key:cn{#1}{#1} +} +\cs_generate_variant:Nn \@@_make_key:n { e } +\cs_new_protected:Nn \@@_make_key:N +{ + \seq_map_function:NN #1 \@@_make_key:e +} +\cs_new_protected:Nn \@@_make_ccool_exp:nnn +{ + \@@_aux_val:Nn \g@@_aux_key_seq {#1} + \@@_aux_outer_set:n{#3} + \@@_aux_outer:n + { + \exp_args:NNf + \@@_seq_use:Nn + \g@@_aux_val_seq + {#2} + } +} +\cs_new_protected:Nn \@@_make_ccool_key:nnn +{ + \@@_prop_if_exist:nTF{#1} + { \c_empty_tl } + { \@@_prop_new:n{#1} } + \exp_args:No \@@_aux_inner_set:n{#2} + \seq_set_from_clist:Nn \g@@_aux_keyval_seq {#3} + \@@_aux_prop:N \g@@_aux_keyval_seq + \@@_prop_append:Nn \g@@_aux_prop {#1} + \@@_aux_key:N \g@@_aux_keyval_seq + \@@_make_key:N \g@@_aux_key_seq +} +\cs_new_protected:Nn \@@_make_ccool_sideeffect:nnn +{ + \@@_make_ccool_key:nnn{#1}{#2}{#3} + \bool_if:nTF{ \g@@_log_open_bool } + { + \@@_log_write:n + { + \begingroup + \def \@@_log_entry { \Ccool<#1>i{#2}{#3} } \expandafter + \endgroup \@@_log_entry + } + }{\c_empty_tl} +} +\cs_new_protected:Npn \@@_make_ccool:nnnn #1 #2 #3 #4 +{ + \exp_args:NNx \DeclareDocumentCommand \Ccool + {%^^A 2 3 4 5 6 7 8 9 + D<>{#1} +o E{ i }{{#2}} m t+ s E{ s o }{{#3}{#4}} +o + } + { + \IfValueT{##2}{##2} + \@@_make_ccool_sideeffect:nnn{##1}{##3}{##4} + \IfBooleanT{##6} + { + \@@_make_ccool_exp:nnn{##1}{##7}{##8} + } + \bool_if:nTF{##5} + { + \gappto{\CcoolHook} + { + \@@_make_ccool_sideeffect:nnn{##1}{##3}{##4} + } + } + {\c_empty_tl} + \IfValueT{##9} + { + \exp_not:n{ \Ccool<##1>[##9] } + } + } +} +\msg_new:nnn {@@}{ generic }{#1} +\msg_new:nnn {@@}{ iow }{#1~is~closed~can't~write} +\msg_new:nnn {@@}{ keyonly }{#1~does~not~take~values;~keyval~is~#2} +\msg_new:nnn {@@}{ keywrong }{#1~does~not~recognize~key~#2} +\msg_new:nnn {@@}{ separ }{#1~expects~1~to~3~items,~#2} +\msg_new:nnn {@@}{ unset }{#1~unset} +\cs_new_protected:Nn \@@_option_inner:n +{ + \tl_gset:Nn \g@@_option_inner_tl {#1} +} +\@@_option_inner:n +{ + \msg_warning:nnn{ @@ }{ unset }{ \exp_not:N \g@@_option_inner_tl } +} +\cs_new:Nn \@@_option_name:n +{ + \tl_gset:Nn \g@@_option_name_tl{#1} +} +\@@_option_name:n +{ + \msg_error:nnx{ @@ } + { generic } + { \exp_not:N\g@@_option_name_tl~undefined } +} +\cs_new_protected:Nn \@@_option_outer:n +{ + \tl_gset:Nn \g@@_option_outer_tl {#1} +} +\@@_option_outer:n +{ + \msg_warning:nnn{ @@ }{ unset }{ \exp_not:N \g@@_option_outer_tl } +} +\cs_new_protected:Nn \@@_option_separ:n +{ + \cs_gset:Npn \g@@_option_separ_tl {#1} +} +\@@_option_separ:n +{ + \msg_warning:nnn{ @@ }{ unset }{ \exp_not:N \g@@_option_separ_tl } +} +\cs_new_protected:Npn \@@_prop_append:NN #1 #2 +{ + \cs_set:Nn \@@_prop_append:nn + { + \prop_gput:Nnx #1 {##1}{ \prop_item:Nn #2{##1} } + } + \prop_map_function:NN #2 \@@_prop_append:nn +} +\cs_generate_variant:Nn \@@_prop_append:NN { cN } +\cs_new_protected:Nn \@@_prop_append:Nn +{ + \@@_prop_append:cN{ \@@_prop_name:n {#2} } #1 +} +\cs_new_protected:Nn \@@_prop_clear_new:n +{ + \exp_args:No \prop_clear_new:c{ \@@_prop_name:n {#1} } +} +\cs_new_protected:Nn \@@_prop_clear_new_map:n +{ + \seq_set_from_clist:Nn \g@@_aux_key_seq {#1} + \seq_map_function:NN \g@@_aux_key_seq \@@_prop_clear_new:n +} +\cs_new:Nn \@@_prop_if_exist:nTF +{ + \prop_if_exist:cTF{ \@@_prop_name:n {#1} }{#2}{#3} +} +\cs_new:Nn \@@_prop_item:nn +{ + \prop_item:cn { \@@_prop_name:n {#1} } {#2} +} +\cs_new:Npn \@@_prop_name:n #1{ @@_#1 } +\cs_new_protected:Nn \@@_prop_new:n +{ + \prop_new:c{ \@@_prop_name:n {#1} } +} +\cs_new_protected:Nn \@@_seq_from_prop:NNn +{ + \cs_set_protected:Nn \@@_seq_from_prop:n + { + \seq_gput_right:No #1 { \prop_item:cn{#3}{##1} } + } + \seq_map_function:NN #2 \@@_seq_from_prop:n +} +\cs_new:Nn \@@_seq_use:Nn +{ + \exp_last_unbraced:NNf + \seq_use:Nnnn #1 + \@@_aux_separ:n{#2} +} +\cs_new:Nn \@@_sys_date: +{ + \int_eval:n + { + \c_sys_year_int * 10000 + +\c_sys_month_int * 100 + +\c_sys_day_int * 1 + } +} +\cs_new:Nn \@@_sys_date_hex: +{\int_to_hex:n{\@@_sys_date:}} +\cs_new:Nn \@@_sys_time: +{ + \int_eval:n + { + \c_sys_hour_int * 100 + +\c_sys_minute_int * 1 + } +} +\cs_new:Nn\@@_sys_time_hex: +{\int_to_hex:n{\@@_sys_time:}} +\cs_new:Nn\@@_sys_filename: +{ + \c_sys_jobname_str-- + \@@_sys_date_hex:-- + \@@_sys_time_hex: +} +\NewDocumentCommand{ \CcoolClear } +{ D<>{\g@@_option_name_tl} } +{ + \@@_prop_clear_new_map:n{#1} +} +\NewDocumentCommand{\CcoolHook}{}{\c_empty_tl} +\ProvideDocumentCommand \CcoolLambda { O{1} m } +{ + \@@_lambda:nn { #1 } { #2 } +} +\NewDocumentCommand{ \CcoolOption } +{ m } +{ + \keys_set:nn{ @@ }{#1} +} +\keys_define:nn { @@ } +{ +Expans .multichoices:nn = { eo, ee, ex, xo, xe, xx } +{ \tl_gset_eq:NN \g@@_option_expans_tl \l_keys_choice_tl }, +Expans .default:n = { xo }, +Expans .initial:n = { xo }, +File .code:n = { + \tl_gset:Nx \g@@_log_file_tl{#1} +}, +File .default:n = { \@@_sys_filename: }, +File .initial:n = { \@@_sys_filename: }, +Inner .code:n={ + \@@_option_inner:n{#1} + \exp_last_unbraced:Nf + \@@_make_ccool:nnnn + { + { \g@@_option_name_tl } + { \g@@_option_inner_tl } + { \g@@_option_separ_tl } + { \g@@_option_outer_tl } + } +}, +Inner .value_required:n = false, +Inner .default:n = {####1}, +Inner .initial:n = {####1}, +Name .code:n={ + \@@_option_name:n{#1} + \exp_last_unbraced:Nf + \@@_make_ccool:nnnn + { + { \g@@_option_name_tl } + { \g@@_option_inner_tl } + { \g@@_option_separ_tl } + { \g@@_option_outer_tl } + } +}, +Name .value_required:n = false, +Name .default:n = { Math }, +Name .initial:n = { Math }, +Outer .code:n={ + \@@_option_outer:n{#1} + \exp_last_unbraced:Nf + \@@_make_ccool:nnnn + { + { \g@@_option_name_tl } + { \g@@_option_inner_tl } + { \g@@_option_separ_tl } + { \g@@_option_outer_tl } + } +}, +Outer .value_required:n = false, +Outer .default:n = { \ensuremath{####1} }, +Outer .initial:n = { \ensuremath{####1} }, +Separ .code:n={ + \@@_option_separ:n{#1} + \exp_last_unbraced:Nf + \@@_make_ccool:nnnn + { + { \g@@_option_name_tl } + { \g@@_option_inner_tl } + { \g@@_option_separ_tl } + { \g@@_option_outer_tl } + } +}, +Separ .value_required:n = false, +Separ .default:n = { {\ }and{\ } } { ,{\ } } { ,{\ }and{\ } }, +Separ .initial:n = { {\ }and{\ } } { ,{\ } } { ,{\ }and{\ } }, +Write .code:n = { + \bool_if:nTF{#1} + {\@@_log_open:} + {\@@_log_close:} +}, +Write .value_required:n = false, +Write .default:n = \BooleanFalse, +Write .initial:n = \BooleanFalse +} +\NewDocumentCommand{\CcoolRead} +{o} +{ + \IfValueTF{#1} + {\@@_log_read:e{#1}} + {\@@_log_read:} +} +\NewDocumentCommand{\CcoolVers} +{} +{\use:c{ver@ccool.sty}} +\ExplSyntaxOff +%% +%% Copyright (C) 2020 by Erwann Rogard +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License (LPPL), either +%% version 1.3c of this license or (at your option) any later +%% version. The latest version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Erwann Rogard. +%% +%% This work consists of the file ccool.dtx and the derived files: +%% ccool.sty, and ccool.pdf. +%% +%% +%% End of file `ccool.sty'. -- cgit v1.2.3