如何显示基线并在其上创建文本?

如何显示基线并在其上创建文本?

我使用下面的结构:

\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}

但我希望我和exactly 我的 家人能够平等 相处。hrule widthtext width

我的输出是:
在此处输入图片描述

答案1

以下是假设文本中没有换行符的建议:

\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}

在此处输入图片描述

相关内容