如何寫箭頭 xdashmapsto?

如何寫箭頭 xdashmapsto?

這是一個延續這個問題關於雙有理幾何所需的箭頭,其基本前提與這個問題關於xdashrightarrow等等

我需要一個類似的箭頭xmapsto,但mapsto箭頭是虛線的。我目前有

\def\dashmapsto{\mapstochar\dashrightarrow}

這給出了dashmapsto箭頭。如果我能和xdashmapsto它一起去的話,我會很喜歡它。

謝謝你盡你所能的幫助。

答案1

我只是將您引用的兩個答案結合起來,將 David 的技術應用於 Heiko 的代碼。功勞歸於他們。這是我對 Heiko 代碼的補充:

\newcommand\xdashmapsto[2][]{\mathrel{\mapstochar\xdashrightarrow[#1]{#2}}}

唯一的區別是要記住以與 所採用的相同方式使用參數\xdashrightarrow

\documentclass{article}
\usepackage{amsfonts}
\usepackage{amsmath}
\newcommand\xdashmapsto[2][]{\mathrel{\mapstochar\xdashrightarrow[#1]{#2}}}

\makeatletter
\newcommand*{\da@rightarrow}{\mathchar"0\hexnumber@\symAMSa 4B }
\newcommand*{\da@leftarrow}{\mathchar"0\hexnumber@\symAMSa 4C }
\newcommand*{\xdashrightarrow}[2][]{%
  \mathrel{%
    \mathpalette{\da@xarrow{#1}{#2}{}\da@rightarrow{\,}{}}{}%
  }%
}
\newcommand{\xdashleftarrow}[2][]{%
  \mathrel{%
    \mathpalette{\da@xarrow{#1}{#2}\da@leftarrow{}{}{\,}}{}%
  }%
}
\newcommand*{\da@xarrow}[7]{%
  % #1: below
  % #2: above
  % #3: arrow left
  % #4: arrow right
  % #5: space left 
  % #6: space right
  % #7: math style 
  \sbox0{$\ifx#7\scriptstyle\scriptscriptstyle\else\scriptstyle\fi#5#1#6\m@th$}%
  \sbox2{$\ifx#7\scriptstyle\scriptscriptstyle\else\scriptstyle\fi#5#2#6\m@th$}%
  \sbox4{$#7\dabar@\m@th$}%
  \dimen@=\wd0 %
  \ifdim\wd2 >\dimen@
    \dimen@=\wd2 %   
  \fi
  \count@=2 %
  \def\da@bars{\dabar@\dabar@}%
  \@whiledim\count@\wd4<\dimen@\do{%
    \advance\count@\@ne
    \expandafter\def\expandafter\da@bars\expandafter{%
      \da@bars
      \dabar@ 
    }%
  }%  
  \mathrel{#3}%
  \mathrel{%   
    \mathop{\da@bars}\limits
    \ifx\\#1\\%
    \else
      _{\copy0}%
    \fi
    \ifx\\#2\\%
    \else
      ^{\copy2}%
    \fi
  }%   
  \mathrel{#4}%
}
\makeatother

\begin{document}

\[ X \xdashmapsto{x} Y \xdashmapsto{\mathrm{longer}} Z 
\xdashmapsto[\mathrm{underset}]{\mathrm{longer}} W 
\]

\end{document}

在此輸入影像描述

如果發現箭頭後面的間距太大,可以用一個小的負空間重新定義它,如下所示

\newcommand\xdashmapsto[2][]{\mathrel{\mapstochar\xdashrightarrow[#1]{#2}\!}}

相關內容