For typesetting short snippets of music notation within TeX, you can use the MusixTeX package <https://ctan.org/pkg/musixtex>.
Following a few links, I found a great overview:
MusiXTEX - Using TEX to write polyphonic instrumental music
http://icking-music-archive.org/software/musixtex/musixdoc.p... (pdf)
For Lilypond, here's an introduction that demonstrates how to "write music by typing text":
Lilypond: "Compiling" Music
https://lilypond.org/text-input.html
Following a few links, I found a great overview:
MusiXTEX - Using TEX to write polyphonic instrumental music
http://icking-music-archive.org/software/musixtex/musixdoc.p... (pdf)
For Lilypond, here's an introduction that demonstrates how to "write music by typing text":
Lilypond: "Compiling" Music
https://lilypond.org/text-input.html