4

I want to add a number in front of this vertical line in this equation here but without it aligning to the middle of the equation, instead aligining to one of the equations.

enter image description here

\begin{equation*}
 \left. \begin{cases}
    A + B = 1 \\
    Ae + Be^2 = 2e^2 
  \end{cases} \right|
\end{equation*} 
3
  • 1
    Welcome to TeX.SE.
    – Mico
    Commented May 14, 2023 at 7:28
  • Since you really want the number following the vertical line, it would be better to chnge the title and clarify the question text. Commented May 15, 2023 at 23:31
  • A regular array would also do in this case.
    – Werner
    Commented May 16, 2023 at 15:15

5 Answers 5

7

(I edited this answer after the OP clarified that the number should actually come after, not before, the vertical line.)

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation*}
\left\{
 \begin{matrix*}[l]
    A + B = 1 \\
    Ae + Be^2 = 2e^2 
 \end{matrix*}  
\right|
 \begin{matrix} 
    5 \\ 
    \phantom{.}
 \end{matrix}
\qquad\qquad
\left\{
 \begin{matrix*}[l]
    A + B = 1 \\
    Ae + Be^2 = 2e^2 
 \end{matrix*}  
\right|
 \begin{matrix}
   \\ 
   9 
 \end{matrix}
\end{equation*}

\end{document}
0
5
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularray}
\begin{document}
\begin{equation*}
\left\{
\begin{tblr}{columns={colsep=2pt}}
A + B = 1        \\
Ae + Be^2 = 2e^2 \\
\end{tblr}
\middle|
\begin{tblr}{columns={colsep=2pt}}
5 \\
  \\
\end{tblr}
\right.
\end{equation*}

\begin{equation*}
\left\{
\begin{tblr}{columns={colsep=2pt}}
A + B = 1        \\
Ae + Be^2 = 2e^2 \\
\end{tblr}
\middle|
\begin{tblr}{columns={colsep=2pt}}
  \\
9 \\
\end{tblr}
\right.
\end{equation*}
\end{document}

enter image description here

0
5

You can use nicematrix

\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}

\begin{document}

\[
\begin{NiceArray}{l@{\;\;}l}
A+B=1 & e \\
Ae+Be^2=2e^2
\CodeAfter
  \SubMatrix\{{1-1}{2-1}|
\end{NiceArray}
\qquad
\begin{NiceArray}{l@{\;\;}l}
Ae+Be=e \\
Ae+Be^2=2e^2 & -1
\CodeAfter
  \SubMatrix\{{1-1}{2-1}|
\end{NiceArray}
\]

\end{document}

enter image description here

3

Another solution with nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\[
\setlength{\arraycolsep}{2pt}
\begin{NiceArray}{\{l|l}
A+B=1 & 5 \\
Ae+Be^2=2e^2
\end{NiceArray}
\qquad
\begin{NiceArray}{\{l|l}
Ae+Be=e \\
Ae+Be^2=2e^2 & 9
\end{NiceArray}
\]

\end{document}

Output of the above code

1

Using spalign package....

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,spalign}

\begin{document}
\[
\spalignsys{A + B = 1; Ae + Be^2 = 2e^2}\left|  \begin{aligned}
    & \alpha  \\
    &    
\end{aligned}\right.\to 
\spalignsys{A + B = 1; Ae + Be^2 = 2e^2}\left|  \begin{aligned}
    &  \\
    & \beta   
\end{aligned}\right.
\]
\end{document}

enter image description here

or this.......

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,spalign}

\begin{document}
\[
\spalignsys{A + B = 1; eA + e^2B = 2e^2}\left|  \begin{aligned}
    & \pi  \\
    &    
\end{aligned}\right.\to 
\spalignsys{A + B = 1; eA + e^2B = 2e^2}\left|  \begin{aligned}
    &  \\
    & \lambda   
\end{aligned}\right.
\]
\end{document}

enter image description here

2
  • 2
    The vertical alignment across the two components (\spalignsys and aligned) isn't considered here in general. In this instance, you can see that the \alpha is not on the same baseline as 1 (to it's left), for example.
    – Werner
    Commented May 15, 2023 at 19:25
  • @Werner Yes I have seen it but I didn't put a big emphasis on it. Thank you very much.
    – Sebastiano
    Commented May 15, 2023 at 19:27

You must log in to answer this question.

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