From 62c2845193bfddff5c24679c01f891fbb91b4fb9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 12 Mar 2020 20:30:55 +0000 Subject: oops (12mar20) git-svn-id: svn://tug.org/texlive/trunk@54260 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/oops/oops.sty | 238 ++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/oops/oops.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/oops/oops.sty b/Master/texmf-dist/tex/latex/oops/oops.sty new file mode 100644 index 00000000000..1284f917935 --- /dev/null +++ b/Master/texmf-dist/tex/latex/oops/oops.sty @@ -0,0 +1,238 @@ +%% +%% This is file `oops.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% oops.dtx (with options: `package') +%% ---------------------------------------------------------------- +%% oops --- An object oriented practical scribe's package, +%% typically for typesetting math +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------- +%% + \RequirePackage{xparse}[2019/05/28] + \ProvidesExplPackage + {oops} % Package name + {2020/03/11} % Release date + {1.0} % Release version + {An object oriented practical scribe's package} % Description + +\NeedsTeXFormat{LaTeX2e}[2019/10/01] +\ExplSyntaxOn +\msg_new:nnn +{Oops} +{generic} +{#1} +\seq_new:N \__erw_oops_seq +\keys_define:nn { Oops } +{ + GenericObject .tl_gset:N = \__erw_oops_object_default_tl, + GenericObject .value_required:n = false, + GenericObject .default:n = {Math}, + GenericObject .initial:n = {Math}, + Inner .code:n = + { + \cs_gset:Npn \__erw_oops_inner_default:n ##1{#1} + }, + Inner .value_required:n = false, + Inner .default:n = {#1}, + Inner .initial:n = {#1}, + Separators .tl_gset:N = \__erw_oops_separators_default_tl, + Separators .value_required:n = false, + Separators .default:n = {{ \text{~and~}}{\text{,~}}{\text{,~and~}}}, + Separators .initial:n = {{ \text{~and~}}{\text{,~}}{\text{,~and~}}}, + Outer .code:n = + { + \cs_gset:Npn \__erw_oops_outer_default:n ##1{#1} + }, + Outer .value_required:n = false, + Outer .default:n = {\ensuremath{#1}}, + Outer .initial:n = {\ensuremath{#1}} +} +\cs_new:Npn \__erw_oops_name:n #1{__erw_oops_#1} +\cs_new_protected:Nn \__erw_oops_new:n +{ + \prop_new:c{\__erw_oops_name:n { #1 }} +} +\cs_new_protected:Nn \__erw_oops_clear_new:n +{ + \prop_clear_new:c{\__erw_oops_name:n { #1 }} +} +\cs_new_protected:Nn \__erw_oops_put:nnn +{ + \prop_put:cnn { \__erw_oops_name:n { #1 } } { #2 } { #3 } +} +\cs_new_protected:Nn \__erw_oops_putinner:nnn +{ + \__erw_oops_put:nnn{#1} + {#2} + {\__erw_oops_inner:n{#3}} +} +\cs_new:Nn \__erw_oops_item:nn +{ + \prop_item:cn { \__erw_oops_name:n { #1 } } { #2 } +} +\cs_new:Npn \__erw_oops_item:nnn #1 #2 #3 +{ + \__erw_oops_item:nn{#1}{#2} +} +\cs_new:Nn \__erw_oops_itemcmd:Nn +{ + \ProvideDocumentCommand{#1} + {O{\__erw_oops_object_default_tl}} + { + \__erw_oops_item:nn {##1}{ #2 } + } +} +\cs_generate_variant:Nn \__erw_oops_itemcmd:Nn {c} +\cs_new:Npn \__erw_oops_itemcmd:nnn +#1 +#2 +#3 +{ + \__erw_oops_itemcmd:cn{#2}{#2} +} +\cs_new:Npn \__erw_oops_itemto_seq:nnn #1 #2 #3 +{ + \seq_put_right:Nn + \__erw_oops_seq + {\__erw_oops_item:nn{#1}{#2}} +} +\cs_new:Nn \__erw_oops_if_exist:nTF +{ + \prop_if_exist:cTF{\__erw_oops_name:n { #1 }}{#2}{#3} +} +\cs_set:Npn \__erw_oops_parse:Nnn +#1 % fun +#2 % prop name +#3 % clist +{ + + \tl_if_blank:nTF{#3} + {\c_empty_tl} + { + \seq_set_split:Nnn \l_tmpa_seq {,}{#3} + \cs_set:Npn \__erw_oops_parse:w ##1 = ##2 \q_stop + { + #1 + {#2} + {\tl_trim_spaces:n{##1}} % key + {\tl_trim_spaces:n{##2}} % value + } + \cs_set:Npn \__erw_oops_parse:n ##1 + { + \__erw_oops_parse:w ##1 \q_stop + } + \seq_map_function:NN \l_tmpa_seq \__erw_oops_parse:n + } +} +\NewDocumentCommand{\OopsOptions} +{m} +{ + \keys_set:nn { Oops } {#1} +} +\NewDocumentCommand{\OopsClear} +{m} +{ + \__erw_oops_clear_new:n{#1} +} +\NewDocumentCommand{\OopsNew} +{ + m + +o + E{iso} + { + {\__erw_oops_inner_default:n{##1}} + {\__erw_oops_separators_default_tl} + {\__erw_oops_outer_default:n{##1}} + } + m + E{i} + { + {\__erw_oops_inner_default:n{##1}} + } + g + +o +} +{ + \__erw_oops_if_exist:nTF{#1} + {\c_empty_tl} + {\__erw_oops_new:n{#1}} + + \IfValueTF{#2} + {#2} + {\c_empty_tl} + \cs_gset:Npn + + \__erw_oops_inner:n ##1 + {#3} + \__erw_oops_parse:Nnn + \__erw_oops_putinner:nnn + {#1} + {#6} + + \__erw_oops_parse:Nnn + \__erw_oops_itemcmd:nnn + {#1} + {#6} + + \IfValueTF{#2} + { + \seq_clear:N \__erw_oops_seq + \__erw_oops_parse:Nnn + \__erw_oops_itemto_seq:nnn + {#1} + {#6} + \cs_gset:Npn + \__erw_oops_outer:n ##1 + {#5} + \__erw_oops_outer:n + {\exp_last_unbraced:NNo + \seq_use:Nnnn + \__erw_oops_seq + {#4} + } + } + {\c_empty_tl} + + \IfValueTF{#8} + { + \IfValueTF{#9} + { + \exp_not:n{\OopsNew{#1}i{#7}{#8}[#9]} + } + { + \exp_not:n{\OopsNew{#1}i{#7}{#8}} + } + } + { + \IfValueTF{#9} + { + \exp_not:n{\OopsNew{#1}[#9]} + } + {\c_empty_tl} + } +} +\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 oops.dtx +%% and the derived files oops.ins, +%% oops.pdf and +%% oops.sty. +%% +%% +%% End of file `oops.sty'. -- cgit v1.2.3