# Beginner template

I just downloaded TexWorks using MikTex. I am trying to write my math homework in Latex form but I am having difficulty getting the correct template. My template looks like this:

\title{}
\date{\today}

\documentclass[12pt]{article}

\begin{document}
\maketitle

\section{}

\end{document}


How can I insert my questions in LaTex form? For example, right after the date I want to have "{question 1(in bold)} ... {answer to question 1} ... {question 2(in bold)} ... {answer to question 2}" so on and so forth to the very last question?

• The LaTeX wikibook might be a good place to start: en.wikibooks.org/wiki/LaTeX – darthbith Sep 4 '13 at 2:58
• I would rather recommend using the exam document class that comes with MiKTeX (via CTAN) – Sean Allred Sep 4 '13 at 3:57

This can be done in several ways. Here's one possibility using theorem-like structures defined with the help of the amsthm package:

\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{etoolbox}
\usepackage{lipsum}

\theoremstyle{definition}
\newtheorem{que}{Question}

\title{Assignment}
\author{The Author}
\date{\today}

\begin{document}

\maketitle

\begin{que}
\lipsum[4]
\end{que}

\begin{ans}
\lipsum[4]
\end{ans}

\begin{que}
\lipsum[4]
\end{que}

\begin{ans}
\lipsum[4]
\end{ans}

\end{document}


In the previous solution I made the assumption that each question was immediately followed by its answer; a solution with more freedom might be:

\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{refcount}
\usepackage{lipsum}

\theoremstyle{definition}
\newtheorem{que}{Question}

\newenvironment{ans}[1]
{\end{answ}}

\title{Assignment}
\author{The Author}
\date{\today}

\begin{document}

\maketitle

\begin{que}
\label{que:foo}
\lipsum[4]
\end{que}

\begin{que}
\label{que:bar}
\lipsum[4]
\end{que}

\begin{ans}{que:bar}
\lipsum[4]
\end{ans}

\begin{ans}{que:foo}
\lipsum[4]
\end{ans}

\end{document}


In this approach, you label each question (using the standard \label command), and then use the string used for the label as a mandatory argument for the ans environment.

• Also, I want the symbol $\mathbb{R}^n$ to show but my latex says it doesn't recognize that form? What other forms are there for that symbol? – Q.matin Sep 4 '13 at 3:08
• @Q.matin load amssymb in the preamble (before \begin{document}): \usepackage{amssymb}. – Gonzalo Medina Sep 4 '13 at 3:09
• I tried using your template and it says I must install the new package but I clicked on install and nothing happened? Do you know why? – Q.matin Sep 4 '13 at 3:11
• @Q.matin I haven't used MikTeX for many years now, so I cannot help you with this. In any case, it seems that you installed the basic version of MiKTeX; you should install the complete version, so you won't be bothered with installation of missing packages. – Gonzalo Medina Sep 4 '13 at 3:15
• @Q.matin It may be that there is a long delay; I had a difficulty with MiKTeX where I thought it wasn't installing packages-on-demand, but it was actually just taking a long time to do so. – Iain Sep 4 '13 at 3:21