# Math Homework template for Latex

Författare

Samuel S. Gross

Last Updated

för 8 år sedan

Licens

LaTeX Project Public License 1.3c

Sammanfattning

A custom .sty and template for college math homework.

Författare

Samuel S. Gross

Last Updated

för 8 år sedan

Licens

LaTeX Project Public License 1.3c

Sammanfattning

A custom .sty and template for college math homework.

```
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%free online editor available at%%%%%%%%%%%%%%%%%%%%%%
%%%%%https://www.writelatex.com/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt,leqno ]{article}
%The document class defines the master templates, the structure of the document,
%and lays out the types of
%objects that can be manipulated for this type of document.
%the brackets contain basic options that will be applied globally (throughout
%the document). Here, we specify a 10pt font, and when we number an equation, the
%number will be on the left.
%The document class is a file ***.cls. You will probably never have to edit or create
% a .cls file. There are many available on the internet for your use.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{times}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{homework}
%packages control the ``style'' or look of the document. These come in the form of
%files ***.sty. The package ``homework'' above was created by me. The other packages
%are very common for this type of document. You can google to learn more about what
%they can do, and what options they give you. For example
\usepackage[margin=1.5in]{geometry}
%the geometry package lets you customize the margins of your document.
% and the
\usepackage{setspace}
%package gives us the ability to set the line spacing.
\newtheorem{theorem}{Theorem}
\theoremstyle{definition}
\newtheorem{problem}[theorem]{Problem}
%these set up environments for listing things. The numbering is automatic.
\newenvironment{solution}[1][Solution]{\begin{doublespace}\textbf{#1.}\quad }{\ \rule{0.5em}{0.5em}\end{doublespace}}
%this is the environment for writing solutions. Doble spaced, with an end of proof
%box at the end
\title{Number Theory\\
Math 360 Fall, 2014\\
Homework 1}
\author{Dr. Samuel S. Gross \\
Bloomsburg University}
%above is the information that goes in the title. Notice the { and }.
%the double slashes \\ mean start a new line.
\begin{document} %this means end the preamble (stuff controling the styles above and
%start the content of the document. We can make adjustments as we go. For example,
\maketitle %make the title according to the styles outlined in homework.sty
\vskip .25in %skip a bit before we start the regular text.
\thispagestyle{empty} %no need to number first page.
\begin{problem}
This is a sample Problem. with parts
\begin{enumerate}
\item[Bonus:] part 1. This part has the custom name "Bonus:
instead of a number.
\item part 2
\end{enumerate}
\end{problem}
\begin{solution}
This is the solution. We set up the solution environment to be double spaced, and the margins
are a bit bigger than normal. This allows your professor plenty of room to write comments
in between the lines or in the margins.
This is how you write a new paragraph. Just skip a line in your document.
Use dollar signs for math mode. everything between them is read as math instead
of regular text. $3x+4y=5$ is a line.
Use double dollar signs to display the equation on its own line. $$3x+4y \text{ is a line.}$$
Alternatively, you can use slash and brackets.
\[
3x+4y=5.
\]
There are many more ways to do this.
Use google for more advanced ways of writing equations. There are environments
for displaying multiple equations, where everything is aligned at the $=$ sign,
numbered or unnumbered automatically, definining references for equations to call later.
For example, you may want to automatically number an equation, then refer to it later.
Here is an example. The equation below
\begin{equation}\label{myeqn}
3x+4y=5
\end{equation}
is given a number automatically. I gave it a label so that I can reference
equation \eqref{myeqn} later. If I insert an equation above, the numbering changes
will all propogate automatically!
Now, let's use a new environment...one that automatically aligns equations at the equal sign.
\begin{align}
a^2 + b^2 &= c^2 \\ % the \\ says end the line, and start a new one
a^6 &= b^3 \\ % the & says this is where the alignment takes place
a^4 &\ge b^5\\ % change where the & is, change what character the alignment takes place at.
c^{1/2} &> \sqrt[3]{x}\\
a_1 &= b_{2n+1}
\end{align}
I addition to showing you some usefull structure for typing math characters, notice that
all the equations were automatically numbered. This is not always desirable. A general rule
is that using a ``*'' will surpress the numbering. For example
\begin{align*}
a^2 + b^2 &= c^2 \\ % ^ means exponent ^{} means everything in {} is in the exponent
a^6 &= b^3 \\ % \ge for greater than.
a^4 &\ge b^5\\ % the [] in sqrt is the argument.
c^{1/2} &> \sqrt[3]{x}\\
a_1\cdot \log_3 (4) &= b_{2n+1} %logarithms, dots, subscripts
\end{align*}
Let's chat about parenthesis.
Notice the difference below
\begin{align*}
(\int_2^\infty f(x) dx)^2 \\ %spaces ignored in math mode
\left( \int_2^\infty f(x) dx \right)^2 %left and right auto size to whats in between
\end{align*}
Lastly, it is a good idea to google things. You should never settle for anything that does not
look exactly how you want. Here is a link to a nice quick reference that you can print off and
keep handy
\begin{center}
\url{http://web.ift.uib.no/Teori/KURS/WRK/TeX/symALL.html}
\end{center}
A nice project is ``detexify''.
\begin{center}
\url{http://detexify.kirelabs.org/classify.html}
\end{center}
Use your mouse to sketch what symbol you want, and it tells you the \LaTeX .
\end{solution}
Summation notation works like
$$\sum_{k=1}^n \frac{1}{k} $$
\end{document}
```

We only use cookies for essential purposes and to improve your experience on our site. You can find out more in our cookie policy.