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/source/latex/cascade | |
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/source/latex/cascade')
-rw-r--r-- | Master/texmf-dist/source/latex/cascade/cascade.dtx | 204 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cascade/cascade.ins | 4 |
2 files changed, 172 insertions, 36 deletions
diff --git a/Master/texmf-dist/source/latex/cascade/cascade.dtx b/Master/texmf-dist/source/latex/cascade/cascade.dtx index 33aaa5b8a93..3112dab3142 100644 --- a/Master/texmf-dist/source/latex/cascade/cascade.dtx +++ b/Master/texmf-dist/source/latex/cascade/cascade.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2018-2020 by F. Pantigny +% Copyright (C) 2018-2021 by F. Pantigny % ----------------------------------- % % This file may be distributed and/or modified under the @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{1.1} -\def\myfiledate{2020/07/05} +\def\myfileversion{1.2} +\def\myfiledate{2021/08/23} % % %<*batchfile> @@ -26,7 +26,7 @@ \usedir{tex/latex/cascade} \preamble -Copyright (C) 2018-2020 by F. Pantigny +Copyright (C) 2018-2021 by F. Pantigny ----------------------------------- This file may be distributed and/or modified under the @@ -106,30 +106,32 @@ version 2005/12/01 or later. % \begin{abstract} % The LaTeX package \pkg{cascade} provides a command |\Cascade| to do % constructions to present mathematical demonstrations with successive braces -% for the deductions. +% for the deductions. The package \pkg{cascade} provides also a command +% |\Edacsac| which creates similar structures but with +% braces going backwards. % \end{abstract} % % % % \vspace{1cm} -% \section{Presentation} +% \section{The command \textbackslash Cascade} % % The package \pkg{cascade} provides a command |\Cascade| which allows % constructions like the following where the size of the right brace is computed % on only a part of the LaTeX elements composed on the left. % \begin{center} -% \Cascade{$\det(A) = \begin{vmatrix}3&4\\ -1&7\end{vmatrix}\neq 0$}% -% {and, therefore, $A$ is inversible}% -% {}% +% \Cascade{$\det(A) = \begin{vmatrix}3&4\\ -1&7\end{vmatrix}\neq 0$} +% {and, therefore, $A$ is inversible} +% {} % {yet $AX=Y$} % hence, $X = A^{-1}Y$ % \end{center} % % \medskip % \begin{Verbatim} -% ~emphase#\Cascade@{$\det(A) = \begin{vmatrix}3&4\\ -1&7\end{vmatrix}\neq 0$}% -% {and, therefore, $A$ is inversible}% -% {}% +% ~emphase#\Cascade@{$\det(A) = \begin{vmatrix}3&4\\ -1&7\end{vmatrix}\neq 0$} +% {and, therefore, $A$ is inversible} +% {} % {yet $AX=Y$} % hence, $X = A^{-1}Y$ % \end{Verbatim} @@ -272,13 +274,49 @@ version 2005/12/01 or later. % |\CascadeOptions|. In this case, the scope of the declarations is the current % TeX group (these declarations are ``semi-global''). % +% \bigskip +% \section{The command \textbackslash Edacsac} +% +% The command |\Edacsac| (\textsl{cascade} written in reverse) is similar to the +% command |\Cascade| but with braces going backwards. The key |t| is not available in that command. +% +% \begin{Verbatim} +% Singularity +% ~emphase#\Edacsac@ +% {elementary} +% { +% ~emphase#\Edacsac@ +% {non-degenerate elementary} +% {~emphase#\ShortEdacsac@{hyperbolic}{non-hyperbolic}} +% {degenerate elementary} +% {} +% } +% {non-elementary} +% {~emphase#\ShortEdacsac@{Nilpotent}{Higher order}} +% \end{Verbatim} +% +% +% Singularity +% \Edacsac +% {elementary} +% { +% \Edacsac +% {non-degenerate elementary} +% {\ShortEdacsac{hyperbolic}{non-hyperbolic}} +% {degenerate elementary} +% {} +% } +% {non-elementary} +% {\ShortEdacsac{nilpotent}{higher order}} +% +% % % \bigskip % \section{Technical remark} % -% The package |\Cascade| is designed to provide by default results similar to the -% those given by the environments of \pkg{amsmath} --- and \pkg{mathtools} --- -% especially |{aligned}|. +% The package \pkg{cascade} is designed to provide by default results similar to +% the those given by the environments of \pkg{amsmath} --- and \pkg{mathtools} +% --- especially |{aligned}|. % % \bigskip % \begin{BVerbatim}[baseline=c,boxwidth=10cm] @@ -303,7 +341,8 @@ version 2005/12/01 or later. % The package \pkg{cascade} constructs the braces with the classical pair % |\left|-|\right| of TeX. However, the extensible delimiters, in TeX, cannot % take all sizes. We give, in the following example, the braces obtained when -% surrounding vertical rules from $6$~mm to $17$~mm (the code is in |expl3|). +% surrounding vertical rules from $6$~mm to $17$~mm (the code uses the L3 +% programming layer). % % \begin{Verbatim} % \int_step_inline:nnnn 6 1 {17} { $\left.\hbox{\vrule height ~#1 mm}\right\}$\quad } @@ -330,10 +369,6 @@ version 2005/12/01 or later. {Easy presentation of demonstrations in cascades} % \end{macrocode} % -% \interitem -% \begin{macrocode} -\RequirePackage{xparse} -% \end{macrocode} % % \interitem % \iffalse @@ -404,7 +439,7 @@ version 2005/12/01 or later. %% %% This set of options will be used by \Cascade and \ShortCascade % \fi -% The set of keys |cascade/command| will be used for the commands |\Cascade|. +% The set of keys |cascade/command| will be used by the command |\Cascade|. % \begin{macrocode} \keys_define:nn { cascade / command } { @@ -461,6 +496,19 @@ version 2005/12/01 or later. space-between .value_required:n = true } % \end{macrocode} +% +% \medskip +% \begin{macrocode} +\cs_new_protected:Npn \@@_initialisation: + { + \box_clear_new:N \l_@@_box_one + \box_clear_new:N \l_@@_box_two + \box_clear_new:N \l_@@_box_three + \box_clear_new:N \l_@@_box_four + \dim_zero_new:N \l_@@_top_dim + \dim_zero_new:N \l_@@_bottom_dim + } +% \end{macrocode} % % \medskip % \DescribeMacro{\CascadeOptions} @@ -484,7 +532,7 @@ version 2005/12/01 or later. \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: % \end{macrocode} @@ -500,10 +548,7 @@ version 2005/12/01 or later. \spread@equation \dim_set_eq:NN \l_@@_interline_dim \l_@@_interline_all_dim \keys_set:nn { cascade / command } { #1 } - \box_clear_new:N \l_@@_box_one - \box_clear_new:N \l_@@_box_two - \box_clear_new:N \l_@@_box_three - \box_clear_new:N \l_@@_box_four + \@@_initialisation: \hbox_set:Nn \l_@@_box_one { \bool_set_true:N \l_@@_first_argument_bool @@ -524,7 +569,6 @@ version 2005/12/01 or later. % The dimension |\l_@@_top_dim| is the space that we will have to add before the % main construction to make up for the ``|\smash[t]|'' of the box |#1|. % \begin{macrocode} - \dim_zero_new:N \l_@@_top_dim \dim_set:Nn \l_@@_top_dim { \dim_max:nn @@ -535,7 +579,6 @@ version 2005/12/01 or later. % The dimension |\l_@@_bottom_dim| is the space that we will have to add after % the main construction to make up for the ``|\smash[b]|'' of the box |#3|. % \begin{macrocode} - \dim_zero_new:N \l_@@_bottom_dim \dim_set:Nn \l_@@_bottom_dim { \dim_max:nn @@ -565,6 +608,10 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NT \l_@@_first_argument_bool { +% \end{macrocode} +% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available +% on Overleaf. +% \begin{macrocode} \dim_set:Nn \l_tmpa_dim { \box_ht:N \l_tmpb_box + \box_dp:N \l_tmpb_box } \l_tmpa_dim = 0.5\l_tmpa_dim @@ -575,7 +622,7 @@ version 2005/12/01 or later. } % \end{macrocode} % \begin{macrocode} - \hbox:n + \hbox { \c_math_toggle_token \left . @@ -625,7 +672,7 @@ version 2005/12/01 or later. \halign { \hfil ## \cr - \hbox:n + \hbox { \tl_if_empty:nF { #1 } { @@ -637,7 +684,7 @@ version 2005/12/01 or later. } \cr \noalign { \skip_vertical:n \l_@@_interline_dim } - \hbox:n + \hbox { \tl_if_empty:nF { #2 } { @@ -654,15 +701,92 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% \bigskip +% The command |\Edacsac|. The code is simpler because we don't need the +% |\halign| and we don't have the key |t|. +% +% \begin{macrocode} +\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_@@_interline_dim \l_@@_interline_all_dim + \keys_set:nn { cascade / command } { #1 } + \@@_initialisation: + \hbox_set:Nn \l_@@_box_one { #2 } + \hbox_set:Nn \l_@@_box_two { #3 } + \hbox_set:Nn \l_@@_box_three { #4 } + \hbox_set:Nn \l_@@_box_four { #5 } + \dim_set:Nn \l_@@_top_dim + { + \dim_max:nn + \c_zero_dim + { \box_ht:N \l_@@_box_two - \box_ht:N \l_@@_box_one } + } + \dim_set:Nn \l_@@_bottom_dim + { + \dim_max:nn + \c_zero_dim + { \box_dp:N \l_@@_box_four - \box_dp:N \l_@@_box_three } + } + \box_set_ht:Nn \l_@@_box_two \c_zero_dim + \box_set_dp:Nn \l_@@_box_four \c_zero_dim + \vbox + { + \skip_vertical:N \l_@@_top_dim + \vtop + { + \hbox + { + \c_math_toggle_token + \left \{ + \vcenter + { + \hbox + { + \tl_if_empty:nF { #2 } + { + \box_use_drop:N \l_@@_box_one + \skip_horizontal:n \l_@@_space_between_dim + } + \box_use_drop:N \l_@@_box_two + \strut + } + \skip_vertical:N \l_@@_interline_dim + \hbox + { + \tl_if_empty:nF { #4 } + { + \box_use_drop:N \l_@@_box_three + \skip_horizontal:n \l_@@_space_between_dim + } + \box_use_drop:N \l_@@_box_four + \strut + } + } + \right . + \c_math_toggle_token + } + \skip_vertical:N \l_@@_bottom_dim + } + } + \group_end: +} +% \end{macrocode} +% % % \bigskip % \begin{macrocode} \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. } @@ -688,6 +812,15 @@ version 2005/12/01 or later. { \Cascade [ #1 ] { } { #2 } { } { #3 } } % \end{macrocode} % +% \bigskip +% \DescribeMacro{\ShortEdacsac} +% Idem for |\ShortEdacsac| +% \begin{macrocode} +\NewDocumentCommand \ShortEdacsac { O { } m m } + { \Edacsac [ #1 ] { #2 } { } { #3 } { } } +% \end{macrocode} +% +% % \vspace{1cm} % \section{History} % @@ -695,7 +828,10 @@ version 2005/12/01 or later. % % New option |t|. % +% \subsection*{Changes between versions 1.0 and 1.1} % +% New commands |\Edacsac| and |\ShortEdacsac|. +% % % \PrintIndex % \tableofcontents diff --git a/Master/texmf-dist/source/latex/cascade/cascade.ins b/Master/texmf-dist/source/latex/cascade/cascade.ins index 6f7ebb3ff9a..db89312250c 100644 --- a/Master/texmf-dist/source/latex/cascade/cascade.ins +++ b/Master/texmf-dist/source/latex/cascade/cascade.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2018 by F. Pantigny +%% Copyright (C) 2018-2021 by F. Pantigny %% %% %% This file may be distributed and/or modified under the @@ -17,7 +17,7 @@ \usedir{tex/latex/cascade} \preamble -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 |