8

I've tried using \usepackage[utf8]{inputenc}, but that throws an error:

Package inputenc Error: Unicode char µ (U+B5)
(inputenc)                not set up for use with LaTeX.

Whatever I do, unicode character in the source either do not appear, or do not appear and throw an error. I would like to use both Russian and mathematical symbols in my source code.

How can I do this?

4
  • 4
    I think the least troublesome solution would be using a unicode egine like XeTeX or LuaTeX with an appropriate font.
    – Johannes_B
    Oct 1, 2017 at 14:33
  • are you planning onto using µ in math mode too?
    – user4686
    Oct 1, 2017 at 15:50
  • @jfbu: Yes. I find it easier to read the source when it looks somewhat like the output.
    – Zaz
    Oct 1, 2017 at 16:05

1 Answer 1

6

Probably this will miss more complex scenarios, but from here:

%%
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\DeclareUnicodeCharacter{B5}{\ifmmode\mu\else\textmu\fi}
%
% use http://shapecatcher.com/ to find the char
% or https://w3c.github.io/xml-entities/unicode-names.html

\begin{document}

This is a textmode µ and this a math mode one: $µ_µ$.

\end{document}

Output from above

If you do not want to define everything, you need to switch to a native unicode TeX engine, like for example xelatex. If you compilte with xelatex the following code:

%%
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
%
% use http://shapecatcher.com/ to find the char
% or https://w3c.github.io/xml-entities/unicode-names.html

\begin{document}

Is the character ẁ used in some language?

This is a textmode µ and this a math mode one: $𝜇_𝜇$. 
(But be careful, math mu is a different unicode codepoint,
\texttt{1D707}.)

\end{document}

to obtain:

enter image description here

Where I am using the unicode-math package; I found the mathmode µ codepoint at shapcatcher.

4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .