12 February 2014

Doing your homework in latex.

It is a common occurrence for other students to comment on my homework whenever I turn it in for one of my classes.

The complete LaTeX file (and the pdf output) can be found in my repository, latex-homework-template .

Below are a few screenshots of problems that I’ve done in the past:

Cover page

If I didn’t know how easy it was and the benefits that I get from typesetting my homework, I’d probably ask as well. However, I’d argue that using LaTeX to type up homework has made me a far better student than when I used to handwrite my homeworks.

And that is something that I care a lot about.

The Benefits

I can summarize the benefits like so:

It can be kept in Source Control. Handwriting can’t be stored in a version control system; once you erase something, it’s gone.

You can see your homework materialize in front of you. Seeing the results and the equations in their complete LaTeX-glory is a very powerful way to conceptualize things. There’s just something different about the way things look so perfect that makes the subject easier to understand.

You’ll do better in your classes. This one goes with the previous point, but having the ability to see your homework helps you understand it. By understanding it well, you’ll do better on tests. You will maximize how much you can learn as well as maximize your grade (if that matters to you).

It’s very neat & tidy. Although my handwriting has improved quite a bit, I still find myself slipping back into a rushed, messy script from the past. LaTeX gives zero doubt that the professor/TA will be able to read my solutions.

About LaTeX

A very short history.

Donald Knuth , a legendary Computer Scientist as well as one of my favorites, is well known for the system that he created called just TeX .

It is a piece of typesetting software that aids in writing documents and formulas. The power comes from the fact that the document that you write is plain source code.

The code that you write is then “typeset” into the final document in whatever form you wish.

Here’s an example of some basic LaTeX code:

With the output looking like below:

Example output

Using the Template

I’ve created a GitHub repository, latex-homework-template , just for my homework template that I’ve been using ever since I started. I found it online and used it as a base to start my template.

To use it, just download the homework.tex file and start editing. Once you need to typeset it, you’ll need LaTeX here .

After that, you just need to compile it and you’ll get your output. There are tons of different resources that I’ve found useful in learning LaTeX:

TeX StackExchange

LaTeX Wikibook

Effect on Performance

I have a solid set of anecdotal evidence in favor of using LaTeX for writing up my homework.

In all the classes that I’ve used LaTeX, I’ve come out of the class with a very strong understanding of the material as well as a good grade. Although I’m not a big fan of grades (like at all), I know it matters to some people.

This might have to do with the fact that doing the homework in LaTeX takes longer. It might have to do with the fact that I perfect the appearance and spend a lot more time looking at the subject.

The most likely reason is a combination of all that I previously mentioned plus other factors. I’m usually one to always want to quantify something, but in this case, I know it helps; that’s all I need.

Learning Curve

There definitely is a learning curve when it comes to trying to use LaTeX for homework. I felt that it was definitely worth the effort unlike how it might seem to some students.

I reasoned that when I go to graduate school, I will want to use it there. I also know how pervasive it is in textbooks. Since I love to read textbooks so much, I wanted to see what it took to write them so elegantly. I may even want to write one in the future; we’ll have to see =]

To me it seemed like a small tradeoff for the great benefits that it provided.

I cannot recommend using LaTeX for your homework enough.

The benefits go a long way. It helps you learn the material and in a way that isn’t as easily achieved when just using pencil and paper.

LaTeX is also widely used in academia and learning about the tool is almost essential if you wish to go to graduate school.

Once I graduate from university, I plan on releasing all my code for the last three semesters as open source. It includes all my LaTeX code which has really accumulated over the last year. It should provide a nice resource for others.

In the meantime, hopefully if you start using LaTeX for your homework, you won’t be able to resist doing it early because of how fun it is. Well, at least it was fun for me =]

The LaTeX homework Document Class

January 10, 2015

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 \documentclass{homework} at the top of the document. It provides a document layout and some helper commands that make working with questions easy.

Installation

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 .cls file instead of three .sty 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:

typesetting homework in latex

The class file also has a bunch of helper \usepackage 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 \question . 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, <target number - 1> = 9.

See homework.tex for more.

Some classes like to give their homework questions fancy names. If this is the case, you can use \question*{The Question's Name} to make a named question.

Question Parts

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

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 \section macros. This means you can use tools like Markdown, which have a concise syntax, together with a tool like pandoc to convert Markdown into LaTeX. As an example, consider that we have the Markdown:

Running pandoc -f markdown -t latex my-homework.md will output

And since \section is the same thing as , 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.

02 Using LaTeX for Homework

I hope that you will use the LaTeX typesetting system to write your homework solutions for this course. (See the guide to submitting homework.) It might look daunting at first, if you haven't used LaTeX before, but you won't have to learn LaTeX in depth. You just have to fill in answers to exercises, so you won't need to deal with the complexities of writing complete documents. You will mainly need to know how to express mathematics in LaTeX. Unfortunately, matrices and systems of linear equations are among the more difficult things to write. Fortunately, you will have examples that you can imitate. What follows here is some basic information to get you oriented.

Using LaTeX is something like programming: You write "source code" in plain text, which is "compiled" to produce the actual document. Perhaps the first thing to know is that to start a new paragraph, you need to leave a blank line. Other than that, carriage returns are ignored. Also, multiple consecutive spaces are treated as a single space.

To Include mathematics in a document, you type the LaTeX source code for the math between dollar signs. For example, $ax^2+bx+c=0$ will be typeset as \(ax^2+bx+c=0\). If you enclose the code between double dollar signs, the math will be displayed on on line by itself. (This is called "displayed math.") For example, $ $ax^2+bx+c=0$ $ will be typeset as \[ax^2+bx+c=0\] Some things look different as displayed math. For example, compare \(\lim_{n\to\infty}\sum_{k=1}^n\frac{1}{2^n}=1\) to \[\lim_{n\to\infty}\sum_{k=1}^n\frac{1}{2^n}=1\] If case you are wondering, the LaTeX code for that is \lim_{n\to\infty}\sum_{k=1}^n\frac{1}{2^n}=1 . Remember that it has to be enclosed between either single or double dollar signs. Stuff that is between dollar signs is said to be in math mode , as opposed to the regular "text mode."

In the source code, certain characters have special meaning: $ \ { } ^ _ & ~ # % . We have seen that $ is used to surround math code.

The backslash character, \ , is used for LaTeX commands, and braces, { and } , are used to enclose the parameters to which a command applies. For example, in \sqrt{b^2-4ac} , the command is \sqrt , the parameter is b^2-4ac , and the typeset result is \(\sqrt{b^2-4ac}\). The \frac command is used to make a fraction, and it has two parameters, so \frac{n!}{k!(n-k)!} is typeset as \(\frac{n!}{k!(n-k)!}\). Some commands don't have parameters. For example, \infty represents the infinity symbol, \(\infty\), and \to produces a right arrow, \(\to\). Note that you might need to leave a space after a command like \to to mark the end of the command word. For example, use f\colon X\to Y to get \(f\colon X\to Y\). Typing \colonX instead of \colon X will just get you an error.

The special characters caret, ^ , and underscore,  _ , are used for exponents and subscripts in math mode. Note that if an exponent or subscript is more than one character or command, it must be enclosed in braces, so you need f^{-1}(x_i) to get \(f^{-1}(x_i)\). Some similar things, such as the upper and lower limits on a sum ( \sum_{n=1}^\infty for \(\sum_{n-1}^\infty\)) and the thing that goes below "lim" ( \lim_{x\to a} for \(\lim_{x\to a}\)). By the way, in display math, that would look like \(\displaystyle\lim_{x\to a}\). If you want to force some math into display style, use the command \displaystyle in regular math mode: $\displaystyle\lim_{x\to a}$ .

We will see that the amphersand, & , is used similarly to a tab character in tables and matrices. The other three special characters probably won't come up in your writing for this course. (A  ~ represents a non-breaking space, #  is used when defining new commands, and %  marks the start of a comment that ends at the end of the same line. Comments are ignored by LaTeX.) Most of the special characters can be output to the typeset document by preceding the character by a backslash in the source code. For example, type  \{ for \(\{\). However, this does not work for the backslash character; \\ is used to force a line break in the output. It also does not work for \^  or  \~ (which are used for making accented characters). I also note that | , < , and  > work in math mode but give funny results if used outside of math mode.

Some LeTeX code uses environments . Environments are coded using \begin and \end , which take the name of the environment as parameter. For example, you will write your solution to exercises in this course using my " answer " environment. That means that you will write your solution between \begin{answer} and \end{answer} . Similarly, I will write the problem text between \begin{problem} and \end{\problem} . (These two environments are not built into LaTeX. It is possible to define new environments and new commands in a document. The LaTeX source files that I give you will already define any extra commands and environments that you need.)

If you are going to use LaTeX in this course, you need to learn about matrix environments. To produce a matrix enclosed in parentheses, use the pmatrix environment. The rows of the matrix are separated by \\ . In each row, the elements of that row are separated by  & . All of that goes between \begin{pmatrix} and \end{pmatrix} , and it must all be in math mode or displayed math mode. LaTeX ignores end-of-lines in math mode, but it's a good idea to lay out the matrix in the source code similarly to how it looks when typeset (except I don't always do that for simple column vectors, which have just one element per row). For example,

