# underline (empty space) until end of line (manual “fill in the blank” to end of line), within enumerated environment

I keep encountering situations where I would like to quickly include a few "fill-in-the-blank" style underlined horizontal spaces (usually within an enumerated environment) but each time I come to search the tex.SE, all I find in searches are more specific or advanced applications. Even when I use the "questions that may already have your answer" and "similar questions" I don't find anything that addresses this specific case.

It seems to me I should be able to make this happen relatively easily, without necessarily loading a new package (if that's what's best, then that's what's best, but I'm trying to learn how to build up expressions myself, instead of always relying on existing packages), but I can't seem to make it happen.

Until now, I have not posted the question, because I've assumed I'm just not using the right language, but this is the 4th or 5th time that I've done this, so I figure I can't be the only one not finding the result.

Basically, I just want something that behaves like

\newcommand{\myBlank}{\underline{\qquad\qquad\qquad\qquad}.}


or

\newcommand{\myBlank}{\underline{\hspace{5cm}}.}


except, instead of a constant length, have it expand to the remaining space on the current line (i.e. until the end of line).

I tried using glue (which I only recently discovered, and know very little about), but that didn't seem to work, either:

\newlength{\myBlankSp}
\setlength{\myBlankSp}{10cm plus 10cm minus 15cm}

\def\myBlank{\underline{\hspace{\myBlankSp}}}


Any simple solutions? Again, both interested in understanding how to create it, but also ensuring that a simple answer (ideally not just calling a package) is actual findable on the SE, as it seems both useful and as though it's the type of issue that can teach you something important about the way LaTeX works.

You are looking for \hrulefill. EDITED to show in an enumerate environment.

\documentclass{article}
\begin{document}
\begin{enumerate}
\item blah \hrulefill.

\item blah blah \hrulefill.

\item blah blah blah \hrulefill. (10pt)
\end{enumerate}
\end{document}


The OP asks for a deeper line. No problem, by setting the parameters for \hrule (which is part of the definition of the \hrulefill).

\documentclass{article}
\usepackage[nopar]{lipsum}
\makeatletter
\newcommand\arulefill{%
\makeatother
\begin{document}
\begin{enumerate}
\item blah \arulefill.

\item blah blah \arulefill.

\item \lipsum[3] \arulefill. (10pt)
\end{enumerate}
\end{document}


EDITED to include definition provided in comments

The macro uses the concept of leaders (the things that allow a string of dots in a table of contents, for example). In this case, though, it uses an \hrule rather than a dot fill. The actual definition of \hrulefill is \leaders\hrule\hfill\kern\z@

• I should've asked long ago. Less revealing than I expected, though. – Rax Adaam Apr 20 '18 at 17:08
• @RaxAdaam The macro uses the concept of leaders (the things that allow a string of dots in a table of contents, for example). In this case, though, it uses an \hrule rather than a dot fill. The actual definition of \hrulefill is \leaders\hrule\hfill\kern\z@. – Steven B. Segletes Apr 20 '18 at 17:11
• Is there any simple way of adjusting the height of the line? When used within a paragraph (i.e. bottom line of a long question), I find the line doesn't leave much room for writing on. I can post a linked question, if so. Thank you also for taking the time to explain the relationship. I'll add that to the answer, as I think it's helpful for users to (at least gradually) learn how these things work :) – Rax Adaam Apr 21 '18 at 12:20
• @RaxAdaam I have edited the answer to show how to set the rule depth/height. – Steven B. Segletes Apr 21 '18 at 14:16