4

We can use \llbracket \rrbracket using the \usepackage{stmaryrd} to generate double bracket. My question is:

how we can generate a matrix with double bracket (in the same style as the \llbracket \rrbracket version)?

Edit: I just come up with the following way to make a vector form with two dimension:

\providecommand{\matbrack}[2]{
\left\llbracket
\begin{matrix}
    #1 \\
    #2
\end{matrix}
\right\rrbracket
}

Inside text:

$\vecbrack{M}{1}$
Mico
  • 506,678
Amin
  • 946

3 Answers3

8

I suggest generalizing the command you have in mind by making it take just 1 argument. That way, it can be used for scalars, column and row vectors of arbitrary length, and entire matrices. I would also like to suggest creating a variant of the smallmatrix environment (provided by the amsmath package) that's surrounded by double-struck brackets, for use in inline math settings.

enter image description here

\documentclass{article}
\usepackage{amsmath}  % for 'matrix' env.
\usepackage{stmaryrd} % for '\llbracket' and '\rrbracket'

\newcommand{\bbrack}[1]{% \left\llbracket \begin{matrix} #1 \end{matrix} \right\rrbracket} % for use in inline math: \newenvironment{bbsmallmatrix}{% \left\llbracket\begin{smallmatrix}}{% \end{smallmatrix}\right\rrbracket}

\begin{document} aaa $\bbrack{ M \ 1 }$ zzz \quad aaa $\begin{bbsmallmatrix} M \ 1 \end{bbsmallmatrix}$ zzz \end{document}

Mico
  • 506,678
4

These brackets are \lBrack and \rBrack in unicode-math, stix or stix2. A simple example of use:

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}

\DeclarePairedDelimiter{\Brack}{\lBrack}{\rBrack} \newenvironment{bbmatrix}% {\left\lBrack\begin{matrix}}% {\end{matrix}\right\rBrack}

\begin{document} [ \Brack{ \rho, \vartheta, \varphi } \begin{bbmatrix} a &b &c \ d &e &f \ \alpha & \beta & \gamma \end{bbmatrix} ] \end{document}

Latin Modern Math sample

Davislor
  • 44,045
  • Good answer, but the unicode-math package give some problems to me. SO I've combined with @Mico's anwer and use stmaryrd package and commands \rrbracket and \llbracket instead of \lBrack and \rBrack – Tito Eliatron Dec 11 '20 at 09:22
2

Expanding on Mico's answer above, if you do NOT want to use the stmaryrd package, you can define a new command:

\newcommand{\bbrack}[1]{{
  \mathchoice
    {\left\lbrack\!\!\left\lbrack #1 \right\rbrack\!\!\right\rbrack} % display style
    {\left\lbrack\!\left\lbrack #1 \right\rbrack\!\right\rbrack} % text style
    {} % script style
    {} % scriptscript style
  }
}

to handle arbitrary length scalars, vectors, and matrices. This has the added benefit of looking like \llbracket and \rrbracket.

Example output

\documentclass{article}

\usepackage{amsmath} \newcommand{\bbrack}[1]{{ \mathchoice {\left\lbrack!!\left\lbrack #1 \right\rbrack!!\right\rbrack} % display style {\left\lbrack!\left\lbrack #1 \right\rbrack!\right\rbrack} % text style {} % script style {} % scriptscript style } }

\begin{document}

Inline style: $\bbrack{\mathcal{K}, \mathcal{M}}$

With inline small matrix: $\bbrack{ \begin{smallmatrix} M \ 1 \end{smallmatrix}}$

Finally, normal display style would look like,

\begin{equation} \bbrack{ \begin{matrix} 0 & D & 0 & 0 & M & 0 & 0 & 0\ M & 0 & 0 & 0 & M & 0 & 0 & 0 \ 0 & 0 & 1 & 0 & M & 0 & 0 & 0\ 0 & 0 & 1 & 0 & M & 0 & 0 & 0\ 0 & 0 & 1 & 0 & M & 0 & 0 & 0\ 0 & 0 & 1 & \varphi & M & 0 & 0 & 0\ 0 & 0 & 1 & 0 & M & 0 & \ddots & \vdots \ 0 & 0 & 1 & 0 & M & 0 & \dots & 0\ \end{matrix} } \end{equation}

\end{document}