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:

x &= 3+2 \\ 
  &= 5
  • 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 '18 at 8:51
  • @egreg how do you do it? – Patrik Aug 14 '18 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 '18 at 9:32
  • @egreg hahaha, right. I assumed you meant that you use a video projector – Patrik Aug 14 '18 at 9:48

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{pst-node, auto-pst-pdf}


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


enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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