# Seeking advice for my clumsy math homework template [closed]

I typed my math homework with LaTeX. This was my first try on making some document with LaTeX. I can Google for math symbols, so it's okay, but the overall structure is really clumsy; especially spacing.

Any advice would be really appreciated.

\documentclass[11pt,letterpaper]{article}
\setlength{\topmargin}{-.5in}
\setlength{\textheight}{9in}
\setlength{\oddsidemargin}{.125in}
\pagestyle{plain}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother

\begin{document}

\title{Assignment#2\\MTH000}
\author{MY NAME\\student number}

\maketitle

\begin{theorem}{\textbf{Problem 4.1}}
\end{theorem}

\begin{proof}
\vspace{1mm}
\qquad (1) $f$ is not a function because $f$ does not satisfy the condition that if $(x,y) \in f$ and $(x,z) \in f$ then $y=z$. That is, $(1,4) \in f$ and $(1,2) \in f$, but $4 \neq 2$.

\vspace{1mm}
\qquad (2) $f$ is not a function because $f$ does not satisfy the condition that if $x \in A$ then there exists $y \in B$ such that $(x,y) \in f$.
\newline while $4 \in A$, there is no $y \in B$ such that $(4,y) \in f$.

\end{proof}
\vspace{5mm}
\begin{theorem}{\textbf{Problem 4.3}}
Given: $A=\{1,2\}, B=\{1,2,3\}$
\end{theorem}

\begin{proof}
\vspace{1mm}
\qquad The set of all $f:A \to B$ is $f = \{(1,1),(1,2),(1.3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)\}$
\end{proof}

\begin{theorem}{\textbf{Problem 4.5}}
\end{theorem}

\begin{proof}
\vspace{1mm}
\vspace{1mm}

\end{proof}
\vspace{5mm}

\begin{theorem}{\textbf{Problem 4.6}}
\end{theorem}

\begin{proof}
\vspace{1mm}
\qquad (\rmnum{1}) The image of $f$ is $\{2,4,5\}$\\
\vspace{1.5mm}
\qquad \quad (\rmnum{2}) $f^{-1}(\{3,4\})$ does not exist, as there is no $x$ such that $f(x)=3$\\
\vspace{.1mm}
\qquad \quad (\rmnum{3}) $f(\{1,2,4\})=\{2,4\}$\\
\vspace{2mm}
\qquad \quad (\rmnum{4}) $f^{-1}(\{3\})$ does not exist, as there is no $x$ such that $f(x)=3$.
\vspace{1mm}
\qquad \quad \ (\rmnum{5}) $f(f^{-1}(\{2,3\}))$ does not exist, because $f^{-1}(\{2,3\})$ does not exist, as there is no $x$ such that $f(x)=3$.
\end{proof}
\vspace{5mm}

\begin{theorem}{\textbf{Problem 4.7}}
\end{theorem}

\begin{proof}
\vspace{1mm}
\qquad $f(1)=2$, $f(2)=4$, $f(3)=3$, $f(4)=6$, $f(5)=1$, \\
\vspace{0.5mm}
\qquad and $g(1)=4,g(2)=4,g(3)=1,g(4)=3,g(5)=2,g(6)=2$.
\vspace{2mm}
\end{proof}

\begin{proof}
\vspace{1mm}
\qquad $g \circ f:A \to C$ is : \\
\vspace{1mm}
\qquad $g \circ f(1) = g(f(1)) = g(2) = 4$ \\
\vspace{1mm}
\qquad $g \circ f(2) = g(f(2)) = g(4) = 3$ \\
\vspace{1mm}
\qquad $g \circ f(3) = g(f(3)) = g(3) = 1$ \\
\vspace{1mm}
\qquad $g \circ f(4) = g(f(4)) = g(6) = 2$ \\
\vspace{1mm}
\qquad $g \circ f(5) = g(f(5)) = g(1) = 4$ \\
\vspace{5mm}
\end{proof}

\begin{theorem}{\textbf{Problem 4.}}
\end{theorem}

\begin{proof}
\vspace{1mm}
\vspace{1mm}

\end{proof}
\vspace{5mm}

\end{document}

-
Welcome to TeX.SE! I edited your post to indent the code using the {} button :) –  cmhughes Feb 2 at 17:32
It is worth reading Horrors in LaTeX. –  Donut E. Knot Feb 2 at 17:44

