4

I have this code

\[\left[\begin{array}{ll}
\text{word} & \\
\text{HEAD} & \begin{array}[t]{ll}
          \text{det} & \\
          \text{AGR} & \begin{array}[t]{lr}
                \text{agr-cat-pg} & \\
                \text{NUM} & ^{\color{green}[1]}\text{sg} \\
                \text{PER} & \text{ter} \\
                \text{GEN} & ^{\color{green}[2]}\text{fe}
                \end{array}
         \end{array} \\ \\
\text{VAL} & \begin{array}[t]{ll}
            \text{val-cat} & \\
            \text{SPR} & <> \\
            \text{COMPS} & <> \\
            \text{MOD} & <>
         \end{array}
\end{array}\right]\]

which produces the following output:

enter image description here

Now I want to enclose the det matrix inside square brackets like this:

enter image description here

but when I add \left[ ... \right] I get an undesired result:

\[\left[\begin{array}{ll}
\text{word} & \\
\text{HEAD} & \left[\begin{array}[t]{ll}
          \text{det} & \\
          \text{AGR} & \begin{array}[t]{lr}
                \text{agr-cat-pg} & \\
                \text{NUM} & ^{\color{green}[1]}\text{sg} \\
                \text{PER} & \text{ter} \\
                \text{GEN} & ^{\color{green}[2]}\text{fe}
                \end{array}
         \end{array}\right] \\ \\
\text{VAL} & \begin{array}[t]{ll}
            \text{val-cat} & \\
            \text{SPR} & <> \\
            \text{COMPS} & <> \\
            \text{MOD} & <>
         \end{array}
\end{array}\right]\]

![enter image description here

How can I solve it? Other solutions involving a different environment than array are also welcome.

Thanks in advance.

  • You could have a 2x2 matrix with \text{word\\HEAD} or something like that. – manooooh Jun 14 at 17:18
9

You want to use delarray. I added also some tricks to avoid \text.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{delarray,array,xcolor}

\newcolumntype{L}{>{$}l<{$}}
\newcolumntype{R}{>{$}r<{$}}

\begin{document}

\[
\begin{array}\lbrack{LL}\rbrack
word & \\
HEAD & \begin{array}[t]\lbrack{LL}\rbrack
          det & \\
          AGR & \begin{array}[t]{LR}
                agr-cat-pg & \\
                NUM & \textsuperscript{\color{green}[1]}sg \\
                PER & ter \\
                GEN & \textsuperscript{\color{green}[2]}fe
                \end{array}
         \end{array} \\ \\
VAL & \begin{array}[t]\lbrack{LL}\rbrack
            val-cat & \\
            SPR & <> \\
            COMPS & <> \\
            MOD & <>
         \end{array}
\end{array}
\]

\end{document}

enter image description here

  • Thank you very much @egreg ! – Pierrot Jun 14 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.