Take the 2-minute tour ×
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.

What's wrong with my code for three stars (***)? It's so ugly compared to my ** and *.

\documentclass{article}
\newcommand{\oneS}{\ensuremath{{}^{\textstyle *}}}
\newcommand{\twoS}{\ensuremath{{}^{\textstyle **}}}
\newcommand{\threeS}{\ensuremath{{}^{\textstyle ***}}}

\begin{document}

0.11\oneS \newline

0.11\twoS \newline

0.11\threeS

\end{document}
share|improve this question
add comment

3 Answers

up vote 14 down vote accepted

The star is treated as binary operator. In the first two cases, there are not enough math atoms for a binary operator, but in the third case, the first star is "multiplicated" with the third star and the second star is set as binary operator with additional spaces. You can get rid of this behaviour by putting the star in braces. Braces in math mode make a subformula that is treated as ordinary math atom:

{*}{*}{*} or *{*}*

Also \textstyle can be improved. Probably it should avoid that the star is set in \scriptstyle as superscript whereas the number has normal size. \mathchoice helps here. It takes four arguments for the four styles and TeX uses the argument for the style that is finally active.

\documentclass{article}
\newcommand*{\SuperScriptSameStyle}[1]{%
  \ensuremath{%
    \mathchoice
      {{}^{\displaystyle #1}}%
      {{}^{\textstyle #1}}%
      {{}^{\scriptstyle #1}}%
      {{}^{\scriptscriptstyle #1}}%
  }%
}

\newcommand*{\oneS}{\SuperScriptSameStyle{*}}
\newcommand*{\twoS}{\SuperScriptSameStyle{**}}
\newcommand*{\threeS}{\SuperScriptSameStyle{*{*}*}}

\begin{document}

0.11\oneS

0.11\twoS

0.11\threeS

$\frac{0.11\oneS}{0.11\twoS_{0.11\threeS}}$

\end{document}

Result

Addition

Using LaTeX's \mathpalette the definition can be simplified a little:

\newcommand*{\SuperScriptSameStyle}[1]{%
  \ensuremath{%
    \mathpalette\SuperScriptSameStyleAux{#1}%
  }%
}
\newcommand*{\SuperScriptSameStyleAux}[2]{%
  % #1: math style
  % #2: superscript
  {}^{#1#2}%
}
share|improve this answer
add comment

Here is a fix, but I don't know why??

\documentclass{article}
\newcommand{\oneS}{\ensuremath{{}^{\textstyle *}}}
\newcommand{\twoS}{\ensuremath{{}^{\textstyle **}}}
\newcommand{\threeS}{\ensuremath{{}^{\textstyle **}\oneS}}
\begin{document}
0.11\oneS \par
0.11\twoS \par
0.11\threeS
\end{document}
share|improve this answer
add comment

Another fix:

\usepackage{mathabx}
\newcommand{\threeS}{\ensuremath{{}^{\textstyle 
  \asterisk\asterisk\asterisk}}}

Or simply

\newcommand{\threeS}{\ensuremath{^{***}}}

But fix of Heiko Oberdiek is munch better.

share|improve this answer
add comment

Your Answer

 
discard

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