# Math mode in document title

The title of the LaTeX document I'm writing has some math-mode expressions. However, its font type does not match that in the rest of words, which are not in math-mode.

Example:

\documentclass[a4paper]{article}

\title{From $7-8$~$\mu$m}
\author{Baister}

\begin{document}
\maketitle
\end{document}


As you can see, "From" and "m" looks different than the rest of the letters.

I'm forced to use a concrete class (provided by a company), so that I can't use titlepage environment.

How can I solve this problem?

Thanks.

• The thing is, that in maths a bold face letter usually has a different meaning than a normal roman letter. So, you could live with the difference (i think this is \mcro\meter?, the m should be in math mode as well), make the whole title not in bold, or use package siunitx and let it take care of the font. – Johannes_B Feb 25 '15 at 16:24

You could \unslant the \mu, using Bruno's \slantbox described at Shear transform a "box". I also set the number range as 7--8 in text mode, since the math version of your MWE was typeset as seven minus eight.

\documentclass[a4paper]{article}
\def\slantvalue{0}
\newsavebox{\foobox}
\newcommand{\slantbox}[2][\slantvalue]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\def\unslant#1{\slantbox[-.25]{$#1$}}

\title{From 7--8~\unslant{\mu}m}
\author{Baister}

\begin{document}
\maketitle
\end{document}


There is also the upgreek package; however, its font may not match the underlying font either:

\documentclass[a4paper]{article}
\usepackage{upgreek}

\title{From 7--8~$\upmu$m}
\author{Baister}

\begin{document}
\maketitle
\end{document}


• It doesn't work. It shows the right boldface \mu letter, but its size is much smaller than the rest of the words. – baister Feb 26 '15 at 9:00
• @baister I don't know why that would be. Without seeing the actual code that you are using, the only thing I could suggest would be to alter the definition to \def\unslant#1{\slantbox[-.25]{#1}} and invoke it as, for example, \title{From 7--8~\unslant{\Huge$\mu$}m}. That would force the greek letter into the specified size. – Steven B. Segletes Feb 26 '15 at 11:04

If you can load the siunitx package, \SIrange{} might solve your problem. You can adjust the appearance with \sisetup{}, and the option detect-all will match the appearance to that of the surroundings.

\documentclass[a4paper]{article}
\usepackage{siunitx}
\sisetup{range-phrase=--,range-units=single,detect-all}

\title{\bfseries From \SIrange{7}{8}{\micro\meter}}
\author{Baister}
\begin{document}
\maketitle
\end{document}


• It doesn't work. From the point of view of font size and boldface, it shows "7-8 um" the same way as my original example. The problem is that the "7-8 um" size is much smaller than the rest of the words. What marks the difference is the \bfseries command, but it changes all the title style. – baister Feb 26 '15 at 8:57
• @baister I just put the \bfseries in there to demonstrate how the font will match the surrounding style/weight if you use the detect-all option in siunitx. If you remove it the appearance should match that in your document. Sorry for not making that more clear. – erik Feb 26 '15 at 15:16