1

How can I align the two right handed equation as done for the two left handed ones in the screenshot blew: enter image description here

Here is my code regarding this part:

\begin{align*}
u &= e^{-3x} 
&&\text{ d}v = \cosh(5x)\text{ d}x \\
\text{d}u &= -3e^{-3x} \text{ d}x  
&& v = \frac{1}{5}\sinh(5x).
\end{align*}.

Thanks in advance.

  • 1
    you have not added the alignment marker & before = in the right hand equations – David Carlisle May 12 '17 at 12:23
2

Two alignment points require 3 & (the 2nd & indicates a new column, the 3rd is for the alignment point in that column). Also it would be shorter to write a macro for the differential symbol, with a correct spacing. Here's one, borrowed from an answer on this site, to add to your preamble. Note that, with alignat you have control on the horizontal separation between the two columns:

\documentclass[12pt,a4paper]{article}
\usepackage{mathtools}
\newcommand*{\dd}{\mathop{\kern0pt\mathrm{d}}\!{}}

\begin{document}

\begin{align*}
u &= e^{-3x} & \dd v &= \cosh(5x)\dd x \\
\dd u &= -3e^{-3x} \dd x & v &= \frac{1}{5}\sinh(5x).
\end{align*}

\begin{alignat*}{2}
u &= e^{-3x} &\dd v & = \cosh(5x)\dd x \\
\dd u &= -3e^{-3x} \dd x & \hspace{3em} v &= \frac{1}{5}\sinh(5x).
\end{alignat*}

\end{document} 

enter image description here

| improve this answer | |
  • you say 3 but you have 4 & in each row in your code section – David Carlisle May 12 '17 at 12:24
  • @David Carlisle: As I didn't test, I didn't see there were only two TeX lines. I'll fix it. Thanks! – Bernard May 12 '17 at 12:27
  • @Campa: Even with the corrected code? – Bernard May 12 '17 at 12:33
  • Why not change all d's? – egreg May 12 '17 at 15:29
  • @egreg: Just because I forgot to check… I messed up with my clipboard manager. I'll fix the code. Thanks for pointing it! – Bernard May 12 '17 at 15:41

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.