5

It is really strange, but LaTeX doesn't seem to include any tag for an arrow with vertical stroke (unicode character 21F8), used in mathematics to represent a partial function between sets (as reported in this article from Wiki.en). Do you know any workaround to this? I tried something like

\newcommand{\pto}{\to\hspace{-xyz cm}\shortmid \hspace{xyz cm}}

(for different values of xyz) but the outcome is not very satisfactory. Thank you in advance for any help.

P.S.: the symbol should fit in mathematical equations.

6

You may want to use \pfun in package oz as listed in the overview here.

  • 1
    Great! I didn't know that package before, thank you too. – s.t. Mar 7 '12 at 16:20
  • 2
    Small warning to any users who use this approach. When I imported the oz package to use \pfun, for some reason it replaced some of my other math symbols. For example where I had an integral using \int it was rendered as the set intersection symbol instead! I used the other solution by egreg and redefined the \pfun command myself. – jbx Nov 29 '13 at 0:51
13

Here's a possible way

\newcommand\pto{\mathrel{\ooalign{\hfil$\mapstochar$\hfil\cr$\to$\cr}}}

Note that the definition of oz.sty is equivalent to

\newcommand\pfun{\mathrel{\ooalign{\hfil$\mapstochar\mkern5mu$\hfil\cr$\to$\cr}}}

so it differs from the former only by a slight shift to the left of the bar.


A complete and better implementation using also the shift in oz.sty; this one works also in subscripts and superscripts.

\documentclass{article}

\makeatletter
\newcommand{\pto}{}% just for safety
\newcommand{\pgets}{}% just for safety

\DeclareRobustCommand{\pto}{\mathrel{\mathpalette\p@to@gets\to}}
\DeclareRobustCommand{\pgets}{\mathrel{\mathpalette\p@to@gets\gets}}

\newcommand{\p@to@gets}[2]{%
  \ooalign{\hidewidth$\m@th#1\mapstochar\mkern5mu$\hidewidth\cr$\m@th#1\to$\cr}%
}
\makeatother

\begin{document}

$A\pto B\pgets C$

$\scriptstyle A\pto B\pgets C$

\end{document}

enter image description here

  • Note for latex newbies, you need to copy this definition somewhere, and then you can use it in maths expressions like $\pfun$ – rleelr Jul 3 '17 at 21:27
  • @rleelr Back then the style was different. I took the occasion for improving the answer. Thanks for noting. – egreg Jul 3 '17 at 21:38
5

With unicode-math package (requires XeTeX or LuaTeX) and a proper Unicode math font, you can access that Unicode arrow (and a gazillion of other Unicode math symbols):

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITS Math}

\begin{document}
$\nvrightarrow$
\end{document}
0

You can use Unicode: \char"21F8

enter image description here

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.