\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\title{\sc Homework 1}
\author{\sc by Me}
\date{\sc January 2017}
\begin{document}
\maketitle
\noindent 1) Show that $\sqrt{2} \in \mathbb{R} $
\vspace{1pc}
We will define two sequences, $A_k$ and $B_k$.
Let $A_k = a_1.a_2a_3a_4\dots a_k$, and ${A_k}^2 > 2$ but decreasing the last digit, $a_k$,
by 1 will result ${A_k}^2 < 2$.
\end{document}
(字体)<10.95> 在输入行 12。!未定义控制序列。l.12 \noindent 1) 证明 $\sqrt{2} \in \mathbb {R} $
当我尝试编译它时,我收到此错误。我仍然得到了我想要的 PDF 输出,但我仍然不明白为什么会出现此错误。我尝试包括包 amsmath、amstext,但并没有修复错误。
答案1
上面显示的格式的错误消息不可读,显示 TeX 错误时应始终保留行尾。
您的文档中的错误是
! Undefined control sequence.
l.12 \noindent 1) Show that $\sqrt{2} \in \mathbb
{R} $
? h
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
?
正如帮助文本清楚显示的那样,消息中的换行符的位置表明\mathbb
了尚未定义的有问题的命令。
TeX 本身只能告诉你它没有定义,而不是如何定义它,但谷歌搜索该命令应该很快告诉你你需要这个包amsfonts
添加
\usepackage{amsfonts}
使得文档没有错误,但是 TeX 标记存在很多问题。
latex2e 中不推荐使用“两个字母”字体命令(默认情况下未定义),通常最好使用 latex 命令,\scshape
但在这种情况下,通常应避免在文档中使用字体命令,尤其是在结构命令中,如\title
和,\author
因为这些命令的重点是它们只包含带有数据的纯文本,样式取决于文档类。出于类似的原因,您应避免使用\vspace
和\noindent
和显式编号,例如1)
。
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\makeatletter
% \@maketitle copied from article.cls, woth \ascshape added
\renewcommand\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\scshape
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
\par
\vskip 1.5em}
\makeatother
\title{Homework 1}
\author{by Me}
\date{January 2017}
\begin{document}
\maketitle
\begin{enumerate}
\item Show that $\sqrt{2} \in \mathbb{R} $
\bigskip
We will define two sequences, $A_k$ and $B_k$.
Let $A_k = a_1a_2a_3a_4\dots a_k$, and
% You could use {A_k}^2 if you really need to stress the order
% bit it makes the 2 float off and normally the more compact
% form is used (and understood)
$A_k^2
> 2$
but decreasing the last digit, $a_k$,
by
% math mode!
$1$
will result
% as above
$A_k^2
< 2$.
\end{enumerate}
\end{document}