3

I want to change the arrow in the math mode, \to, into the arrow shape drawn by the tikz package. In fact, when I want to use \to, I want to replace the following arrow

enter image description here

with

enter image description here

The arrows plotted by tikz, as all of you know, may be obtained from

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,arrows,matrix,shapes.multipart}

\begin{document}

\begin{tikzpicture}[node distance=1cm and 1.5cm,
arrow/.style={
  -latex',
 shorten >= 3pt,
  shorten <= 3pt,
}
]

\draw[arrow]
  (0,0) -- (1,0);        
\end{tikzpicture}

\end{document}

It is obvious that the length of the arrow is not important and it may change.

4
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\let\oldto\to
\renewcommand\to[1][1.4em]{\tikz[baseline=-0.5ex, 
                                 shorten <=2pt, shorten >=2pt] \draw[-latex] (0,0) -- (#1,0);}
\begin{document}
$a\to b$

$a \oldto b$

\end{document}

enter image description here

2

I think it's not so simple. Try

\[a  \to b c_{x\to y_{z \to 0}}\]

My proposal is to use the picture mode arrow as suggested by @LSGQ but using \matchoice to adapt the size, and using \mathop to obtain the correct spacing; clearly if you prefer TikZ arrows you can adapt @Zarko's solution as well.

\documentclass{article}
\usepackage{pict2e}
\usepackage{graphicx}
\let\originalto\to
\newcommand{\sizedarrow}[2]{\raisebox{#2ex}{\scalebox{#1}{\vector(1,0){1em}}}}
\newcommand{\arrowto}{\mathchoice
    {\sizedarrow{1}{0.5}}%
    {\sizedarrow{0.8}{0.4}}%
    {\sizedarrow{0.6}{0.35}}%
    {\sizedarrow{0.5}{0.3}}%
}
\renewcommand{\to}{\mathop{\arrowto}}
\begin{document}
\[a \originalto b  c_{x\originalto y_{z\originalto 0}}\]
\[a  \to b c_{x\to y_{z \to 0}}\]
\end{document}

enter image description here

1

If you only need horizontal arrows, you don't need to load any packages, base LaTeX is enough:

\renewcommand{\to}{\raisebox{.5ex}{\ \vector(1,0){.5cm}\ }}

(in fact, is good old pict package). You can adjust length and math spacing. Works in math mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.