I am trying to add interlinear comments to a piece of text. I am currently using the solution here: How to do centered interlinear text in LaTeX
This involved defining a command
\newcommand\wrd[2]{%
\leavevmode
\vbox{\offinterlineskip
\halign{%
\hfil##\hfil\cr
{\footnotesize\sffamily\vphantom{p}#1}\cr
\noalign{\vskip\lineskip}%
\vphantom{A}#2\cr
}%
}%
}
and running
\wrd{Tang Yin is a painter, poet and calligrapher, one of the "Four Masters of Ming Dynasty.}{Tang Yin entitled ‘Spring Slumber’ depicting a beautiful woman asleep.}
However, I run into trouble when my comment is more than one line long. Ideally, I would like the comment, even if it is multiple lines, to exist entirely above the line of text it is commenting on. I have tried to use expex, but I am not familiar enough with LaTeX generally to know how to do this simple task. Someone please help me.
Edit: here is a small compilable example:
\documentclass[twoside,11pt]{memoir} % Font size
\usepackage{expex}
\newcommand\wrd[2]{%
\leavevmode
\vbox{\offinterlineskip
\halign{%
\hfil##\hfil\cr
{\footnotesize\sffamily\vphantom{p}#1}\cr
\noalign{\vskip\lineskip}%
\vphantom{A}#2\cr
}%
}%
}
%----------------------------------------------------------------------------------------
\begin{document}
\lq What a lovely smell!\rq
He repeated the words several times over.
Inside the room there was a painting \wrd{This is an interlinear comment but it is too long to fit above the line}. {by Tang Yin entitled ‘Spring Slumber’ depicting a beautiful woman asleep. under a crab-apple tree}, whose buds had not yet opened. The painting was flanked on either side by a pair of calligraphic scrolls inscribed with a couplet from the brush of the Song poet Qin Guan:
(on one side)
\vskip5pt
\end{document}



\documentclassand ending with\end{document}. Since different document classes are set up differently in ways that may affect what you are trying to do, it's really better not to have to guess. – barbara beeton Apr 24 '22 at 00:01