# Unsure why i am getting Missing Number treated as Zero error

I only know the basics of latex and for some reason I am now getting the following error.

!Missing number, treated as zero.

\let \centering.

The beginning on my code is as follows:

\newtheorem{cor}[thm]{Corollary}
\newtheorem{prop}[thm]{Proposition}
\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}
\numberwithin{equation}{subsection}
\setlength{\parindent}{0pt}

\begin{document}
\begin{titlepage}
\textheight
\centering
\vspace*{\baselineskip}
\rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}


I don't understand why I am getting this error for the \centering line and because of this I am unable to complete quick builds.

Any help would be appreciated.

• Remove that \textheight. It is a length, it will have no effect where it is in your code. – Phelype Oleinik Jan 22 '18 at 12:28

The error is because of the \textheight in your code. You can't use it like that.

\textheight is a length, which is how TeX represents real-valued variables. When you use a variable like that (either real-valued, like \textheight or integer, like \c@page), TeX is expecting that you will do an assignment. That is, you will store a value in that variable (exactly like in other programming languages), but it never finds the value it was looking for and says Missing number when it finds the first illegal token (in this context), which in this case is the \let token after it expanded \centering:

! Missing number, treated as zero.
\let
l.7 \centering
?


which is precisely the cause of the error. If you insert a number (1cm, for example) after the \textheight the code will compile correctly and the value of \textheight would change to 1cm. P.S.: Don't do that :)

If you want to print the value of \textheight you can use \the:

\the\textheight


which is TeX's primitive to access the value of a register.

• Unless there is no vote for your answer the question still counts as 'unanswered'.... oops, there is a vote ;-) – user31729 Jan 22 '18 at 12:46
• @ChristianHupfer Thanks :). To be honest, I answered more to see if someone knows why TeX expects a length after the \textheight. I have never seen this, and it got me curious... – Phelype Oleinik Jan 22 '18 at 13:07
• You can set a TeX length by saying \textheight 2cm, which is what TeX expects when it finds a length without any special context. (The syntax used in the TeXbook is \textheight=2cm, but the = is not necessary.) – schtandard May 2 '19 at 9:20
• @schtandard If one want to change the \textwidth, yes, but what OP seems to want is to print the value (though we will never know for sure). The TeXbook syntax actually says (pages 275 and 276) that a ⟨variable assignment⟩ → ⟨dimen variable⟩⟨equals⟩⟨dimen⟩ and ⟨equals⟩ → ⟨optional spaces⟩ | ⟨optional spaces⟩=₁₂, which means that a catcode 12 = is an optional part of the assignment syntax. – Phelype Oleinik May 2 '19 at 14:14
• Sure. I was trying to point out why TeX expects a length after \textheight (because it expects an assignment), since you requested that information. (Though I now see that this question is much older than I first thought.) – schtandard May 2 '19 at 14:27