Straight math arrows
The problem is that your arrow doesn't scale appropriately, depending on the math style. Simply using \text
or \mathchoice
alleviates a little the situation, but leaves a problem with the arrow tip not scaling appropriately.
Here's a definition using \mathchoice
and a decoration, to be able to scale down the arrow tip appropriately. Perhaps some adjustments are still needed.
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
%Redefine \rightArrow
\newcommand\rightArrow{%
\mathchoice
{\mathrel{%
\tikz[baseline]
\draw[decoration={markings,mark=at position 1 with {\arrow[scale=0.88]{angle 90}}},postaction=decorate,yshift=0.75ex]
(0,0) -- (.95em,0);}%
}
{\mathrel{%
\tikz[baseline]
\draw[decoration={markings,mark=at position 1 with {\arrow[scale=0.88]{angle 90}}},postaction=decorate,yshift=0.75ex]
(0,0) -- (.95em,0);}%
}
{\mathrel{%
\tikz[baseline]
\draw[decoration={markings,mark=at position 1 with {\arrow[scale=0.6]{angle 90}}},postaction=decorate,yshift=0.43ex]
(0,0) -- (.65em,0);}\mkern1.8mu}
{\mathrel{%
\tikz[baseline]
\draw[decoration={markings,mark=at position 1 with {\arrow[scale=0.5]{angle 90}}},postaction=decorate,yshift=0.38ex]
(0,0) -- (.58em,0);}\mkern1.5mu}
}
\begin{document}
$x^2 - 2x + 1 = 0 \mathchar"3221 (x-1)^2 = 0 \mathchar"3221 x = 1$
$x^2 - 2x + 1 = 0 \rightArrow (x-1)^2 = 0 \rightArrow x = 1$
$\lim_{x\rightarrow 0}\quad A_{\lim_{x\rightarrow 0}}$
$\lim_{x\rightArrow 0}\quad A_{\lim_{x\rightArrow 0}}$
\end{document}
The problem is that the tikz definition you gave doesn't scale with the smaller math styles. To overcome that, we use the scalerel
package to scale (on the fly) the good normal-sized arrow to the same vertical extent as the original arrow that you are replacing, in the current math style.
\documentclass{minimal}
\usepackage{scalerel}
\usepackage{tikz}
\usetikzlibrary{arrows}
\let\svrightarrow\rightarrow
\newcommand{\TSrightarrow}{\mathbin{\tikz[baseline]\draw[arrows={-angle 90},yshift=0.75ex] (0,0) -- (.95em,0);}}
\renewcommand\rightarrow{\mathrel{\scalerel*{\TSrightarrow}{\svrightarrow}}}
\parindent 0pt
\begin{document}
$x^2 - 2x + 1 = 0 \svrightarrow (x-1)^2 = 0 \svrightarrow x = 1$\\~\\
$x^2 - 2x + 1 = 0 \rightarrow (x-1)^2 = 0 \rightarrow x = 1$\\~\\
\( \lim_{h\svrightarrow0}\frac{f(x+h)-f(x)}{h} \)\\~\\
\( \lim_{h\rightarrow0}\frac{f(x+h)-f(x)}{h} \)
\end{document}