will produce this in the typeset document: \[\begin{pmatrix} 3 & -10 & 2 \\ -1 & 7 & 4 \\ 5 & 0 & 1 \end{pmatrix} \begin{pmatrix} x\\ y\\ z \end{pmatrix} = \begin{pmatrix} 3x-10y+2z \\ -x+7y+4z \\ 5x+z \end{pmatrix}\]

Later, we will use the vmatrix environment to make matrices that are enclosed between vertical bars instead of between parentheses. There is a plain matrix environment for typesetting the elements of the matrix with nothing enclosing them. I use the matrix environment to typeset systems of linear equations, where each equation is one row in the matrix. Each term in an equation is one element of the row. The equal sign and the right-hand side of the equation are also elements. A column can be left empty—two & 's in a row—if a term is missing from the equation. For example:

gives \[ \begin{matrix} 3x_1 & -2x_2 & +x_3 & -x_4 & = & 7\\ -x_1 & & -5x_3 & +2x_4 & = & 2\\ & x_2 & +2x_3 & & = & 0\\ 2x_1 & +3x_2 & & -5x_4 & = & -1 \end{matrix} \]

Unfortunately, there is no simple environment for making augmented matrices. I use a pattern based on the array environment, which makes it possible to put lines between columns of the array and to say whether you want the columns to be centered, left justified, or right justified. This is specified in an extra parameter that comes after \begin{array} . For example, \begin{array}{cccc|c} is used for an array with five centered columns and a line between the fourth and fifth columns; you can use r and l instead of c to get right-justified or left-justified columns. Since the array environment does not include parentheses, I have to add them myself: \left( and \right) add appropriately sized parentheses around whatever is put between them. Here's the augmented matrix that represents the above linear system:

giving \[\left( \begin{array}{cccc|c} 3 & -2 & 1 & -1 & 7\\ -1 & 0 & -5 & 2 & 2\\ 0 & 1 & 2 & 0 & 0\\ -2 & 3 & 0 & -5 & -1 \end{array} \right) \]

The only other environment that is really essential is align* . This environment is unusual in that it is used for mathematics, but it has to be used in regular text mode, not inside math mode. Its purpose is to vertically align a sequence of rows. Rows are separated by \\ , and the position in each row that is to be aligned is marked with a  & . Often, a row is an equation or inequality (or just the operator and the right half of an equation/inequality), with the operators vertically aligned. Here is an example:

which is typeset as

\(\begin{align*} \frac{d}{dx}(x\sin(x^2)) &= x\frac{d}{dx}(\sin(x^2)) + \sin(x^2)\frac{d}{dx}(x) \\ &= x\cos(x^2)\frac{d}{dx}(x^2) + \sin(x^2)\\ &= x\cos(x^2)2x + \sin(x^2)\\ &= 2x^2\cos(x^2) + \sin(x^2) \end{align*}\)

For showing a series of row reductions applied to a matrix or linear system, you might use array or matrix environments inside an align* environment. This can get complicated, but an example is given in the first homework assignment. I have defined the command \rowop for making the arrows that go between the steps of a row reduction. The parameter to \rowop is either a single row operation or several operations separated by  \\ . For example, \rowop{\rho_2\leftrightarrow\rho_3} and \rowop{2\rho_1+\rho_2\\-3\rho_1+\rho_3} for \(\rowop{\rho_2\leftrightarrow\rho_3}\) and \(\rowop{2\rho_1+\rho_2\\-3\rho_1+\rho_3}\)

You can find lists of other LaTeX command elsewhere, and you will find examples in the documents that I give you. Here are a few more that you might use in this course. Most of these are used only in math mode, and a few of them require some preliminary configuration in the LaTeX file.

, ,
\( \subset, \subseteq, \supset,\supseteq\)
\(\{, \}, \in, \notin, \cup, \cap,\varnothing \)
\(\le,\ge,\ne,\approx \)
\(\forall,\exists,\therefore\)
\(\cdot, \dots, \cdots, \vdots, \ddots \)
\( \alpha, \beta, \gamma, \rho, \dots\)
\(\mathbb{R}, \mathbb{Q}, \mathbb{N} \)
\(\mathscr{A}, \mathscr{B}, \dots \)
\( \mathcal{A}, \mathcal{B}, \dots \)
\(f\colon A\to B \)
\(\bigcup_{n=1}^\infty, \bigcap_{\alpha\in A} \)
\(\rightarrow,\Rightarrow,\longrightarrow \)
\( \leftrightarrow,\Leftrightarrow\)

(back to contents)

  • Starting out with T e X...
  • CTAN Background
  • T e X user groups
  • Upload basics
  • Upload addendum
  • T e X Directory Structure
  • T e X Archive
  • Contributors

Announcements

  • Extended search
  • File search

assignment – A class file for typesetting homework and lab assignments

A class file for typesetting homework and lab assignments.

Sources
Documentation
Version 2004-07-14
Licenses TeX Project Public License
Maintainer
Contained in X Live as assignment
X as assignment
Topics

Download the contents of this package in one zip archive (83.5k).

Community Comments

  • 2004-07-14 CTAN has a new package: assignment

Suggestions

Maybe you are interested in the following packages as well.

  • homework: A L a T e X class for writing your homework
  • bankstatement: A L a T e X class for bank statements based on csv data
  • hitec: Class for documentation
  • script: Variant report and book styles

LaTeX is a “document preparation system.” It’s used to create presentable documents. More specifically, LaTeX is a “What You See Is What You Mean” interface; instead of focusing on how the content should look when everything’s done, you declare what you intend for the final document to contain, and these annotations are compiled into a final version. For comparison, Microsoft Word and other word processors are dubbed “What You See Is What You Get” (WYSIWYG, pronounced “whizy-whig”), because what’s displayed on the screen is how the document actually looks.

LaTeX works with plain text files (generally ending in .tex ). You format your document with a special syntax, then use either a command line tool (like pdflatex ) or a graphical interface (like TeXShop or ShareLaTeX) to compile the plain text into a PDF or some other graphical format.

People enjoy LaTeX for a number of reasons. First, LaTeX is particularly useful for typesetting mathematical equations, as we’ll see. It’s also easy to focus on just writing the content. Instead of fiddling with fonts and changing the appearance of the document, you can focus on its content. One final reason is that because LaTeX is plain text, you can use your favorite text editor (i.e. Vim) to edit content written in LaTeX.

