I am trying to use the mathastext package to replace alphabet letters in math with the default fonts in the document, and gfsdidot (udidot) for greek. I can either get everything relevant except greek working, or get greek working but break latin.
I use pdfLaTeX, and I think I have enough math alphabets, so that shouldn't be the issue. I also know that GFS Didot comes in all desired weights and shapes. How does an alphabet in mathastext know that it is only meant for greek and why does it not contain \mathrm? What is its relation to \mathnormal (which currently is equally broken)?
\Mathrm may seem like a syntax error but it is defined internally in mathastext.sty, though I am not sure how (or if) to properly use it.
If it's any help to convey what I am looking to do: something akin to what unicode-range does in CSS, to use one font for one range of characters, and another font for another range. For pdfLaTeX this seems to get harder because fonts are not in unicode, but it should indeed be possible, because mathastext does so properly for the default math alphabet. How?
\documentclass{article}
\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ebgaramond}
\usepackage[LGRgreek,italic]{mathastext}
\DeclareSymbolFont{mycustom}{LGR}{udidot}{normal}{n}
\SetSymbolFont {mycustom}{normal}{LGR}{udidot}{\rmdefault}{n}%
\DeclareSymbolFontAlphabet{\Mathrm}{mycustom}%%% disable this to break greek but fix latin
\MTgreekfont{udidot}
\MTitgreek
\MTitGreek
\Mathastext
\newcommand*{\GRALPH}{\alpha \beta \gamma \delta \epsilon
\zeta \eta \theta \iota \kappa \lambda \mu \nu \xi o \pi
\rho \sigma \tau \upsilon \phi \chi \psi \omega \varsigma}
\newcommand*{\gralph}{A B \Gamma \Delta E Z H \Theta I K
\Lambda M N \Xi O \Pi P \Sigma T \Upsilon \Phi X \Psi \Omega}
\begin{document}
\noindent
\( \GRALPH - \mathrm{\GRALPH} \)\\
\( \gralph - \mathrm{\gralph} \)\\
so far it looks good, but now also latin turns up as greek:\\
\( abcdefghijklmnopqrstuvwxyz - \mathrm{abcdefghijklmnopqrstuvwxyz} \)
\end{document}


mathastextdoes not modify that in math mode textfont family "0" still refers to ComputerModern, as set-up by LaTeX. So it needs a custom\Mathrmto switch to the document text font, in contrast to Computer Modern (or whatever replaced it if some math font package was loaded). By default, it does\renewcommand\mathrm{\Mathrm}. But in "subdued" mode, the normal and bold math versions will recover the original meaning of\mathrm. – Nov 15 '17 at 22:37\mathrmto act similarly as\textrm, even though stacking doesn't work. (for that we have\boldsymbol) Couldmathastextmaybe be made to play nice withisomath? Or could the OT1(?)\mathrmfamily be extended with with the LGR characters? – gnucchi Nov 15 '17 at 22:54\alphain math mode is declared to use a given slot in a given (math) font.mathastext, with optionLGRgreekmakes it slot number 97. It also tells TeX that\alphais of "variable family type". So inside say\mathrm,\alphawill give the character at slot 97 in what ever font\mathrmcommand has been configured to use. In the case ofmathastext,\mathrmgives\Mathrm, and\Mathrmis configured to use the text-font. Thus in 99% of cases slot 97 will give letter "a". – Nov 16 '17 at 07:28\mathrmwith LGR characters" can not work with the LaTeX native mechanisms. However we can naturally define\alphaupetc... symbols, and let our macro\uprightlettersdo both of\mathrmand\let\alpha\alphaupetc... where\alphaupwill have been defined as a symbol not reacting to math alphabets. This is possible approach. Is it really worthwile, in comparison to simply use directly\alphaupin mark-up? or for that matters\upgreek{\alpha}as in my answer? It is not clear to me what you mean by "play nice with isomath". Perhaps precisely this? – Nov 16 '17 at 07:34mathastextit's clear that both latin and greek from separate fonts can be used with the same markup. Or do the\alpha\betaetc. commands automatically change math alphabet, even though seemingly using the default? – gnucchi Nov 16 '17 at 08:10\mathrmusing the text font, I think the cleanest workaround would be to use\textwith the [tag:alphabeta] package, still allowing name commands for greek letters, e.g.:\text{\gamma}. – gnucchi Nov 17 '17 at 22:29mathastextdoes not interfere with Greek, so indeed if some other package provides a solution to your issue, that could be best way. – Nov 19 '17 at 18:47