I want something like \sim^a but with the 'a' in the top center not like a power.
2 Answers
See a comparison. Naturally, you might want to define the operator of your choice as a separate macro.
\documentclass{memoir}
\usepackage{amsmath}
\begin{document}
\begin{align}
1&\sim^a x\
2&\stackrel a\sim x\%obsolete
3&\mathop\sim^a x\
4&\overset a\sim x\
5&\substack{a\\sim} x\
6&\begin{subarray}{c}a\\sim\end{subarray} x\
7&\buildrel a\over\sim x\
\end{align}
\end{document}
Related.
- Please read @egreg's valuable comment.
- https://ctan.org/pkg/stackrel
- https://youtu.be/LFrdqQZ8FFc
- 4,624
-
3Note that
\stackrel{a}{\sim}is essentially equivalent to\overset{a}{\sim}, because\simis a relation symbol. Both end up in doing\mathop{\sim}\limits^a, with the big difference that the latter is generally unwanted if not wrapped in\mathrel(and you getaabove\simjust by chance, becausealignuses display math mode). Number 7 is the same as number 2, only using a foreign syntax. – egreg Jun 30 '20 at 22:39 -
1
Just I'm adding the use of another package called accents. Here there are others output but with a lot of sincerity the correct solutions are those referred to the comments and response of the good user @CampanIgnis.
Edit after the comment of the very nice user @egreg using \mathrel.
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{accents}
\begin{document}
\textit{one option}, , $\square\mathrel{\accentset{a}{\sim}}\blacksquare$
\texttt{another options}
[\triangle\mathrel{\accentset{\displaystyle a}{\sim}}\square]
[\diamond\mathrel{\accentset{\scriptstyle a}{\sim}}\square]
[\blacksquare\mathrel{\accentset{\scriptscriptstyle a}{\sim}}\triangle]
\end{document}
- 54,118
-
3
\accentset{a}{\sim}does not make the symbol into a relation symbol and\mathrel{\accentset{a}{\sim}}should probably be used. – egreg Jun 30 '20 at 22:35 -
@egreg A very correct observation, which I have immediately accepted. – Sebastiano Jun 30 '20 at 22:42
-
1
-
1


\overset{a}{\sim}– egreg Jun 30 '20 at 21:50