1

I am aligning some equations using the \begin{aligned} from amsmath package. This aligns the equations using the = as alignment point, which is nice, but I also want a vertical line drawn between every two = symbols. Essentially, I want to achieve this:

enter image description here

Is there a way to do this? Many thanks

EDIT: here is the code I use now:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\begin{document}
\begin{align*} 
x &= 3+2 \\ 
  &= 5
\end{align*}
\end{document}
4
  • 1
    I sometimes use the line when showing computations on the blackboard, because the environment is much more cluttered than printed paper, so the line helps keeping things together. I find no use for it in a printout.
    – egreg
    Aug 14, 2018 at 8:51
  • @egreg how do you do it?
    – Patrik
    Aug 14, 2018 at 9:04
  • @Patrik Well, on the blackboard I use no TeX macro, but chalk (or an electronic pen for virtual blackboards).
    – egreg
    Aug 14, 2018 at 9:32
  • @egreg hahaha, right. I assumed you meant that you use a video projector
    – Patrik
    Aug 14, 2018 at 9:48

1 Answer 1

2

Here are two possibilities: one based on pstricks, which allows for more complex ways to link two = signs (or actually any two elements in a formula), another with standard tools (\stackrel and \smash) which is fine in this case:

\documentclass[11pt, svgnames]{article}

\usepackage{mathtools}
\newcommand*{\cvrule}{\smash{\color{SeaGreen}\rule{0.4pt}{2ex}}}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\begin{postscript}
\begin{alignat*}{2}
x & \stackrel{\pnode{E1}}{=} 3 + 2 &\hspace{3em} x & = 3 + 2\\
  & \stackrel{\pnode{E2}}{=}5 & & \stackrel{\cvrule}{=} 5
\end{alignat*}
\ncline[linewidth=0.4pt, linecolor=Tomato, nodesepA=1.5ex]{E1}{E2}
\end{postscript}

\end{document} 

enter image description here

1
  • Thanks, this does exactly what I need. I chose the second possibility, as it does not require me to enable \write18
    – Patrik
    Aug 16, 2018 at 7:14

You must log in to answer this question.

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