cgnieder/xsim

Suggestion: let blank lines end at the end of the line

Sk1nk opened this issue · 4 comments

Sk1nk commented

Since the lockdown I need to create more and more exercise-sheets and your package is saving me a lot of trouble ever since. Thank you very much for all the effort you put into this.

I recently came across a problem I couldn't figure out. Is there a way to let the blank line end at the end of a line like \hrulefill would? Right now I am adjusting the width=.xx\linewidth for each blank space to give my students as much writing space as possible, but I would love a boolean, that would complete the line to the end of the line, after commands such as width are fulfilled. That way I could do something like

"Give the definition for the following

  • factor: ______
  • product: _____
  • meaning of life: _____________________________________________________________________ _____________________________________________________________________________________________________________________________________________"

The \linegoal from linegoal package might be helpful:

\documentclass{article}
\usepackage{lipsum}
\usepackage[pass, showframe]{geometry}

\usepackage{linegoal}
\usepackage{xsim}

\begin{document}
\lipsum[2]

abc \blank[width=\linegoal]{text}
\end{document}

image

It's a reasonable wish and shouldn't be too hard to implement. Meanwhile @muzimuzhi's suggestion seems a valid way to go :)

After thinking about this a little bit more I believe using \linegoal might be a better option than to implement something myself.

What do you think?

Perhaps users may also want to add a punctuation after such blank lines, and when width=\linegoal is used, that could (only) be supported by adding a new blank option:

\documentclass{article}
\usepackage[pass, showframe]{geometry}

\usepackage{linegoal}
\usepackage{xsim}

\begin{document}
current:

abc \blank[width=-3pt+\linegoal]{text}.

def \blank[width=2\linewidth-3pt+\linegoal]{text}.

% expected:

% abc \blank[width=\linegoal, end-punct={.}]{text}
\end{document}

image