How to TeX your homework

The TeX template used in the video is included at the bottom of this post. You can paste this into a .tex file locally, or into Overleaf.

  • If you’re just starting out, I recommend using Overleaf as your TeX editor.
  • You can use Detexify to hand-draw a symbol to find the LaTeX command for it.
  • There is also a nice WikiBook on LaTeXing mathematics.
  • When in doubt, Google is your friend!

You will frequently have problems with TeX which will make the document unable to compile. You should remember to compile often so that you can pinpoint your errors. Here are some things to check.

  • Remember to place math within dollar signs, so $x^2$ typesets as x2.
  • Make sure you have started and ended all environments in the appropriate spots.
  • Make sure you have closed all of your curly braces { }.
  • Check to see if you used a new command that requires a new package.
%% Thanks to Bennet Goeckner for giving me his TeX template, which this is based on. 
%% These percent symbols tell the compiler to ignore the remainder of a given line.
%% We use them to write comments that will not appear in the finalized output.

%% The following tells the compiler which type of document we're making.
%% There are many options. ``Article'' is probably fine for our class.
\documentclass[12pt]{article}

%% After declaring the documentclass, we load some packages which give us 
%% some built-in commands and more functionality. 
%% The following is a list of packages that this file might use.
%% If a command you're using isn't working, try Googling it -- you might need to add a specific package.
%% I have included the standard ones that I like to load.
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{mdframed}
\usepackage{multicol}
\usepackage{verbatim}
\usepackage{tikz}
\usepackage[margin = .8in]{geometry}
\geometry{letterpaper}
\linespread{1.2}

%% One of the nicest things about LaTeX is you can create custom macros. If  there is a long-ish expression that you will write often, it is nice to give it a shorter command.
%% For our common number systems.
\newcommand{\RR}{\mathbb{R}} %% The blackboard-bold R that you have seen used for real numbers is typeset by $\mathbb{R}$. This macro means that $\RR$ will yield the same result, and is much shorter to type.
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}} 
\newcommand{\QQ}{\mathbb{Q}}

%% Your macros can even accept arguments. 
\newcommand\set[1]{\left\lbrace #1 \right\rbrace} %% In mathmode, if you write \set{STUFF}, then this will output {STUFF}, i.e. STUFF inside of a set
\newcommand\abs[1]{\left| #1 \right|} %% This will do the same but with vertical bars. I.e., \abs{STUFF} gives |STUFF|
\newcommand\parens[1]{\left( #1 \right)} %% Similar. \parens{STUFF} gives (STUFF)
\newcommand\brac[1]{\left[ #1 \right]} %% Similar. \brac{STUFF} gives [STUFF]
\newcommand\sol[1]{\begin{mdframed}
\emph{Solution.} #1
\end{mdframed}}
\newcommand\solproof[1]{\begin{mdframed}
\begin{proof} #1
\end{proof}
\end{mdframed}}
%% A few more important commands:

%% You should start every proof with \begin{proof} and end it with \end{proof}.  
%%
%% Code inside single dollar signs will give in-line mathmode. I.e., $f(x) = x^2$ 
%% Code \[ \] will give mathmode centered on its own line.
%%
%% Other common commands:
%%	\begin{align*} and \end{align*} -- Good for multiline equations
%%	\begin{align} and \end{align} -- Same as above, but it will number the equations for easy reference
%%	\emph{italicized text here} and \textbf{bold text here} are also useful.
%%
%% Some very specific mathmode commands and their meanings:
%%	x \in A -- x is an element of A
%%	x \notin A -- x is not an element of A
%%	A \subseteq B -- A is a subset of B
%%	A \subsetneq B -- A is a proper subset of B
%%	x \equiv y \pmod{n} -- x is congruent to y mod n. 
%%	x \geq y and x \leq y -- Greater than or equal to and less than or equal to 
%%
%% You'll probably find lots of relevant commands in the question prompts. Also Google is your friend!

\begin{document}
\noindent Your name! \hfill  The date 

\begin{center}
  {\large Math 300 Homework 1}
\end{center}


\begin{enumerate}
\item This is question 1. Note that the \texttt{enumerate} environment creates a numbered list. 

\sol{In the preamble, I created a command which gives a framed box around a solution.
}

\item Here's the next item in the list.
\begin{enumerate}
\item This question might have multiple parts. Perhaps the first part is just computational.
\sol{Here is my answer to part (a). We have that $\int 2x \, dx = x^2$. Or perhaps I want an equation on its own line:
\[ \sin^2(x) + \cos^2(x) = 1.
\]
Maybe I want to \emph{emphasize} some text.
}

\item Maybe the next requires a proof. I created a command which invokes the \texttt{proof} environment built into one of our packages. It includes a box at the end of it.
\solproof{Here is my proof for part (b).

Remember that Google is your best friend for \LaTeX{} questions, but I'm also happy to answer any questions you have! In the notes and in lecture, I will try to point out any new commands I am using.}
\end{enumerate}
\end{enumerate}
\end{document}

Leave a Reply

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