I think it’s better to give you an picture example:
how can i do this in libreoffice?
You may use a frame anchored as character  and formatted to your needs. The frame style may be reused. Under some aspects there will be a certain degree of tinkering needed.
ask70311FractionLikeTextInLine001.odt
Hi
LibreOffice has a feature for this:
- Check 
Tools▸Options▸Language Settings▸Languages▸Default Languages for Documents:Asian - Type the concerned text (e.g. 1234), select it
 - 
Format▸Asian phonetic guide▸type abcd in theRuby textcolumn▸Close 
By default, the Rubies character style applies to Ruby text. You can adapt it to your presentation needs.
In the attached example I added the underlined and increased the font size. I also created the RubiesBase characters style  to apply the same font size to the 1234 text.
Regards