TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I see a nice feature \answerline to the right of a question. The answer is put to the right of a question. What I want is:

  1. the number before the answer line should be removed, because I think the number before answer line is redundant.
  2. dotted line between the question end and the answer.

Is that possible?

share|improve this question
up vote 3 down vote accepted

Using the code from Werner's solution to the other question, you can put a \leaders command in the replacement text that was removing the vertical skip.

\leaders takes some box and copies it enough times to fill up some specified horizontal space. So here is one version: we make a box containing a dot with some space around it, we ask the sequence of boxes to fill up an aggressively stretchable horizontal space of 0pt plus 1filll. This will squeeze out the other stretchable space on the line before the answer material, pushing it to the right and filling the intervening space with a line of dots.

For removing the number, we just note that Werner's code already provided a command \answerline* command, so we may use that when we wish to suppress numbers.

Sample output


\xpatchcmd{\answerline}% <cmd>
  {\par\nobreak\vskip\answerskip}% <search>
  {\leaders\hbox{\hskip0.2em .\hskip0.2em}\hskip 0pt plus 1filll}% <replace>
  {}{}% <success><failure>
\xpatchcmd{\answerline}{\fi \par}{\fi}{}{}% Remove line break after \answerline
\RenewDocumentCommand{\answerline}{s o}{%
    {\def\@queslevel{\relax}}% \answerline*
    {}% \answerline
    {\oldanswerline[{}]}% \answerline
    {\oldanswerline[#2]}% \answerline[..]

  \question Write hello \answerline*[hello] to your mother
  \question Write hello \answerline[hello] to your mother
share|improve this answer
Dear Andrew, thanks for the answer, though the thanks come a litter later. I just mark your post as a good answer, thank you again. – ollydbg23 Oct 16 '13 at 5:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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