How can we type equations and add explanations like below?

The options that I can think of are: (1) using tags which I don't know how to break them into two lines (2) using minipage, which might not be very convenient if we want to make sure that which explanation is aligned with which equation. Is there a better way?

• There are many options, and you will get much better answers if you show us what you have tried. This will spare those who want to help you from typing in the equations and texts. – user121799 Feb 14 at 17:19
• If you prefer to have the same typograph of your picture you can add the option \usepackage{newtxtext,newtxmath}. – Sebastiano Feb 14 at 20:56

IMHO you do not need anything special for that.

\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage{xcolor}
\newcommand{\dd}{\mathrm{d}}
\begin{document}
\begin{align*}
\left.\frac{\dd f}{\dd x}\right|_{x=3}&=\frac{1}{\sqrt{\dots}}
&
\textcolor{cyan}{
\begin{aligned}
\frac{\dd}{\dd x}\left(-(-25-x^2)\right)^{1/2}  \\
= \dots
\end{aligned}}
\end{align*}
\begin{align*}
y^2&=x^2+\sin xy \\
\frac{\dd }{\dd x}\left(y^2\right)
&= \frac{\dd }{\dd x}\left(x^2\right) + \frac{\dd }{\dd x}\left(\sin xy\right)
& &\text{\textcolor{cyan}{\begin{tabular}{l}Differentiate both sides\\
w.r.t.\ $x$\end{tabular}}} \\
2y\frac{\dd y}{\dd x}
&= 2x+\cos(xy)\frac{\dd}{\dd x}(xy)
& &\text{\textcolor{cyan}{\begin{tabular}{l}Treating $y$ as a function \\
of $x$ and using the Chain Rule\end{tabular}}}
\end{align*}
\end{document}


• Long life to \mathrm{d}!! – manooooh Feb 14 at 18:59
• @manooooh LOL :-) I absolutely agree with you :-) – Sebastiano Feb 14 at 20:52
• @marmot My best compliments and wishes for your 100k! – Sebastiano Feb 14 at 20:53