3

I'm using the mathastext package in order not to have italic everywhere in maths formulas, in particular for function names or vectors and matrices letters.

But this leads to strange behavior with greek letters as the following MWE shows:

\documentclass{report}
\usepackage{amsmath}
\usepackage[LGRgreek,defaultmathsizes]{mathastext}
\begin{document}

\begin{equation}
\mathit{y} = \mathit{X\beta} + \mathit{\epsilon}
\end{equation}

\begin{equation}
\mathit{y} = \mathit{X}{\beta} + \epsilon
\end{equation}

\end{document}

Which gives:
ital greek letters are latin

How could I locally (i.e. within any particular equation) force some letter to be italic, especially greek letters?

  • You're using the wrong approach. You should mark up the symbols you want upright, rather than the converse. – egreg Jul 9 '17 at 15:20
  • What if 99% of them are upright? I do not wish to mark them all individually. – s.k Jul 9 '17 at 16:17
  • I think it has something to do with math alphabets, and that mathastext only applies one alphabet (rm or it) for greek, but not completely sure. – svenper Nov 15 '17 at 12:30
1

The OP indicates in a comment that "99% of them are upright? I do not wish to mark them all individually." Thus, while there are many reasons not to do it this way, I use the inverse of the solution at Upright Greek font fitting to Computer Modern, and introduced the macro \slant, which (in pdflatex) can be applied to any particular argument.

\documentclass{report}
\usepackage{amsmath}
\usepackage[LGRgreek,defaultmathsizes]{mathastext}
\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
        \sbox{\foobox}{#2}%
        \hskip\wd\foobox
        \pdfsave
        \pdfsetmatrix{1 0 #1 1}%
        \llap{\usebox{\foobox}}%
        \pdfrestore
}}
\newcommand\slant[2][.25]{\slantbox[#1]{$#2$}}
\begin{document}

\begin{equation}
\mathit{y} = \mathit{X\beta} + \slant\epsilon
\end{equation}

\begin{equation}
\mathit{y} = \mathit{X}{\beta} + \epsilon
\end{equation}

\centering
$\alpha\beta\gamma\delta\epsilon\eta\mu\phi\sigma\tau\omega\xi\psi\zeta$\par
\slant\alpha\slant\beta\slant\gamma\slant\delta\slant\epsilon%
\slant\eta\slant\mu\slant\phi\slant\sigma\slant\tau\slant\omega%
\slant\xi\slant\psi\slant\zeta

\end{document}

enter image description here

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.