0

I want to map math characters in my PDF output to Unicode characters. XeLaTeX already does this somewhat, but with very unsatisfactory results.

Just for comparison, consider the very simple example $\mathbb E[X] = \sum_x x p(x)$.

  1. As baseline, Plain PDFLaTeX gives:
E[X] =
P
x xp(x)
  1. PDFLaTeX + \usepackage[noTeX]{mmap} gives:
[] =
Σ︀
 ()
  1. Plain XeLaTeX gives:
E[X] =
Σ
x xp(x)

4 Finally, XeLaTeX + \usepackage{unicode-math} gives:

[] = Σ ()

However, I want to avoid unicode-math due to its font management issues (see here and its related questions). Is there any way I can get behavior in 2 and 4 in XeLaTeX without changing math fonts?

Mygod
  • 163
  • You want something like https://tex.stackexchange.com/questions/119713/. They are very difficult. So have fun. – Symbol 1 Apr 05 '20 at 03:13
  • I don't think that xetex has something comparable to pdfgentounicode. Use unicode-math, if you care about copy and paste. – Ulrike Fischer Apr 05 '20 at 07:56
  • @Symbol1 I do not think so. I am trying to map math characters to Unicode math characters, not map them to LaTeX source. – Mygod Apr 06 '20 at 00:20
  • @UlrikeFischer As I mentioned in the question, I want to avoid unicode-math; or do you know how to switch off its main functionalities (font mappings) and only keep the character mapping? – Mygod Apr 06 '20 at 00:20
  • No, as I already wrote: imho xetex has nothing comparable to pdfgentounicode. So either you use a proper unicode math font, or you accept the problems of the type1 math fonts. – Ulrike Fischer Apr 06 '20 at 10:33

1 Answers1

0

mmap uses \pdfglyphtounicode to map the glyphs. xetex to my knowledge doesn't support it, but with lualatex you can use it. As mmap doesn't support lualatex by default you have to map a number of command names to the names of luatex with the luatex845 package:

\documentclass{book}
\usepackage{amssymb}
\usepackage{luatex85}
\usepackage[noTeX]{mmap}
\begin{document}
$\mathbb E[X] = \sum_x x p(x)$
\end{document}
Ulrike Fischer
  • 327,261
  • This works but gives a warning at \begin{document} line: !!! No .cmap file found for TU !!!. Why is that? – Mygod Apr 07 '20 at 14:14
  • As I wrote mmap is not really meant for luatex, it gets a bit confused about the default font encoding. You could ask the the author to improve the luatex support. – Ulrike Fischer Apr 07 '20 at 14:20