# Copy and paste unicode math

Consider the following example compiled with luatex.

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\begin{document}
$A_1$
\end{document}


Since Latin Modern Math is a unicode math font, I though I could copy and paste from the resulting .pdf file the two corresponding unicode characters:

u+1d434 (mathematical italic capital a)
u+2081 (subscript one)


I'd like to get: 𝛢₁

But it does not work with evince as my viewer and emacs as my editor. emacs correctly displays 𝛢₁ when copy pasted from a web page

Note that u+2081 (subscript one) does not appear in unimath-symbols.pdf.

So is | would | will it be possible to copy and paste unicode math from a luatex-generated .pdf ? If the answer is yes, how complex can the mathematical expression be?

• In TeX $A_1$ does not involve the subscript one character. TeX works with boxes and thus places a 1 from the scriptsize font in a box and lowers it below the baseline. – Henri Menke May 15 '16 at 9:48
• Subscripts are implemented by switching to a smaller font, not by switching the symbol -- after all you could want all sorts of characters in the subscripts. Beside this: Simple copy & paste can't reliable reproduce math expressions. See e.g. $A_{1^2}$ versus $A_1^2$. – Ulrike Fischer May 15 '16 at 9:48
• @UlrikeFischer Ok so there is no invisible information stored within the .pdf file for OpenType math fonts. I'll stick with Heiko's answer. – cjorssen May 15 '16 at 11:03

In principle you could do something like this, based on Heiko's answer:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{accsupp}
\DeclareUnicodeCharacter{2081}{\ensuremath{_{\BeginAccSupp{method=hex,unicode,ActualText=2081}1\EndAccSupp{}}}}%
\begin{document}
$A₁$
\end{document}


Unfortunately, this does not work because some component in the chain (accsupp, LaTeX, or the PDF reader) thinks itself smart and turns the subscript ₁ into a regular 1. This happens both with Evince and Okular on my machine.

EDIT: The PDF reader sems to be at fault. When I search for A1 in Evince, the search bar result correctly shows A₁, but copying the text yields A 1.