We can make a macro \dblbounds
with a simple syntax using the stackengine
and xstring
packages. Using in addition xparse
, we can define a macro \multibounds
that accepts any number of bounds as a list, with an even simpler syntax: only one argument, the different "bounds" are written with the same syntax as above, and separated by a semicolon:
\documentclass[a4paper, 11pt]{book}
\usepackage{mathtools}
\usepackage{xstring, xparse}
\usepackage{stackengine}
\newcommand\dblbound[2]{\!\everymath{\scriptstyle}\setstackgap{L}{0.8\baselineskip}\Vectorstack[l]{\StrBehind{#1}{..} \StrBefore{#1}{..}}\:\Vectorstack[l]{\StrBehind{#2}{..} \StrBefore{#2}{..}}}
\newcommand\myVectorstack[1]{\def\stackalignment{l}\setstackEOL{..}\everymath{\scriptstyle}%
\raisebox{1pt}{\Vectorstack{\StrBehind{#1}{..}..\StrBefore{#1}{..}}}\:}
\DeclareDocumentCommand \multibounds
{ > { \SplitList { ; } } m}
{\!\ProcessList{#1}{\myVectorstack}}
\begin{document}
\[%
\left( T_{ij} \right)\dblbound{i = 1..n}{j = 1..p}%
\qquad
\begin{pmatrix}\displaystyle T_{i, j, k}\end{pmatrix}\multibounds{i = 1..n ; j = 1..p; k = 1.. q}{}
\]%
\end{document}
\strut
s, as in\({\left(T_{ij}\right)_{i=1\strut}^{n\strut}}_{j=1\strut}^{p\strut}\)
, to ensure that the boxes are all the same height.\strut
?