Most computer science classes which posses some aspect of theory to them as well as many upper-level math classes expect their documents to be submitted as PDFs in LaTeX. Moreover, writing in LaTeX is very common practice for submitting papers in academia and industry.

  • Getting Started With LaTeX

Quick Start Guide

  • An excellent intro to LaTeX guide by Adam Blank, a former student, TA, and CS instructor at CMU.

Handy Tools

  • A tool for figuring out the command for typesetting a symbol in LaTeX. Just draw it with your mouse!
  • A tool for typesetting equations online. Also contains a bunch of handy buttons for commonly used symbols, similar to many LaTeX GUIs. Useful in combination with an editor like Vim which doesn’t have these features built in.
  • Tool that simplifies drawing finite state machines , which come up in theoretical computer science classes.

Curl up with a cup of tea and just keep reading

  • A very comprehensive overview of how LaTeX works in 157 pages of LaTeX.

As it turns out, most LaTeX documents are pretty similar in nature. Using a template for the repetitive parts of LaTeX is pretty common. Below is a list of some LaTeX templates that you might like to use for typesetting homework assignments. There are also a number of sites online which have collections of free LaTeX templates.

  • This template has been distributed by a number of classes at CMU, including 15-251 and 15-451. It’s fairly straightforward, but it does the job.
  • This project lets you just do \documentclass { homework } to gain access to a load of helpful commands for typesetting your homework.
  • This is another LaTeX template. It was based off the CMU template above, with some convenience features added on top of it, and restyled a bit.
  • This is a huge LaTeX preamble that contains useful macros for commonly used math symbols.

No Search Results

  • Learn LaTeX in 30 minutes

This introductory tutorial does not assume any prior experience of L a T e X but, hopefully, by the time you are finished, you will not only have written your first L a T e X document but also acquired sufficient knowledge and confidence to take the next steps toward L a T e X proficiency.

  • 1 What is L a T e X ?
  • 2 Why learn L a T e X ?
  • 3 Writing your first piece of L a T e X
  • 4 The preamble of a document
  • 5 Including title, author and date information
  • 6 Adding comments
  • 7 Bold, italics and underlining
  • 8 Adding images
  • 9 Captions, labels and references
  • 10.1 Unordered lists
  • 10.2 Ordered lists
  • 11.1 Inline math mode
  • 11.2 Display math mode
  • 11.3 More complete examples
  • 12.1 Abstracts
  • 12.2 Paragraphs and new lines
  • 12.3 Chapters and sections
  • 13.1 Creating a basic table in L a T e X
  • 13.2 Adding borders
  • 13.3 Captions, labels and references
  • 14 Adding a Table of Contents
  • 15 Downloading your finished document
  • 16.1 Loading packages
  • 16.2 Finding information about packages: CTAN
  • 16.3 Packages available on Overleaf: Introducing TeX Live

What is L a T e X ?

L a T e X (pronounced “ LAY -tek” or “ LAH -tek”) is a tool for typesetting professional-looking documents. However, LaTeX’s mode of operation is quite different to many other document-production applications you may have used, such as Microsoft Word or LibreOffice Writer: those “ WYSIWYG ” tools provide users with an interactive page into which they type and edit their text and apply various forms of styling. LaTeX works very differently: instead, your document is a plain text file interspersed with LaTeX commands used to express the desired (typeset) results. To produce a visible, typeset document, your LaTeX file is processed by a piece of software called a TeX engine which uses the commands embedded in your text file to guide and control the typesetting process, converting the LaTeX commands and document text into a professionally typeset PDF file. This means you only need to focus on the content of your document and the computer, via LaTeX commands and the TeX engine, will take care of the visual appearance (formatting).

Why learn L a T e X ?

Various arguments can be proposed for, or against, learning to use L a T e X instead of other document-authoring applications; but, ultimately, it is a personal choice based on preferences, affinities, and documentation requirements.

Arguments in favour of L a T e X include:

  • support for typesetting extremely complex mathematics, tables and technical content for the physical sciences;
  • facilities for footnotes, cross-referencing and management of bibliographies;
  • ease of producing complicated, or tedious, document elements such as indexes, glossaries, table of contents, lists of figures;
  • being highly customizable for bespoke document production due to its intrinsic programmability and extensibility through thousands of free add-on packages .

Overall, L a T e X provides users with a great deal of control over the production of documents which are typeset to extremely high standards. Of course, there are types of documents or publications where L a T e X doesn’t shine, including many “free form” page designs typically found in magazine-type publications.

One important benefit of L a T e X is the separation of document content from document style: once you have written the content of your document, its appearance can be changed with ease. Similarly, you can create a L a T e X file which defines the layout/style of a particular document type and that file can be used as a template to standardise authorship/production of additional documents of that type; for example, this allows scientific publishers to create article templates, in L a T e X , which authors use to write papers for submission to journals. Overleaf has a gallery containing thousands of templates , covering an enormous range of document types—everything from scientific articles, reports and books to CVs and presentations. Because these templates define the layout and style of the document, authors need only to open them in Overleaf—creating a new project—and commence writing to add their content.

Writing your first piece of L a T e X

The first step is to create a new L a T e X project. You can do this on your own computer by creating a new .tex file; alternatively, you can start a new project in Overleaf .

Let’s start with the simplest working example, which can be opened directly in Overleaf:

 Open this example in Overleaf.

This example produces the following output:

You can see that L a T e X has automatically indented the first line of the paragraph, taking care of that formatting for you. Let’s have a closer look at what each part of our code does.

The first line of code, \documentclass{article} , declares the document type known as its class , which controls the overall appearance of the document. Different types of documents require different classes; i.e., a CV/resume will require a different class than a scientific paper which might use the standard L a T e X article class. Other types of documents you may be working on may require different classes such as book or report . To get some idea of the many L a T e X class types available, visit the relevant page on CTAN (Comprehensive TeX Archive Network) .

Having set the document class, our content, known as the body of the document, is written between the \begin{document} and \end{document} tags. After opening the example above, you can make changes to the text and, when finished, view the resulting typeset PDF by recompiling the document . To do this in Overleaf, simply hit Recompile , as demonstrated in this brief video clip:

Any Overleaf project can be configured to recompile automatically each time it is edited: click the small arrow next to the Recompile button and set Auto Compile to On , as shown in the following screengrab:

Screengrab showing how to set Auto Compile to On or Off

Having seen how to add content to our document, the next step is to give it a title. To do this, we must talk briefly about the preamble .

The preamble of a document

The screengrab above shows Overleaf storing a L a T e X document as a file called main.tex : the .tex file extension is, by convention, used when naming files containing your document’s LaTeX code.

The previous example showed how document content was entered after the \begin{document} command; however, everything in your .tex file appearing before that point is called the preamble , which acts as the document’s “setup” section. Within the preamble you define the document class (type) together with specifics such as languages to be used when writing the document; loading packages you would like to use (more on this later ), and it is where you’d apply other types of configuration.

A minimal document preamble might look like this:

where \documentclass[12pt, letterpaper]{article} defines the overall class (type) of document. Additional parameters, which must be separated by commas, are included in square brackets ( [...] ) and used to configure this instance of the article class; i.e., settings we wish to use for this particular article -class-based document.

In this example, the two parameters do the following:

  • 12pt sets the font size
  • letterpaper sets the paper size

Of course other font sizes, 9pt , 11pt , 12pt , can be used, but if none is specified, the default size is 10pt . As for the paper size, other possible values are a4paper and legalpaper . For further information see the article about page size and margins .

The preamble line

is an example of loading an external package (here, graphicx ) to extend L a T e X ’s capabilities, enabling it to import external graphics files. L a T e X packages are discussed in the section Finding and using L a T e X packages .

Including title, author and date information

Adding a title, author and date to our document requires three more lines in the preamble ( not the main body of the document). Those lines are:

  • \title{My first LaTeX document} : the document title
  • \thanks{Funded by the Overleaf team.} : can be added after the name of the author, inside the braces of the author command. It will add a superscript and a footnote with the text inside the braces. Useful if you need to thank an institution in your article.
  • \date{August 2022} : you can enter the date manually or use the command \today to typeset the current date every time the document is compiled

