[Tex/LaTex] How to map unicode characters to math symbols

math-modeunicodeunicode-math

I have documentation with some mathematics, that I want to convert via LaTeX, but I'd also like to keep it as much readable in source as possible (as it's more for me than anybody else). Since I can write many mathematical symbols directly with digraphs in vim and they show correctly in fonts I use, I would like to use them instead of the TeX commands. There is a package unicode-math that is supposed to do it, but it would need lualatex and does not work anyway (bug report).

Now I am really using just a handful of symbols. Is it possible, and if it is, how, to map the characters I want to use manually? I have looked at the inputenc documentation, but couldn't make much sense of it and didn't notice relevant examples. Or, alternatively, can I workaround the bug somehow?

Best Answer

Getting around the bug is easy: Add \setmathfont{lmodern-math.otf} after loading unicode-math. Btw: unicode-math can also be used with xelatex.

And if you want to declare definitions for utf8-input you can do it like this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{222B}{\int}%U+222B= integral
\begin{document}
$∫f(x)$
\end{document}