Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the exam package and want to use \fillwithlines{\stretch{1}} but only so it goes .6\textwidth across the page. I've tried using minipage, parbox, and makebox, but none of them work with the \stretch{1} command.

The code below does not print any lines at all.

\documentclass{exam}

\begin{document}
    \begin{questions}
        \question Question\newline
            \begin{minipage}[b]{.6\linewidth}
                \fillwithlines{\stretch{1}}
            \end{minipage}
    \end{questions}
\end{document}
share|improve this question
    
Welcome to TeX.SE! Please edit your question to provide a MWE (minimum working example) of a LaTeX program that generates the issues you're trying to solve. –  Mico Nov 2 '12 at 11:11

1 Answer 1

up vote 3 down vote accepted

Use the following variation of \fillwithlines allowing you to specify as optional argument the width of the lines (default=\textwidth):

\documentclass{exam}

\makeatletter
\newcommand\mlinefill[1]{\leavevmode
    \leaders\hrule height \linefillthickness\hfill%
\rule{\dimexpr\textwidth-#1\relax}{0pt}\kern\z@}

\newcommand\mfillwithlines[2][\textwidth]{%
  \begingroup
  \ifhmode
    \par
  \fi
  \hrule height \z@
  \nobreak
  \setbox0=\hbox to \hsize{\hskip \@totalleftmargin
          \vrule height \linefillheight depth \z@ width \z@
          \mlinefill{#1}}%
  % We use \cleaders (rather than \leaders) so that a given
  % vertical space will always produce the same number of lines
  % no matter where on the page it happens to start:
  \cleaders \copy0 \vskip #2 \hbox{}%
  \endgroup
}
\makeatother

\begin{document}
    \begin{questions}
        \question Question\newline
                \mfillwithlines[.6\textwidth]{\stretch{1}}
    \end{questions}
\end{document}
share|improve this answer

Your Answer

 
discard

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.