1

I'd like to know whether I am doing the following properly. As in, is this the best way to present the development of the equation?

\newcommand{\integral}[2]{\int #1 \, \mathrm{d}#2}
\begin{equation}
    \begin{aligned}
        \derivative{}{x}\left[uv\right] & = \derivative{u}{x} v & + & u \derivative{v}{x} \\
        \integral{\derivative{}{x}\left[uv\right]}{x} & = \integral{\derivative{u}{x} v}{x} & + & \integral{u \derivative{v}{x}}{x} \\
        uv & = \integral{v}{u} & + & \integral{u}{v} \\
        \integral{v}{u} & = uv & - & \integral{u}{v} \\
        & \text{or} & & \\
        \integral{u}{v} & = uv & - & \integral{v}{u} \\
    \end{aligned}
\end{equation}

Preview of LaTeX

What should I do about the second operations' alignment (the plus/minus sign)? Do I need to use ampersand for that line of plus/minus symbols? or only for the equal sign? (see image below) Preview of LaTeX without second ampersand

Also what about the 'or' text? How should I deal with that? Should it be under the equal sign or in dead center, or something else?

Thanks

3
  • 1
    I’d use either centering or left alignment. The relation and operation symbols are not really strictly related so as to require alignment. To be honest, I’d omit the last line, which is exactly the same as the previous one, mathematically.
    – egreg
    Sep 20, 2020 at 14:57
  • 1
    Welcome to TeX.SE.
    – Mico
    Sep 20, 2020 at 15:22
  • Thanks for the suggestion @egreg, I also thought it shouldn't be necessary, but I'm new to TeX, and wanted to know others opinion. Sep 21, 2020 at 4:58

1 Answer 1

2

If you insist on providing two alignments points, you should use an alignat* environment, not an align* environment. But, as @egreg has already remarked in a comment, there's nothing in these equations that requires or at least recommends performing alignment across rows. Hence, using a gather* environment may be best.

Both possibilities are illustrated in the following screenshot.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'gather*' and 'alignat*' environments
\newcommand{\diff}{\mathop{}\!\mathrm{d}} % "differential" operator
\newcommand\deriv[2]{\frac{\diff #1}{\diff #2}}
\newcommand{\integral}[2]{\int \! #1 \diff #2}

\begin{document}
\begin{alignat*}{2}
\deriv{}{x}\left[uv\right] 
      &= \deriv{u}{x} v &&+ u \deriv{v}{x} \\
\integral{\deriv{}{x}\left[uv\right]}{x} 
      &= \integral{\deriv{u}{x} v}{x} &&+ \integral{u \deriv{v}{x}}{x} \\
uv    &= \integral{v}{u} &&+ \integral{u}{v} \\
\text{hence}\integral{v}{u} 
      &= uv &&- \integral{u}{v} 
\end{alignat*}

\begin{gather*}
\deriv{}{x}[uv] 
      = \deriv{u}{x} v + u \deriv{v}{x} \\
\integral{\deriv{}{x}[uv]}{x} 
      = \integral{\deriv{u}{x} v}{x} + \integral{u \deriv{v}{x}}{x} \\
uv    = \integral{v}{u} + \integral{u}{v} \\
\text{hence}\quad\integral{v}{u} 
      = uv - \integral{u}{v} 
\end{gather*}
\end{document}
1
  • 1
    Alright then, I guess I'll remove it, I just wanted to know if it was necessary, or if it looked any better, but I guess not, thanks for the alternative also @mico Sep 21, 2020 at 4:57

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.