我的代码如下:
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage[margin=0.5in]{geometry}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\begin{document}
...
Ex. If $x$ is even, then $x^2$ is even.
Proof: Let $y$ \in \Z $: x = 2y$ (we know y exists from the definition of even). Then:
\begin{equation}
x^2 = (2y)^2
x^2 = 4y^2
x^2 = 2(2y^2)
(2y^2) is an Integer (because Integers are closed under multiplication), so x^2 is Even.
\end{equation}
但当我跑步时pdflatex file.tex
,我得到
! Undefined control sequence.
l.26 Proof: Let $y$ \in
\Z $: x = 2y$ (we know y exists from the defini...
?
我尝试将 放入部分\in \Z
中$...$
,并尝试更改$...$
为\(...\)
,但无济于事。这可能是什么原因造成的?我该如何修复?
(解释一下:我从此列表。看来这份名单并不完全准确)
答案1
\in
是数学模式符号,需要数学模式。
\Z
只是未定义。我的猜测是这样的:
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage[margin=0.5in]{geometry}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\usepackage{dsfont}
\newcommand*{\Z}{\mathds{Z}}
\begin{document}
Ex. If $x$ is even, then $x^2$ is even.
Proof: Let $y \in \Z\colon x = 2y$
\end{document}
或者使用\mathbb
:
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage[margin=0.5in]{geometry}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\newcommand*{\Z}{\mathbb{Z}}
\begin{document}
Ex. If $x$ is even, then $x^2$ is even.
Proof: Let $y \in \Z\colon x = 2y$
\end{document}
此外,环境equation
不适用于多个方程。请参阅包的文档amsmath
。它为方程系统提供了许多环境(align
、、gather
...)。
答案2
这就是你想要的吗?
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage[margin=0.5in]{geometry}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\begin{document}
...
Ex. If $x$ is even, then $x^2$ is even.
Proof: Let $y\in Z : x = 2y$ (we know y exists from the definition of even). Then:
\begin{equation}
\begin{aligned}
x^2 &= (2y)^2\\
\Leftrightarrow x^2 &= 4y^2\\
\Leftrightarrow x^2 &= 2(2y^2)
\end{aligned}
\end{equation}
$(2y^2)$ is an Integer (because Integers are closed under multiplication), so $x^2$ is Even.
\end{document}