3

enter image description here

The picture above is generated by $\star$, $\star\star$ or $\star\star\star$.

Indeed, this phenomenon was mentioned in here. However they didn't give a solution, and I want to know how to get rid of it.

Salomo
  • 231

2 Answers2

7

Redefine \star by \mathord which is \mathbin instead originally. See here for the differences on \mathord, \mathop, \mathbin, \mathrel, \mathopen, \mathclose, and \mathpunct. Of course, if you still need the original \star to be the binary operator, then you'd better rename the redefined\star command.

\documentclass{article}

\makeatletter \DeclareMathSymbol{\star}{\mathord}{letters}{"3F} \makeatother

\begin{document} $\star$, $\star\star$ or $\star\star\star$

\end{document}

enter image description here

By the way please give a minimal working sample next time to make people answer your question conveniently.

M. Logic
  • 4,214
  • Thank you for the solution and the reminder! – Salomo Jul 21 '22 at 02:48
  • 3
    But to copy a comment above: "I wouldn't redefine a standard command, better use a new name or use {\star}{\star}{\star}". – Teepeemm Jul 21 '22 at 13:03
  • I agree with @Teepeemm: this solution is wrong even if the OP is not using \star in other situations. It's mostly like \def\c{\gamma} that a colleague used to do, but he got a weird error when a paper of his had a Turkish coauthor. – egreg Jul 22 '22 at 09:04
2

Bizarre spacing with 4 $\star$s explaines why this happens.

I only see a place where this can happen. Quite likely you're tagging equations with , , and so on with

\tag{$\star$}
\tag{$\star\star$}
\tag{$\star\star\star$}

Well there's a much simpler solution for this case, namely using \textborn (which is a star).

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align} x=1 \tag{\textborn} \ y=2 \tag{\textborn\textborn} \ z=3 \tag{\textborn\textborn\textborn} \end{align}

\end{document}

However, since \textborn seems out of place there, it's better to define an alias such as \textstar

\documentclass{article}
\usepackage{amsmath}

\newcommand{\textstar}{\textborn}

\begin{document}

\begin{align} x=1 \tag{\textstar} \ y=2 \tag{\textstar\textstar} \ z=3 \tag{\textstar\textstar\textstar} \end{align}

\end{document}

Oh, well, maybe your font family doesn't fully cover the TS1 encoding. In this case you can take advantage of having defined a suitable command:

\documentclass{article}
\usepackage{amsmath}

%\usepackage{somestrangefontpackage}

%\newcommand{\textstar}{\textborn} % somestrangefontpackage doesn't support \textborn \newcommand{\textstar}{\mbox{$\star$}}

\begin{document}

\begin{align} x=1 \tag{\textstar} \ y=2 \tag{\textstar\textstar} \ z=3 \tag{\textstar\textstar\textstar} \end{align}

\end{document}

enter image description here

If my guess is incorrect and you're using \star as an ordinary math symbol that you happen to get repeated in formulas, then do

\documentclass{article}
\usepackage{amsmath}

\newcommand{\pstar}{{\star}} % choose a better name

\begin{document}

$\pstar+\pstar\pstar+\pstar\pstar\pstar= \pstar\pstar\pstar\pstar\pstar\pstar$

\end{document}

enter image description here

In this case, it would be better to define a command that repeates the given number of stars, wouldn't it?

\documentclass{article}
\usepackage{amsmath}

\newcommand{\pstar}{{\star}} % choose a better name \ExplSyntaxOn \NewDocumentCommand{\pstars}{m} { \prg_replicate:nn { #1 } { \pstar } } \ExplSyntaxOff

\begin{document}

$\pstars{1}+\pstars{2}+\pstars{3}=\pstars{6}$

\end{document}

egreg
  • 1,121,712
  • So far as I know, we usually have two uses of \star: one is as the difficulty or importance mark which is used in exercise headings or before section titles and in this case we may use 3 or 4 stars at most; another is as a binary operator, for example x\star y in which there should be spaces before and after the star, and \star is an abstract binary operator for \wedge, \vee and so on. For equation tags, we usually use *(or \ast or \textasteriskcentered) instead of \star, and \dagger, \ddagger, \S, \P and so on in sequel similar to footnote numbers in symbols. – M. Logic Jul 22 '22 at 16:46