I want to make a blank between texts on both ends of a line. For example,
\begin{enumerate}
\item There \hrulefill\ in the room.
\end{enumerate}
But, the above appears in student's version only, and I want to make a teacher's version where the answer is also printed in the blank. I don't have any idea but
\begin{enumerate}
\item There \underline{\makebox[100pt][l]{is a chair}} in the room.
\end{enumerate}
The method is not satisfactory because the length of the blank is unknown in advance.
My problems:
-
How to put text on an
\hrulefill
? -
(A bonus question) I found out that the vertical position of the horizontal rule generated by
\hrulefill
and\underline
is different. How can I control the vertical position of these horizontal rules?
Best Answer
While cslstr's method is more robust, one way to do this is to replace the
\hrulefill
with one that uses underlines using\xleaders
.Which produces:![example output](https://i.stack.imgur.com/ULDQp.png)
If you wanted the answer left aligned you can remove the beginning
\ulfrule{}
before the answer:More on what
\xleaders
does can be found in this answer