Background
I've created a macro with name \an in order to write single line and multiline annotations inside the alignat environment (see example below)
\documentclass{article}
\usepackage{amsmath, stackengine, lipsum}
\setstackEOL{\\}
\newcommand\an[1]{%
\scantokens{&\hspace{10px}& {\tiny \Longstack[l]{(#1)}}}
}
\begin{document}
\begin{alignat*}{2}
x &= 0 \an{a}
\\ &= 0 + 0 + 0 \an{\lipsum[1][1] \\ \lipsum[2][1]}
\end{alignat*}
\end{document}[
The problem
I sometimes need to write long pieces of text inside those annotations which makes me insert a newline whenever it reaches the end of the page. Otherwise, the following would occur
The current workaround is to manually insert a newline character in those places where I want a breakline, but that's a repetitive task that I think it is possible to automate by using the value of the \textwidth variable.
The question
So, my question is: How can I make the \an macro insert a newline character whenever the argument passed reaches the \textwidth value?



\parboxon the second pass. – Donald Arseneau May 01 '20 at 05:54