\xrightarrow:箭头上方的文本位置应较低

\xrightarrow:箭头上方的文本位置应较低

以下是 LaTeX 代码示例

\documentclass[b4paper,oneside, final, 10pt]{article}
\usepackage[english]{babel}
\usepackage{charter}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage[top=1.5cm, bottom=2.9cm, left=2.1cm, right=2.1cm]{geometry}

\begin{document}
    \noindent\textbf{\large Algebraic Morse Theory:} Let $R$ be any ring. A 
\emph{based $R$-complex}, is a chain $R$-complex $(A_\star,\partial_\star)$, 
together with a chosen decomposition $A_n\!=\bigoplus_{i\in I_n}\!\!\!A_{n,i}$ 
for every $n$. Then $\partial_{n,i,j}\!=\!\partial_{i,j}$ denotes the $R$-module 
homomorphism $A_{n,i} \smash{\overset{\iota}{\longrightarrow}} 
A_n \smash{\overset{\partial_n}{\longrightarrow}}A_{n-1} 
\smash{\overset{\pi}{\longrightarrow}}A_{n-1,j}$, where $\iota$ is the coordinate inclusion and 
$\pi$ is the coordinate projection. The associated digraph of $A_\star$, 
$\Gamma_{\!A_\star}\!=\!\Gamma$, is a directed simple graph whose vertices are 
the indices from all $I_n$, and directed edges correspond to nonzero maps 
$\partial_{i,j}$. Each edge $(i,j)$ will be denoted by $i\!\to\!j$.\\[2mm]

    \noindent\textbf{Conclusion:} Given a based $R$-complex $(A_\star,\partial_\star,I_\star)$,
 any Morse matching $\mathcal{M}$ on $\Gamma_{\!A_\star}$ induces a homotopy 
equivalence between complexes $(A_\star,\partial_\star)$ and 
$(\mathring{A}_\star,\mathring{\partial}_\star)$, more precisely $A_\star
\xrightarrow{\pi\text{ s.d.r. }}\pi(A_\star) = \pi(\mathring{A}_\star)
\xleftarrow{\pi=p^{-1}\,\cong}\mathring{A}_\star$, and therefore isomorphisms 
$H_n(A_\star,\partial_\star) \cong H_n(\mathring{A}_\star,\mathring{\partial}_\star)$ 
for all $n\!\in\!\mathbb{Z}$. In particular, if $\mathcal{M}^0_{n-1}\!= 
\emptyset =\!\mathcal{M}^0_{n+1}$ then there holds $H_n(A_\star,\partial_\star) 
\cong  \mathring{A}_n$.
\end{document}

产生在此处输入图片描述(\iota、\partial、\​​pi 太高) 而不是在此处输入图片描述。此外,它产生在此处输入图片描述而不是 (降低文本)在此处输入图片描述

甚至更好(降低文本并更好地与 p 重叠)在此处输入图片描述

有没有办法创建一个更好的命令\xrightarrow(如果可能的话,还有\xleftarrow\xRightarrow\xLeftarrow等),以便更好地定位文本,就像上面的图片一样?第二张和第五张图片中的样式最理想。此外,如果此命令有一个可选参数[...],指定与箭头线的偏移量(包括负空间),我会非常高兴。

PS 顺便问一下,有没有办法让上标和下标中的 + 和 - 符号左右两侧的空间更小?例如,上图中的 -1 离 p 太远了。

答案1

我写了一些函数,允许降低/提高xrightarrow箭头下方/上方的文本。似乎使用这些宏排版的文本会更宽一些,但看起来还不错 ;)

所需代码为:

\usepackage{ifthen}
\usepackage{xargs}

\newcommandx{\yaHelper}[2][1=\empty]{%
\ifthenelse{\equal{#1}{\empty}}%
  { \ensuremath{ \scriptstyle{ #2 } } } % no offset
  { \raisebox{ #1 }[0pt][0pt]{ \ensuremath{ \scriptstyle{ #2 } } } }  % with offset
}

\newcommandx{\yrightarrow}[4][1=\empty, 2=\empty, 4=\empty, usedefault=@]{%
  \ifthenelse{\equal{#2}{\empty}}
  { \xrightarrow{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's no text below
  { \xrightarrow[ \protect{ \yaHelper[ #2 ]{ #1 } } ]{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's text below
}

\newcommandx{\yleftarrow}[4][1=\empty, 2=\empty, 4=\empty, usedefault=@]{%
  \ifthenelse{\equal{#2}{\empty}}
  { \xleftarrow{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's no text below
  { \xleftarrow[ \protect{ \yaHelper[ #2 ]{ #1 } } ]{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's text below
}

\newcommandx{\yRightarrow}[4][1=\empty, 2=\empty, 4=\empty, usedefault=@]{%
  \ifthenelse{\equal{#2}{\empty}}
  { \xRightarrow{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's no text below
  { \xRightarrow[ \protect{ \yaHelper[ #2 ]{ #1 } } ]{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's text below
}

\newcommandx{\yLeftarrow}[4][1=\empty, 2=\empty, 4=\empty, usedefault=@]{%
  \ifthenelse{\equal{#2}{\empty}}
  { \xLeftarrow{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's no text below
  { \xLeftarrow[ \protect{ \yaHelper[ #2 ]{ #1 } } ]{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's text below
}  

用法是:yrightarrow[<TEXT-BELOW>][<OFFSET-BELOW>]{<TEXT-ABOVE>}[<OFFSET-ABOVE>}其他的也类似。
一个最小工作示例如下:

\documentclass{minimal}
\usepackage{amsmath}
\usepackage{ifthen}
\usepackage{xargs}

\newcommandx{\yaHelper}[2][1=\empty]{%
\ifthenelse{\equal{#1}{\empty}}%
  { \ensuremath{ \scriptstyle{ #2 } } } % no offset
  { \raisebox{ #1 }[0pt][0pt]{ \ensuremath{ \scriptstyle{ #2 } } } }  % with offset
}   

\newcommandx{\yrightarrow}[4][1=\empty, 2=\empty, 4=\empty, usedefault=@]{%
  \ifthenelse{\equal{#2}{\empty}}
  { \xrightarrow{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's no text below
  { \xrightarrow[ \protect{ \yaHelper[ #2 ]{ #1 } } ]{ \protect{ \yaHelper[ #4 ]{ #3 } } } } % there's text below
}

\begin{document}
    \begin{align*}
        A \yrightarrow{\pi \, \text{s.d.r.}}[-2pt] B \, , \: C \yrightarrow[\pi \, \text{s.d.r.}][4pt]{\pi \, \text{s.d.r.}}[-2pt] D
    \end{align*}
\end{document}  

示例结果(剪切)

但是,这似乎是一种蛮力方法,我不知道是否会有任何副作用(而且我没有进行任何数学大小检查,箭头上方和下方的内容将始终设置为scriptstyle)。当然,这是一个“愚蠢”的解决方案,因为必须手动确定偏移量。最后,不支持第五张图像所建议的功能。

我建议您暂时不要接受这个答案,因为我希望有人能提供更好的解决方案(希望包括第五幅图所建议的功能,这可能可以通过首先用稍大的字体和白色打印内容然后用黑色套印实际内容来实现)。

相关内容