Article Class Latex Template Assignment

For the class file itself: I actually made my own class file (adapted from the class file) to format my homework the way I wanted. It is here, if you're interested in trying it or fiddling with it:

You supply it with and in the preamble, and it automatically uses today's date.

This file is used by inserting at the beginning of a document.

The standard formatting for a problem looks like this:

It creates a new page for every problem. Also, if a problem has multiple "parts" the formatting might look like this

The will use letters (a), (b), etc. And will use (a), then (b), etc.

An example page (from a real homework assignment) looks like this

If you want to try it out, download it, put it in your folder and run (if you're on a UNIX based system).

There are definitely things in this class file that are automated that people would want more control over, so I suggest fiddling around to find what works best for you.

For syntax highlighting: Werner's answer mentioning the package for syntax highlighting and code is great. (That style file could be used with this class file.)

There are LaTeX document classes for typesetting books, articles, exams, presentations, and more. Now, there’s one for homework assignments, too.


Check out and download the source on GitHub.


This is a LaTeX document class. That means you use it with at the top of the document. It provides a document layout and some helper commands that make working with questions easy.


Certainly the easiest way to start using this template is to copy the .cls file to your computer in the same directory as your LaTeX project directory.

A better way to install this template is to fork the above repository and then clone that fork to a particular folder on your computer:

Then, whenever you need to use the template, you can copy the template wherever. Also, if there are ever any updates, you can simply run

to update the template.

Preferred Installation

The best way to install this file is to follow the instructions here, keeping in mind that you’re trying to install a file instead of three files.


See the homework.tex file for an exhaustive list of usage examples. There are also comments explaining features for which there are no examples given.

The result is the following:

The class file also has a bunch of helper s that you might want to take a look at in homework.cls.

For your convenience, the file template.tex is a nearly-empty LaTeX file that contains the bare essentials to get started using the homework class.

To start a question, just type . It will add the text “Question #” with a line underneath to the document. If you’d like to change “Question” to something else, use

Similarly, if you ever need to skip numbers, you can do

So, to skip to the 10th question, = 9.

See homework.tex for more.

Some classes like to give their homework questions fancy names. If this is the case, you can use to make a named question.

See homework.tex for more.

Question Parts

Another common thing on homework assignments is to have multi-part questions. To deal with these, use the form


See homework.tex for more.

Induction Proofs

In math classes, induction proofs come up a lot, and they almost always have the same form: base case, induction hypothesis, and induction step.


One of my favorite features of this document class is that it redefines the macros. This means you can use tools like Markdown, which have a concise syntax, together with a tool like to convert Markdown into LaTeX. As an example, consider that we have the Markdown:

Running will output

And since is the same thing as \question, we’re golden, and this compiles as we’d want it to. Throw it into the blank template.tex file included in the repo, and you’ve got yourself a typeset homework.


I’ve make a lot of other LaTeX-related posts. Be sure to check them out as well! My hope is that you find something that makes developing LaTeX just that much easier.


0 thoughts on “Article Class Latex Template Assignment

Leave a Reply

Your email address will not be published. Required fields are marked *