1

I'm trying to find an easy way to have a right (or left) arrow with a full tip. I need it in sentences like press "A" → "B" → "C" or better a full arrow. the amsmath shows the funny curly arrows
$\rightarrow$

is there an easy way to get a "nicer" arrow without getting into tikz, since in plain sentences thta's not really working

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

1 Answer 1

1

You can create one with an assemblage of - and \blacktriangleright from the package amssymb, using \mathrel and \joinrel to handle the spacing

\newcommand*{\myrightarrow}{$\mathrel{-}\joinrel\mathrel{\blacktriangleright}$}

But the arrow head is too big. If you shrink it, a \vcenter is needed to align the triangle on the math axis. So something like this should work

\makeatletter
\newcommand*{\myrightarrow}{%
  $\mathrel{-}\joinrel\mathrel{%
    \vcenter{\hbox{\fontsize{\fpeval{\f@size*0.35}}{0}$\blacktriangleright$}}
  }$
}
\newcommand*{\myleftarrow}{%
  $\mathrel{%
    \vcenter{\hbox{\fontsize{\fpeval{\f@size*0.35}}{0}$\blacktriangleleft$}}
  }\joinrel\mathrel{-}$
}
\makeatother

The current font size (given by \f@size) is scaled by a factor 0.35; the commands \makeatletter and \makeatother are needed to handle the char @ in macro names. Note that this produces warnings about not available font sizes. You can suppress them with unicode-math (LuaLaTex or XeLaTeX).

Full example:

\documentclass{article}

\usepackage{amssymb}
\usepackage{unicode-math}

\makeatletter
\newcommand*{\myarrow}{$\mathrel{-}\joinrel\mathrel{\blacktriangleright}$}
\newcommand*{\myrightarrow}{%
  $\mathrel{-}\joinrel\mathrel{%
    \vcenter{\hbox{\fontsize{\fpeval{\f@size*0.35}}{0}$\blacktriangleright$}}
  }$
}
\newcommand*{\myleftarrow}{%
  $\mathrel{%
    \vcenter{\hbox{\fontsize{\fpeval{\f@size*0.35}}{0}$\blacktriangleleft$}}
  }\joinrel\mathrel{-}$
}
\makeatother

\begin{document}

press "A" \myrightarrow{} "B" \myleftarrow{} "C"

{\Huge press "A" \myrightarrow{} "B" \myleftarrow{}  "C"}

{\tiny press "A" \myrightarrow{} "B" \myleftarrow{}  "C"}

\end{document}

arrows made by symbol assemblage

By the way, TikZ also works inline:

\documentclass{article}

\usepackage{tikz}

\makeatletter
\newlength{\myarrowunit}
\newcommand{\tikzrightarrow}{%
  \setlength{\myarrowunit}{\f@size pt}
  \tikz[baseline, yshift={0.3\myarrowunit}]
  \draw[-latex, line width={0.06\myarrowunit}]
  (0,0) -- (1.5\myarrowunit,0) ;%
}
\makeatother


\begin{document}

press "A" \tikzrightarrow{} "B" \tikzrightarrow{}  "C"

{\Huge press "A" \tikzrightarrow{} "B" \tikzrightarrow{}  "C"}

{\tiny press "A" \tikzrightarrow{} "B" \tikzrightarrow{}  "C"}

\end{document}

with tikz

and also latex picture environment:

\documentclass{article}

\usepackage{pict2e}

\makeatletter
\newcommand{\picrightarrow}{%
  \setlength{\unitlength}{\f@size pt}
  \begin{picture}(1.5,1)%
    \linethickness{0.06\unitlength}%
    \put(0,0.3){\vector(1,0){1.5}}
  \end{picture}%
}
\makeatother

\begin{document}

press "A" \picrightarrow{} "B" \picrightarrow{}  "C"

{\Huge press "A" \picrightarrow{} "B" \picrightarrow{}  "C"}

{\tiny press "A" \picrightarrow{} "B" \picrightarrow{}  "C"}

\end{document}

with picture environment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .