8

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?

Jan Hudec
  • 183
  • 5

2 Answers2

10

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}
Ulrike Fischer
  • 327,261
  • 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 01 '13 at 09:08
10

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}

enter image description here

egreg
  • 1,121,712