36

I would like to insert a \mu command to form $\mu$ m (micro meters) i.e. as a unit, not a variable.

This means I do not want \mu to be italic. However, LaTeX only accepts the \mu command in math-mode and therefore it appears in italic....

\mathrm{\mu} does not work.

Any ideas on how can to change this into a regular upright symbol?

38

It is better to use siunitx for units.

\documentclass{article}
\usepackage{libertine} 
\usepackage{siunitx}

\begin{document}
\begin{equation}
\SI{100}{\micro\meter}
\end{equation}

\end{document}

enter image description here

14

Without the great siunitx package, in this case you can also:

1) If you use xetex or luatex compilers, insert \usepackage{fontspec} in the preamble and simply write µ (altGr+m in Linux, Alt+230 in Windows).

2) If you use the pdflatex compiler:

  • Write \textmu{} if you load the textcomp package in the preample.

  • Write µ as above if you load both textcomp and inputenc with the uft8 option (but do not use fontspec with pdflatex). If you have some problem here, check that the file itself have really a UTF8 encoding. Add also some beautiful font, since the default mu is ugly.

Aside, note that text in math mode is not necessarily italic nor slanted text, depending of the font. A MWE with pdflatex showing the four mu styles:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
%\usepackage{fontspec} % for textex or luatex
\usepackage{palatino} % font to avoid the ugly default µ
\begin {document}
\obeylines
Four styles of \textmu:
100 µm    
100 \textsl{µ}m
100 \textit{µ}m
100 $\mu$m
\end{document}

MWE

3) Some fine \textmu variants are also provided by the textgreek package through the options cbgreek (default), euler and artemisia but note that the textcomp command have precedence. Fortunately, textgreek provide the alternative \textmugreek command in case you are using both packages. To avoid typing the command, you can make that µ character print \textmugreek instead \textmu adding this to the preamble:

\usepackage[artemisia]{textgreek}
\usepackage{newunicodechar}
\newunicodechar{µ}{\textmugreek}

4) Using babel with greek option you can also use \greektext m \latintext to obtain µ. You can also simplify this coding as above or by a simple macro:

\documentclass{article}
\usepackage[greek,english]{babel}
\usepackage{xspace
\newcommand{\micron}{\greektext m\latintext m\xspace}
\begin{document}
100 \micron
\end{document}

5) Use upgreek package and $\upmu$. This in a only math command but you can make your own \Mu command compatible with both math and text mode:

\documentclass[a4paper]{article}
\usepackage{upgreek,xspace}
\def\Mu{\ensuremath\upmu\xspace}
\begin{document}
Write \Mu in text or math mode because $\Mu\neq\mu$
\end{document}

6) The same as above but using txfonts package and $\muup$.

1

Just use \textmu (without $$ symbols), for instance: 2 \textmu m for 2 µm

  • This is included in the answer by Fran, which also explains which package you need to load. – Andrew Swann Sep 9 '16 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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