我不知道为什么这不起作用:
我是一名初学者LaTeX
,我正在努力理解这一点。
代码:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\begin{document}
\begin{theorem}
Given two line segments whose lengths are $a$ and $b$ respectively there
is a real number $r$ such that $b=ra$.
\end{theorem}
\begin{proof}
To prove it by contradiction try and assume that the statemenet is false,
proceed from there and at some point you will arrive to a contradiction.
\end{proof}
\end{document}
日志:
! LaTeX Error: Environment theorem undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.8 \begin{theorem}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 9.
註釋1:我已经安装了 Texmaker 和 Texlivesudo apt-get install texlive-full
註釋2:我的操作系统是 Ubuntu,我的 Latex 编辑器是 Texmaker。
备注3我正在用这个学习地点但我也使用了包的文档amsthm
。(在文档中我们应该使用lem
lemma 命令)
谢谢
答案1
amsthm
是一个包创造定理和定理相关环境。默认情况下它不会执行此操作。因此,您可以发出
\newtheorem{theorem}{Theorem}
定义theorem
环境:
\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Test
\end{theorem}
\end{document}