TransWikia.com

Using Tikz arrow shapes in math mode of a article or book

TeX - LaTeX Asked on February 18, 2021

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.

3 Answers

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

letoldtoto
renewcommandto[1][1.4em]{tikz[baseline=-0.5ex, 
                                 shorten <=2pt, shorten >=2pt] draw[-latex] (0,0) -- (#1,0);}
begin{document}
$ato b$

$a oldto b$

end{document}

enter image description here

Correct answer by Zarko on February 18, 2021

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.

Answered by LSGQ on February 18, 2021

I think it's not so simple. Try

[a  to b c_{xto 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}
letoriginaltoto
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_{xoriginalto y_{zoriginalto 0}}]
[a  to b c_{xto y_{z to 0}}]
end{document}

enter image description here

Answered by Rmano on February 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP