代码拉取完成,页面将自动刷新
% Copyright 2018 李文威 (Wen-Wei Li).
% Permission is granted to copy, distribute and/or modify this
% document under the terms of the Creative Commons
% Attribution 4.0 International (CC BY 4.0)
% http://creativecommons.org/licenses/by/4.0/
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{myarrows}[2018/02/20 Package for extendable arrows]
\RequirePackage{amsmath}
\RequirePackage{tikz-cd}
% 以下用 tikz 定义可伸缩箭头, 不用 amsmath 和 extarrows 的版本以免 unicode-math 产生问题. 代码借自 Antal Spector-Zabusky
% 重定义 \xrightarrow[below]{above}
\makeatletter
\newbox\xratbelow
\newbox\xratabove
\renewcommand{\xrightarrow}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [->, baseline=-.75ex]
\draw (0,0) -- node[below=-2pt] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
% 重定义 \xlefttarrow[below]{above}
\renewcommand{\xleftarrow}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [<-, baseline=-.75ex]
\draw (0,0) -- node[below] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
% 重定义 \xleftrightarrow[below]{above}
\renewcommand{\xleftrightarrow}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [<->, baseline=-.75ex]
\draw (0,0) -- node[below] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
% 重定义 \xhookrightarrow[below]{above}, 使用 tikz-cd 的 hookrightarrow
\renewcommand{\xhookrightarrow}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [baseline=-.75ex]
\draw (0,0) edge[commutative diagrams/hookrightarrow] node[below] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
% 重定义 \xhooklefttarrow[below]{above}, 使用 tikz-cd 的 hookleftarrow
\renewcommand{\xhookleftarrow}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [baseline=-.75ex]
\draw (0,0) edge[commutative diagrams/hookleftarrow] node[below] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
% 重定义 \xmapsto[below]{above}, 使用 tikz-cd 的 mapsto
\renewcommand{\xmapsto}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [baseline=-.75ex]
\draw (0,0) edge[commutative diagrams/mapsto] node[below] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
% 定义 \xlongequal[below]{above}, 使用 tikz-cd 的等号
\newcommand{\xlongequal}[2][]{%
\setbox\xratbelow=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xratabove=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xratlen}{max(\wd\xratbelow, \wd\xratabove) + .6em}%
\mathrel{\tikz [baseline=-.75ex]
\draw (0,0) edge[commutative diagrams/equal] node[below] {\box\xratbelow}
node[above] {\box\xratabove}
(\xratlen,0) ;}}
\makeatother
\endinput
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。