
\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}
(Fonte) <10.95> na linha de entrada 12. ! Sequência de controle indefinida. l.12 \noindent 1) Mostre que $\sqrt{2} \in \mathbb {R} $
Recebo esse erro quando tento compilar isso. Ainda recebo uma saída em PDF como desejo, mas ainda me incomoda o motivo pelo qual esse erro está aparecendo. Tentei incluir o pacote amsmath, amstext, mas não corrigiu o erro.
Responder1
A mensagem de erro no formato que você mostrou acima não é legível, você deve sempre preservar os finais de linha ao mostrar erros do TeX.
O erro no seu documento é
! 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.
?
O que, como o texto de ajuda deixa claro, mostra, pela posição da quebra de linha na mensagem, que \mathbb
é o comando problemático que não foi definido.
O próprio TeX só pode dizer que não está definido, não como defini-lo, mas o Google para esse comando deve dizer rapidamente que você precisa do pacoteamsfonts
Adicionando
\usepackage{amsfonts}
torna o documento livre de erros, mas há muitos problemas com a marcação do TeX.
Os comandos de fonte de "duas letras" não são recomendados no latex2e (e não definidos por padrão), geralmente é melhor usar os comandos do latex, neste caso \scshape
porém em geral você deve evitar comandos de fonte no documento e especialmente em comandos estruturais como \title
e \author
já que o objetivo desses comandos é que eles apenas possuem texto simples com os dados e o estilo depende da classe do documento. Por razões semelhantes, você deve evitar \vspace
numeração \noindent
explícita, como 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}