[Tex/LaTex] Box around one or multiple equations using tcolorbox

tcolorbox

I want to put (1) a box around 1 equation inside an align environment, and also (2) a box around all equations in align environment. I'm already using tcolorbox and would like to use that. I have tried boxing all equations with tcolorbox but the problem is that it goes page-wide which I don't like, and also leaves a visible margin above the first equation. I want to keep equation numbers out of the box as well.
Any suggestions?

Edit: Thanks for pointing me to a solution. The problem, however, is that all the solutions use another math environment (either within tcolorbox or empheq package). I am using a very specialized align environment and hence have to have a box without tcolorbox or empheq equation style.

So I want a box around align equations without leaving \begin{align} and \end{align} environment.

Edit2: Here is the MWE code.

\documentclass{article}

\usepackage{amsmath}


\begin{document}

\begin{flalign}

      \begin{gathered}

        A \quad  \vphantom{\sum \limits _{n=0} ^{N-1}} \\

        B \quad ~~ \vphantom{\sum \limits _{n=0} ^{N-1}}

      \end{gathered}

      &&

      \begin{aligned}\label{equationAB}

        A\: &= \sum \limits _{n=0} ^{N-1} a[n]\\

        B &= \sum \limits _{n=0} ^{N-1} b[n]

      \end{aligned}

      &&

    \end{flalign}

\end{document} 

Best Answer

I give a try with tcolorbox. Are you looking for the following?

enter image description here

The code puts a \tcbhighmath box around the aligned equations:

\documentclass{article}

\usepackage{amsmath}
\usepackage[many]{tcolorbox}

\begin{document}
  \begin{flalign}
    \begin{gathered}
      A \quad  \vphantom{\sum \limits _{n=0} ^{N-1}} \\
      B \quad ~~ \vphantom{\sum \limits _{n=0} ^{N-1}}
    \end{gathered}
    &&
    \tcbhighmath{\begin{aligned}\label{equationAB}
      A\: &= \sum \limits _{n=0} ^{N-1} a[n]\\
      B &= \sum \limits _{n=0} ^{N-1} b[n]
    \end{aligned}}
    &&
  \end{flalign}
\end{document}