5

I use the below structure for it:

\documentclass[12pt]{article}
\begin{document}
\begin{minipage}[t]{.9\textwidth}
\leavevmode\rlap
{I want to stop the hrule, at the end of my text.}
\rule{\textwidth}{0.0001pt}
\leavevmode\rlap
{And also I want to stop the hrule, at the end of my text too.}
\rule{\textwidth}{0.0001pt}
\leavevmode\rlap
{And also for here.}
\rule{\textwidth}{0.0001pt}
\end{minipage}
\end{document}

But I want to be exactly equal my hrule width and text width together.

My output is:
enter image description here

3

Here is a suggestion assuming that there is no linebreak in the text:

\documentclass[12pt]{article}
\newsavebox\textbox
\newcommand\showbaseline[1]{%
  \leavevmode
  \sbox\textbox{#1}%
  \rlap{\rule{\wd\textbox}{.1pt}}%
  \usebox\textbox
}
\begin{document}
\begin{minipage}[t]{.9\textwidth}
  \raggedright
  \showbaseline{Short text.}\\
  \showbaseline{I want to stop the hrule, at the end of my text.}
  \showbaseline{And also I want to stop the hrule, at the end of my text too.}
  \showbaseline{And also for here.}
\end{minipage}
\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.