First, a minimal working sample is as follows.
\documentclass{article}
\usepackage{tikz}
\makeatletter
\newcommand*\newcirc{\mathrel{%
\tikz{%
\draw (0em,0em) circle [radius=0.2em];%
}}}
\makeatother
\begin{document}
[
\phi\newcirc\psi
]
\end{document}
As you see, I defined a math symbol of \newcirc by TikZ. It seems to work well. While when I put it in the script without brackets, for example, $\phi_\newcirc$, it doesn't work. So is there any way to fix the problem by revising the codes? (I don't like to add brackets every time when I use it singly in the script, for example, $\phi_{\newcirc}$)
$\phi_{\newcirc}$is correct. But you can put\bgroupand\egroup(or a pair of curly brackets) intro the command to make it work for the command. – dexteritas Sep 08 '23 at 08:32\mathrelthe spacing usually added by this is ignored, so$\phi_{\newcirc}$would be the best way, to not change the behavior in the other case. – dexteritas Sep 08 '23 at 09:24_{...}(which is the correct, LaTeX syntax anyway). You can get a look at https://tex.stackexchange.com/a/571062/38080 for a way to make the symbols scale. – Rmano Sep 08 '23 at 09:35scalerelpackage and the definition\newcommand{\newcirc}{\mathrel{\scalerel*{\tikz{\draw circle [radius=0.2em];}}{x}}}. – Sandy G Sep 08 '23 at 17:46