# How to map unicode characters to math symbols?

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?

-
Welcome to TeX.sx! This seems a job for the newunicodechar package. Can you give a short example showing the "handful of symbols" you need? –  egreg Jan 31 '13 at 14:39

## 2 Answers

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}

-
I tried both. Both worked, but lualatex didn't like some other things about the doxygen output, so I chose the later. –  Jan Hudec Feb 1 '13 at 9:08

With the newunicodechar package you don't even need to hunt through tables of Unicode characters (this assumes pdflatex is used):

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{newunicodechar}
\usepackage{bm}

\newunicodechar{ɑ}{\alpha}
\newunicodechar{β}{\beta}
\newunicodechar{𝜶}{\bm{\alpha}}

\begin{document}
$ɑ + 𝜶 = β$
\end{document}


-
Thanks. I eventually used the raw \DeclareUnicodeCharacter as I see the codepoints in Vim anyway. –  Jan Hudec Feb 1 '13 at 9:10