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, the same packages and document structure will be applicable to many of the documents you are working on. Using a template will save you the time of having to input all of this information every time you create a new document.
A good front end LaTeX software package will contain at least some standard templates for different document types such as articles, beamers (slides for a presentation), 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 has 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:
% This is a template for doing homework assignments in LaTeX
\documentclass{article} % 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
\newcommand{\question}[2][]{\begin{flushleft}
\textbf{Question #1}: \textit{#2}
\end{flushleft}}
\newcommand{\sol}{\textbf{Solution}:} %Use if you want a boldface solution line
\newcommand{\maketitletwo}[2][]{\begin{center}
\Large{\textbf{Assignment #1}
Course Title} % Name of course here
\vspace{5pt}
\normalsize{Matthew Frenkel % Your name here
\today} % Change to due date if preferred
\vspace{15pt}
\end{center}}
\begin{document}
\maketitletwo[5] % Optional argument is assignment number
%Keep a blank space between maketitletwo and \question[1]
\question[1]{Here is my first question}
YOUR SOLUTION HERE
\question[2]{Here is my second question}
YOUR SOLUTION HERE
\question[3]{What is the \Large{$\int_0^2 x^2 \, dx $}\normalsize{. Show all steps}}
\begin{align*}
\int_0^2 x^2 &= \left. \frac{x^3}{3} \right|_0^2 \\
&= \frac{2^3}{3}-\frac{0^3}{3}\\
&= \frac{8}{3}
\end{align*}
\end{document}