# Missing number, treated as zero

This error appears when you have written something inside a count, dimension or skip entry which isn't a number. If you do this, you will generate the error message below:

main.tex, line 5

l<to be read again> t l.8 \vspace{this should be a number} A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)

## Common causes

**Forgetting to include a number where a number is required:**

The most basic way this error can be generated is if you have forgotten to include a number in a command where a number is required. An example of this is shown below.

```
We want to insert some vertical space between here
\vspace{this should be a number}
and here.
```

Here the ** \vspace{...}** command expects a number as its argument, telling it how much vertical space to leave between the text. As there is no number present, an error appears. The correct way to write this

```
We want to insert some vertical space between here
\vspace{6em}
and here.
```

There are many commands like ** \vspace{...}** which require numbers as their argument. The most common of these are

- Spacing commands such as:
`\vspace{...}`

`\vspace*{...}`

`\hspace{...}`

`\hspace*{...}`

- Scaling commands, such as
. This will scale your image to be`\includegraphics[scale = 0.7]{image}`

times its actual size. The other options available here which require numbers are:`0.7`

`width`

`height`

`page`

`resolution`

`trim`

.`angle`

- The
command, where the argument states how many lines you want to be skipped.`\linebreak[number]`

- Counters commands such:
`\addtocounter{mycounter}{number}`

`\setcounter{mycounter}{number}`

- Length setting commands such as
. This will change the value of a particular length such as`\setlenght{\lengthname}{number}`

to the value`\textwidth`

(e.g.`number`

).`\setlength{\textwidth}{1in}`

- Table option commands such as
.`\multicolumn{number}{c}{Table entry}`

**Having a linebreak \\ followed by square brackets:**

If a linebreak command ** \\** is ever followed by square brackets

**, it will be taken as an optional argument, and thus a number will be expected inside the square brackets. This is even true if there is whitespace and newlines between the**

`[...]`

**and**

`\\`

**commands. This problem often appears in tables, as shown below:**

`[...]`

```
\begin{tabular}{c|c}
[x] & 2\\
[x]^2 & 4
\end{tabular}
```

This will generate an error, as on the third line, we have a linebreak followed by squared brackets. LaTeX expects a number inside the square brackets, but instead finds ** x**. The correct way to write the above table is to include the square brackets inside curly braces

**as shown below:**

`{...}`

```
\begin{tabular}{c|c}
[x] & 2\\
{[x]}^2 & 4
\end{tabular}
```

**Using the subfigure package:**

The ** subfigure** package is long outdated, and will generate a 'Missing number' error when there is no error present. An example of this is shown below:

```
% In your preamble
\usepackage{subfigure}
% In the body of your document
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[scale=0.2]{image}
\caption{A gull}
\label{fig:gull}
\end{subfigure}%
\end{figure}
```

This will generate an error, as the subfigure package does not recognise ** \textwidth** as a number, when it is in fact a number (equivalent to the constant width of the total text block on a page). The way to resolve this is to use the more updated

**package, which has replaced**

`subcaption`

**. Writing the same code as above with**

`subfigure`

**in the preamble instead of**

`\usepackage{subcaption}`

**will give the desired result without any error.**

`\usepackage{subfigure}`

## Overleaf guides

- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features

## LaTeX Basics

- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors

## Mathematics

- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf

## Figures and tables

- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package

## References and Citations

- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles

## Languages

- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish

## Document structure

- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks

## Formatting

- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes

## Fonts

## Presentations

## Commands

## Field specific

- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices

## Class files

- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class