我想将虚线左箭头放在符号上方。
虚线左箭头如下所示:
$x \dashedleftarrow y$
我希望箭头位于符号 $x$ 上方,就像
$\overleftarrow{x}$
,仅虚线。
我尝试搜索,但只找到以下内容: “断裂”箭头符号
我在“综合 LaTeX 符号列表”中没有找到它,并且由于显而易见的原因,DeTexify 在这里不起作用(它只能给我虚线左箭头,但不能给我虚线左箭头符号)。
编辑:读自http://ctan.vgtu.lt/info/symbols/comprehensive/symbols-a4.pdf,有用于定义向量的包 esvect,但它没有帮助,因为它只允许选择某些向量样式。
EDIT2:“extpfeil”包可能会有帮助: http://ctan.vgtu.lt/macros/latex/contrib/extpfeil/README
应该是三个符号(单个标记或 {} 组)的列表,给出(按此顺序): - 箭头的左端 - 箭头的中间部分(将被乘以,主要是 \relbar 或 \Relbar) - 箭头的右端。
但是中间部分应该是什么呢?我以前很少使用宏,这让我有点困惑。
EDIT3:我最终使用了 mapf 的答案,因为我遇到了 Gonzalo 的答案的渲染问题。
现在我发现我也需要一个虚线右箭头。
我弄乱了 mapf 答案中的参数以找出它的工作原理。我尝试反转左虚线箭头定义中的参数,但得到了奇怪的结果 :)
Mapf,也许你可以解释一下这些参数的含义?
这是最小的例子和我现在遇到的问题:
\documentclass[12pt,a4paper,draft]{article}
\pagestyle{plain}
\usepackage[estonian]{babel}
\usepackage[a4paper]{geometry}
\usepackage{hyphenat}
\usepackage{enumerate}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{indentfirst}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{color}
\usepackage{tikz}
% =============================================
%Import symbol "\dashedleftarrow" from font MnSymbol without importing the whole package
% =============================================
\DeclareFontFamily{U} {MnSymbolA}{}
\DeclareFontShape{U}{MnSymbolA}{m}{n}{
<-6> MnSymbolA5
<6-7> MnSymbolA6
<7-8> MnSymbolA7
<8-9> MnSymbolA8
<9-10> MnSymbolA9
<10-12> MnSymbolA10
<12-> MnSymbolA12}{}
\DeclareFontShape{U}{MnSymbolA}{b}{n}{
<-6> MnSymbolA-Bold5
<6-7> MnSymbolA-Bold6
<7-8> MnSymbolA-Bold7
<8-9> MnSymbolA-Bold8
<9-10> MnSymbolA-Bold9
<10-12> MnSymbolA-Bold10
<12-> MnSymbolA-Bold12}{}
\DeclareSymbolFont{MnSyA} {U} {MnSymbolA}{m}{n}
\DeclareMathSymbol{\dashedleftarrow}{\mathrel}{MnSyA}{98}
\DeclareMathSymbol{\dashedrightarrow}{\mathrel}{MnSyA}{96}
\def\Gg{{\mathbf{G}}}
\def\gc{{\mathbf{g}}}
\newcommand{\toright}[1]{\overrightarrow{#1}}
\newcommand{\toleft}[1]{\overleftarrow{#1}}
\newcommand{\torightleft}[1]{\toleft{\toright{#1}}}
\newcommand{\toprerightleft}[1]{\toleft{\topreright{#1}}}
\newcommand{\torightpreleft}[1]{\topreleft{\toright{#1}}}
\newcommand{\toprerightpreleft}[1]{\topreleft{\topreright{#1}}}
\newcommand{\toleftright}[1]{\toright{\toleft{#1}}}
\newcommand{\topreleftright}[1]{\toright{\topreleft{#1}}}
\newcommand{\toleftpreright}[1]{\topreright{\toleft{#1}}}
\newcommand{\topreleftpreright}[1]{\topreright{\topreleft{#1}}}
% =============================================
% How to make dashed left arrow over symbol:
% https://tex.stackexchange.com/questions/114501/dashed-left-arrow-over-symbol
% =============================================
\makeatletter
\newcommand{\topreleft}[1]{%
\vbox {\m@th\ialign{##\crcr
\odlafill \crcr
\noalign{\kern-\p@\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
\newcommand{\topreright}[1]{%
\vbox {\m@th\ialign{##\crcr
\odrafill \crcr
\noalign{\kern-\p@\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
%% fill with (short) minus signs
\def\odlafill{%
$\m@th\dashedleftarrowtip\mkern-5mu\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill\mkern-0.5mu$}
% $\m@th\mkern0mu\dashedleftarrowtip\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill$}
%% fill with find (short) minus signs
\def\odrafill{%
$\m@th\mkern-5mu\cleaders\hbox{$\mkern-3mu\shortbar\mkern4mu$}\hfill\mkern-0.5mu\dashedrightarrowtip$}
%$\m@th\mkern-0.5mu\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill\mkern-5mu\dashedrightarrowtip$}
%$\m@th\dashedrightarrowtip\mkern-5mu\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill\mkern-0.5mu$}
%$\m@th\mkern0mu\dashedrightarrowtip\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill$}
%% put 2pt space above and below the tip
\def\dashedleftarrowtip{%
\raisebox{\z@}[5pt][1pt]{$\mathord{\dashedleftarrow}$}}
%% put 2pt space above and below the tip
\def\dashedrightarrowtip{%
\raisebox{\z@}[5pt][1pt]{$\mathord{\dashedrightarrow}$}}
%% make the minus shorter to fit \dashedleftarrow
\def\shortbar{%
% \smash{\scalebox{1}[1.0]{$-$}}}
\smash{\scalebox{0.4}[1.0]{$-$}}}
\makeatother
% =============================================
\begin{document}
Arrow over G should fit nicely into the brackets:
$\left[\toleft{\Gg}\right] = \left[ \topreleft{\Gg} \right].$
Dashed right arrow and left arrow should be of the same length:
$\toprerightleft{\gc}$
Left and right arrow are misaligned:
$\toprerightpreleft{\gc}$
Just for comparison:
$\torightleft{[\gc]}$
Both dashed arrows should be of the same length and align:
$\topreright{\topreleft{\Gg}}$
\end{document}
答案1
这是一个纯 LaTeX 解决方案,它使用\dashedleftarrow
,MnSymbol
并使其可以使用(缩短的)减号进行扩展,就像通常的可扩展重音符号一样。要使用的新命令是\odla{...}
,是 的缩写\overdashedleftarrow
。
\documentclass{article}
\usepackage{graphicx}
\usepackage{MnSymbol}
\makeatletter
\newcommand{\odla}[1]{%
\vbox {\m@th\ialign{##\crcr
\odlafill \crcr
\noalign{\kern-\p@\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
%% fill with (short) minus signs
\def\odlafill{%
$\m@th\dashedleftarrowtip\mkern-5mu\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill\mkern-0.5mu$}
%% put 2pt space above and below the tip
\def\dashedleftarrowtip{%
\raisebox{\z@}[2pt][2pt]{$\mathord{\dashedleftarrow}$}}
%% make the minus shorter to fit \dashedleftarrow
\def\shortbar{%
\smash{\scalebox{0.4}[1.0]{$-$}}}
\makeatother
\begin{document}
\begin{equation*}
\odla{x} \quad \odla{ab} \quad \odla{abc} \quad \odla{abcd} \quad \odla{abcde} \quad \odla{a}^{\:\odla{b}} \quad \odla{abcdefghijklmnop}
\end{equation*}
\end{document}
在可能的情况下,您不想使用它MnSymbol
作为数学字体,而只是想\dashedleftarrow
在这里使用它作为箭头提示,我们可以像这样使用此符号:
\documentclass{article}
\usepackage{graphicx}
\DeclareFontFamily{U}{MnSymbolA}{}
\DeclareSymbolFont{MnSyA}{U}{MnSymbolA}{m}{n}
\DeclareFontShape{U}{MnSymbolA}{m}{n}{
<-6> MnSymbolA5
<6-7> MnSymbolA6
<7-8> MnSymbolA7
<8-9> MnSymbolA8
<9-10> MnSymbolA9
<10-12> MnSymbolA10
<12-> MnSymbolA12}{}
\DeclareMathSymbol{\dashedleftarrow}{\mathrel}{MnSyA}{98}
\makeatletter
\newcommand{\odla}[1]{%
\vbox {\m@th\ialign{##\crcr
\odlafill \crcr
\noalign{\kern-\p@\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
%% fill with (short) minus signs
\def\odlafill{%
$\m@th\dashedleftarrowtip\mkern-5mu\cleaders\hbox{$\mkern4mu\shortbar\mkern-3mu$}\hfill\mkern-0.5mu$}
%% put 2pt space above and below the tip
\def\dashedleftarrowtip{%
\raisebox{\z@}[2pt][2pt]{$\mathord{\dashedleftarrow}$}}
%% make the minus shorter to fit \dashedleftarrow
\def\shortbar{%
\smash{\scalebox{0.4}[1.0]{$-$}}}
\makeatother
\begin{document}
\begin{equation}
\odla{x} \quad \odla{ab} \quad \odla{abc} \quad \odla{abcd} \quad \odla{abcde} \quad \odla{a}^{\:\odla{b}} \quad \odla{abcdefghijklmnop}
\end{equation}
\end{document}
答案2
也许有点过头了,但你可以借助 TikZ 来定义你的箭头:
\documentclass{article}
\usepackage{tikz}
\newcommand\overdarrow[1]{%
\begin{tikzpicture}[baseline=(arg.base)]
\node[inner xsep=0pt] (arg) {$#1$};
\draw[densely dashed,dash pattern=on 2pt off 1.5pt,->,shorten >= 0.5pt] (arg.north east) -- (arg.north west);
\end{tikzpicture}%
}
\begin{document}
$a + \overdarrow{LC} = \overdarrow{x} + z$
\end{document}
为了在箭头应用于单个小字符时获得虚线图案,也许您可以尝试不同的虚线图案:
\documentclass{article}
\usepackage{tikz}
\newcommand\overdarrow[1]{%
\begin{tikzpicture}[baseline=(arg.base)]
\node[inner xsep=0pt] (arg) {$#1$};
\draw[densely dashed,dash pattern=on 1pt off 1pt,->,shorten >= 0.5pt] (arg.north east) -- (arg.north west);
\end{tikzpicture}%
}
\begin{document}
$a + \overdarrow{x} = \overdarrow{xy} + z = \overdarrow{ABC}$
\end{document}