如何向上画出左、右鱼叉?

如何向上画出左、右鱼叉?

我熟悉 和\leftharpoonup\rightharpoonup它们是\leftarrow和 的补充\rightarrow。还有\leftrightarrow,但奇怪的是,没有\leftrightharpoonup

我实现了一个非常丑陋的黑客程序,效果很好,但我对更好的方法很感兴趣。对我目前的方法的批评:1)由于黑客行为而似乎“不合适”2)符号在中间显得太粗。在图片中,您可以稍微看到,它太粗显然是两个符号的粘贴。

鱼叉

代码:

\documentclass{article}
\usepackage{mathtools}
\pagestyle{empty}
% Usage:  \phantomword[c]{hiddenmath}{shownmath}
%
% The hidden text defines the box size.
% The shown text is placed inside the box.
% The optional argument is the alignment: l,c,r
\MHInternalSyntaxOn
% Using mathpalette requires more shuffling of arguments
\providecommand*\phantomword[3][c]{%
  \mathchoice
  {\MT_phantom_word:NNnn #1\displaystyle {#2}{#3}}%
  {\MT_phantom_word:NNnn #1\textstyle {#2}{#3}}%
  {\MT_phantom_word:NNnn #1\scriptstyle {#2}{#3}}%
  {\MT_phantom_word:NNnn #1\scriptscriptstyle {#2}{#3}}%
}
\def\MT_phantom_word:NNnn #1#2#3#4{%
  \@begin@tempboxa\hbox{$\m@th#2#4$}%
% can't use \settowidth as that also uses \@tempboxa...
    \setlength\@tempdima{\widthof{$\m@th#2#3$}}%
    \hbox{\hb@xt@\@tempdima{\csname bm@#1\endcsname}}%
  \@end@tempboxa}
\MHInternalSyntaxOff

\newcommand{\leftrightharpoonup}{%
    \mathrlap{\leftharpoonup}%
    \phantomword[l]{\,\leftharpoonup}{\,\rightharpoonup}%
}

\begin{document}
$$
\begin{matrix}
    \leftharpoonup & \leftrightharpoonup & \rightharpoonup \\
    \leftarrow  & \leftrightarrow & \rightarrow
\end{matrix}
$$
\end{document}

答案1

我不确定这些命令的作用,但有一个更简单的解决方案:只需将测量留给 TeX。

\documentclass{article}
\usepackage{amsmath,amssymb}
\newcommand{\leftrightharpoonup}{%
  \mathrel{\mathpalette\lrhup\relax}%
}
\newcommand{\lrhup}[2]{%
  \ooalign{$#1\leftharpoonup$\cr$#1\rightharpoonup$\cr}%
}

\begin{document}
\[
\begin{matrix}
\leftharpoonup & \leftrightharpoonup & \rightharpoonup \\
\leftarrow     & \leftrightarrow     & \rightarrow
\end{matrix}
\]
\end{document}

在此处输入图片描述

如果要非常确定\mathsurround不为零,则代码\lrhup应该是

\makeatletter
\newcommand{\lrhup}[2]{%
  \ooalign{$\m@th#1\leftharpoonup$\cr$\m@th#1\rightharpoonup$\cr}%
}
\makeatother

答案2

作为对略有不同的问题(已关闭)的回答,这里是 \dblrightarrow基于\rightharpoonup以下内容的mathabx

\documentclass{article}
\usepackage{mathtools}
\newcommand{\te}[1] {\overleftrightarrow{\mkern-1mu#1\mkern1mu}}

\DeclareFontFamily{U}{matha}{\hyphenchar\font45}
\DeclareFontShape{U}{matha}{m}{n}{ <-6> matha5 <6-7> matha6 <7-8>
matha7 <8-9> matha8 <9-10> matha9 <10-12> matha10 <12-> matha12 }{}
\DeclareSymbolFont{matha}{U}{matha}{m}{n}
%
\DeclareMathSymbol{\abxrightharpoonup}{\mathrel}{matha}{"E1}
\newcommand{\dblrightharpoon}{\mathrel{\mathrlap{\abxrightharpoonup}\mkern-1.7mu\abxrightharpoonup}}

\begin{document}

    \[ A \dblrightharpoon B \]

\end{document} 

在此处输入图片描述

相关内容