Getting Started with LaTeX

LaTeX is a typesetting program useful for mathematical and scientific writings or publications. This guide provides an overview of how to get started with LaTeX, as well as resources and exercise to help new users of the program.

Introduction

Before reading this section you should have a basic understanding of how to create a LaTeX document, as well as, the basic structure of a document.

This section is about creating templates for LaTeX documents. Templates are meant to speed up the initial creation of a LaTeX document. Often it is the case that the same packages and document structure will be applicable to many of the documents you are working on, in this case using a template will save you the time of having to input all of this information every time you create a new document.

Using and Creating Templates

A good front end LaTeX software package will contain at least some standard templates for different document types such as articles, beamers, and books, a great one will also let you create your own template. Templates can be very useful when there are certain documents types you need to create often such as class notes, homework assignments, and lab reports. In these cases a template will create consistency between documents and greatly simplify the creation of the document.

Using Templates

How to use a template depends on what program you are using to write your LaTeX code. If you are not using any front end software a template would simply be an already written .tex file you used to start your document. It is important to make sure that you do not save over the template as you create the new document as this would destroy the template file. Different front end software have different methods for using templates. In TexStudio for example under "File" there is a "new from template" option. TexStudio comes with a number of preprogrammed templates but also allows you to add your own. TexMaker on the other hand, under file, has the option "new by copying an existing file". In this case you would need to create your own template file, but you would not have to worry that you might accidentally save over it.

If the template you are looking for is not built into the software you are using there are online resources such as LaTeX Templates where you can download templates for a variety of purposes. A more advanced LaTeX user may also want to consider creating their own template.

Creating Templates

When creating a template there are several important questions to ask yourself:

  1. What document class will I need and will this ever change?
  2. What packages will I need for the documents I am making?
  3. How do I want the document to be structured?
  4. Are there any new commands that I will want to create?

Sample Template Code

% This is a template for doing homework assignments in LaTeX

\documentclass % This command is used to set the type of document you are working on such as an article, book, or presenation

\usepackage < geometry >% This package allows the editing of the page layout
\usepackage < amsmath >% This package allows the use of a large range of mathematical formula, commands, and symbols
\usepackage < graphicx >% This package allows the importing of images

Course Title> % Name of course here
\vspace

\today > % Change to due date if preferred
\vspace

\end < center >>
\begin < document >
\maketitletwo [5] % Optional argument is assignment number
%Keep a blank space between maketitletwo and \question[1]