# Left/right brackets spanning multiple lines within aligned environment

I'm trying to draw tall square brackets on both sides of a four-line component of an equation within an aligned environment. I've tried \Bigg[ and \Bigg], but these aren't tall enough for me. I also tried inserting invisible brackets with \left. and \right., but those don't span all four lines. I also tried using \vphantom but that didn't help either (I am not too sure how to use it, as I didn't see any examples using that command that show what I want to do). I did see some examples for using \cases to produce a single (left or right) tall curly brace, but I want a square brace, and on both sides (and in the middle of an equation).

Here's my code:

\usepackage{amsmath}
\usepackage{bbm}
\begin{align}
\ln{Y_{ijt}} = & \enspace \beta_0 + \sum\limits_{k=A,B,C}
\begin{aligned}
& \left[ \Sigma_r \beta_{1kr} \ln(q_{it}) \mathbbm{1}(B_n) \right. \\
& \left. + \Sigma_r \beta_{2kr} \ln(p_{it}) \mathbbm{1}(B_n) \right. \\
& \left. + \Sigma_r \gamma_{1kr} \ln(Y_{ij,t-1}) \mathbbm{1}(B_n) \right. \\
& \left. + \Sigma_r \gamma_{2kr} \ln(Y_{ij,t-2}) \mathbbm{1}(B_n) \right] \\
\end{aligned}
\mathbbm{1}(i \in k) \\
& + \theta_{ij} + \lambda_{t} + \epsilon_{ijt} \nonumber
\end{align}


So, what I'd like to see is those left and right square brackets within the aligned environment span the whole four lines within that aligned section.

Quite a tough formula.

I'd use split rather than align, so the equation number is centered with respect to the whole thing and the last line will not appear as hanging from nowhere. I'd also not replace \sum with \Sigma. Using \textstyle makes the summation symbol smaller.

Instead of \mathbbm{1} (that uses bitmap fonts), I suggest using the STIX2 symbol.

\documentclass{article}
\usepackage{amsmath}

\DeclareFontFamily{U}{stix2bb}{}
\DeclareFontShape{U}{stix2bb}{m}{n}{<->stix2-mathbb}{}

\newcommand{\indic}{\text{\usefont{U}{stix2bb}{m}{n}1}}% indicator function

\begin{document}

\begin{split} \ln Y_{ijt} = \beta_0 &+ \sum\limits_{k=A,B,C} \left[ \begin{aligned} & \textstyle \sum_r \beta_{1kr} \ln(q_{it}) \indic(B_n) \\ & \textstyle \quad + \sum_r \beta_{2kr} \ln(p_{it}) \indic(B_n) \\ & \textstyle \quad + \sum_r \gamma_{1kr} \ln(Y_{ij,t-1}) \indic(B_n) \\ & \textstyle \quad + \sum_r \gamma_{2kr} \ln(Y_{ij,t-2}) \indic(B_n) \\ \end{aligned} \right] \indic(i \in k) \\ & + \theta_{ij} + \lambda_{t} + \epsilon_{ijt} \end{split}

\end{document}


• Thanks for the quick answer. I had tried \split in an earlier iteration but had not worked it all the way through. (Also, I have never really liked the look of the mathbbm{1} indicator symbol, but have not known what to replace it with.) – herfa Sep 29 '20 at 13:42

I guess that you like to have:

(red lines shows text borders)

\documentclass{article}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage{geometry}
\usepackage{mathtools}
\usepackage{bbm}

\begin{document}
\label{eq:long} \begin{aligned} \ln{Y_{ijt}} & = \enspace \beta_0 \\ & + \sum\limits_{k=A,B,C} \left[ \begin{multlined} \Sigma_r \beta_{1kr} \ln(q_{it}) \mathbbm{1}(B_n) + \Sigma_r \beta_{2kr} \ln(p_{it}) \mathbbm{1}(B_n)\\ + \Sigma_r \gamma_{1kr} \ln(Y_{ij,t-1}) \mathbbm{1}(B_n) + \Sigma_r \gamma_{2kr} \ln(Y_{ij,t-2}) \mathbbm{1}(B_n) \end{multlined} \right]\cdot\mathbbm{1}(i \in k) \\ & + \theta_{ij} + \lambda_{t} + \epsilon_{ijt} \end{aligned}
\end{document}


I propose to use the bmatrix*[l] environment from mathtools, and the \medop command from nccmath to obtain medium-sized sum symbols inside the matrix:

\documentclass{article}

\usepackage{geometry}
\usepackage{nccmath, mathtools}
\newcommand{\msum}{\medop\sum\limits}
\usepackage{bbm}
\usepackage{booktabs, bigstrut}

\begin{document}

\label{eq:long} \begin{aligned} \ln{Y_{ijt}} = \enspace \beta_0 & + \sum\limits_{k=A,B,C} \begin{bmatrix*}[l] \msum _r \beta_{1kr} \ln(q_{it}) \mathbbm{1}(B_n) + \msum_r \beta_{2kr} \ln(p_{it}) \mathbbm{1}(B_n) \bigstrut\\%[2ex] \addlinespace[0.8ex] {}+ \msum_r \gamma_{1kr} \ln(Y_{ij,t-1}) \mathbbm{1}(B_n) + \msum_r \gamma_{2kr} \ln(Y_{ij,t-2}) \mathbbm{1}(B_n) \end{bmatrix*}\cdot\mathbbm{1}(i \in k) \\ & + \theta_{ij} + \lambda_{t} + \epsilon_{ijt} \end{aligned}

\end{document}