如何强制调整大小的数学模式符号以适应字体大小的变化?

如何强制调整大小的数学模式符号以适应字体大小的变化?

我想使用 制作一个包含已调整大小的数学符号的乳胶符号\scriptscriptsize。但是,当包含符号的范围受到字体大小调整时,\scriptscriptsize-ed 符号的大小不会适当调整。

请看此图,并注意右箭头尺寸不会像波浪号那样发生很大变化: 调整大小不正确

以下代码片段演示了该问题:

\documentclass{article}
\newcommand{\isoeq}{ 
\kern-0em\mathrel{\raisebox{0.13em}{${\sim}$}}
\kern-0.75em\mathrel{\raisebox{-0.13em}{${\scriptscriptstyle \to}$}}  
}

\begin{document}
{\normalsize $A \isoeq B$}, \quad {\Large $A \isoeq B$}
\end{document}

你能解释一下如何正确完成此操作以使$\to$上方的右箭头能够调整大小吗?

答案1

我会用以下方式对符号进行不同的定义\scalebox

\documentclass{article}
\usepackage{amsmath,graphicx}

\makeatletter
\newcommand{\isoeq}{\mathrel{\mathpalette\@isoeq\rightarrow}}
\newcommand{\qeosi}{\mathrel{\mathpalette\@isoeq\leftarrow}}
\newcommand{\@isoeq}[2]{%
  \ooalign{%
    \raisebox{0.2\height}{$\m@th#1\sim$}\cr
    \hidewidth\raisebox{-\height}{\scalebox{0.6}{$\m@th#1#2$}}\hidewidth\cr
  }%
}
\makeatother

\begin{document}

$A \isoeq B$ \quad {\Large $A \isoeq B$}

$X_{A\isoeq B}$ $A\qeosi B$

\end{document}

在此处输入图片描述

答案2

箭头受到尺寸变化的影响。如果你添加,\showoutput你会看到第一个是 5pt,第二个是 7pt

.......\OMS/cmsy/m/n/5 !

.......\OMS/cmsy/m/n/7 !

但是请注意,scriptscriptsyle 与 textstyle 相比的相对大小并不是在所有大小下都相同的,特别是为了防止它们在小尺寸时变得太小,因此当您将 scriptscript 字符堆叠在 textstyle 字符上时,相对大小不是恒定的,从同一样式中获取两个字符会更容易。

右箭头上的波浪符号为 U+2972,有些字体将其作为单个字形,例如:

在此处输入图片描述

\documentclass{article}

\usepackage{stix2}

\begin{document}

$ A \similarrightarrow B$

\Large 
$ A \similarrightarrow B$

\end{document}

相关内容