TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my country, the base of logarithm is written in superscript before the log sign, i.e. $^a\log b$ means log base a of b. This doesn't look nice on LaTeX, because there is a gap between ^a and \log. How to remove this gap?

share|improve this question
I've never seen that notation and I find it a source for ambiguities, even if there's a thin space before the superscript: $2\mylog{2}x$ (with David's definition) will leave the reader with the doubt whether it's "four times the logarithm of x" or "2 times the base 2 logarithm of x". – egreg Jul 16 '12 at 17:37
Indeed it is. Unfortunately I have no choice but to follow the consensus. For such case of ambiguity, I'd put a dot to indicate multiplication. – steve Jul 16 '12 at 19:41
Can you reveal where this notation is used? It's certainly uncommon. – egreg Jul 16 '12 at 19:42
I'm from Indonesia – steve Jul 16 '12 at 19:43
This is not an uncommon notation at all. Here in the Netherlands it is also widely used. It is taught like this at the middle school. – Chiel ten Brinke Apr 25 '13 at 12:38
up vote 7 down vote accepted

You can use a negative space \! to remove (or reduce) this to your liking. It would be best to define a command for this, for the sake of consistency:

enter image description here

\usepackage{xparse}% http://ctan.org/pkg/xparse
  {}^a\log xyz\ \mbox{or}\ \Log[a]xyz\ \mbox{or}\ \Log xyz\ \mbox{or}\ \log_a xyz

Of course, more specific kerning is also possible using \kern.

The above MWE defined \Log[<base>] that takes an optional argument <base>. Without <base> it defaults to \log.

share|improve this answer

enter image description here

The space comes because \log is a \mathop command. Here you don't want any space between the superscript and the log but you do want the entire construct to be a \mathop so:




$ x+x\mylog2 x$
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.