疊加字形和上標/下標

疊加字形和上標/下標

我用來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}

在此輸入影像描述

相關內容