latex-homework
latex-homework copied to clipboard
LaTeX class and template for typesetting math homework
The homework class
Provides the LaTeX class homework.cls for typesetting homework in a straightforward problem-solution format. Designed to avoid this mistake.
Read on for a description of the homework class.
Table of Contents
- Introduction
- Features
- Example
- Getting Started
- Template
- Usage
- Documentation
- Commands
- Environments
- Class Options
- License
Introduction
Features
- Simple interface for specifying homework information (e.g., name and course).
- Environments for writing problem statements, problem parts, and solutions.
- Automatic title creation.
- Compatible with
articleclass options. - Loads the AMS math packages.
- Automatic PDF author/title/bookmark metadata creation.
Example
For an examples of homework solutions created using the homework class,
see example.tex and the resulting PDF.
Getting Started
Template
template.tex is a ready-to-use homework template that uses the
homework class.
Usage
- Download
homework.clsand save it in the same directory as your homework.texfile (alternatively, see this question to learn where to put.clsfiles to be globally available to TeX) - At the top of the homework
.texfile, put\documentclass{homework}. - In the preamble, specify the homework information using the commands listed in the Commands section.
- In the document, begin writing problems in
problemenvironments and solutions insolutionenvironments (see Environments).
Documentation
Commands
The following commands should be used in the preamble of the homework .tex
file.
If these are not used, you will get an error.
\name{<name>}: Replace<name>with your name.\course{<course>}: Replace<course>with the name of the course.\term{<term>}: Replace<term>with the term when the course is held.\hwnum{<number>}: Replace<number>with the number of the homework.
Thus, at a minimum, your preamble must contain
\documentclass{homework}
\name{<name>}
\course{<course>}
\term{<term>}
\hwnum{<hwnum>}
You can also change the default text of various labels that appear on the document by using the following commands.
\hwname{<name>}: Replace<name>with the desired label for the type of homework (e.g., Assignment or Problem Set). The default is Homework.\problemname{<name>}: Replace<name>with the desired label for problems created with theproblemenvironment (e.g., Exercise or Question). The default is Problem.\solutionname{<name>}: Replace<name>with the desired label for solutions created with thesolutionenvironment (e.g., Proof, Answer, or a label in another language). The default is Solution.
Environments
The following environments are provided to typeset the homework.
-
problem: wraps individual problem statements. By default, problems are numbered beginning at1. To change the number of a given problem ton, use the command\problemnumber{n}before theproblemenvironment. -
solution: wraps the solution to a problem. -
parts: enumerates parts of a multiple-part problem. If multiplepartsenvironments are used in a singleproblemenvironment, labels will resume unless you use the\unresumecommand right after the beginning of eachpartsenvironment. New parts are declared using the\partcommand. The part labels can be customized by providing one of the following options to thepartsenvironment:a: (default) Lowercase letters.A: Uppercase letters.r: Lowercase Roman numerals.R: Uppercase Roman numerals.n: Numbers.
To specify your own labels to
parts(for example, to only list partsb,dande) use the custom label as parameter as in\part[b)]. -
claim,lemma,propostion,theorem,corollary,proof: organize claims made in a solution (and prove these claims). The 'claim' environment takes an optional argument that labels the claim (e.g.,\begin{claim}[Conjecture]will make the claim be labelled "Conjecture"). The other listed environments are derived from the 'claim' environment.
Class Options
To use a class option, write
\documentclass[<options>]{homework}
at the beginning of your homework file, where <options> is a comma-separated
list of the options that you wish to use.
All the options of the article class may be used.
In addition, the homework class provides the following options.
boxes: Use this option if you want theproblemenvironment to enclose problem statements in boxes.hidesolutions: Use this option to hide solutions in the output. With this option enabled, you can still write solutions in thesolutionenvironment, but these solutions will not show up in the final document.qed: Use this option if you want an end-of-proof symbol printed at the end of solutions.
License
This code is distributed under the MIT license. For more info, read the LICENSE file.