[Tex/LaTex] Customized log notation

math-operatorsspacing

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?

Best Answer

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

\documentclass{article}
\usepackage{xparse}% http://ctan.org/pkg/xparse
\NewDocumentCommand{\Log}{o}{%
  \IfNoValueTF{#1}{}{{}^{#1}\!}\log}%
\begin{document}
\[
  {}^a\log xyz\ \mbox{or}\ \Log[a]xyz\ \mbox{or}\ \Log xyz\ \mbox{or}\ \log_a xyz
\]
\end{document}​

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.

Related Question