I am using flalign environment for some summations which have substacks, however this seems to be giving me an "Undefined control sequence" error. Everything still compiles fine so it's not a huge deal but I would like to know if there is any way to fix this error.

        &\bigcup_{k=1}^{n+1}A_{k} - A_{n+1} = \bigcup_{k=1}^{n}A_{k} - A_{n+1} 
        =\bigcup_{k=1}^{n}A_{k} - A_{n+1}\cap\bigcup_{k=1}^{n}A_{k} &\\
        &P[\bigcup_{k=1}^{n+1}A_{k}] - P[A_{n+1}] =
        P[\bigcup_{k=1}^{n}A_{k}] - P[A_{n+1}\cap\bigcup_{k=1}^{n}A_{k}] \tag{finite additivity}&\\
        P[\bigcup_{k=1}^{n+1}A_{k}] &=
        P[\bigcup_{k=1}^{n}A_{k}] + P[A_{n+1}] - P[A_{n+1}\cap\bigcup_{k=1}^{n}A_{k}] &\\
        &= P[\bigcup_{k=1}^{n}A_{k}] + P[A_{n+1}] - P[\bigcup_{k=1}^{n}(A_{n+1}\cap A_{k})] &\\
        &= \sum_{\substack{T\subseteq [n] \\ T\neq \emptyset}}(-1)^{(|T|+1)}P[\bigcap_{t\in T}A_t]
        + P[A_{n+1}]
        - \sum_{\substack{T\subseteq [n] \\ T\neq \emptyset}}(-1)^{(|T|+1)}P[\bigcap_{t\in T}A_{n+1}\cap A_t] \\
        &= \sum_{\substack{T\subseteq [n+1]\\ A_{n+1}\notin T \\ T\neq \emptyset}}(-1)^{(|T|+1)}P[\bigcap_{t\in T}A_t]
        + \sum_{\substack{T\subseteq [n+1] \\ A_{n+1}\in T \\ T\neq \emptyset}}(-1)^{(|T|+1)}P[\bigcap_{t\in T} A_t] \\
        &= \sum_{\substack{T\subseteq [n+1] \\ T\neq \emptyset}}(-1)^{(|T|+1)}P[\bigcap_{t\in T}A_t]

Removing all substacks gets rid of the errors.

  • Welcome to TeX.SE. Does your document load the amsmath package in the preamble? (The amsmath package defines the flalign environment and the \substack macro.)
    – Mico
    Commented Sep 7, 2021 at 4:58
  • Please extend your code fragment to complete small document beginning with \documentclass and ending with \end{document}. Source of your problem may be in your document preamble.
    – Zarko
    Commented Sep 7, 2021 at 4:59

1 Answer 1


Your code compiles on my system (MacTeX2021) if I make sure to load the amsmath package. That's the package that defines the flalign (short for "full length align") environment and the \substack macro.

That said, I don't think that your equations make good use of the machinery of the flalign environment. (In fact, I'd go as far as claim that they make no use at all of that machinery.) For your equations, using a simple align environment, with one & alignment point per row, would make far more sense. Oh, and don't forget to enlarge the [ and ] square brackets if they enclose a \bigcup or \bigcap expression.

enter image description here

\bigcup_{k=1}^{n+1}A_{k} - A_{n+1} 
  &= \bigcup_{k=1}^{n}A_{k} - A_{n+1} 
   =\bigcup_{k=1}^{n}A_{k} - A_{n+1}\cap\bigcup_{k=1}^{n}A_{k} \\
P\Bigl[\,\bigcup_{k=1}^{n+1}A_{k}\Bigr] - P[A_{n+1}] 
  &= P\Bigl[\,\bigcup_{k=1}^{n}A_{k}\Bigr] 
   - P\Bigl[A_{n+1}\cap\bigcup_{k=1}^{n}A_{k}\Bigr] 
  \tag{finite additivity}\\
  &= P\Bigl[\,\bigcup_{k=1}^{n}A_{k}\Bigr] + P[A_{n+1}] 
    - P\Bigl[A_{n+1}\cap\bigcup_{k=1}^{n}A_{k}\Bigr] \\
  &= P\Bigl[\,\bigcup_{k=1}^{n}A_{k}\Bigr] + P[A_{n+1}] 
    - P\Bigl[\,\bigcup_{k=1}^{n}(A_{n+1}\cap A_{k})\Bigr] \\
  &= \sum_{\substack{T\subseteq [n] \\ T\neq\emptyset}}
     (-1)^{(|T|+1)}P\Bigl[\,\bigcap_{t\in T}A_t\Bigr]
        + P[A_{n+1}] \notag \\
  &\qquad- \sum_{\substack{T\subseteq [n] \\ T\neq\emptyset}}
     (-1)^{(|T|+1)}P\Bigl[\,\bigcap_{t\in T}A_{n+1}\cap A_t\Bigr] \\
  &= \sum_{\substack{T\subseteq [n+1]\\ A_{n+1}\notin T \\ T\neq\emptyset}}
     (-1)^{(|T|+1)}P\Bigl[\,\bigcap_{t\in T}A_t\Bigr] \notag \\
  &\qquad+ \sum_{\substack{T\subseteq [n+1] \\ A_{n+1}\in T \\ T\neq\emptyset}}
     (-1)^{(|T|+1)}P\Bigl[\,\bigcap_{t\in T} A_t\Bigr] \\
  &= \sum_{\substack{T\subseteq [n+1] \\ T\neq\emptyset}}
     (-1)^{(|T|+1)}P\Bigl[\,\bigcap_{t\in T}A_t\Bigr]
  • I realized the issue was somewhere else in my document even though for some it went away when I deleted the substacks. Thanks for the other tips though. Commented Sep 7, 2021 at 5:48

You must log in to answer this question.

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