3
\documentclass{book}
\usepackage{stackengine}
\usepackage{ulem}

\renewcommand{\baselinestretch}{4}

\begin{document}


    \stackunder{\uline{this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text this a text}}{text1}



    \uline
    {   
        \stackunder{\stackunder{ text this a text this a text this a text this a text this a text this}{\uline{text1}}}{text 2} \\
        \stackunder{ text this a text this a text this a text this a text this a text this}{Cont. text1}\\
        \stackunder{ text this a text this a text this a text this a text this a text this}{Cont. text1}
    }
\end{document}

I am trying to make underlined text with some text under. for that i have used stackengine package to put some text under that line. but it is a hbox type and it is not possible to be wrap automatically and it should be updated under text also

I can do that manually but in most cases those stuff which i want to be underlined with text under it is long. another thing it should be capable to do nested underlined text also so pls help me to solve this issue

enter image description here

Russel
  • 31

1 Answers1

2

Here is a starting point. With this simple solution you have to manually mark the words where the tag is to be placed.

enter image description here

\documentclass{article}
\usepackage{ulem}

\newcommand\tag[2]{% \begin{tabular}[t]{@{}c@{}} #1\ \makebox[0pt]{#2} \end{tabular}% }

\begin{document} \uline{A long, long sentence that goes \tag{beyond}{sentence} the end of line, and even then does not stop, but \tag{goes on}{sent.\ continued}, and on, and on, and on.} \end{document}

gernot
  • 49,614
  • thanks for your time. but still there is 3 problem: first of all i can't use another \uline as a nested command in the main \uline (i tried it but still i have the same problem like what is happened for long text inside the fist line of my picture) and second one is how i can put this tabular in the middle of line and 3rd one is how i can do wrapping automatically – Russel Dec 30 '20 at 23:55