With these lines added, your preamble should look something like this:

To typeset the title, author and date use the \maketitle command within the body of the document:

The preamble and body can now be combined to produce a complete document which can be opened in Overleaf:

Adding comments

LaTeX is a form of “program code”, but one which specializes in document typesetting; consequently, as with code written in any other programming language, it can be very useful to include comments within your document. A L a T e X comment is a section of text that will not be typeset or affect the document in any way—often used to add “to do” notes; include explanatory notes; provide in-line explanations of tricky macros or comment-out lines/sections of LaTeX code when debugging.

To make a comment in L a T e X , simply write a % symbol at the beginning of the line, as shown in the following code which uses the example above:

This example produces output that is identical to the previous LaTeX code which did not contain the comment.

  • Bold, italics and underlining

Next, we will now look at some text formatting commands:

  • Bold : bold text in LaTeX is typeset using the \textbf{...} command.
  • Italics : italicised text is produced using the \textit{...} command.
  • Underline : to underline text use the \underline{...} command.

The next example demonstrates these commands:

Another very useful command is \emph{ argument } , whose effect on its argument depends on the context. Inside normal text, the emphasized text is italicized, but this behaviour is reversed if used inside an italicized text—see the next example:

 Open this \emph example in Overleaf.

  • Note: some packages, such as Beamer , change the behaviour of the \emph command.

Adding images

In this section we will look at how to add images to a L a T e X document. Overleaf supports three ways to insert images:

The Insert Figure button on the editor toolbar

  • Copy and paste an image into Visual Editor or Code Editor .
  • Use Code Editor to write LaTeX code that inserts a graphic.

Options 1 and 2 automatically generate the LaTeX code required to insert images, but here we introduce option 3—note that you will need to upload those images to your Overleaf project. The following example demonstrates how to include a picture:

 Open this image example in Overleaf.

Importing graphics into a L a T e X document needs an add-on package which provides the commands and features required to include external graphics files. The above example loads the graphicx package which, among many other commands, provides \includegraphics{...} to import graphics and \graphicspath{...} to advise L a T e X where the graphics are located.

To use the graphicx package, include the following line in your Overleaf document preamble:

In our example the command \graphicspath{{images/}} informs L a T e X that images are kept in a folder named images , which is contained in the current directory:

Image showing LaTeX accessing images stored in a folder

The \includegraphics{universe} command does the actual work of inserting the image in the document. Here, universe is the name of the image file but without its extension.

  • Although the full file name, including its extension, is allowed in the \includegraphics command, it’s considered best practice to omit the file extension because it will prompt L a T e X to search for all the supported formats.
  • Generally, the graphic’s file name should not contain white spaces or multiple dots; it is also recommended to use lowercase letters for the file extension when uploading image files to Overleaf.

More information on L a T e X packages can be found at the end of this tutorial in the section Finding and using LaTeX packages .

Captions, labels and references

Images can be captioned, labelled and referenced by means of the figure environment, as shown below:

There are several noteworthy commands in the example:

  • \includegraphics[width=0.75\textwidth]{mesh} : This form of \includegraphics instructs L a T e X to set the figure’s width to 75% of the text width—whose value is stored in the \textwidth command.
  • \caption{A nice plot.} : As its name suggests, this command sets the figure caption which can be placed above or below the figure. If you create a list of figures this caption will be used in that list.
  • \label{fig:mesh1} : To reference this image within your document you give it a label using the \label command. The label is used to generate a number for the image and, combined with the next command, will allow you to reference it.
  • \ref{fig:mesh1} : This code will be substituted by the number corresponding to the referenced figure.

Images incorporated in a L a T e X document should be placed inside a figure environment, or similar, so that L a T e X can automatically position the image at a suitable location in your document.

Further guidance is contained in the following Overleaf help articles:

  • Positioning of Figures
  • Inserting Images

Creating lists in L a T e X

You can create different types of list using environments , which are used to encapsulate the L a T e X code required to implement a specific typesetting feature. An environment starts with \begin{ environment-name } and ends with \end{ environment-name } where environment-name might be figure , tabular or one of the list types: itemize for unordered lists or enumerate for ordered lists.

Unordered lists

Unordered lists are produced by the itemize environment. Each list entry must be preceded by the \item command, as shown below:

You can also open this  larger Overleaf project which demonstrates various types of L a T e X list.

Ordered lists

Ordered lists use the same syntax as unordered lists but are created using the enumerate environment:

As with unordered lists, each entry must be preceded by the \item command which, here, automatically generates the numeric ordered-list label value, starting at 1.

For further information you can open this  larger Overleaf project which demonstrates various types of L a T e X list or visit our dedicated help article on L a T e X lists , which provides many more examples and shows how to create customized lists.

Adding math to L a T e X

One of the main advantages of L a T e X is the ease with which mathematical expressions can be written. L a T e X provides two writing modes for typesetting mathematics:

  • inline math mode used for writing formulas that are part of a paragraph
  • display math mode used to write expressions that are not part of a text or paragraph and are typeset on separate lines

Inline math mode

Let’s see an example of inline math mode:

To typeset inline-mode math you can use one of these delimiter pairs: \( ... \) , $ ... $ or \begin{math} ... \end{math} , as demonstrated in the following example:

Display math mode

Equations typeset in display mode can be numbered or unnumbered, as in the following example:

To typeset display-mode math you can use one of these delimiter pairs: \[ ... \] , \begin{displaymath} ... \end{displaymath} or \begin{equation} ... \end{equation} . Historically, typesetting display-mode math required use of $$ characters delimiters, as in $$ ... display math here ... $$ , but this method is no longer recommended : use LaTeX’s delimiters \[ ... \] instead.

More complete examples

The following examples demonstrate a range of mathematical content typeset using LaTeX.

The next example uses the equation* environment which is provided by the amsmath package, so we need to add the following line to our document preamble:

For further information on using amsmath see our help article .

The possibilities with math in L a T e X are endless so be sure to visit our help pages for advice and examples on specific topics:

  • Mathematical expressions
  • Subscripts and superscripts
  • Brackets and Parentheses
  • Fractions and Binomials
  • Aligning Equations
  • Spacing in math mode
  • Integrals, sums and limits
  • Display style in math mode
  • List of Greek letters and math symbols
  • Mathematical fonts

Basic document structure

Next, we explore abstracts and how to partition a L a T e X document into different chapters, sections and paragraphs.

Scientific articles usually provide an abstract which is a brief overview/summary of their core topics, or arguments. The next example demonstrates typesetting an abstract using L a T e X ’s abstract environment:

  • Paragraphs and new lines

With the abstract in place, we can begin writing our first paragraph. The next example demonstrates:

  • how a new paragraph is created by pressing the "enter" key twice, ending the current line and inserting a subsequent blank line;
  • how to start a new line without starting a new paragraph by inserting a manual line break using the \\ command, which is a double backslash; alternatively, use the \newline command.

The third paragraph in this example demonstrates use of the commands \\ and \newline :

Note how L a T e X automatically indents paragraphs—except immediately after document headings such as section and subsection— as we will see .

New users are advised that multiple \\ or \newline s should not used to “simulate” paragraphs with larger spacing between them because this can interfere with L a T e X ’s typesetting algorithms. The recommended method is to continue using blank lines for creating new paragraphs, without any \\ , and load the parskip package by adding \usepackage{parskip} to the preamble.

Further information on paragraphs can be found in the following articles:

  • How to change paragraph spacing in LaTeX
  • LaTeX Error: There's no line here to end provides additional advice and guidance on using \\ .

Chapters and sections

