Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I type the following equation in LaTex:

enter image description here

share|improve this question
1  
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

4 Answers 4

up vote 8 down vote accepted

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}

Result

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}

Result gathered

share|improve this answer
    
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,
  drop fuzzy shadow}}

\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}

enter image description here

share|improve this answer

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} 

enter image description here

share|improve this answer
    
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}
\usepackage[overload]{empheq}

\begin{document}

\begin{gather}[left=\color{Purple}\empheqlbrace\enspace, right=quad\color{red} \empheqlVert]%
2A + 2B = 0\\
A - B = 1,\\
\sum_{i=0}^{A} = B\\
\int_{0}^{A} x\,\mathrm{d}x = B
\end{gather}

\end{document} 

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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