![叠加字形和上标/下标](https://linux22.com/image/455982/%E5%8F%A0%E5%8A%A0%E5%AD%97%E5%BD%A2%E5%92%8C%E4%B8%8A%E6%A0%87%2F%E4%B8%8B%E6%A0%87.png)
我使用stackengine
叠加\cup
和\^{}
来创建一个右端点带有箭头的杯子。这在正常大小下有效,但如果我将新符号用作上标/下标,则新符号不会减小其大小,或者脱字符不会保持对齐(添加 时\text
)。
\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\newcommand{\cupr}{\topinset{\^{}}{$\cup$}{-0.7pt}{2.55pt}}
\newcommand{\cuprr}{\text{\topinset{\^{}}{$\cup$}{-0.7pt}{2.55pt}}}
\begin{document}
$$\cupr^{\cupr^{\cupr}} \qquad \cup^{\cup^{\cup}} \qquad \cuprr^{\cuprr^{\cuprr}} $$
\end{document}
我怎样才能解决这个问题?
答案1
此处的参数适用于 Computer Modern 字体。对于其他字体,请自行调整(目测)。
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\cupr@tip}{\text{\raisebox{-0.1ex}{$\m@th\hat{}$}}}
\newcommand{\cupr}{\mathbin{\cup\cupr@}}
\newcommand{\cupr@}{%
\mathchoice
{\mkern-1.35mu\cupr@tip}
{\mkern-1.35mu\cupr@tip}
{\mkern-1.55mu\cupr@tip}
{\mkern-1.875mu\cupr@tip}
}
\makeatother
\begin{document}
$A\cup B$
$A\cupr B$
$A\cupr B_{A\cupr B_{A\cupr B}}$
\end{document}