Adding space in LaTeX maths expressions

less than 1 minute read

So this is a simple one which is used everywhere. Essentially I was trying to express some run times in LaTeX using the following:

O(n log(n))

However, this displayed as:

O(nlog(n))

The solution is to add some horizontal space using real units as follows:

O(n\hspace{2 mm}log(n))

I found 2mm to be about right when using pdflatex, but feel free to play with it your self.

Tags:

Updated: