# Greek characters inside \mathrm and \mathbf cause garbled output

Within a TeX file, the author coded the Greek characters inside the \mathrm and \mathbf as shown below:

$\mathrm{4 km\cdot (0,157+j 0,072)\omega/km}$


When I use the mtpro2 package, I obtain the below garbled output for the Greek characters:

Is possible to get the correct rendered output?

MWE

\documentclass[numbers]{book}

\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{mtpro2}

\begin{document}
without \verb+\mathrm  -->+

$\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu$ \bigskip

with \verb+  \mathrm  -->+

$\mathrm{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}$\bigskip

with \verb+  \mathbf  -->+

$\mathbf{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}$

\end{document}

• Sorry, what's the roman version of a greek character? And you can make the greek characters bold with \boldsymbol. – marmot Jun 7 '18 at 3:01
• @marmot yes we can use it \boldsymbol, unfortunately author has used so many places \mathrm and \mathbf, i cant able to trace wherever is occuring, so i need a error to throw those greek characters inside the \mathrm/\mathbf – Venkatesan Ramachandiran Jun 7 '18 at 3:10

I can't test because I don't own mtpro2.sty but perhaps this will help

\documentclass[numbers]{book}

\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{mtpro2}

\makeatletter
\@tfor\x:=\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu
\do{\count@\numexpr\x-"7000\relax
\expandafter\mathchardef\x=\count@}
\makeatother

\begin{document}
without \verb+\mathrm  -->+

$\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu$ \bigskip

with \verb+  \mathrm  -->+

$\mathrm{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}$\bigskip

with \verb+  \mathbf  -->+

$\mathbf{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}$

\end{document}


UPDATE. Here is version with intelligent Greek letters. I can not test the mtpro2 with bold math. I could test the lite version on overleaf.

For the full version uncomment the commented out parts in \expandafter\edef\x....

\documentclass{book}

\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage[lite]{mtpro2}

\AtBeginDocument{\setbox0\hbox{$\mathrm{\xdef\MATHRMFAM{\the\fam}}% \mathbf{\xdef\MATHBFFAM{\the\fam}}$}}

\makeatletter
\@tfor\x:=\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu
\do{\edef\y{\expandafter\expandafter\expandafter
\@gobble\expandafter\string\x}%
\expandafter\let\csname ORIG\y\expandafter\endcsname\x
\expandafter\edef\x{\noexpand\ifnum\noexpand\fam=\noexpand\MATHRMFAM\space
\expandafter\noexpand\csname up\y\endcsname
%\noexpand\else
%\noexpand\ifnum\noexpand\fam=\noexpand\MATHBFFAM\space
%\expandafter\noexpand\csname bmup\y\endcsname
\noexpand\else
\expandafter\noexpand\csname ORIG\y\endcsname
\noexpand\fi
%\noexpand\fi
}%
}%
\makeatother
\begin{document}
without \verb+\mathrm  -->+

$\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu$ \bigskip

with \verb+  \mathrm  -->+

$\mathrm{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}$\bigskip

with \verb+  \mathbf  -->+

$\mathbf{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}$\bigskip

with \verb+  \mathit  -->+

\$\mathit{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu}

\end{document}


Produces on overleaf (I didn't even install lite version of mtpro on my disk)

The \mathit test is for comparison. With full mtpro and the commented-out lines uncommented you should see (if I believe info on macro names from doc) the upright bold Greek letters when using \mathbf.

This has to due with a lack of defined upright and bold Greek symbols, within the default character set of mtpro2 that the package loads. This is partially discussed in a related question and a hint toward a solution is provided in another question.

While there are likely other ways of resolving this, one possible way is to ensure that valid upright and bold Greek character sets are available, to allow \mathrm and \mathbf to function as expected.

One way of accomplishing this is to load mathdesign (before mtpro2) and isomath, with the OMLmathrm and OMLmathbf options (after mtpro2), as shown below and on Overleaf:

\usepackage[utopia]{mathdesign}

\usepackage{mtpro2}

\usepackage[OMLmathrm, OMLmathbf]{isomath}