23

Specifically, a bunch of them; for a sign-in sheet, list of signatures for a petition or a worksheet with short answer essay style questions.

6

4 Answers 4

29

The exam document class offers you ready-to-use environments and commands for essay-questions; a little example:

\documentclass{exam}

\begin{document}

\begin{EnvFullwidth}
\Large \textbf{Essay questions}
\end{EnvFullwidth}

\begin{questions}
\question
Explain how the cooling of matter in the centuries following the big
bang has influenced the British parliamentary system of government
\fillwithlines{2in}
\question
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\fillwithlines{1in}
\end{questions}

\end{document}

enter image description here

The distance between the lines can be changed by setting the length \linefillheight (default value 0.25in); the thickness of the lines can be changed by setting the length \linefillthickness (default value 0.1pt). The remaining space on the page can be filled with linesby using

\fillwithlines{\stretch{1}}
\newpage
4
  • LaTeX never ceases to amaze me. +1
    – Reid
    Commented Jul 31, 2011 at 4:59
  • This is great, thanks. Is there a way to make this two columns?
    – Charlie
    Commented Aug 2, 2011 at 21:55
  • @Charlie: I am not sure that I understand your question. You can use the twocolumn class option: \documentclass[twocolumn]{exam}. If this is not what you need, please give a more detailed explanation of what you need. Commented Aug 2, 2011 at 23:17
  • Can someone help me with with \fillwithlines which works, but I'v been unable to use this command with \linefillheight and \linefillthickness. I used various combinations of all three commands nested in each other. I want to change the height between lines and line thicknes
    – Jon
    Commented Aug 28, 2023 at 11:02
8

I have the following:

\newenvironment{rules}[1][1] 
  {\flushleft\minipage{\textwidth} 
   \linespread{#1}\selectfont 
   \def\\{\begingroup\leavevmode\parfillskip=0pt 
   \hrulefill\endgraf\endgroup}} 
{\endminipage\endflushleft}

Here is an example

Some text before.
\begin{rules}[1.5]
Give a short proof of Fermat's last theorem  \\ \\ \\
\end{rules}
Some text after.

The optional argument is a factor for vertically spacing the rules (acts on \baselinestretch.

Minimal example

\documentclass{article}

\newenvironment{rules}[1][1]
  {\flushleft\minipage{\textwidth}
   \linespread{#1}\selectfont
   \def\\{\begingroup\leavevmode\parfillskip=0pt
   \hrulefill\endgraf\endgroup}}
{\endminipage\endflushleft}

\begin{document}

Some text before.

\begin{rules}[1.5]
Give a short proof of Fermat's last theorem  \\ \\ \\
\end{rules}

Some text after.

\end{document}

enter image description here

2
  • 1
    "I have discovered a truly marvelous proof of this, which this margin is too narrow to contain." So two and a half lines should be sufficient. :)
    – Alexander
    Commented Oct 23, 2012 at 12:23
  • @Alexander Cubum autem in duos cubos, aut quadratoquadratorum in duos quadratoquadratos, et generaliter nullam in infinitum ultra quadratum potestatem in duos eiusdem nominis fas est dividere. Cuius rei demonstrationem mirabilem sane detexi hanc marginis exiguitas non caperet.
    – egreg
    Commented Oct 23, 2012 at 12:27
1

I found this answer (german) to be very helpfull.

Using other solutions I either got overfull hboxes, because the last line of a paragraph cannot have full \textwidth. This was also the reason \hrulefill gave me lines that were not long enogh (complying the he last line of paragrah rules).

Spacing of the lines can be set in parskip here it is set to 4pt. Line thickness is set behind \rule, here 0.5pt.

The setting in the group do not affect the rest of the document. Additional spacing before and escpcially after the lines can be facillitated with \vspace{} e.g.\vspace{0.2\baselineskip}

MWE:

\documentclass{article}
\parindent0pt
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua:

\vspace{0.2\baselineskip}
\begingroup
    \setlength{\parskip}{4pt}% 5pt parskip
    \setlength{\parindent}{0pt}% no indent
    \setlength{\parfillskip}{0pt plus 1fil}% Paragraph can be completely full
    \par\rule{\linewidth}{0.5pt}\par
    \par\rule{\linewidth}{0.5pt}\par
    \par\rule{\linewidth}{0.5pt}\par
\endgroup
\vspace{0.2\baselineskip}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
\end{document}

output MWE: loreipsum with blank lines inbetween

EDIT: added MWE on request

0
0

The \hrule command creates horizontal lines. Other commands, such as \bigskip or \smallskip separate the lines. Here are 3 lines (each 5 inches in length) and two different separations between them.

\documentclass{article}
\begin{document}
\hrule width 5.0in
\bigskip
\bigskip
\hrule width 5.0in
\bigskip 
\hrule width 5.0in
\end{document}

The \hrule command has several arguments but only the width of the line is mentioned here. For more information on lines and their arguments consider "A Gentle Introduction to TeX" which can be downloaded by clicking here: Gentle. The pages 70-72 are most relevant to your question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .