5

1. I am interested in the matrix:

enter image description here

To make this matrix, I am using the following code (the full document):

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{stmaryrd}
\newcommand{\bbrack}[1]{
\left\llbracket \begin{matrix} #1 \end{matrix} \right\rrbracket}
 \newenvironment{bbsmallmatrix}{
\left\llbracket\begin{smallmatrix}}{
\end{smallmatrix}\right\rrbracket}
 \begin{document}
\begin{equation} 
\bbrack{ A\\ B}
\end{equation}
\end{document}

What are other possible codes to make the same matrix?

2. I would like to make the same style of matrix as before but with \llparenthesis and \rrparenthesis. What are all the possible codes to make this matrix?

2
  • 1
    Rather than asking for all possible ways to do something, wouldn't it be better to tell us why you think your current approach isn't sufficient? There are many ways to do the same thing in TeX... Sep 18 at 19:05
  • 3
    there are infinitely many tex inputs that would make that output what is your actual question? Sep 18 at 19:35

2 Answers 2

6

There is no single way to do it. I can propose bbmatrix based on amsmath and ppmatrix built by measuring the contents in order to push the parentheses near to each other.

\documentclass{article}
\usepackage{amsmath,stmaryrd}

\makeatletter
\newenvironment{bbmatrix}
  {\left\llbracket\env@matrix}
  {\endmatrix\right\rrbracket}
\makeatother

\newlength{\ppmatrixdim}
\newlength{\ppmatrixdimtwo}
\newlength{\ppmatrixdimthree}
\newsavebox{\ppmatrixbox}
\AtBeginDocument{%
  \settoheight{\ppmatrixdimtwo}{$\begin{matrix} 0 \\ 0 \end{matrix}$}%
  \settoheight{\ppmatrixdimthree}{$\begin{matrix} 0 \\ 0 \\ 0 \end{matrix}$}%
}
\ExplSyntaxOn

\muskip_new:N \l_alezig_ppmatrix_muskip

\NewDocumentEnvironment{ppmatrix}{b}
 {
  \settoheight{\ppmatrixdim}{$\begin{matrix} #1 \end{matrix}$}
  \bool_case:nF
   {
    { \dim_compare_p:n { \ppmatrixdim < \ppmatrixdimtwo } }
      { \muskip_set:Nn \l_alezig_ppmatrix_muskip { -3mu } }
    { \dim_compare_p:n { \ppmatrixdim < \ppmatrixdimthree } }
      { \muskip_set:Nn \l_alezig_ppmatrix_muskip { -7mu } }
   }
   {
    \muskip_set:Nn \l_alezig_ppmatrix_muskip { -9mu }
   }
  \left(\mspace{\l_alezig_ppmatrix_muskip}\left(
  \begin{matrix} #1 \end{matrix}
  \right)\mspace{\l_alezig_ppmatrix_muskip}\right)
 }{}

\ExplSyntaxOff

\begin{document}

\begin{gather*}
\begin{bbmatrix} a \end{bbmatrix} \\
\begin{bbmatrix} a \\ b \end{bbmatrix} \\
\begin{bbmatrix} a \\ b \\ c \end{bbmatrix} \\
\begin{ppmatrix} a \end{ppmatrix} \\
\begin{ppmatrix} a \\ b \end{ppmatrix} \\
\begin{ppmatrix} a \\ b \\ c \end{ppmatrix} \\
\begin{ppmatrix} a \\ b \\ c \\ d \end{ppmatrix}
\end{gather*}

\end{document}

enter image description here

You can try your hand for the small versions.

3

Here is what you can do with nicematrix (but it's probably an overuse).

\documentclass{article}
\usepackage{nicematrix}
\usepackage{stmaryrd}

\begin{document}

$\begin{NiceArrayWithDelims}{\llbracket}{\rrbracket}{c}
a \\ b \\ c 
\end{NiceArrayWithDelims}$

\bigskip
$\begin{NiceArray}{((c))}  
a \\ b \\ c 
\end{NiceArray}$

\end{document}

Output of the above code

2
  • I don't know why but I cannot run this code. It doesn't provide an error, it doesn't even build the pdf.
    – Alezig
    Sep 23 at 11:58
  • Your TeX installation is probably not up-to-date. Sep 23 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .