Skip to content
{{ message }}

Instantly share code, notes, and snippets.

# dcernst/HWTemplate.tex

Last active Jan 29, 2021
LaTeX homework template for Weekly Homework assignments for Dana Ernst's courses.
 % -------------------------------------------------------------- % This is all preamble stuff that you don't have to worry about. % Head down to where it says "Start here" % -------------------------------------------------------------- \documentclass[12pt]{article} \usepackage[margin=1in]{geometry} \usepackage{amsmath,amsthm,amssymb} \newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} \newenvironment{theorem}[Theorem]{\begin{trivlist} \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}} \newenvironment{lemma}[Lemma]{\begin{trivlist} \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}} \newenvironment{exercise}[Exercise]{\begin{trivlist} \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}} \newenvironment{problem}[Problem]{\begin{trivlist} \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}} \newenvironment{question}[Question]{\begin{trivlist} \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}} \newenvironment{corollary}[Corollary]{\begin{trivlist} \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}} \begin{document} % -------------------------------------------------------------- % Start here % -------------------------------------------------------------- \title{Weekly Homework X}%replace X with the appropriate number \author{Tony Stark\\ %replace with your name Foundations of Mathematics} %if necessary, replace with your course title \maketitle \begin{theorem}{x.yz} %You can use theorem, exercise, problem, or question here. Modify x.yz to be whatever number you are proving Delete this text and write theorem statement here. \end{theorem} \begin{proof} Blah, blah, blah. Here is an example of the \texttt{align} environment: %Note 1: The * tells LaTeX not to number the lines. If you remove the *, be sure to remove it below, too. %Note 2: Inside the align environment, you do not want to use -signs. The reason for this is that this is already a math environment. This is why we have to include \text{} around any text inside the align environment. \begin{align*} \sum_{i=1}^{k+1}i & = \left(\sum_{i=1}^{k}i\right) +(k+1)\\ & = \frac{k(k+1)}{2}+k+1 & (\text{by inductive hypothesis})\\ & = \frac{k(k+1)+2(k+1)}{2}\\ & = \frac{(k+1)(k+2)}{2}\\ & = \frac{(k+1)((k+1)+1)}{2}. \end{align*} \end{proof} \begin{theorem}{x.yz} Letn\in \Z\$. Then yada yada. \end{theorem} \begin{proof} Blah, blah, blah. I'm so smart. \end{proof} % -------------------------------------------------------------- % You don't have to mess with anything below this line. % -------------------------------------------------------------- \end{document}

### bansalgagan commented Sep 4, 2013

 Hi, thanks for code! What else can be filled as replacement for \begin{proof}, like \begin{solution} ..etc?

### sauln commented Jan 20, 2014

 I'm also curious. As a brand new latex user this template is very helpful. But where does the \begin{proof} come from? What is the analogous expression to the exercise and question environment? Thanks

### forestwhite commented Aug 31, 2016

 I'm new to LaTeX and this got me started ... it is similar to learning HTML from a basic page with some level of detail. Very helpful :)

### malachi-ai commented Jan 29, 2021

 I'm also new to Latex and Ive been using this example for my homework. Thank you.

### dcernst commented Jan 29, 2021

 Huh, I missed the questions from 2013 and 2014. Sorry about that. Here are some responses 7 years late. The amsthm (short for AMS Theorem) package (loaded on line 9) provides the opportunity to use \begin{proof}...\end{proof}. Unfortunately, \begin{solution}...\end{solution} is not a thing that loads with any package (that I know of). However, you can "build" this environment as follows. Add the following line of code above \begin{document} but below \usepackage{amsthm,...}: \newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}} This will allow you to use \begin{solution}...\end{solution} in your document. It will mimic the look of the output for the proof environment, but it will say "Solution." instead of "Proof."
to join this conversation on GitHub. Already have an account? Sign in to comment