Longer documents, irrespective of authoring software, are usually partitioned into parts, chapters, sections, subsections and so forth. LaTeX also provides document-structuring commands but the available commands, and their implementations (what they do), can depend on the document class being used. By way of example, documents created using the book class can be split into parts, chapters, sections, subsections and so forth but the letter class does not provide (support) any commands to do that.

This next example demonstrates commands used to structure a document based on the book class:

The names of sectioning commands are mostly self-explanatory; for example, \chapter{First Chapter} creates a new chapter titled First Chapter , \section{Introduction} produces a section titled Introduction , and so forth. Sections can be further divided into \subsection{...} and even \subsubsection{...} . The numbering of sections, subsections etc. is automatic but can be disabled by using the so-called starred version of the appropriate command which has an asterisk (*) at the end, such as \section*{...} and \subsection*{...} .

Collectively , LaTeX document classes provide the following sectioning commands, with specific classes each supporting a relevant subset:

  • \part{part}
  • \chapter{chapter}
  • \section{section}
  • \subsection{subsection}
  • \subsubsection{subsubsection}
  • \paragraph{paragraph}
  • \subparagraph{subparagraph}

In particular, the \part and \chapter commands are only available in the report and book document classes.

Visit the Overleaf article article about sections and chapters for further information about document-structure commands.

Creating tables

The following examples show how to create tables in LaTeX, including the addition of lines (rules) and captions.

Creating a basic table in L a T e X

We start with an example showing how to typeset a basic table:

The tabular environment is the default L a T e X method to create tables. You must specify a parameter to this environment, in this case {c c c} which advises L a T e X that there will be three columns and the text inside each one must be centred. You can also use r to right-align the text and l to left-align it. The alignment symbol & is used to demarcate individual table cells within a table row. To end a table row use the new line command \\ . Our table is contained within a center environment to make it centred within the text width of the page.

Adding borders

The tabular environment supports horizontal and vertical lines (rules) as part of the table:

  • to add horizontal rules, above and below rows, use the \hline command
  • to add vertical rules, between columns, use the vertical line parameter |

In this example the argument is {|c|c|c|} which declares three (centred) columns each separated by a vertical line (rule); in addition, we use \hline to place a horizontal rule above the first row and below the final row:

Here is a further example:

  • Creating tables in L a T e X can be time-consuming so you may want to use the TablesGenerator.com online tool to export L a T e X code for tabulars.

You can caption and reference tables in much the same way as images. The only difference is that instead of the figure environment, you use the table environment.

Adding a Table of Contents

Creating a table of contents is straightforward because the command \tableofcontents does almost all the work for you:

Sections, subsections and chapters are automatically included in the table of contents. To manually add entries, such as an unnumbered section, use the command \addcontentsline as shown in the example.

Downloading your finished document

The following brief video clip shows how to download your project’s source code or the typeset PDF file:

More information can be found in the Overleaf help article Exporting your work from Overleaf .

Finding and using LaTeX packages

L a T e X not only delivers significant typesetting capabilities but also provides a framework for extensibility through the use of add-on packages . Rather than attempting to provide commands and features that “try to do everything”, L a T e X is designed to be extensible , allowing users to load external bodies of code (packages) that provide more specialist typesetting capabilities or extend L a T e X ’s built-in features—such as typesetting tables. As observed in the section Adding images , the graphicx package extends L a T e X by providing commands to import graphics files and was loaded (in the preamble) by writing

Loading packages

As noted above, packages are loaded in the document preamble via the \usepackage command but because (many) L a T e X packages provide a set of options , which can be used to configure their behaviour, the \usepackage command often looks like this:

The square brackets “ [...] ” inform L a T e X which set of options should be applied when it loads somepackage . Within the set of options requested by the user, individual options, or settings, are typically separated by a comma; for example, the geometry package provides many options to configure page layout in L a T e X , so a typical use of geometry might look like this:

The geometry package is one example of a package written and contributed by members of the global L a T e X community and made available, for free, to anyone who wants to use it.

If a L a T e X package does not provide any options, or the user wants to use the default values of a package’s options, it would be loaded like this:

When you write \usepackage[...]{somepackage} L a T e X looks for a corresponding file called somepackage .sty , which it needs to load and process—to make the package commands available and execute any other code provided by that package. If L a T e X cannot find somepackage .sty it will terminate with an error, as demonstrated in the following Overleaf example:

 Open this error-generating example on Overleaf

Image showing error causes by a missing package

Finding information about packages: CTAN

Packages are distributed through the Comprehensive TeX Archive Network , usually referred to as CTAN, which, at the time of writing, hosts 6287 packages from 2881 contributors. CTAN describes itself as

... a set of Internet sites around the world that offer TEX-related material for download.

You can browse CTAN to look for useful packages; for example:

  • alphabetically (useful if you know the package name)

You can also use the search facility (at the top of the page).

Packages available on Overleaf: Introducing TeX Live

Once per year a (large) subset of packages hosted on CTAN, plus L a T e X -related fonts and other software, is collated and distributed as a system called TeX Live , which can be used to install your own (local) LaTeX setup. In fact, Overleaf’s servers also use TeX Live and are updated when a new version of TeX Live is released. Overleaf’s TeX Live updates are not immediate but take place a few months post-release, giving us time to perform compatibility tests of the new TeX Live version with the thousands of templates contained in our gallery . For example, here is our TeX Live 2022 upgrade announcement .

Although TeX Live contains a (large) subset of CTAN packages it is possible to find an interesting package, such as igo for typesetting Go diagrams , which is hosted on CTAN but not included in (distributed by) TeX Live and thus unavailable on Overleaf. Some packages hosted on CTAN are not part of TeX Live due to a variety of reasons: perhaps a package is obsolete, has licensing problems, is extremely new (recently uploaded) or has platform dependencies, such as working on Windows but not Linux.

New packages, and updates to existing ones, are uploaded to CTAN all year round but updates to TeX Live are distributed annually; consequently, packages contained in the current version of TeX Live will not be as up-to-date as those hosted on CTAN. Because Overleaf’s servers use TeX Live it is possible that packages installed on our servers—i.e., ones available to our users—might not be the very latest versions available on CTAN but, generally, this is unlikely to be problematic.

  • Documentation Home

Overleaf guides

  • Creating a document in Overleaf
  • Uploading a project
  • Copying a project
  • Creating a project from a template
  • Using the Overleaf project menu
  • Including images in Overleaf
  • Exporting your work from Overleaf
  • Working offline in Overleaf
  • Using Track Changes in Overleaf
  • Using bibliographies in Overleaf
  • Sharing your work with others
  • Using the History feature
  • Debugging Compilation timeout errors
  • How-to guides
  • Guide to Overleaf’s premium features

LaTeX Basics

  • Creating your first LaTeX document
  • Choosing a LaTeX Compiler

Mathematics

  • Aligning equations
  • Using the Symbol Palette in Overleaf

Figures and tables

  • Positioning Images and Tables
  • Lists of Tables and Figures
  • Drawing Diagrams Directly in LaTeX
  • TikZ package

References and Citations

  • Bibliography management with bibtex
  • Bibliography management with natbib
  • Bibliography management with biblatex
  • Bibtex bibliography styles
  • Natbib bibliography styles
  • Natbib citation styles
  • Biblatex bibliography styles
  • Biblatex citation styles
  • Multilingual typesetting on Overleaf using polyglossia and fontspec
  • Multilingual typesetting on Overleaf using babel and fontspec
  • International language support
  • Quotations and quotation marks

Document structure

  • Sections and chapters
  • Table of contents
  • Cross referencing sections, equations and floats
  • Nomenclatures
  • Management in a large project
  • Multi-file LaTeX projects
  • Lengths in L a T e X
  • Headers and footers
  • Page numbering
  • Paragraph formatting
  • Line breaks and blank spaces
  • Text alignment
  • Page size and margins
  • Single sided and double sided documents
  • Multiple columns
  • Code listing
  • Code Highlighting with minted
  • Using colours in LaTeX
  • Margin notes
  • Font sizes, families, and styles
  • Font typefaces
  • Supporting modern fonts with X Ǝ L a T e X

