1

For a document like

\documentclass{article}

\usepackage[T1]{fontenc}

\input glyphtounicode.tex
\input glyphtounicode-cmr.tex
\pdfgentounicode=1

\pagestyle{empty} % for quick CTRL+A
\begin{document}
  Some text and then $x$.

  Some text and then $\int_0^1 x$.
\end{document}

Trying to copy-paste yields

Some text and then x.
Some text and then ∫ 1
0
x.

Now, I guess the interval isn’t really properly expressible in plain text (unless it can be done through some funky Unicode composition), but I would not expect the result to be that bad – maybe ∫0 1 x? Is there something I can do for better results?

egreg
  • 1,121,712
timo_k
  • 15

1 Answers1

1

Run it with lualatex:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\pagestyle{empty}
\begin{document}
    Some text and then $x$.

    Some text and then $∫_0^1 x$.
\end{document}

enter image description here

  • Although the answer referred to in the “duplicate of question” might be interesting in the long term, this does exactly what I was looking for in the short term. – timo_k Sep 24 '17 at 12:28
  • Actually, fractions now seem to be out of order: $\int x\sin ax\;\mathrm{d}x = \frac{\sin ax}{a^2}-\frac{x\cos ax}{a}+C$ when copied gives ∫ x sin ax dx = sin ax − x cos ax + C a2 a but I guess sin ax / a2 - x cos ax / a + C would be too much to expect – timo_k Sep 24 '17 at 12:31