handouts/docs-latex.md

3.0 KiB

LaTeX documentation

All LaTeX handouts are based on handout.cls.
This class is based on article.cls, and should work with most LaTeX packages.

The best way to start a new document is to make a copy of an existing one.

Notes

  • Compile your handouts with XeLaTeX.
    pdflatex is known to misbehave with handout.cls.
    This will happen by default if you use vscode.
    If you use Overleaf, you'll have to configure it manually (see document settings).

Document Options

Document options are passed to \documentclass, as follows:

\documentclass[
	% Show solutions is `solutions` is provided,
	% hide them if `nosolutions` is provided.
	%
	% You should set only ONE of these flags at a time.
	% Solutions are shown by default.
	% All handouts are stored with `solutions` enabled.
	solutions,
	nosolutions,

	% Enable this option if you need more space on the handout's first page.
	% We use a long warning by default.
	shortwarning,

	% If present, hide page numbers.
	% This should only be used for single-page handouts
	% (e.g, warm-ups)
	nopagenumber
]{handout}

Use geometry to change margins and page dimensions. US letter is the default.

Utilities

  • \say{text}: Puts text in quotes, handling details like period spacing. Courtesy of dirtytalk.
  • \note[Type]{text}: Makes a note.
  • \hint{text}: Shorthand for \note[Hint]{text}

Sections

The usual LaTeX title-customization techniques WILL NOT WORK with this class.
Don't even try to load titlesec.

handout.cls supports two levels of sections:

  • \section, for large parts of the handout
  • \definition, \theorem, \proposition, \example, \remark, \problem, and \problempart

All these macros have the following syntax: \problem{title}<label>

  • title is the problem's title, and may be empty.
  • label is the problem's label. This is optional.
    If a label is provided, this section may be referenced with \ref{label}.

Examples:

  • \problem{}
  • \problem{Bonus}
  • \problem{}<gcd>, which may be referenced with \ref{gcd}

Do not use \begin{problem} ... \end{problem}.
Sections are macros, not environments.

Environments:

  • \begin{solution}: A fancy red for solutions to problems.
    This is hidden if the nosolutions is provided.
  • \begin{instrutornote}: A fancy blue box for instructor notes.
    This is hidden if the nosolutions is provided.
  • \begin{examplesolution}: A fancy gray for sample solutions.
    This is never hidden.

All the above environments break across pages and may safely be nested.

Each of these environments also provides the \linehack macro, which draws a line across the box.
This is useful for, say, solutions to multipart problems.