Presentations

  • Environments

Field specific

  • Theorems and proofs
  • Chemistry formulae
  • Feynman diagrams
  • Molecular orbital diagrams
  • Chess notation
  • Knitting patterns
  • CircuiTikz package
  • Pgfplots package
  • Typesetting exams in LaTeX
  • Attribute Value Matrices

Class files

  • Understanding packages and class files
  • List of packages and class files
  • Writing your own package
  • Writing your own class

Advanced TeX/LaTeX

  • In-depth technical articles on TeX/LaTeX

Get in touch

Have you checked our knowledge base ?

Message sent! Our team will review it and reply by email.

Email: 

university of washington logo

  • News & Events
  • Current Students
  • Prospective Students
  • Faculty Candidates
  • Industry Affiliates
  • Support CSE

CSE 312: Typesetting Homework

  • CSE 312 Home

Computer Science & Engineering University of Washington Box 352350 Seattle, WA 98195-2350 (206) 543-1695 voice, (206) 543-2969 FAX

Comments to tompa

UW Privacy Policy and UW Site Use Agreement

Assignments

Assignments, also known as homework, are usually given to school or university students to reinforce their knowledge of a subject and aid in learning. They are typically structured in question and answer form to be completed by the student consecutively.

typesetting homework in latex

fphw Assignment

This template is for formatting assignments or homework in a clear and simple way. The title section at the top of the first page clearly displays the assignment, student and class information. This information also appears in the headers and footers of subsequent pages. Questions in the assignment are clearly demarcated and appear inside boxes to focus attention. The template features examples of including images, tables, equations and code listings for covering virtually all common assignment information. Multi-part questions and answers are shown for more complex questions.

  • View Template Information

Wenneker Assignment

This template can be used by teachers or students for school or university assignments. It contains a clear title section at the start to specify the assignment class, title, date and teacher/student name. The template supports up to 4 levels of sections to structure the assignment into sections, questions, subquestions and bonus content. Examples of common assignment content are included: figure, equations, lists, table, code and paragraphs of text.

Lachaise Assignment

This template is for teachers/instructors/educators to create assignments/homework for their students. It includes a clear title on the first page for the course, assignment and teacher’s name, as well as the institution and date. Sets of questions can be grouped by headings and the template includes examples of unnumbered and numbered sections, and numbered subsections (for longer assignments). Amongst the description text for each question, examples are provided for virtually any subject matter, including: equations, algorithms, code and command line outputs.

Cleese Assignment

This template comes in two versions, one for teachers/instructors/educators to create assignments/homework for their students to fill out by hand, and another for students proficient in LaTeX to answer questions posed to them at school or university/college. Both versions contain simple environments for each question and subquestion within, and allow answer boxes to be created with either an answer or blank for space to write an answer. Sets of questions can be grouped by headings and the template includes examples of including an image, table, equation and code within questions.

typesetting homework in latex

LaTeX Templates Information

General enquiries [email protected]

Most templates licensed under CC BY-NC-SA 4.0

LaTeX Templates is developed in New Zealand

© Creodocs Limited. All Rights Reserved.

Instantly share code, notes, and snippets.

@eyliu

