I don’t think this has any existing solutions, but I want to ask before causing myself unnecessary complications.
In some contexts it’s useful to write a line of “actual text” and then have additional information under or over each line. In Chinese you sometimes want pinyin underneath; Japanese has furigana which is usually over the text; for linguistics and teaching it’s helpful to show the grammatical syntax underneath.
Example of Chinese:
Example of syntax markup:
If the text and annotation are needed to line up neatly (as here) I can’t think of an option other than laboriously writing everything out in tables while monitoring to check it doesn’t get wider than the page and start flowing.
If they aren’t, I can’t think of a solution other than writing out each line manually with the corresponding annotations underneath.
I won’t be surprised if there isn’t a way of doing this more neatly, but if there is, I’d love to know.
Furigana is a bit different because it’s often only associated with specific characters whose pronunciation needs clarifying, like personal names. So there might be a different solution, like wrapping those characters in something that creates a box that is placed just above them. I don’t need furigana at the moment, I just brought it up because it’s related to the overall question.

