![为我的笨拙的数学作业模板寻求建议](https://linux22.com/image/262311/%E4%B8%BA%E6%88%91%E7%9A%84%E7%AC%A8%E6%8B%99%E7%9A%84%E6%95%B0%E5%AD%A6%E4%BD%9C%E4%B8%9A%E6%A8%A1%E6%9D%BF%E5%AF%BB%E6%B1%82%E5%BB%BA%E8%AE%AE.png)
我用 LaTeX 打出了我的数学作业。这是我第一次尝试用 LaTeX 制作文档。我可以用 Google 搜索数学符号,所以还行,但整体结构真的很笨拙;尤其是间距。
如有任何建议,我将非常感激。
\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}
\qquad
\vspace{1mm}
\qquad
\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}
\qquad
\vspace{1mm}
\qquad
\end{proof}
\vspace{5mm}
\end{document}
答案1
我认为这是一个很好的问题,并赞扬你对此的涉足LaTeX
。
以下是我为改进你的代码所采取的措施:
- 加载
geometry
帮助处理页面尺寸的包 \begin{theorem}{\textbf{Problem...}}
将所有出现的改为\subsection*{Problem...}
;使用环境是没有意义的theorem
,因为你似乎只想要标题- 使用
enumerate
环境作为列表,并使用enumitem
帮助罗马枚举的包 - 使用
align
环境(从amsmath
)解决你最后一个问题 最重要的是 - 删除了所有手动水平和垂直间距。页面设置应该在序言中进行全局调整。
您不应该使用
\\
来结束一行(除非您处于tabular
或align
或类似的环境中);将段落中的换行符保留给 TeX,或者使用空白行来开始一个新段落。
代码
\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}