# Multiline Tag command

I want to have a multiline equation, and to annotate the lines, for the purposes of a key, to explain the various steps being taken. I currently use the tag command, which works fine for short explanations, but if they get too long, then the flow is broken. If I try to include a line break or similar, I get a bunch of errors thrown.

\begin{align*}
\int\frac{\ln x}{x^{10}}\ dx&=-\frac{\ln x}{9x^{-9}}+\frac{1}{9}\int x^{-10}\ dx
\tag{IBP: $u=\ln x$, $dv=x^{-10}dx$, $du=\frac{dx}{x}$, $v=-\frac{1}{9}x^{-9}$}\\
%This tag is too long, I want to split it.
&=-\frac{\ln x}{9x^{-9}}+\frac{1}{81} x^{-9}+C
\end{align*}


Is there a convienent way to make this?

• it always helps to post a complete document rather than a fragment, so that people can run the code. \tag is intended for user-specified equation numbers (the text is copied by \ref for example) not really for explanatory notes. However \parbox{3cm}{IBP:....} would allow line breaks (\intertext is the intended command here although the layout is different) – David Carlisle Oct 21 '19 at 19:20
• That is fair. In anything I really write, I don't use that, I just split the align (though now will probably start using intertext) but I am TA for a bunch of Calc II students, who want to do as little work as possible. So, when I write my key, I want to emulate about what I require of them, without subjecting them to my own atrocious handwriting. – Brandon Myers Oct 22 '19 at 21:11

The following solution demonstrates how to employ @DavidCarlisle's suggestion to use \intertext rather than \tag.

Never shy away from using complete, human-language sentences to explain your thought process. It's neither shameful nor a sign of weakness to be clear.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\int\frac{\ln x}{x^{10}}\,dx
&=-\frac{\ln x}{9x^{-9}}+\frac{1}{9}\int x^{-10}\,dx\\
\intertext{The preceding equality employs integration by parts: Put
$u=\ln x$ and $dv=x^{-10}dx$; thus, $du=\frac{dx}{x}$ and $v=-\frac{1}{9}x^{-9}$.}
&=-\frac{\ln x}{9x^{-9}}+\frac{1}{81} x^{-9} + C
\end{align*}
\end{document}


How about this layout with flalign* and eqparbox?

\documentclass{article}
\usepackage{amsmath, nccmath}
\usepackage{eqparbox}

\begin{document}

\begin{flalign*}
&\qquad & \int\frac{\ln x}{x^{10}}\ dx&=-\frac{\ln x}{9x^{-9}}+\frac{1}{9}\int x^{-10}\ dx
&&\smash[b]{\eqparbox[t]{Annot}{IBP:$\begin{array}[t]{l@{}}u=\ln x, dv=x^{-10}dx,\\ du=\mfrac{dx}{x}, v=-\frac{1}{9}x^{-9}\end{array}$}}\\
& & & =-\frac{\ln x}{9x^{-9}}+\frac{1}{81} x^{-9}+C
\end{flalign*}

\end{document}


You shouldn't abuse \tag.

\documentclass{article}
\usepackage{amsmath}
\usepackage{varwidth}

\usepackage{showframe} % just for the example

\newcommand{\IBP}[2][]{%
\mbox{#1IBP: \smash[b]{\begin{varwidth}[t]{0.3\displaywidth}#2\end{varwidth}}}%
}

\begin{document}

\begin{flalign*}
&&\int\frac{\ln x}{x^{10}}\,dx&=-\frac{\ln x}{9x^{-9}}+\frac{1}{9}\int x^{-10}\,dx
&&\IBP{$u=\ln x$, $dv=x^{-10}\,dx$, \\ $du=\frac{dx}{x}$, $v=-\frac{1}{9}x^{-9}$}
\\
&&&=-\frac{\ln x}{9x^{-9}}+\frac{1}{81} x^{-9}+C
\end{flalign*}

\begin{flalign*}
&&\int\frac{\ln x}{x^{10}}\,dx&=-\frac{\ln x}{9x^{-9}}+\frac{1}{9}\int x^{-10}\,dx
&&\IBP[\footnotesize]{$u=\ln x$, $dv=x^{-10}\,dx$, \\ $du=\frac{dx}{x}$, $v=-\frac{1}{9}x^{-9}$}
\\
&&&=-\frac{\ln x}{9x^{-9}}+\frac{1}{81} x^{-9}+C
\end{flalign*}

\end{document}


Beware that if the argument of \IBP is deeper than the rest of the alignment you'd get overprinting, but this doesn't seem much of a problem. Anyway, I added an optional size argument to set the part in smaller type if needed.