I use the following mystic TeX so as to display the Landau's notations for big and small O.
There is one partial solution to improve the scriptscriptstyle so as to not use a small o : see the secund answer below. The problemen with \smallOBis
is the wrong spacing, contrary to \smallO
. How can I do this ?
% Sources :
% 1) http://forum.mathematex.net/latex-f6/bonnes-commandes-de-base-t12278.html
% 2) http://tex.stackexchange.com/questions/30944/mathcalo-and-font-size
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\newcommand{\bigO}[1]{\ensuremath{\mathop{}\mathopen{}\mathcal{O}\mathopen{}\left(#1\right)}}
\newcommand\smallO[1]{
\mathchoice
{% \displaystyle
\ensuremath{\mathop{}\mathopen{}{\scriptstyle\mathcal{O}}\mathopen{}\left(#1\right)}
}
{% \textstyle
\ensuremath{\mathop{}\mathopen{}{\scriptstyle\mathcal{O}}\mathopen{}\left(#1\right)}
}
{% \scriptstyle
\ensuremath{\mathop{}\mathopen{}{\scriptscriptstyle\mathcal{O}}\mathopen{}\left(#1\right)}
}
{% \scriptscriptstyle
\ensuremath{\mathop{}\mathopen{}{o}\mathopen{}\left(#1\right)}
}
}
\newcommand\smallOBis[1]{
\mathchoice
{% \displaystyle
\scriptstyle\mathcal{O}\left(#1\right)
}
{% \textstyle
\scriptstyle\mathcal{O}\left(#1\right)
}
{% \scriptstyle
\scriptscriptstyle\mathcal{O}\left(#1\right)
}
{% \scriptscriptstyle
\scalebox{0.8}{$\scriptscriptstyle\mathcal{O}$}\left(#1\right)
}
}
\begin{document}
\[
\renewcommand{\arraystretch}{1.2}%
\begin{array}{llll}
\textbf{Style} & \verb!\bigO!
& \verb!\smallO! & \verb!\smallOBis!
\\ \hline
\verb!\displaystyle! & \displaystyle \bigO{\frac{1}{n}}
& \displaystyle 1 + \smallO{\frac{1}{n}} - 2 & \displaystyle 1 + \smallOBis{\frac{1}{n}} - 2
\\
\verb!\textstyle! & \textstyle \bigO{\frac{1}{n}}
& \textstyle 1 + \smallO{\frac{1}{n}} - 2 & \textstyle 1 + \smallOBis{\frac{1}{n}} - 2
\\
\verb!\scriptstyle! & \scriptstyle \bigO{\frac{1}{n}}
& \scriptstyle 1 + \smallO{\frac{1}{n}} - 2 & \scriptstyle 1 + \smallOBis{\frac{1}{n}} - 2
\\
\verb!\scriptscriptstyle! & \scriptscriptstyle \bigO{\frac{1}{n}}
& \scriptscriptstyle 1 + \smallO{\frac{1}{n}} - 2 & \scriptscriptstyle 1 + \smallOBis{\frac{1}{n}} - 2
\end{array}
\]
\end{document}
Best Answer
One problem here is the available font sizes at that small-a-size. Using a scaling factor supported by
graphicx
by means of\scalebox{<factor>}{<stuff>}
:The choice was made to scale a
\scriptscriptstyle\mathcal{O}
by 80%, since the shape of\mathcal{O}
at larger font sizes looks different from that of\scriptscriptstyle
. I'm sure that playing around with larger size and smaller scale factors would provide a suitable solution.Edit: An update to the definition of
\smallOBis
, as defined in @projetmbc's updated question:Two changes were made to
\smallOBis
:\mathcal{O}
as an operator via\operatorname{..}
, therefore correcting the spacing with other relational/binary operators on the left side; and\!
.