The three different slashes all use the same glyph name slash in the PDF file. Therefore only one mapping can be set via feature \pdfgentounicode. The PDF format provides another feature ActualText that can be used with package accsupp. The example lets the normal slash untouched, it is mapped to U+002F via \pdfgentounicode/glyphtounicode.tex.
The other two are defined as macros. At some stage macros are necessary for accsupp, because it must put some markup in the PDF page contents stream before and after the glyph.
\documentclass{article}
\pdfgentounicode=1
\input{glyphtounicode}
\usepackage{accsupp}
\usepackage{nicefrac}
\usepackage{etoolbox}
% U+2215
\newcommand*{\mathdivide}{%
\ensuremath{%
\BeginAccSupp{method=hex,unicode,ActualText=2215}/\EndAccSupp{}%
}%
}
% U+2044
\newcommand*{\fractionslash}{%
\ensuremath{%
\BeginAccSupp{method=hex,unicode,ActualText=2044}/\EndAccSupp{}%
}%
}
% Patch nice frac macros to insert the right slashes
\makeatletter
\expandafter\patchcmd\csname \@backslashchar @UnitsUglyFrac \endcsname
{/}{\mathdivide}{%
\@latex@info@no@line{Successful patched \string\@UnitsUglyFrac}%
}{%
\@latex@error{Could not patch \string\@UnitsUglyFrac}%
}
\expandafter\patchcmd\csname \@backslashchar @UnitsNiceFrac \endcsname
{/}{\fractionslash}{%
\expandafter\patchcmd\csname \@backslashchar @UnitsNiceFrac \endcsname
{/}{\fractionslash}{%
\@latex@info@no@line{Successful patched \string\@UnitsNiceFrac}%
}{%
\@latex@error{Could not patch \string\@UnitsNiceFrac}%
}%
}{%
\@latex@error{Could not patch \string\@UnitsNiceFrac}%
}
\makeatother
\begin{document}
/ $a\mathdivide b$
\nicefrac{a}{b} $\nicefrac{a}{b}$
\end{document}

The result from copy and paste:
- "/ a∕b a⁄b a⁄b"
- "/ a\u2215b a\u2044b a\u2044b" (escape notation)
xpatchinstead ofetoolboxyou can more simply say\xpatchcmd{\@UnitsNiceFrac}{...}{...}{...}{...}– egreg Sep 20 '12 at 20:08nicefracis great. I was wondering whether there is a way to simply write/instead of defining a new macro\mathdivideusingaccsupp. The reason I suspect such a solution could be possible is that the hyphen-minus is somehow being treated in two different ways by (La)TeX depending on the mode, leading to two different pastable Unicode characters in the output. So there might be a way to patch/amend TeX internals? – Lover of Structure Sep 21 '12 at 17:55-) in the source; when it is in text mode it will paste as the "hyphen-minus", but when it is in math mode it will paste as the "minus sign". That means that LaTeX has a mechanism by which it treats the same input character in a way that leads to two different, context-dependent output pastings. The fact that both slashes look the same (assuming that they do) shouldn't be an obstacle in theory: perhaps one can define two characters generated by textmode-/and mathmode-/that look the same but paste differently. – Lover of Structure Sep 21 '12 at 22:31-in the text font the glyphhyphenand glyphminusin the math font. But for/you get in both cases the glyphslash. – Heiko Oberdiek Sep 21 '12 at 23:16