eyliu / homework.cls

  • Download ZIP
  • Star ( 2 ) 2 You must be signed in to star a gist
  • Fork ( 0 ) 0 You must be signed in to fork a gist
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.
  • Learn more about clone URLs
  • Save eyliu/247991 to your computer and use it in GitHub Desktop.
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{homework}[2009/05/15 v0.0.1 Document class for typesetting homework]
\LoadClass[12pt,letterpaper,answers]{exam}
\RequirePackage{xspace}
\newcommand{\course}[1]{\def\@course{#1\xspace}}
\newcommand{\problemlist}[1]{\begin{center}\large #1 \end{center}}
\makeatletter
\renewcommand{\maketitle}{
\newpage
\null
\firstpageheader{}{}{}
\runningheader{\@author}{\@course \@title}{\@date}
\begin{flushright}
\bf\large \@author \\ \@course \\ \@title \\ \@date
\end{flushright}
} \makeatother
\RequirePackage[margin=1in]{geometry}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage[usenames,dvipsnames]{color}
\RequirePackage{todonotes}
\RequirePackage{graphicx}
\RequirePackage{url}
\RequirePackage{listings}
\RequirePackage{tikz}
\usetikzlibrary{arrows,snakes,patterns}
\RequirePackage{siunitx}
%\newunit{\inch}{in}
%\newunit{\cycles}{cycles}
\sisetup{load=accepted,repeatunits=false}
\RequirePackage[version=3]{mhchem}
\RequirePackage{hyperref}
% LaTeX settings for MATLAB code listings
% based on Ted Pavlic's settings in http://links.tedpavlic.com/ascii/homework_new_tex.ascii
% This is the color used for MATLAB comments below
\definecolor{MyDarkGreen}{rgb}{0.0,0.4,0.0}
% For faster processing, load Matlab syntax for listings
\lstloadlanguages{Matlab}%
\lstset{language=Matlab, % Use MATLAB
frame=single, % Single frame around code
basicstyle=\small\ttfamily, % Use small true type font
keywordstyle=[1]\color{Blue}\bfseries, % MATLAB functions bold and blue
keywordstyle=[2]\color{Purple}, % MATLAB function arguments purple
keywordstyle=[3]\color{Blue}\underbar, % User functions underlined and blue
identifierstyle=, % Nothing special about identifiers
% Comments small dark green courier
commentstyle=\usefont{T1}{pcr}{m}{sl}\color{MyDarkGreen}\small,
stringstyle=\color{Purple}, % Strings are purple
showstringspaces=false, % Don't put marks in string spaces
tabsize=5, % 5 spaces per tab
%
%%% Put standard MATLAB functions not included in the default
%%% language here
morekeywords={xlim,ylim,var,alpha,factorial,importdata,poissrnd,normpdf,normcdf,strcat},
%
%%% Put MATLAB function parameters here
morekeywords=[2]{on, off, interp},
%
%%% Put user defined functions here
morekeywords=[3]{FindESS, homework_example},
%
morecomment=[l][\color{Blue}]{...}, % Line continuation (...) like blue comment
numbers=left, % Line numbers on left
firstnumber=1, % Line numbers start with line 1
numberstyle=\tiny\color{Blue}, % Line numbers are blue
stepnumber=5 % Line numbers go in steps of 5
}
% Includes a MATLAB script.
% The first parameter is the label, which also is the name of the script
% without the .m.
% The second parameter is the optional caption.
\newcommand{\matlabscript}[2]
{\begin{itemize}\item[]\lstinputlisting[caption=#2,label=#1]{#1.m}\end{itemize}}
\newcommand{\real}{\operatorname{real}}
\newcommand{\imag}{\operatorname{imag}}
\newcommand{\abs}[1]{\ensuremath{\left\lvert #1 \right\rvert}}
\newcommand{\Arg}{\operatorname{Arg}}
\newcommand{\Log}{\operatorname{Log}}
\newcommand{\Res}{\operatornamewithlimits{Res}}
\renewcommand{\vec}[1]{\ensuremath{\textbf{#1}}}
\newcommand{\sumover}[1]{\ensuremath{\sum_{#1=-\infty}^\infty}}
\theoremstyle{definition}
\newtheorem*{claim}{Claim}
\newtheorem*{theorem}{Theorem}
\newcommand{\sech}{\operatorname{sech}}
\newcommand{\rect}{\operatorname{rect}}
\newcommand{\sinc}{\operatorname{sinc}}
\newcommand{\jinc}{\operatorname{jinc}}
\newcommand{\MATLAB}{{\scshape Matlab}}
\renewcommand{\qedsymbol}{$\blacksquare$}
\newcommand{\figbox}{\framebox[3in]{\rule{0pt}{2in}}}
\renewcommand{\theenumi}{\alph{enumi}}
\documentclass{homework}
\begin{document}
\author{John Doe}
\course{Popular Culture 101}
\title{Homework \#1}
\maketitle
\begin{questions}
\question
What is the answer to the ultimate question of life, the universe, and everything?
\begin{solution}
42
\end{solution}
\newpage
\question
What is the airspeed velocity of an unladen swallow
\begin{solution}
African or European swallow?
\end{solution}
\end{questions}
\end{document}

LaTeX – A document preparation system

LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents. LaTeX is available as free software .

You don't have to pay for using LaTeX, i.e., there are no license fees, etc. But you are, of course, invited to support the maintenance and development efforts through a donation to the TeX Users Group (choose LaTeX Project contribution) if you are satisfied with LaTeX.

You can also sponsor the work of LaTeX team members through the GitHub sponsor program at the moment for Frank , David and Joseph . Your contribution goes without any reductions by GitHub to the developers in support of the project.

The volunteer efforts that provide you with LaTeX need financial support, so thanks for any contribution you are willing to make.

Recent News

  • 13 June, 2024 LaTeX 2024-061-01 PL1 released and distributed
  • 24 April, 2024 Development releases for the L3 Programming Layer
  • 27 March, 2024 ISO PDF/UA-2 standard released - Examples made by LaTeX
  • 26 March, 2024 Accessibility talks at DEIMS 2024 conference in Tokyo
  • 25 November, 2023 Talks from the TUG Conference 2023 in Bonn
  • 4 November, 2023 LaTeX 2023-11-01 released and distributed
  • 10 June, 2023 LaTeX 2023-06-01 released and distributed

LaTeX the product

The latex3 project, latex books.

List of books on LaTeX in English, French, German, and Spanish.

Documentation

The official LaTeX help and documentation section.

Learn more about the people behind the LaTeX project.

Writing a thesis in LaTeX

Why you should write your thesis in LaTeX? Start here and give it a try!

What is LaTeX, and why should you use it to write your thesis? LaTeX is a typesetting system widely used in academia, particularly for technical and scientific documents, which offers a series of advantages over traditional word processors:

  • Superior Typesetting Quality and Consistent Formatting. One of LaTeX’s best qualities is its consistency, which ensures that your thesis not only reads well but also looks professional.
  • Great Handling of Mathematical Content. Thesis in STEM fields often involve an extensive use of mathematical formulas and equations. LaTeX provides a powerful equation editor that allows you to write and format complex equations with ease; moreover, referencing them is easy, thanks to the labeling system.
  • Efficient Citation Management. Thanks to tools like BibTeX and BibLaTeX, managing references and citations is fast and efficient.
  • Flexibility and Customization. LaTeX offers many customization options. You can tailor the appearance of your thesis to meet specific guidelines or personal preferences. You can change the look of a whole document in a matter of seconds, and it will keep its consistency.
  • Learning and Community Support. Although LaTeX has a steeper learning curve than traditional word processors, the investment in learning it pays off. Moreover, a vast community of LaTeX users and a wealth of resources are available, including tutorials, templates, and forums where you can seek and share advice.

Ok, but where do I start?

With that said, where should you start when trying to learn LaTeX? In my opinion, the easiest way is to use an online editor like Overleaf , which does not require you to install anything and allows for real-time collaboration for free. This has its limitations (it’s slow at compiling, and the free plan also has a compilation time limit), but it’s a great starting point. Pair this with the hundreds of templates already available on this and other websites, and you will be writing documents in no time.

In this article, I will explain how to use my particular template, which can be found here, but you can try to follow along with similar templates. One I highly suggest taking a look at once you grasp LaTeX basics is Classic Thesis by André Miede.

The Title Page

Once you downloaded the zip and opened it with your preferred editor (on Overleaf, you can start a new project by simply uploading the zip file), you will see the following file structure:

Once you understand how this structure works, you can easily add and remove things. First, let’s change the Title Page! To do so, all you have to do is open the config.tex file: here, you can insert your university name, department, course, title, supervisors’ name, academic year, and your name and matriculation number.

This template uses custom fonts! You will have to change the compiler from pdfLaTeX to either XeLaTeX or LuaLaTeX!

To do so in overleaf, click the Menu button in the top left corner. You will find the compiler option in the Settings section.

If you are using VSCode with LaTeX Workshop, I have included the appropriate flag at the start of the document (%!TEX program = lualatex). All you have to do is enabling magic comments by changing the setting forceRecipeUsage to false.

Managing and adding chapters

As you can see, I added a dedication page. You can choose to remove it by removing or commenting the following lines in the main.tex file:

To modify other sections, like the abstract or the introduction, you can go to their respective files: ./frontmatter/abstract.tex and ./chapters/introduction.tex . If you want to add another section, do so by creating the relative tex file in the appropriate folder; then add it to the main document by including it in the main.tex file: \include{path/to/document.tex} .

If you are having troubles with anything, you can refer to the Overleaf tutorials. Usually, you can find everything you may need there. Moreover, I suggest the LaTeX Cookbook by Stefan Kottwitz, a book that teaches you how to solve common problems when using LaTeX.

Customization

You can customize how things look in the SciThesis.cls file. Here, you can manage packages and other layout preferences.

You can customize how theorems, code portions, labels, and other things look.

The easiest thing you can customize is the main color for the Chapters and links:

Here, you can change the RGB definition to any color you want. The default one is teal.

What’s next?

This is just an introductory post to get this template up and running. In the next weeks, I will write more specific tutorials on how to handle common situations you may encounter when writing your thesis, starting with bibliography management.

See you next time!

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to get started to typeset mathematical proofs with LaTeX? [duplicate]

I want to start using LaTeX to organize my proofs into a readable fashion. This motif is due to my professors preferring e-mail communication instead of reading a chicken-scratch proof. I know enough LaTeX such that I can post on math.SE and make my question readable, but I do not know how to include LaTeX in a document.

How do I make my proof into a LaTeX document?

texenthusiast's user avatar

  • Just as you would with mathjax's but now you need to declare your packages and the document type. –  dustin Commented Aug 26, 2013 at 2:13
  • 1 Have a look at Best Way to Start Using LaTeX/TeX? –  texenthusiast Commented Aug 26, 2013 at 2:16
  • 1 Good resources for math: mathmode by Her­bert Voß and Short Math Guide for LATEX by Michael Downes . Full detailed math-into-latex-4 by Ge­orge Grätzer . Remember to use AMS developed LaTeX classes specifically for math amsart amsbook and amsproc which are part of major TeX distributions –  texenthusiast Commented Aug 26, 2013 at 4:49

The skeleton is as follows,

enter image description here

For more detailed at a glance tutorial, visit Theorem .

kiss my armpit's user avatar

  • Forgot to mention above. You have to switch the document class from standalone to article because the former is used just for creating the image above. –  kiss my armpit Commented Aug 26, 2013 at 3:06
  • I know there is a typo in the quadratic formula. Ignore it! –  kiss my armpit Commented Aug 26, 2013 at 3:39
  • Does amsart load amsthm package ? if not why (very strange though) ? –  texenthusiast Commented Aug 26, 2013 at 4:40

Not the answer you're looking for? Browse other questions tagged math-mode amsthm learning .

  • Featured on Meta
  • Upcoming sign-up experiments related to tags

Hot Network Questions

  • 66: Luftballons
  • Multiple Travelling Salesmen - How to make the second slowest salesman matter?
  • Network devices cannot ping subnetwork devices
  • How does the June 2024 Ukraine peace summit hope to achieve peace, if Russia is not invited?
  • Can you make a logo very similar to an existing trademark?
  • Why was the 1540 a computer in its own right?
  • How is the progress field of Bitcoin Core's synchronisation/Initial Block Download debug logs calculated?
  • Using commented dashes to divide up code chunks
  • Is "Shopping malls are a posh place" grammatical when "malls" is a plural and "place" is a singular?
  • How does this tensegrity table work?
  • Expected Value Chi Square distribution
  • TCP source port sharing
  • Is there anyway to estimate the time average power without knowing the power factor?
  • How does the IC direct supplement work on NS / Dutch railways?
  • If humans colonized Earth 100,000 years ago, would we know it?
  • What type of aircraft is this?
  • Help me understand what happened and how the machine left works
  • Is Blaise Pascal's approach to "curing unbelief" in the proposition that God exists philosophically sound?
  • Filling a rectangular grid with holes using tetrominoes
  • The smell of wet gypsum
  • Transparent image showing background and not logo in Blender
  • How to not make my series repetitive?
  • Is a Poisson minus a constant still a Poisson?
  • Psychology Today Culture Fair IQ test question

typesetting homework in latex

\(\text{\TeX nique}\)

\(\text{A \LaTeX \, Typesetting Game}\)

  • No \(\texttt{\$}\) signs needed
  • All formulas are rendered in display style
  • Use \( \verb \left \) and \( \verb \right \) to correctly size balanced delimiters like \( \verb ( \), \( \texttt \{ \), and \( \verb \lceil \)
  • Prefer \( \verb \bmod \) and \( \verb \pmod \) to \( \verb \mod \)
  • Harder problems are worth more points
  • Use Detexify to quickly look up unknown symbols

Have a cool idea for a formula we should add? Submit it here !

Try to create the following formula:

This is what your output looks like:

Edit your code here:

Toggle Shadow

IMAGES

  1. Typesetting Equations in Word using LaTeX syntax (Part 3)

    typesetting homework in latex

  2. LaTeX Typesetting

    typesetting homework in latex

  3. Typesetting exams in LaTeX

    typesetting homework in latex

  4. Typesetting Equations in Word using LaTeX syntax (Part 1)

    typesetting homework in latex

  5. Basic Latex Typesetting

    typesetting homework in latex

  6. Basic Latex Typesetting

    typesetting homework in latex

VIDEO

  1. Mathematical Typesetting for Teachers using LaTeX

  2. Re-Typesetting Books in LaTeX

  3. OER on Latex " A Shallow dive into LATEX "

  4. Lec 12 Typesetting Multiple Choice Questions in LaTeX

  5. Mastering LaTeX: Say Goodbye to Word Formatting Woes!

  6. LaTeX Guide

COMMENTS

  1. CTAN: Package homework

    T. X. class for writing your homework. The current document class is for writing homework. It has the following features. Simple and clear interface. Built-in support for many theorem-type environments, already configured and ready to use. Multilingual support. Page numbers are of the form "Page [current] of [total]", which can help you ...

  2. Typesetting exams in LaTeX

    An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.

  3. GitHub

    homework is a LaTeX class for typesetting homework assignments. It can handle any Unicode input (so no more worrying about accent characters or writing in another language), and works for problem sets, book problems, lab reports, even essays.

  4. Doing Your Homework in LaTeX

    Doing Your Homework in LaTeX. It is a common occurrence for other students to comment on my homework whenever I turn it in for one of my classes. The complete LaTeX file (and the pdf output) can be found in my repository, latex-homework-template. View on GitHub. Below are a few screenshots of problems that I've done in the past: Cover page ...

  5. The LaTeX homework Document Class

    There are LaTeX document classes for typesetting books, articles, exams, presentations, and more. Now, there's one for homework assignments, too. Source. Check out and download the source on GitHub. What. This is a LaTeX document class. That means you use it with \documentclass{homework} at the top of the document. It provides a document ...

  6. How can I typeset an exam or assignment paper?

    I want to use LaTeX for exam and assignment papers for a class that I am teaching. I obviously could just do the whole thing myself. But, what alternatives are there for easily typesetting such doc...

  7. A LaTeX class for typesetting homework assignments.

    A simple LaTeX class for typesetting homework assignments. I've used it in some form or another for all of my homework assignments through college and graduate school.

  8. GitHub

    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.

  9. Template for rapid homework typesetting

    This template lets you quickly typeset your homework. With 2 commands you are up and running and with a class option you can toggle the visibility of questions, so you can see the questions while you are typing your answers and then easily hide them to create a submission file. The markup of problems and subproblems can also be easily adapted ...

  10. 02 Using LaTeX for Homework

    02 Using LaTeX for Homework. I hope that you will use the LaTeX typesetting system to write your homework solutions for this course. (See the guide to submitting homework.) It might look daunting at first, if you haven't used LaTeX before, but you won't have to learn LaTeX in depth. You just have to fill in answers to exercises, so you won't ...

  11. CTAN: Package assignment

    A class file for typesetting homework and lab assignments. Sources /macros/latex/contrib/assignment: Documentation: README

  12. LaTeX

    LaTeX Homework Class. This project lets you just do \documentclass {homework} to gain access to a load of helpful commands for typesetting your homework. LaTeX Homework Template. This is another LaTeX template. It was based off the CMU template above, with some convenience features added on top of it, and restyled a bit. Comprehensive Preamble

  13. Typesetting

    LaTeX is the standard tool for typesetting mathematical materials. While it takes some time to learn, it will likely pay for itself in the long run. LaTeX math notation is also supported in some places outside of LaTeX documents, such as on the message board. A template LaTeX file to use for CSE 311 homework assigments.

  14. Learn LaTeX in 30 minutes

    Learn the basics of LaTeX in 30 minutes with Overleaf's online editor, featuring easy-to-use tools, templates, and real-time collaboration.

  15. CSE 312: Typesetting Homework

    CSE 312: Typesetting Homework We do not require you to typeset your homework, nor will typesetting improve your grade. But, if you are interested in learning how to typeset math in Microsoft Word or LaTeX, we have provided some pointers to help you get started.

  16. Writing Math Homework in LaTeX

    Need easily formatted and good looking math homework? In this video I demonstrate how I write my homework in LaTeX.LaTeX is a text setting language which all...

  17. LaTeX Templates

    LaTeX Typesetting Service; Assignments. Assignments, also known as homework, are usually given to school or university students to reinforce their knowledge of a subject and aid in learning. They are typically structured in question and answer form to be completed by the student consecutively.

  18. LaTeX document class for typesetting homework · GitHub

    LaTeX document class for typesetting homework. GitHub Gist: instantly share code, notes, and snippets.

  19. packages

    A class file for typesetting homework and lab assignments assignment.cls . bangorcsthesis. Typeset a thesis at Bangor University. bangorcsthesis.cls . ... Bidirectional typesetting in plain TeX and LaTeX, using XeTeX engine. bidimoderncv.cls biditufte-book.cls biditufte-handout.cls . bidipresentation. Experimental bidi presentation.

  20. LaTeX

    LaTeX - A document preparation system. LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents. LaTeX is available as free software. You don't have to pay for using LaTeX ...

  21. Writing a thesis in LaTeX

    LaTeX is a typesetting system widely used in academia, particularly for technical and scientific documents, which offers a series of advantages over traditional word processors: Superior Typesetting Quality and Consistent Formatting. One of LaTeX's best qualities is its consistency, which ensures that your thesis not only reads well but also ...

  22. How to get started to typeset mathematical proofs with LaTeX?

    I want to start using LaTeX to organize my proofs into a readable fashion. This motif is due to my professors preferring e-mail communication instead of reading a chicken-scratch proof. I know enough LaTeX such that I can post on math.SE and make my question readable, but I do not know how to include LaTeX in a document.

  23. TeXnique

    nique. \text {A \LaTeX \, Typesetting Game} A ATEX Typesetting Game. This is a game to test your \LaTeX LATEX skills. Type as many formulas as you can in three minutes (timed game), or play an untimed game (zen mode)! Timed Game.