From 52b71425066d8e4015ed93679940bedbf7d69e3a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 5 Jul 2020 20:54:40 +0000 Subject: cascade (5jul20) git-svn-id: svn://tug.org/texlive/trunk@55759 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/cascade/README.md | 29 +- .../doc/latex/cascade/cascade-french.pdf | Bin 0 -> 65039 bytes .../doc/latex/cascade/cascade-french.tex | 310 +++++++++++++ Master/texmf-dist/doc/latex/cascade/cascade.pdf | Bin 74417 -> 108503 bytes Master/texmf-dist/source/latex/cascade/cascade.dtx | 506 +++++++++++++++------ Master/texmf-dist/tex/latex/cascade/cascade.sty | 268 +++++++---- 6 files changed, 896 insertions(+), 217 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/cascade/cascade-french.pdf create mode 100644 Master/texmf-dist/doc/latex/cascade/cascade-french.tex (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/cascade/README.md b/Master/texmf-dist/doc/latex/cascade/README.md index a92779e26c5..a124aabb105 100644 --- a/Master/texmf-dist/doc/latex/cascade/README.md +++ b/Master/texmf-dist/doc/latex/cascade/README.md @@ -1,8 +1,29 @@ -The LaTeX extension nicematrix is distributed under the LPPL 1.3 license. +# Readme for the package cascade -This extension has been written by F. Pantigny (fpantigny@wanadoo.fr). +Author: F. Pantigny (`fpantigny@wanadoo.fr`). -This extension is entirely contained in a single file : cascade.sty +CTAN page: `https://ctan.org/pkg/nicematrix` -The LaTeX package cascade provides a command \Cascade to do contructions to present mathematical +## License +The LaTeX extension `cascade` is distributed under the LPPL 1.3 license. + +## Presentation + + +The LaTeX package `cascade` provides a command `\Cascade` to do contructions to present mathematical demonstrations with successive braces for the deductions. + + +## Installation + +The package `cascade` is present in the distributions MiKTeX, TeXLive and MacTeX. + +For a manual installation: + +* put the files `cascade.ins` and `cascade.dtx` in the same directory; +* run `latex cascade.ins`. + +The file `cascade.sty` will be generated. + +The file `cascade.sty` is the only file necessary to use the extension `cascade`. +You have to put it in the same directory as your document or (best) in a `texmf` tree. diff --git a/Master/texmf-dist/doc/latex/cascade/cascade-french.pdf b/Master/texmf-dist/doc/latex/cascade/cascade-french.pdf new file mode 100644 index 00000000000..223217e4a6f Binary files /dev/null and b/Master/texmf-dist/doc/latex/cascade/cascade-french.pdf differ diff --git a/Master/texmf-dist/doc/latex/cascade/cascade-french.tex b/Master/texmf-dist/doc/latex/cascade/cascade-french.tex new file mode 100644 index 00000000000..bc0115099c8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/cascade/cascade-french.tex @@ -0,0 +1,310 @@ +% -*- coding: utf-8 ; -*- +\documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix) +\usepackage{xltxtra} +\usepackage[french]{babel} +\frenchsetup{og = « , fg = »} + +\usepackage{xcolor} +\usepackage{tikz} +\usetikzlibrary{calc} +\usepackage{geometry} +\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} + +\usepackage{cascade} + + +\usepackage{enumitem} +\usepackage{verbatim} +\usepackage{amsmath} + +% We use \MakeShortVerb of shortvrb and not \DefineShortVerb of fancyvrb +% because we don't want the contents of short verbatim colored in gray +\usepackage{shortvrb} +\MakeShortVerb{\|} + +\setlength{\fboxsep}{0pt} + +\usepackage{fancyvrb} +\fvset{commandchars=\~\#\@,formatcom=\color{gray}} + +\usepackage{titlesec} +\titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex} +\titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex} + + +\def\interitem{\vspace{7mm plus 2 mm minus 3mm}} +\def\emphase{\bgroup\color{RoyalPurple}\let\next=} + +\usepackage{footnote} + +\usepackage{varwidth} + +\usepackage[hyperfootnotes = false]{hyperref} + +\hypersetup + { + pdfinfo = + { + Title = L’extension cascade , + Subject = Une extension LaTeX , + Author = F. Pantigny + } + } + + +\NewDocumentEnvironment {scope} {} {} {} + +\NewDocumentCommand {\pkg} {m} {\textsf{#1}} +\NewDocumentCommand {\cls} {m} {\textsf{#1}} + +\setlength{\parindent}{0pt} + + +\begin{document} + +\VerbatimFootnotes + + +\title{L'extension LaTeX \pkg{cascade}\thanks{Ce document correspond à la +version~\myfileversion\space of \pkg{cascade}, à la date du~\myfiledate.}} +\author{F. Pantigny \\ \texttt{fpantigny@wanadoo.fr}} + +\maketitle + +\begin{abstract} +L'extension LaTeX \pkg{cascade} fournit une commande |\Cascade| pour faire des +constructions qui présentent des démonstrations mathématiques avec des accolades +enchaînées pour les déductions. +\end{abstract} + + + +\vspace{1cm} +\section{Présentation} + +L'extension \pkg{cascade} fournit une commande |\Cascade| qui permet des +constructions comme la suivante, où la taille de l'accolade de droite est +calculée sur seulement une partie des éléments LaTeX composés à gauche. +\begin{center} +\Cascade{$\det(A) = \begin{vmatrix}3&4\\ -1&7\end{vmatrix}\neq 0$}% + {et, par conséquent, $A$ est inversible}% + {}% + {or $AX=Y$} +donc, $X = A^{-1}Y$ +\end{center} + +\medskip +\begin{Verbatim} +~emphase#\Cascade@{$\det(A) = \begin{vmatrix}3&4\\ -1&7\end{vmatrix}\neq 0$}% + {et, par conséquent, $A$ est inversible}% + {}% + {or $AX=Y$} +donc, $X = A^{-1}Y$ +\end{Verbatim} + + +\interitem +La commande |\Cascade| prend ses quatre arguments comme suit : +\begin{center} +\Cascade{\fbox{\hbox to 2cm{\vrule height 18 pt depth 5 pt width 0pt\hfil \texttt{\#1}\hfil}}}% +{\fbox{\hbox to 3cm{\vrule height 10 pt depth 12 pt width 0pt\hfil \texttt{\#2}\hfil}}}% +{\fbox{\hbox to 2.5cm{\vrule height 15 pt depth 14 pt width 0pt\hfil \texttt{\#3}\hfil}}}% +{\fbox{\hbox to 1.7cm{\vrule height 12 pt depth 5 pt width 0pt\hfil \texttt{\#4}\hfil}}} +\end{center} + +\interitem +Les commandes |\Cascade| peuvent être imbriquées comme dans l'exemple suivant : +\begin{center} +\Cascade{\ShortCascade{$(BH) \perp (AC)$}{$(OC) \perp (AC)$}} + {or\enskip $(BH) \parallel (OC)$} + {\ShortCascade{$(CH) \perp (AB)$}{$(OB) \perp (AB)$}} + {or\enskip $(CH) \parallel (OB)$} +donc $(OBHC)$ est un parallélogramme +\end{center} + +\interitem +Pour la lisibilité de ces constructions, une version simplifiée de |\Cascade| +est disponible, nommée |\ShortCascade|. + + +Le code |\ShortCascade{X}{Y}| est simplement un raccourci pour le code +|\Cascade{}{X}{}{Y}|. + +\medskip +L'exemple précédent peut être codé avec deux commandes |\ShortCascade| +et une commande |\Cascade| englobante. +\begin{Verbatim} +~emphase#\Cascade@{~emphase#\ShortCascade@{$(BH) \perp (AC)$} + {$(OC) \perp (AC)$}} + {or\enskip $(BH) \parallel (OC)$} + {~emphase#\ShortCascade@{$(CH) \perp (AB)$} + {$(OB) \perp (AB)$}} + {or\enskip $(CH) \parallel (OB)$} +donc $(OBHC)$ est un parallélogramme +\end{Verbatim} + + +\bigskip +\section{L'option t} + +Si on utilise l'option |t| sur la commande |\Cascade| englobante, une structure +complète de commandes |\Cascade| est alignée sur la ligne du haut. + +Quand cette clé |t| est utilisée, si on souhaite ajouter du texte après la +structure, on doit le placer entre chevrons pour que ce texte soit aligné avec +la dernière accolade. + + +\begin{Verbatim} +\begin{enumerate} +\item \Cascade~emphase#[t]@{\ShortCascade{$(BH) \perp (AC)$}{$(OC) \perp (AC)$}} + {or\enskip $(BH) \parallel (OC)$} + {\Cascade{}{$(CH) \perp (AB)$}{}{$(OB) \perp (AB)$}} + {or\enskip $(CH) \parallel (OB)$} + ~emphase#@ +\end{enumerate} +\end{Verbatim} + + +\begin{enumerate} +\item \Cascade[t]{\ShortCascade{$(BH) \perp (AC)$}{$(OC) \perp (AC)$}} + {or\enskip $(BH) \parallel (OC)$} + {\Cascade{}{$(CH) \perp (AB)$}{}{$(OB) \perp (AB)$}} + {or\enskip $(CH) \parallel (OB)$} + +\end{enumerate} + + + +\bigskip +\section{Autres options} + +\begin{itemize} +\item L'option |space-between| est une dimension LaTeX décrite sur la figure +suivante. Sa valeur initiale est de $0.5$~em. Elle s'applique à la commande +courante mais aussi à toutes les éventuelles commandes imbriquées dedans. + + +\item L'option |interline| peut être utilisée pour \emph{augmenter} +l'«interligne» +comme illustré sur la figure suivante. La valeur initiale de |interline| est de +$0$~pt et s'applique seulement à la commande |\Cascade| courante. + +\item L'option |interline-all| change la valeur initiale de |interline| utilisée +par la commande |\Cascade| courante mais aussi toutes les éventuelles commandes +|\Cascade| imbriquées. +\end{itemize} + +\vspace{1cm} + +\begin{center} +\Cascade{\fbox{\hbox to 2cm{\vrule height 18 pt depth 5 pt width 0pt\hfil \texttt{\#1}\hfil + \tikz[remember picture] \coordinate (one) at (0,0) ;}}}% +{\fbox{\vtop{\hbox to 3cm{\tikz[remember picture] \coordinate (two) at (0,0) ; + \vrule height 10 pt depth 12 pt width 0pt\hfil \texttt{\#2}\hfil} + \hbox{\tikz[remember picture] \coordinate (three) at (0,0) ;}}}}% +{\fbox{\vbox{\hbox{\tikz[remember picture] \coordinate (four) at (0,0) ;}% + \hbox to 2.5cm{\vrule height 15 pt depth 14 pt width 0pt\hfil \texttt{\#3}\hfil}}}}% +{\fbox{\hbox to 1.7cm{\vrule height 12 pt depth 5 pt width 0pt\hfil \texttt{\#4}\hfil}}} +\begin{tikzpicture}[remember picture,overlay,blue] +\draw (one) to ++(0,1cm) coordinate (A) to ++(0,2mm) ; +\draw (two) to ++(0,1cm) coordinate (B) to ++(0,2mm) ; +\draw (A) -- (B) ; +\draw[<-] (A) -- ++(-1mm,0) ; +\draw[<-] (B) -- ++(1mm,0) ; +\path (B) node [right=2mm] {\texttt{space-between}} ; +\draw (three) to ++(-3cm,0) coordinate (C) to ++(-2mm,0) ; +\draw (four) -| coordinate (D) (C) ; +\draw (D) to ++(-2mm,0) ; +\draw[<-] (C) -- ++(0,1mm) ; +\draw[<-] (D) -- ++(0,-1mm) ; +\path ($(C)!0.5!(D)$) node [left=2mm] {l'«interligne»} ; +\end{tikzpicture} +\end{center} + +\begin{Verbatim} +\Cascade[~emphase#interline=4mm@]{\ShortCascade{A}{B}}{E}{\ShortCascade{C}{D}}{F} G +\end{Verbatim} + +\begin{center} +\Cascade[interline=4mm]{\ShortCascade{A}{B}}{E}{\ShortCascade{C}{D}}{F} G +\end{center} + +\bigskip +\begin{Verbatim} +\Cascade[~emphase#interline-all=4mm@]{\ShortCascade{A}{B}}{E}{\ShortCascade{C}{D}}{F} G +\end{Verbatim} + +\begin{center} +\Cascade[interline-all=4mm]{\ShortCascade{A}{B}}{E}{\ShortCascade{C}{D}}{F} G +\end{center} + +\interitem +Ces options peuvent être fixées au niveau du document avec la commande +|\CascadeOptions|. Dans ce cas, la portée de ces déclarations est le groupe TeX +courant (ces déclarations sont, comme on dit parfois «semi-globales»). + + + +\bigskip +\section{Remarque technique} + +L'extension |\Cascade| est conçue pour fournir par défaut des résultats similaires +à ceux fournis par les environnements de l'\pkg{amsmath} (et de +\pkg{mathtools}), en particulier |{aligned}|. + + +\bigskip +\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\[\left.\begin{aligned} +& A = \sqrt{a^2+b^2} \\ +& B = \frac{ax+b}{cx+d} +\end{aligned}\right\}\] +\end{BVerbatim} +$\left.\begin{aligned} +& A = \sqrt{a^2+b^2} \\ +& B = \frac{ax+b}{cx+d} +\end{aligned}\right\}$ + +\bigskip +\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\ShortCascade{$\displaystyle A = \sqrt{a^2+b^2}$} + {$B = \dfrac{ax+b}{cx+d}$} +\end{BVerbatim} +\ShortCascade{$\displaystyle A = \sqrt{a^2+b^2}$}{$B = \dfrac{ax+b}{cx+d}$} + +\interitem +L'extension \pkg{cascade} construit les accolades avec la paire habituelle +|\left|-|\right| de TeX. Néanmoins, les délimiteurs extensibles, en TeX, ne +peuvent pas prendre toutes les tailles. On donne, dans l'exemple suivant, les +accolades obtenues en entourant des filets verticaux de $6$~mm à $17$~mm (le code +est en |expl3|). + +\begin{Verbatim} +\int_step_inline:nnnn 6 1 {17} { $\left.\hbox{\vrule height ~#1 mm}\right\}$\quad } +\end{Verbatim} + +\medskip +\begin{center} +\ExplSyntaxOn +\int_step_inline:nnnn 6 1 {17} { $\left.\hbox{\vrule height #1 mm}\right\}$\quad} +\ExplSyntaxOff +\end{center} + + +\section*{Autre documentation} + +Le document |cascade.pdf| (fourni avec l'extension \pkg{cascade}) contient une traduction anglaise de la +documentation ici présente, ainsi que le code source commenté et un historique des versions. + + + + + + +\end{document} + + + + + diff --git a/Master/texmf-dist/doc/latex/cascade/cascade.pdf b/Master/texmf-dist/doc/latex/cascade/cascade.pdf index 4ce09e99de2..b500b161715 100644 Binary files a/Master/texmf-dist/doc/latex/cascade/cascade.pdf and b/Master/texmf-dist/doc/latex/cascade/cascade.pdf differ diff --git a/Master/texmf-dist/source/latex/cascade/cascade.dtx b/Master/texmf-dist/source/latex/cascade/cascade.dtx index a69a8122128..33aaa5b8a93 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 by F. Pantigny +% Copyright (C) 2018-2020 by F. Pantigny % ----------------------------------- % % This file may be distributed and/or modified under the @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{1.01} -\def\myfiledate{2018/07/12} +\def\myfileversion{1.1} +\def\myfiledate{2020/07/05} % % %<*batchfile> @@ -26,7 +26,7 @@ \usedir{tex/latex/cascade} \preamble -Copyright (C) 2018 by F. Pantigny +Copyright (C) 2018-2020 by F. Pantigny ----------------------------------- This file may be distributed and/or modified under the @@ -60,21 +60,53 @@ version 2005/12/01 or later. \fvset{commandchars=\~\#\@,formatcom={\color{gray}}} \parindent 0pt \skip\footins = 2\bigskipamount -\DisableCrossrefs + + +\EnableCrossrefs +\makeatletter +\ExplSyntaxOn +\DoNotIndex{\begin,\end} +\DoNotIndex{\c@iRow,\c@jCol,\theiRow,\thejCol} +\DoNotIndex{\pgfpicture,\endpgfpicture,\tikzpicture,\endtikzpicture} +\DoNotIndex{\pgfpoint,\pgfnode,\pgfnodealias,\pgfcoordinate} +\DoNotIndex{\pgf@x,\pgf@y} +\DoNotIndex{\int_add:Nn,\int_case:nnTF,\int_compare:nNnTF,\int_compare:nTF, + \int_compare_p:nNn,\int_decr:N,\int_eval:n,\int_add:Nn,\int_gdecr:N,\int_gincr:N + \int_gset:Nn,\int_gset_eq:NN,\int_gzero:N,\int_gzero_new:N,\int_if_odd:nTF, + \int_max:nn,\int_new:N,\int_set:Nn,\int_set_eq:NN,\int_step_inline:nnn, + \int_step_variable:nNn,\int_step_variable:nnNn,\int_sub:Nn,\int_use:N,\int_zero:N, + \int_zero_new:N,\g_tmpa_int,\l_tmpa_int,\l_tmpb_int +} +\DoNotIndex{\dim_abs:n,\dim_add:Nn,\dim_compare:nNnTF,\dim_compare_p:nNn, +\dim_const:Nn,\dim_eval:n,\dim_gadd:Nn,\dim_gset:Nn,\dim_gset_eq:NN, +\dim_gset:Nn,\dim_gset_eq:NN,\dim_gsub:Nn,\dim_gzero_new:N,\dim_max:nn, +\dim_min:nn,\dim_new:N,\dim_ration:nn,\dim_set:Nn,\dim_set_eq:NN,\dim_sub:Nn, +\dim_use:N,\dim_zero:N,\dim_zero_new:N,\g_tmpa_dim,\l_tmpa_dim,\l_tmpb_dim, +\c_zero_dim} +\DoNotIndex{\cs_new_protected:Npn,\cs_new:Npn,\cs_set_eq:NN, +\cs_set_protected:Npn} +\DoNotIndex{\bool_if:NTF,\bool_new:N,\bool_set_false:N,\bool_set_true:N,\l_tmpa_bool} +\DoNotIndex{\group_begin:,\group_end:,\c_math_toggle_token} +\DoNotIndex{\tl_set:Nn,\l_tmpa_tl} +\ExplSyntaxOff +\makeatother + + \begin{document} \DocInput{cascade.dtx} \end{document} % % \fi -% \title{The package \pkg{cascade}\thanks{This document corresponds to the version~\myfileversion\space of -% \pkg{cascade}, at the date of~\myfiledate.}} +% \title{The package \pkg{cascade}\thanks{This document corresponds to the +% version~\myfileversion\space of \pkg{cascade}, at the date of~\myfiledate.}} % \author{F. Pantigny \\ \texttt{fpantigny@wanadoo.fr}} % % \maketitle % % \begin{abstract} -% The LaTeX package \pkg{cascade} provides a command |\Cascade| to do constructions to present mathematical -% demonstrations with successive braces for the deductions. +% The LaTeX package \pkg{cascade} provides a command |\Cascade| to do +% constructions to present mathematical demonstrations with successive braces +% for the deductions. % \end{abstract} % % @@ -82,8 +114,9 @@ version 2005/12/01 or later. % \vspace{1cm} % \section{Presentation} % -% The package \pkg{cascade} gives 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. +% 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}% @@ -122,12 +155,15 @@ version 2005/12/01 or later. % \end{center} % % \interitem -% For the lisibility of such constructions, a simplified version of |\Cascade| is available, named |\ShortCascade|. +% For the lisibility of such constructions, a simplified version of |\Cascade| +% is available, named |\ShortCascade|. % -% The code |\ShortCascade{X}{Y}| is merely a shortcut for the code |\Cascade{}{X}{}{Y}|. +% The code |\ShortCascade{X}{Y}| is merely a shortcut for the code +% |\Cascade{}{X}{}{Y}|. % % \medskip -% The preceding example can be coded with two commands |\ShortCascade| and an encompassing command |\Cascade| : +% The preceding example can be coded with two commands |\ShortCascade| and an +% encompassing command |\Cascade|: % \begin{Verbatim} % ~emphase#\Cascade@{~emphase#\ShortCascade@{$(BH) \perp (AC)$} % {$(OC) \perp (AC)$}} @@ -140,17 +176,51 @@ version 2005/12/01 or later. % % % \bigskip -% \section{The options} +% \section{The option t} +% +% With the option |t| in the encompassing command |\Cascade|, a whole strucutre +% of nested commands |\Cascade| is aligned on the top line. +% +% When the key |t| is used, if we wish to add some text after the structure, we +% have to put that text between angle brackets in order to have that text +% aligned with the last brace. +% +% \begin{Verbatim} +% \begin{enumerate} +% \item \Cascade~emphase#[t]@{\ShortCascade{$(BH) \perp (AC)$}{$(OC) \perp (AC)$}} +% {hence\enskip $(BH) \parallel (OC)$} +% {\Cascade{}{$(CH) \perp (AB)$}{}{$(OB) \perp (AB)$}} +% {hence\enskip $(CH) \parallel (OB)$} +% ~emphase#@ +% \end{enumerate} +% \end{Verbatim} +% +% +% \begin{enumerate} +% \item \Cascade[t]{\ShortCascade{$(BH) \perp (AC)$}{$(OC) \perp (AC)$}} +% {hence\enskip $(BH) \parallel (OC)$} +% {\Cascade{}{$(CH) \perp (AB)$}{}{$(OB) \perp (AB)$}} +% {hence\enskip $(CH) \parallel (OB)$} +% +% \end{enumerate} +% +% +% +% \bigskip +% \section{Other options} % % \begin{itemize} -% \item The option |space-between| is a TeX dimension described on the following figure. Its default value is -% $0.5$~em. It applies to the current command |\Cascade| but also to the possible nested commands. +% \item The option |space-between| is a TeX dimension described on the following +% figure. Its initial value is $0.5$~em. It applies to the current command +% |\Cascade| but also to the possible nested commands. % -% \item The option |interline| can be used to \emph{increase} the ``interline'' showed in the following picture. -% The default value of |interline| is $0$~pt and applies only to the current command |\Cascade|. +% \item The option |interline| can be used to \emph{increase} the ``interline'' +% showed in the following picture. The initial value of |interline| is $0$~pt +% and applies only to the current command |\Cascade|. % -% \item The option |interline-all| changes the default value of |interline| used by the current command |Cascade| -% and all the possible nested commands |\Cascade|. +% \item The option |interline-all| changes the default value of |interline| used +% by the current command |\Cascade| and all the possible nested commands +% |\Cascade|. % \end{itemize} % % \vspace{1cm} @@ -164,8 +234,6 @@ version 2005/12/01 or later. % {\fbox{\vbox{\hbox{\tikz[remember picture] \coordinate (four) at (0,0) ;}% % \hbox to 2.5cm{\vrule height 15 pt depth 14 pt width 0pt\hfil \texttt{\#3}\hfil}}}}% % {\fbox{\hbox to 1.7cm{\vrule height 12 pt depth 5 pt width 0pt\hfil \texttt{\#4}\hfil}}} -% \end{center} -% % \begin{tikzpicture}[remember picture,overlay,blue] % \draw (one) to ++(0,1cm) coordinate (A) to ++(0,2mm) ; % \draw (two) to ++(0,1cm) coordinate (B) to ++(0,2mm) ; @@ -180,6 +248,7 @@ version 2005/12/01 or later. % \draw[<-] (D) -- ++(0,-1mm) ; % \path ($(C)!0.5!(D)$) node [left=2mm] {the ``interline''} ; % \end{tikzpicture} +% \end{center} % % \begin{Verbatim} % \Cascade[~emphase#interline=4mm@]{\ShortCascade{A}{B}}{E}{\ShortCascade{C}{D}}{F} G @@ -199,15 +268,17 @@ version 2005/12/01 or later. % \end{center} % % \interitem -% The options can also be given at the document level with the command |\CascadeOptions|. In this case, the scope -% of the declarations is the current TeX group (these declarations are ``semi-global''). +% The options can also be given at the document level with the command +% |\CascadeOptions|. In this case, the scope of the declarations is the current +% TeX group (these declarations are ``semi-global''). % % % \bigskip % \section{Technical remark} % -% The package |\Cascade| is designed to give by default results similar to the those given by the environments of -% \pkg{amsmath} --- and \pkg{mathtools} --- especially |{aligned}|. +% 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}|. % % \bigskip % \begin{BVerbatim}[baseline=c,boxwidth=10cm] @@ -229,8 +300,9 @@ version 2005/12/01 or later. % \ShortCascade{$\displaystyle A = \sqrt{a^2+b^2}$}{$B = \dfrac{ax+b}{cx+d}$} % % \interitem -% 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 +% 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|). % % \begin{Verbatim} @@ -269,20 +341,26 @@ version 2005/12/01 or later. %% The following macro is the same as the macro of amsmath % \fi % \DescribeMacro{\spread@equation} -% We will use the command |\spread@equation| of \pkg{amsmath} to increase the interline in the commands |\Cascade|. -% When used, this command becomes no-op (in the current TeX group). +% We will use the command |\spread@equation| of \pkg{amsmath} to increase the +% interline in the commands |\Cascade|. When used, this command becomes no-op +% (in the current TeX group). % -% Nevertheless, we want the extension \pkg{cascade} available without \pkg{amsmath}. That's why we give a -% definition of |\spread@equation| (this definition will be loaded only if \pkg{amsmath} --- or \pkg{mathtools} --- has +% Nevertheless, we want the extension \pkg{cascade} available without +% \pkg{amsmath}. That's why we give a definition of |\spread@equation| (this +% definition will be loaded only if \pkg{amsmath} --- or \pkg{mathtools} --- has % not been loaded yet). % \begin{macrocode} \cs_if_free:NT \spread@equation - {\cs_set_protected:Npn \spread@equation - {\openup\jot - \cs_set_protected:Npn \spread@equation {}}} + { + \cs_set_protected:Npn \spread@equation + { + \openup \jot + \cs_set_protected:Npn \spread@equation { } + } + } % \end{macrocode} -% Don't put |\cs_set_eq:NN \spread@equation \prog_do_nothing:| in the last line because this would raise errors -% with nested environments. +% Don't put |\cs_set_eq:NN \spread@equation \prog_do_nothing:| in the last line +% because this would raise errors with nested environments. % % % \iffalse @@ -290,28 +368,37 @@ version 2005/12/01 or later. %% The following registers will be used for the options. % \fi % \interitem -% The dimension |\l_@@_interline_dim| will be the value of the vertical space added between the two boxes connected -% by the brace. +% The dimension |\l_@@_interline_dim| will be the value of the vertical space +% added between the two boxes connected by the brace. % \begin{macrocode} \dim_new:N \l_@@_interline_dim % \end{macrocode} % -% \medskip -% The dimension |\l_@@_interline_all_dim| is the default value of |\l_@@_interline_dim|. This default value can be -% modified with the option |interline-all|. Therefore, when modified in the options of a command |\Cascade|, this -% value will affect all the possible nested commands. +% \medskip +% The dimension |\l_@@_interline_all_dim| is the default value of +% |\l_@@_interline_dim|. This default value can be modified with the option +% |interline-all|. Therefore, when modified in the options of a command +% |\Cascade|, this value will affect all the possible nested commands. % \begin{macrocode} \dim_new:N \l_@@_interline_all_dim % \end{macrocode} % % \medskip -% The dimension |\l_@@_space_between_dim| is the horizontal space inserted between the two elements of the same row -% of the construction. +% The dimension |\l_@@_space_between_dim| is the horizontal space inserted +% between the two elements of the same row of the construction. % \begin{macrocode} \dim_new:N \l_@@_space_between_dim -\dim_set:Nn \l_@@_space_between_dim {0.5 em} +\dim_set:Nn \l_@@_space_between_dim { 0.5 em } % \end{macrocode} % +% \medskip +% \begin{macrocode} +\bool_new:N \l_@@_t_bool +\bool_new:N \l_@@_main_command_bool +\bool_new:N \l_@@_nested_command_bool +\bool_new:N \l_@@_first_argument_bool +% \end{macrocode} +% % \interitem % \iffalse %% @@ -319,29 +406,42 @@ version 2005/12/01 or later. % \fi % The set of keys |cascade/command| will be used for the commands |\Cascade|. % \begin{macrocode} -\keys_define:nn {cascade/command} +\keys_define:nn { cascade / command } { % \end{macrocode} -% The option |interline| is the vertical space added between the two items connected by a~brace. +% The key |t| means that the command |\Cascade| will be aligned upwards. +% \begin{macrocode} + t .code:n = + \bool_if:NTF \l_@@_t_bool + { \msg_error:nn { cascade } { t~option~already~set } } + { \bool_set_true:N \l_@@_t_bool } , + t .value_forbidden:n = true , +% \end{macrocode} +% The option |interline| is the vertical space added between the two items +% connected by a~brace. % \begin{macrocode} - interline .dim_set:N = \l_@@_interline_dim, - interline .value_required:n = true , + interline .dim_set:N = \l_@@_interline_dim, + interline .value_required:n = true , % \end{macrocode} % -% The option |interline-all| will change the value of |interline| for all the commands |\Cascade|, even the nested -% commands. +% The option |interline-all| will change the value of |interline| for all the +% commands |\Cascade|, even the nested commands. % \begin{macrocode} - interline-all .code:n = { \dim_set:Nn \l_@@_interline_all_dim {#1} - \dim_set:Nn \l_@@_interline_dim {#1} }, - interline-all .value_required:n = true, + interline-all .code:n = + { + \dim_set:Nn \l_@@_interline_all_dim { #1 } + \dim_set:Nn \l_@@_interline_dim { #1 } + } , + interline-all .value_required:n = true , % \end{macrocode} % % \medskip -% The option |space-between| is the horizontal space inserted between the two elements of the same row -% of the construction. +% The option |space-between| is the horizontal space inserted between the two +% elements of the same row of the construction. % \begin{macrocode} - space-between .dim_set:N = \l_@@_space_between_dim, - space-between .value_required:n = true} + space-between .dim_set:N = \l_@@_space_between_dim , + space-between .value_required:n = true + } % \end{macrocode} % % \iffalse @@ -349,24 +449,27 @@ version 2005/12/01 or later. %% This set of options will be used by \CascadeOptions % \fi % \medskip -% The set of keys |cascade/global| will be used for the command |\CascadeOptions| (which fixes the options at a -% ``global'' level). +% The set of keys |cascade/global| will be used for the command +% |\CascadeOptions| (which fixes the options at a ``global'' level). % % \begin{macrocode} -\keys_define:nn {cascade/global} - {interline-all .dim_set:N = \l_@@_interline_all_dim, - interline-all .value_required:n = true, - space-between .dim_set:N = \l_@@_space_between_dim, - space-between .value_required:n = true} +\keys_define:nn { cascade / global } + { + interline-all .dim_set:N = \l_@@_interline_all_dim , + interline-all .value_required:n = true , + space-between .dim_set:N = \l_@@_space_between_dim , + space-between .value_required:n = true + } % \end{macrocode} % % \medskip % \DescribeMacro{\CascadeOptions} -% The command |\CascadeOptions| is the command to set the options of the \pkg{cascade} at the document level (these -% options are set in a local way in the sense of the TeX groups). +% The command |\CascadeOptions| is the command to set the options of the +% \pkg{cascade} at the document level (these options are set in a local way in +% the sense of the TeX groups). % \begin{macrocode} -\NewDocumentCommand \CascadeOptions {m} - {\keys_set:nn {cascade/global} {#1}} +\NewDocumentCommand \CascadeOptions { m } + { \keys_set:nn { cascade / global } { #1 } } % \end{macrocode} % % \iffalse @@ -378,101 +481,232 @@ version 2005/12/01 or later. % The command |\Cascade| is the main command of this package. % % \begin{macrocode} -\NewDocumentCommand \Cascade {O{} mmmm} - { \if_mode_math: - \msg_error:nn {cascade} {Cascade~in~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} - \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 - \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} +\NewDocumentCommand \Cascade { O { } m m m m D < > { } } + { + \if_mode_math: + \msg_error:nn { cascade } { Cascade~in~math~mode } + \fi: + \mode_leave_vertical: +% \end{macrocode} +% The dimension |\g_@@_yoffset_dim| will be used by the option~|t|. +% \begin{macrocode} + \bool_if:NF \l_@@_nested_command_bool + { + \dim_gzero_new:N \g_@@_yoffset_dim + \bool_set_true:N \l_@@_first_argument_bool + } + \group_begin: + + \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 + \hbox_set:Nn \l_@@_box_one + { + \bool_set_true:N \l_@@_first_argument_bool + \bool_set_true:N \l_@@_nested_command_bool + #2 + } + \hbox_set:Nn \l_@@_box_two { #3 } + \hbox_set:Nn \l_@@_box_three + { + \bool_set_false:N \l_@@_first_argument_bool + \bool_set_true:N \l_@@_nested_command_bool + #4 + } + \hbox_set:Nn \l_@@_box_four { #5 } % \end{macrocode} % % \medskip -% 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|. +% 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 \c_zero_dim - {\box_ht:N \l_@@_box_one - \box_ht:N \l_@@_box_two}} + \dim_zero_new:N \l_@@_top_dim + \dim_set:Nn \l_@@_top_dim + { + \dim_max:nn + \c_zero_dim + { \box_ht:N \l_@@_box_one - \box_ht:N \l_@@_box_two } + } % \end{macrocode} -% 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|. +% 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 \c_zero_dim - {\box_dp:N \l_@@_box_three - \box_dp:N \l_@@_box_four}} + \dim_zero_new:N \l_@@_bottom_dim + \dim_set:Nn \l_@@_bottom_dim + { + \dim_max:nn + \c_zero_dim + { \box_dp:N \l_@@_box_three - \box_dp:N \l_@@_box_four } + } % \end{macrocode} % % \medskip % We do the ``|\smash[t]|'' of box |#1| and the ``|\smash[b]|'' of box |#3|. % \begin{macrocode} - \box_set_ht:Nn \l_@@_box_one \c_zero_dim - \box_set_dp:Nn \l_@@_box_three \c_zero_dim + \box_set_ht:Nn \l_@@_box_one \c_zero_dim + \box_set_dp:Nn \l_@@_box_three \c_zero_dim % \end{macrocode} % % \medskip % We can now construct the box. % \begin{macrocode} - \vbox:n - {\skip_vertical:N \l_@@_top_dim - \vbox_top:n - {\hbox:n - {$\left. - \vcenter {\halign{\hfil##\cr - \hbox:n{\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} \cr - \noalign{\skip_vertical:n \l_@@_interline_dim} - \hbox:n{\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} \cr - } - } - \right\}$ + \vbox_set:Nn \l_tmpa_box + { + \skip_vertical:N \l_@@_top_dim + \vbox_top:n + { + \@@_the_vcenter:nn { #2 } { #4 } +% \end{macrocode} +% We update |\g_@@_yoffset_dim|. +% \begin{macrocode} + \bool_if:NT \l_@@_first_argument_bool + { + \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 + \dim_add:Nn \l_tmpa_dim { \the \fontdimen 22 \textfont2 } + \dim_sub:Nn \l_tmpa_dim + { \dim_max:nn { \box_ht:N \l_@@_box_two } { \box_ht:N \strutbox } } + \dim_gadd:Nn \g_@@_yoffset_dim \l_tmpa_dim + } +% \end{macrocode} +% \begin{macrocode} + \hbox:n + { + \c_math_toggle_token + \left . + \box_use_drop:N \l_tmpb_box + \right \} + \c_math_toggle_token + \bool_if:NT \l_@@_t_bool + { + \bool_if:NF \l_@@_nested_command_bool + { + \tl_if_empty:nF { #6 } + { + \skip_horizontal:n \l_@@_space_between_dim + #6 + } + } + } + } + \skip_vertical:N \l_@@_bottom_dim } - \skip_vertical:N \l_@@_bottom_dim - } } - \group_end: -} + \bool_if:NTF \l_@@_nested_command_bool + { \box_use_drop:N \l_tmpa_box } + { +% \end{macrocode} +% We are in the main command |\Cascade| and, if the option~|t| is in force, we +% have now to take into account that key. +% \begin{macrocode} + \bool_if:NTF \l_@@_t_bool + { \box_move_down:nn \g_@@_yoffset_dim { \box_use:N \l_tmpa_box } } + { \box_use_drop:N \l_tmpa_box } + } + \group_end: + } % \end{macrocode} % -% % \bigskip +% The following macro is only for the lisibility of the code. % \begin{macrocode} -\msg_new:nnn {cascade} - {Cascade~in~math~mode} - {The~commands~\token_to_str:N \Cascade\ - and~\token_to_str:N \ShortCascade\ - should~be~used~in~text~mode~only.~However,~you~can~ - go~on~for~this~time.} +\cs_new_protected:Npn \@@_the_vcenter:nn #1 #2 + { + \hbox_set:Nn \l_tmpb_box + { + \c_math_toggle_token + \vcenter + { + \halign + { + \hfil ## \cr + \hbox:n + { + \tl_if_empty:nF { #1 } + { + \box_use_drop:N \l_@@_box_one + \skip_horizontal:n \l_@@_space_between_dim + } + \box_use:N \l_@@_box_two + \strut + } + \cr + \noalign { \skip_vertical:n \l_@@_interline_dim } + \hbox:n + { + \tl_if_empty:nF { #2 } + { + \box_use_drop:N \l_@@_box_three + \skip_horizontal:n \l_@@_space_between_dim + } + \box_use_drop:N \l_@@_box_four + \strut + } + \cr + } + } + \c_math_toggle_token + } + } +% \end{macrocode} +% +% \bigskip +% \begin{macrocode} +\msg_new:nnn + { cascade } + { Cascade~in~math~mode } + { + The~commands~\token_to_str:N \Cascade\ + and~\token_to_str:N \ShortCascade\ + should~be~used~in~text~mode~only.~However,~you~can~ + go~on~for~this~time. + } % \end{macrocode} % +% \begin{macrocode} +\msg_new:nnn + { cascade } + { t~option~already~set } + { + You~can't~use~the~key~'t'~here~because~it~has~been~set~ + in~an~encompassing~command.~If~you~go~on,~this~key~will~be~ + ignored. + } +% \end{macrocode} +% % \bigskip % \DescribeMacro{\ShortCascade} -% The command |\ShortCascade| is a version simplified of |\Cascade| with only two arguments. +% The command |\ShortCascade| is a simplified version of |\Cascade| with only +% two arguments. % \begin{macrocode} -\NewDocumentCommand \ShortCascade {O{}mm} - {\Cascade[#1]{}{#2}{}{#3}} +\NewDocumentCommand \ShortCascade { O { } m m } + { \Cascade [ #1 ] { } { #2 } { } { #3 } } % \end{macrocode} -% \endinput % +% \vspace{1cm} +% \section{History} +% +% \subsection*{Changes between versions 1.0 and 1.1} +% +% New option |t|. +% +% +% +% \PrintIndex +% \tableofcontents +% +% \end{document} +% % Local Variables: -% TeX-fold-mode: nil +% TeX-fold-mode: t +% TeX-fold-preserve-comments: nil +% flyspell-mode: nil +% fill-column: 80 % End: diff --git a/Master/texmf-dist/tex/latex/cascade/cascade.sty b/Master/texmf-dist/tex/latex/cascade/cascade.sty index 6d2ba6f72a1..4e776bddad2 100644 --- a/Master/texmf-dist/tex/latex/cascade/cascade.sty +++ b/Master/texmf-dist/tex/latex/cascade/cascade.sty @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.01} -\def\myfiledate{2018/07/12} +\def\myfileversion{1.1} +\def\myfiledate{2020/07/05} \RequirePackage{l3keys2e} \ProvidesExplPackage {cascade} @@ -30,96 +30,210 @@ %% %% The following macro is the same as the macro of amsmath \cs_if_free:NT \spread@equation - {\cs_set_protected:Npn \spread@equation - {\openup\jot - \cs_set_protected:Npn \spread@equation {}}} + { + \cs_set_protected:Npn \spread@equation + { + \openup \jot + \cs_set_protected:Npn \spread@equation { } + } + } %% %% The following registers will be used for the options. \dim_new:N \l__cascade_interline_dim \dim_new:N \l__cascade_interline_all_dim \dim_new:N \l__cascade_space_between_dim -\dim_set:Nn \l__cascade_space_between_dim {0.5 em} +\dim_set:Nn \l__cascade_space_between_dim { 0.5 em } +\bool_new:N \l__cascade_t_bool +\bool_new:N \l__cascade_main_command_bool +\bool_new:N \l__cascade_nested_command_bool +\bool_new:N \l__cascade_first_argument_bool %% %% This set of options will be used by \Cascade and \ShortCascade -\keys_define:nn {cascade/command} +\keys_define:nn { cascade / command } { - interline .dim_set:N = \l__cascade_interline_dim, - interline .value_required:n = true , - interline-all .code:n = { \dim_set:Nn \l__cascade_interline_all_dim {#1} - \dim_set:Nn \l__cascade_interline_dim {#1} }, - interline-all .value_required:n = true, - space-between .dim_set:N = \l__cascade_space_between_dim, - space-between .value_required:n = true} + t .code:n = + \bool_if:NTF \l__cascade_t_bool + { \msg_error:nn { cascade } { t~option~already~set } } + { \bool_set_true:N \l__cascade_t_bool } , + t .value_forbidden:n = true , + interline .dim_set:N = \l__cascade_interline_dim, + interline .value_required:n = true , + interline-all .code:n = + { + \dim_set:Nn \l__cascade_interline_all_dim { #1 } + \dim_set:Nn \l__cascade_interline_dim { #1 } + } , + interline-all .value_required:n = true , + space-between .dim_set:N = \l__cascade_space_between_dim , + space-between .value_required:n = true + } %% %% This set of options will be used by \CascadeOptions -\keys_define:nn {cascade/global} - {interline-all .dim_set:N = \l__cascade_interline_all_dim, - interline-all .value_required:n = true, - space-between .dim_set:N = \l__cascade_space_between_dim, - space-between .value_required:n = true} -\NewDocumentCommand \CascadeOptions {m} - {\keys_set:nn {cascade/global} {#1}} +\keys_define:nn { cascade / global } + { + interline-all .dim_set:N = \l__cascade_interline_all_dim , + interline-all .value_required:n = true , + space-between .dim_set:N = \l__cascade_space_between_dim , + space-between .value_required:n = true + } +\NewDocumentCommand \CascadeOptions { m } + { \keys_set:nn { cascade / global } { #1 } } %% %% The command \Cascade is defined with \NewDocumentCommand of xparse -\NewDocumentCommand \Cascade {O{} mmmm} - { \if_mode_math: - \msg_error:nn {cascade} {Cascade~in~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} - \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 - \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_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 \c_zero_dim - {\box_dp:N \l__cascade_box_three - \box_dp:N \l__cascade_box_four}} - \box_set_ht:Nn \l__cascade_box_one \c_zero_dim - \box_set_dp:Nn \l__cascade_box_three \c_zero_dim - \vbox:n - {\skip_vertical:N \l__cascade_top_dim - \vbox_top:n - {\hbox:n - {$\left. - \vcenter {\halign{\hfil##\cr - \hbox:n{\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} \cr - \noalign{\skip_vertical:n \l__cascade_interline_dim} - \hbox:n{\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} \cr - } +\NewDocumentCommand \Cascade { O { } m m m m D < > { } } + { + \if_mode_math: + \msg_error:nn { cascade } { Cascade~in~math~mode } + \fi: + \mode_leave_vertical: + \bool_if:NF \l__cascade_nested_command_bool + { + \dim_gzero_new:N \g__cascade_yoffset_dim + \bool_set_true:N \l__cascade_first_argument_bool + } + \group_begin: + + \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 + \hbox_set:Nn \l__cascade_box_one + { + \bool_set_true:N \l__cascade_first_argument_bool + \bool_set_true:N \l__cascade_nested_command_bool + #2 + } + \hbox_set:Nn \l__cascade_box_two { #3 } + \hbox_set:Nn \l__cascade_box_three + { + \bool_set_false:N \l__cascade_first_argument_bool + \bool_set_true:N \l__cascade_nested_command_bool + #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 + \c_zero_dim + { \box_dp:N \l__cascade_box_three - \box_dp:N \l__cascade_box_four } + } + \box_set_ht:Nn \l__cascade_box_one \c_zero_dim + \box_set_dp:Nn \l__cascade_box_three \c_zero_dim + \vbox_set:Nn \l_tmpa_box + { + \skip_vertical:N \l__cascade_top_dim + \vbox_top:n + { + \__cascade_the_vcenter:nn { #2 } { #4 } + \bool_if:NT \l__cascade_first_argument_bool + { + \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 + \dim_add:Nn \l_tmpa_dim { \the \fontdimen 22 \textfont2 } + \dim_sub:Nn \l_tmpa_dim + { \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 + { + \c_math_toggle_token + \left . + \box_use_drop:N \l_tmpb_box + \right \} + \c_math_toggle_token + \bool_if:NT \l__cascade_t_bool + { + \bool_if:NF \l__cascade_nested_command_bool + { + \tl_if_empty:nF { #6 } + { + \skip_horizontal:n \l__cascade_space_between_dim + #6 + } } - \right\}$ + } + } + \skip_vertical:N \l__cascade_bottom_dim + } + } + \bool_if:NTF \l__cascade_nested_command_bool + { \box_use_drop:N \l_tmpa_box } + { + \bool_if:NTF \l__cascade_t_bool + { \box_move_down:nn \g__cascade_yoffset_dim { \box_use:N \l_tmpa_box } } + { \box_use_drop:N \l_tmpa_box } + } + \group_end: + } +\cs_new_protected:Npn \__cascade_the_vcenter:nn #1 #2 + { + \hbox_set:Nn \l_tmpb_box + { + \c_math_toggle_token + \vcenter + { + \halign + { + \hfil ## \cr + \hbox:n + { + \tl_if_empty:nF { #1 } + { + \box_use_drop:N \l__cascade_box_one + \skip_horizontal:n \l__cascade_space_between_dim + } + \box_use:N \l__cascade_box_two + \strut + } + \cr + \noalign { \skip_vertical:n \l__cascade_interline_dim } + \hbox:n + { + \tl_if_empty:nF { #2 } + { + \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 + } + \cr + } } - \skip_vertical:N \l__cascade_bottom_dim - } + \c_math_toggle_token } - \group_end: -} -\msg_new:nnn {cascade} - {Cascade~in~math~mode} - {The~commands~\token_to_str:N \Cascade\ - and~\token_to_str:N \ShortCascade\ - should~be~used~in~text~mode~only.~However,~you~can~ - go~on~for~this~time.} -\NewDocumentCommand \ShortCascade {O{}mm} - {\Cascade[#1]{}{#2}{}{#3}} + } +\msg_new:nnn + { cascade } + { Cascade~in~math~mode } + { + The~commands~\token_to_str:N \Cascade\ + and~\token_to_str:N \ShortCascade\ + should~be~used~in~text~mode~only.~However,~you~can~ + go~on~for~this~time. + } +\msg_new:nnn + { cascade } + { t~option~already~set } + { + You~can't~use~the~key~'t'~here~because~it~has~been~set~ + in~an~encompassing~command.~If~you~go~on,~this~key~will~be~ + ignored. + } +\NewDocumentCommand \ShortCascade { O { } m m } + { \Cascade [ #1 ] { } { #2 } { } { #3 } } \endinput %% -- cgit v1.2.3