## closed as not a real question by doncherry, Kurt, Martin Schröder, Stefan Kottwitz♦Feb 2 at 20:56

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I think this is a great question, and applaud you for dabbling in LaTeX.

Here's what I have done to improve your code:

• loaded the geometry package to help with page dimenstions
• changed all the occurrences of \begin{theorem}{\textbf{Problem...}} to \subsection*{Problem...}; there's no point using a theorem environment for this because it seemed that you just wanted the heading
• used the enumerate environment for your lists, and used the enumitem package to help with the roman enumeration
• used the align environment (from the amsmath)for your last problem
• most importantly- removed all of the manual horizontal and vertical spacing. Page settings should be tweaked globally in your preamble.

• You should not use \\ to end a line (unless you are in a tabular or align, or similar environment); leave line breaking in paragraphs to TeX, or else use a blank line instead which will start a new paragraph.

Code

\documentclass[11pt,letterpaper]{article}
\usepackage[top=.5in,textheight=9in]{geometry}
\usepackage{amsmath}
\usepackage{enumitem}

\title{Assignment\#2\\MTH000}
\author{MY NAME\\student number}

\begin{document}

\maketitle

\subsection*{Problem 4.1}
\begin{enumerate}
\item $f$ is not a function because $f$ does not satisfy the condition that if $(x,y) \in f$ and $(x,z) \in f$ then $y=z$. That is, $(1,4) \in f$ and $(1,2) \in f$, but $4 \neq 2$.
\item $f$ is not a function because $f$ does not satisfy the condition that if $x \in A$ then there exists $y \in B$ such that $(x,y) \in f$.
while $4 \in A$, there is no $y \in B$ such that $(4,y) \in f$.
\end{enumerate}

\subsection*{Problem 4.3}
Given: $A=\{1,2\}, B=\{1,2,3\}$

The set of all $f:A \to B$ is $f = \{(1,1),(1,2),(1.3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)\}$

\subsection*{Problem 4.5}

\subsection*{Problem 4.6}

\begin{enumerate}[label=(\roman*)]
\item image of $f$ is $\{2,4,5\}$
\item $f^{-1}(\{3,4\})$ does not exist, as there is no $x$ such that $f(x)=3$
\item $f(\{1,2,4\})=\{2,4\}$
\item $f^{-1}(\{3\})$ does not exist, as there is no $x$ such that $f(x)=3$.
\item $f(f^{-1}(\{2,3\}))$ does not exist, because $f^{-1}(\{2,3\})$ does not exist, as there is no $x$ such that $f(x)=3$.
\end{enumerate}

\subsection*{Problem 4.7}
$f(1)=2$, $f(2)=4$, $f(3)=3$, $f(4)=6$, $f(5)=1$,
and $g(1)=4,g(2)=4,g(3)=1,g(4)=3,g(5)=2,g(6)=2$.

$g \circ f:A \to C$ is
\begin{align*}
g \circ f(1)& = g(f(1)) = g(2) = 4 \\
g \circ f(2)& = g(f(2)) = g(4) = 3 \\
g \circ f(3)& = g(f(3)) = g(3) = 1 \\
g \circ f(4)& = g(f(4)) = g(6) = 2 \\
g \circ f(5)& = g(f(5)) = g(1) = 4 \\
\end{align*}

\subsection*{Problem 4.}

\end{document}

-
It is also a good idea to use \colon instead of : when indicating a mapping. You then get the correct spacing. –  Svend Tveskæg Feb 2 at 17:57
May be the enumerate package is enough here (instead of enumitem). It lets you use [(i)] instead of [label=(\roman*)], which is easier to understand. –  Manuel Feb 2 at 19:50