diff options
author | Karl Berry <karl@freefriends.org> | 2021-08-23 20:51:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-08-23 20:51:12 +0000 |
commit | fc376d725a42d32a76b301bea7c6731bbac45141 (patch) | |
tree | 80711da8e7a7576a1d9585ea2801e867d0312585 /Master/texmf-dist/tex/latex/cascade/cascade.sty | |
parent | f58a5b400a2f0cc8eacf8e853529a0bf462b2aff (diff) |
cascade (23aug21)
git-svn-id: svn://tug.org/texlive/trunk@60310 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cascade/cascade.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/cascade/cascade.sty | 108 |
1 files changed, 91 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/cascade/cascade.sty b/Master/texmf-dist/tex/latex/cascade/cascade.sty index 4e776bddad2..2af9af477d3 100644 --- a/Master/texmf-dist/tex/latex/cascade/cascade.sty +++ b/Master/texmf-dist/tex/latex/cascade/cascade.sty @@ -6,7 +6,7 @@ %% %% cascade.dtx (with options: `package') %% -%% Copyright (C) 2018 by F. Pantigny +%% Copyright (C) 2018-2021 by F. Pantigny %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -18,15 +18,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.1} -\def\myfiledate{2020/07/05} +\def\myfileversion{1.2} +\def\myfiledate{2021/08/23} \RequirePackage{l3keys2e} \ProvidesExplPackage {cascade} {\myfiledate} {\myfileversion} {Easy presentation of demonstrations in cascades} -\RequirePackage{xparse} %% %% The following macro is the same as the macro of amsmath \cs_if_free:NT \spread@equation @@ -76,6 +75,15 @@ space-between .dim_set:N = \l__cascade_space_between_dim , space-between .value_required:n = true } +\cs_new_protected:Npn \__cascade_initialisation: + { + \box_clear_new:N \l__cascade_box_one + \box_clear_new:N \l__cascade_box_two + \box_clear_new:N \l__cascade_box_three + \box_clear_new:N \l__cascade_box_four + \dim_zero_new:N \l__cascade_top_dim + \dim_zero_new:N \l__cascade_bottom_dim + } \NewDocumentCommand \CascadeOptions { m } { \keys_set:nn { cascade / global } { #1 } } %% @@ -83,7 +91,7 @@ \NewDocumentCommand \Cascade { O { } m m m m D < > { } } { \if_mode_math: - \msg_error:nn { cascade } { Cascade~in~math~mode } + \msg_error:nn { cascade } { math~mode } \fi: \mode_leave_vertical: \bool_if:NF \l__cascade_nested_command_bool @@ -96,10 +104,7 @@ \spread@equation \dim_set_eq:NN \l__cascade_interline_dim \l__cascade_interline_all_dim \keys_set:nn { cascade / command } { #1 } - \box_clear_new:N \l__cascade_box_one - \box_clear_new:N \l__cascade_box_two - \box_clear_new:N \l__cascade_box_three - \box_clear_new:N \l__cascade_box_four + \__cascade_initialisation: \hbox_set:Nn \l__cascade_box_one { \bool_set_true:N \l__cascade_first_argument_bool @@ -114,14 +119,12 @@ #4 } \hbox_set:Nn \l__cascade_box_four { #5 } - \dim_zero_new:N \l__cascade_top_dim \dim_set:Nn \l__cascade_top_dim { \dim_max:nn \c_zero_dim { \box_ht:N \l__cascade_box_one - \box_ht:N \l__cascade_box_two } } - \dim_zero_new:N \l__cascade_bottom_dim \dim_set:Nn \l__cascade_bottom_dim { \dim_max:nn @@ -146,7 +149,7 @@ { \dim_max:nn { \box_ht:N \l__cascade_box_two } { \box_ht:N \strutbox } } \dim_gadd:Nn \g__cascade_yoffset_dim \l_tmpa_dim } - \hbox:n + \hbox { \c_math_toggle_token \left . @@ -187,7 +190,7 @@ \halign { \hfil ## \cr - \hbox:n + \hbox { \tl_if_empty:nF { #1 } { @@ -199,7 +202,7 @@ } \cr \noalign { \skip_vertical:n \l__cascade_interline_dim } - \hbox:n + \hbox { \tl_if_empty:nF { #2 } { @@ -215,12 +218,81 @@ \c_math_toggle_token } } +\NewDocumentCommand \Edacsac { O { } m m m m } + { + \if_mode_math: + \msg_error:nn { cascade } { math~mode } + \fi: + \mode_leave_vertical: + \group_begin: + \spread@equation + \dim_set_eq:NN \l__cascade_interline_dim \l__cascade_interline_all_dim + \keys_set:nn { cascade / command } { #1 } + \__cascade_initialisation: + \hbox_set:Nn \l__cascade_box_one { #2 } + \hbox_set:Nn \l__cascade_box_two { #3 } + \hbox_set:Nn \l__cascade_box_three { #4 } + \hbox_set:Nn \l__cascade_box_four { #5 } + \dim_set:Nn \l__cascade_top_dim + { + \dim_max:nn + \c_zero_dim + { \box_ht:N \l__cascade_box_two - \box_ht:N \l__cascade_box_one } + } + \dim_set:Nn \l__cascade_bottom_dim + { + \dim_max:nn + \c_zero_dim + { \box_dp:N \l__cascade_box_four - \box_dp:N \l__cascade_box_three } + } + \box_set_ht:Nn \l__cascade_box_two \c_zero_dim + \box_set_dp:Nn \l__cascade_box_four \c_zero_dim + \vbox + { + \skip_vertical:N \l__cascade_top_dim + \vtop + { + \hbox + { + \c_math_toggle_token + \left \{ + \vcenter + { + \hbox + { + \tl_if_empty:nF { #2 } + { + \box_use_drop:N \l__cascade_box_one + \skip_horizontal:n \l__cascade_space_between_dim + } + \box_use_drop:N \l__cascade_box_two + \strut + } + \skip_vertical:N \l__cascade_interline_dim + \hbox + { + \tl_if_empty:nF { #4 } + { + \box_use_drop:N \l__cascade_box_three + \skip_horizontal:n \l__cascade_space_between_dim + } + \box_use_drop:N \l__cascade_box_four + \strut + } + } + \right . + \c_math_toggle_token + } + \skip_vertical:N \l__cascade_bottom_dim + } + } + \group_end: +} \msg_new:nnn { cascade } - { Cascade~in~math~mode } + { math~mode } { - The~commands~\token_to_str:N \Cascade\ - and~\token_to_str:N \ShortCascade\ + The~commands~of~the~extension~'cascade'~ should~be~used~in~text~mode~only.~However,~you~can~ go~on~for~this~time. } @@ -234,6 +306,8 @@ } \NewDocumentCommand \ShortCascade { O { } m m } { \Cascade [ #1 ] { } { #2 } { } { #3 } } +\NewDocumentCommand \ShortEdacsac { O { } m m } + { \Edacsac [ #1 ] { #2 } { } { #3 } { } } \endinput %% |