Sunday, 2 June 2013

How to create dashed right arrow over symbol?

How to create dashed right arrow over symbol?

Recently I asked this question: Dashed left arrow over symbol
I needed to know how to put an dashed left arrow over a symbol. I received two answers, one of them used Tikz for this, other use pure LaTeX solution. I had problems with the Tikz-created arrow, so I went with the LaTeX solution. Solution worked great.
However, now I need to create the same arrow, only directing to the right.
I tried to modify (by trial and error) the code that I was provided by user mapf. But because I do not have good grip on what the commands mean, I am getting wierd results.
I managed to: 1) import dashed right arrow symbol from MnSymbol (symbol \dashedrightarrow, 96) 2) Define command \dashedrightarrowtip
I failed to: 1) Define command \odrafill.
I tried different ways, but the arrows were not aligned and the dashes did not appear correctly.
I added a picture that shows my "testing". I added text to the pictures to describe what are my expectations.

Here is the code I am using:
\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}

\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:
% http://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
  \noali

No comments:

Post a Comment