37

I'm using TeXnicCenter for Windows (7) and I'm a bloody beginner in everything that concerns LaTeX. I'm using the siunitx package for mathematical formulas and it works just fine... with one exception. The \micro (e.g. \si{\micro}) command doesn't work! It simply doesn't show the µ in the PDF file. I've tried to use \u as well without success. Does anybody know what the error could be?

doncherry
  • 54,637
Chris
  • 533

4 Answers4

43

I’ll throw this in here, as my search for a solution led me here, but my problem was another one.

Using XeTeX and Latin Modern, I found that the greek letter μ does not work. However, the Unicode micro sign μ does work.

Knowing that, I added \sisetup{math-micro=\text{µ},text-micro=µ}, and now all seems well.

To clarify, use

µ
MICRO SIGN
Unicode: U+00B5, UTF-8: C2 B5

and not

μ
GREEK SMALL LETTER MU
Unicode: U+03BC, UTF-8: CE BC

for great justice.

MWE for my setup (XeTeX on OS X):

\documentclass{standalone}
\usepackage{fontspec}
\usepackage{siunitx}
% Note that the sign must be
%  µ
%  MICRO SIGN
%  Unicode: U+00B5, UTF-8: C2 B5
% and \emph{not}
%  μ
%  GREEK SMALL LETTER MU
%  Unicode: U+03BC, UTF-8: CE BC
\sisetup{math-micro=\text{µ},text-micro=µ}

\begin{document}
Now you can \si\micro\ all the things.
\end{document}

MWE screenshot

nlogax
  • 531
  • 1
    Nice one! It would be great if you can provide a 10-20 lines of compilable LaTeX file with this working in action. We usually even put a screenshot of the resulting file to show the effect in action. – percusse May 08 '12 at 10:46
  • 3
    That is what I recommend in the manual :-) – Joseph Wright May 08 '12 at 10:55
  • 3
    @JosephWright When I copy the line from the manual, I get the greek letter. In fact, when I copy the one from my own document which is set up to use the micro sign, I also get the greek letter! Not sure why, but might be worth pointing out. :) – nlogax May 08 '12 at 11:26
  • 2
    @nlogax The document has to work with pdfLaTeX, so I can only use what is available there. I'm expecting people using XeLaTeX/LuaLaTeX to use their system character map application to sort this out. – Joseph Wright May 08 '12 at 11:50
  • I am running beamer under XeLaTex with UTF-8 coded input files under Windows (MikTeX). Including the \sisetup{math-micro=\text{µ},text-micro=µ} in the preamble does not work. For some reason it has to be included after the \begin{document}. – uwezi Sep 10 '13 at 13:53
  • Isn't the fonts setup at begin document, any thus earlier it will not know what \text{µ} is. (I do not use XeLaTeX, so this is just a guess). – daleif Sep 10 '13 at 14:22
  • Changing the documentclass in nlogax's answer to beamer works fine for me. You should ask a new question, providing a complete minimal working example (MWE). – Andrew Swann Sep 10 '13 at 15:02
16

Here is a MWE which compiles fine, using the command @daleif suggested

\documentclass[a4paper,final]{article}

\usepackage[T1]{fontenc}
\usepackage[]{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage[]{siunitx}
\usepackage{textcomp}

\begin{document}

  Greek letter \textmu{} in normal text.
  Greek letter µ in normal text.
  The unit for viscosity is \si{\micro\pascal}.
  Just the \si{\micro} is not a SI unit but it works anyway.
  Some number with unit \SI{51}{\micro\metre} lorem ipsum.
  A number with unit in a formula $\SI{123}{\micro\metre}$ dolor sit amet.

\end{document}

As shown in the example, use \si for just units and capital \SI for a value-with-unit-combination.
And if you want a plain µ in the text, you could also try the command \textmu which is made available by the package \usepackage{textcomp}

matth
  • 12,381
5

Depending on which engine and encoding you use, you can just write a literal μ. Or you can typeset it in math mode as a variable $\mu$. It depends on what use the μ has in your document.

If it is a quantifier then add the corresponding unit as daleif already pointed out in the comment.

Marco
  • 26,055
  • Thank you all, so the $\mu$ and the plain µ are both working. The \si{\micro\metre} doesn't :( The problem is that the two working methods return a µ. Is there a possibility to get a normal µ still? – Chris Nov 07 '11 at 20:37
  • If a plain µ yields a slanted µ, then it seems that your font simply doesn't have an upright µ. What is the result of $\mathup\mu$? – Marco Nov 07 '11 at 20:57
  • Again it returns only a µ. Is there no way to add an upright µ to my font? – Chris Nov 07 '11 at 21:58
  • You don't really want to add a glyph to your font. But nothing prevents you from defining a command that inserts an upright µ from another font. – Marco Nov 07 '11 at 22:02
  • Or you can use \DeclareUnicodeCharacter to automate this. Or see this or this – Marco Nov 07 '11 at 22:08
  • Thanks @Marco! How do i use the \DeclareUnicodeCharacter in the correct way? I found this in another thread but still don't get the proper result: \DeclareMathSymbol{a}{\mathalpha}{mymathvariables}{a}`. When i follow the instructions in your two links things get even worse and part of my text appears in greek although I'm sure i used greek only as the secondary language :( – Chris Nov 08 '11 at 15:03
0

Another solution is through the use of the "Babel" package + "Lualatex" as follows, this method defines the symbol as a greek letter: This answer is in accordance with the solution proposed by David Purton: Biblatex usage for multiple languages in same citation

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[bidi=basic,layout=lists.tabular]{babel}
% Define used languages
\babelprovide[import=en,language=Default]{english} % default language
\babelprovide[import=el]{polutonikogreek}
%Define fonts to be used corressponding to each language (Ordinary ttf fonts installed on your system)
\babelfont[english]{rm}{Times New Roman}
\babelfont[polutonikogreek]{rm}[Language=Default]{Palatino Linotype}

\begin{document}

\foreignlanguage{polutonikogreek}{μ} \\
OR\\

\begin{otherlanguage}{polutonikogreek}
μ \\
\end{otherlanguage}

OR\\
%The method below is not preferred as it only uses the font without language definition, also it can be used with babel or polyglyossia package:

\begingroup
   \newfontfamily\myfont[Numbers=OldStyle]{Palatino Linotype}
{\myfont μ}
\endgroup
OR\\
\selectlanguage{polutonikogreek}
μ
\end{document}

Silva
  • 743