我熟悉 和\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}