# How to type several equations with one vertical line next to them

How can I type the following equation in LaTex:

-
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. –  cmhughes Apr 6 at 16:46

The equations can be put in environment array, e.g.:

\documentclass{article}

\begin{document}
$\begin{array}{|l@{}} 2A + 2B = 0\\ A - B = 1, \end{array}$
\end{document}


Or with ensuring \displaystyle:

\documentclass{article}
\usepackage{array}

\begin{document}
$\begin{array}{|>{\displaystyle}l@{}} 2A + 2B = 0\\ A - B = 1, \end{array}$
\end{document}


or a better line spacing provides gathered from package amsmath:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\begin{array}{|l@{}} \begin{gathered} 2A + 2B = 0\\ A - B = 1,\\ \sum_{i=0}^{A} = B\\ \int_{0}^{A} x\,\mathrm{d}x = B \end{gathered} \end{array}$
\end{document}


-
Thank you very much. –  Daniel Apr 6 at 16:46

We go colorful.

\documentclass{article}
\usepackage[svgnames,hyperref]{xcolor}
\usepackage{empheq}
\usepackage[many]{tcolorbox}

\tcbset{highlight math style={enhanced,
colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,

\newtcbox{\otherbox}[1][]{nobeforeafter,math upper,tcbox raise base,arc=0pt,
enhanced,colframe=red!60!black,boxrule=0pt,leftrule=1pt,left=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,#1}

\begin{document}

\begin{empheq}[box={\tcbhighmath[colback=blue!20!white,boxrule=0pt,leftrule=1pt,left=0pt,arc=0pt]}]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\begin{empheq}[box=\otherbox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\end{document}


-

You can also use the environment empheq from the empheq package:

\documentclass{article}
\usepackage{empheq}

\begin{document}
\begin{empheq}[left=\empheqlvert\;\;]{align*}
&2A + 2B = 0\\
&A - B = 1,
\end{empheq}
\end{document}


-
Once more, there was a post with the same idea before I had finished testing mine, and I didn't check before posting myself! –  Bernard Apr 6 at 17:17
@Bernard It often happens to me, too... :-) –  karlkoeller Apr 6 at 17:23

With the empheq package (providing the overload option) there is a much simpler solution: you can put about anything you please on the left or on the right of an amsmath environment. Please note that empheq loads mathtools that in turn loads amsmath :

\documentclass{article}

\usepackage[svgnames]{xcolor}

\begin{document}