Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

2 Answers

up vote 9 down vote accepted

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}
share|improve this answer
    
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
add comment

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

share|improve this answer
    
Thanks. I eventually used the raw \DeclareUnicodeCharacter as I see the codepoints in Vim anyway. –  Jan Hudec Feb 1 '13 at 9:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.