[comp.text.tex] Double brackets

tli@koh-sun2.usc.edu (Tony Li) (03/01/90)

I have a need for double brackets (e.g., [[ X^3 ]] ) as delimiters in
some of the math that I've been doing.  As noted in the TeXbook, [\![
does fine in the text sizes.  However, when you start putting larger
equations inside and using \left and \right, things don't look so
good.  To remedy this, I've been using the following macro, which I'm
posting in case anyone else needs it.  Improvements and comments are
most welcome.

\newbox\Dbrackbox
\newbox\mathstrutbox
\setbox\mathstrutbox\hbox{$\mathstrut$}
\def\Dbrack#1{\mathopen{}
	\left\lbrack
	\setbox\Dbrackbox\hbox{$\left\lbrack #1\right\rbrack$}
	\ifnum\ht\Dbrackbox>\ht\mathstrutbox
	    \mskip-4mu\box\Dbrackbox\mskip-4mu
	\else
	    \!\box\Dbrackbox\!
	\fi
	\right\rbrack
	\mathclose{}}

Tony Li - USC Computer Science Department
Internet: tli@usc.edu Uucp: usc!tli
Thus spake the master programmer: "A well written program is its own
heaven; a poorly-written program its own hell."