[Tex/LaTex] Undefined control sequence error, but no idea what’s wrong with the file

codeerrors

\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}

(Font) <10.95> on input line 12. ! Undefined control sequence. l.12
\noindent 1) Show that $\sqrt{2} \in \mathbb {R} $

I get this error when I try to compile this. I still get a PDF output as I want, but it still bothers me why this error is popping up. I tried including the package amsmath, amstext, but it didn't fix the error.

Best Answer

The error message in the format you have shown above is not readable, you should always preserve line endings when showing TeX errors.

The error on your document is

! 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.

? 

Which as the help text makes clear shows, by the position of the line break in the message that \mathbb is the problematic command that has not been defined.

TeX itself can only tell you that it is not defined, not how to define it but google for that command should quickly tell you that you need the package amsfonts

Adding

\usepackage{amsfonts}

makes the document error free, but there are rather a lot of issues with the TeX markup.

The "two letter" font commands are not recommended in latex2e (and not defined by default) it is usually better to use the latex commands, in this case \scshape however in general you should avoid font commands in the document and especially in structural commands like \title and \author as the whole point of those commands is that they just have plain text with the data and the styling depends on the document class. For similar reasons you should avoid \vspace and \noindent and explicit numbering such as 1).

enter image description here

\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}