Here is a pure LaTeX solution that uses \dashedleftarrow
from MnSymbol
, and makes it extendable with (shortened) minus signs, as usual for extendable accents. The new command to use is \odla{...}
, short for \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}
In the likely case you don't want to use MnSymbol
as your math font just to have the \dashedleftarrow
we use as a the arrow tip here, we can use this symbol like this:
\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}
OK, this is far from being perfect, but in some sense there is no perfectness on the route my answer you linked to. The problem is this: when we use the dashed arrow from MnSymbol
as the arrow tip of an extensible dashed arrow, this symbol defines the length of the dash as well as the gap between dashes. If you also want the extensible dashed arrow to have exactly the same length as one of the standard extensible arrows like \overrightarrow
, we have to compromise somewhere as not always an integral multiple of the (fixed) dashed pattern will match. So we will have uneven spaces somewhere.
\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}
\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}}}
\makeatletter
\newcommand{\topreleft}[1]{%
\vbox {\m@th\ialign{##\crcr
\topreleftfill \crcr
\noalign{\kern-\p@\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
\newcommand{\topreright}[1]{%
\vbox {\m@th\ialign{##\crcr
\toprerightfill \crcr
\noalign{\kern-\p@\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
%% fill with (short) minus signs
\def\topreleftfill{%
$\m@th%
\dashedleftarrowtip%
\mkern-1mu%
\xleaders\hbox{$\mkern2mu\shortbar\mkern-1mu$}\hfill%
\mkern1mu%
\shortbar%
\mkern0.5mu%
$}
\def\toprerightfill{%
$\m@th%
\mkern.5mu%
\shortbar%
\mkern-1mu%
\xleaders\hbox{$\mkern2mu\shortbar\mkern-1mu$}\hfill%
\mkern1mu%
\dashedrightarrowtip%
$}
%% put 4.0pt space above and 0.0pt below the tip
\def\dashedleftarrowtip{%
\raisebox{\z@}[4.0pt][0.0pt]{$\mathord{\dashedleftarrow}$}}
\def\dashedrightarrowtip{%
\raisebox{\z@}[4.0pt][0.0pt]{$\mathord{\dashedrightarrow}$}}
%% make the minus shorter to fit \dashedleftarrow
\def\shortbar{%
\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]
= \left[\toright{\Gg}\right] = \left[ \topreright{\Gg} \right].
\]
Dashed right arrow and left arrow should be of the same length and align:
\[%
\toprerightleft{\gc} = \topreleftright{\gc} = \torightpreleft{\gc} = \toleftpreright{\gc} = \toprerightpreleft{\gc} = \topreleftpreright{\gc} = \torightleft{\gc} = \torightleft{[\gc]}
\]
Left and right arrow should align and have the same length:
\[%
\toprerightpreleft{\gc} = \toprerightpreleft{\Gg}
\]
\bigskip
\[%
\topreright{\topreleft{x}} \quad \topreright{\topreleft{ab}} \quad \topreright{\topreleft{abc}} \quad \topreright{\topreleft{abcd}} \quad \topreright{\topreleft{abcde}}
\]
\[%
\topreleft{\topreright{x}} \quad \topreleft{\topreright{ab}} \quad \topreleft{\topreright{abc}} \quad \topreleft{\topreright{abcd}} \quad \topreleft{\topreright{abcde}}
\]
\end{document}
So there is still some perfectness to be desired. Since you wanted to know how to tweak the parameters, here is how it works. The vertical layout is determined by the arrow tips. The definition
\def\dashedleftarrowtip{%
\raisebox{\z@}[4.0pt][0.0pt]{$\mathord{\dashedleftarrow}$}}
says that thre is no space (0.0pt) below the arrow tip, and 4.0pt above. That way you can position the arrows and determine their distance when they are stacked. This also influences the size of the \left[...\right]
braces, as those encompass also the white space above the arrow.
The horizontal pattern is determined by
\def\topreleftfill{%
$\m@th%
\dashedleftarrowtip%
\mkern-1mu%
\xleaders\hbox{$\mkern2mu\shortbar\mkern-1mu$}\hfill%
\mkern1mu%
\shortbar%
\mkern0.5mu%
$}
Here, \mkern1mu
is a horizontal kerning space of length 1mu
=1/18\quad
. The \xleaders
command fills as much space as possible (\hfill
) with the pattern \hbox{$\mkern2mu\shortbar\mkern-1mu$}
, where the remaining space that can not be filled with another box is evenly distributed before, after and in between the repeated boxes.
Best Answer
Basic Solution:
Now sure exactly what problem you had with using
\rotatebox
, but it seems to work if used as\rotatebox{-90}{$\dashrightarrow$}
:Notes:
Depending on the actual application this might need to be raised vertically, and that can be down with
\raisebox
:If it is a binary/relational operator than you can enclose the symbol in
\mathbin{}/\mathrel{}
:Use
\mathchoice
to auto resize:As per Gonzalo Medina 's suggestion, to be able to use this for different math sizes such as in subscripts, you can use
\mathchoice
to ensure that the symbol also adjusts in size depending on the surrounding math environment:Code:
Use
\text{}
for auto resizing (and change size):egreg had provided a simpler way to get the same effect and that is by enclosing the symbol in
\text{}
, allows it to re size appropriately:Notes:
\scalebox
so that you can make the symbol smaller -- adjust the scale factor to suit.\raisebox{<length>}{}
.Code: