Here is what I explained in the comments. I also had to declare a Symbol Font also for the Latin letters, because there are some things in standard LaTeX, like rightharpoonup which are in letters; and we don't want to reassign them to a font with another encoding.
Update: added at the end the necessary code for LGR which was mentioned in comments.
\documentclass{article}
\DeclareSymbolFont {greekletters}{OML}{cmm}{m}{it}
\DeclareSymbolFont {latinletters}{OML}{cmm}{m}{it}
\DeclareMathVersion {upright}
\SetSymbolFont {latinletters}{upright}{OT1}{cmr}{m}{n}
\SetSymbolFont {greekletters}{upright}{U}{txmia}{m}{it} % using the upright
% Greek letters provided with the txfonts
% package
\DeclareMathSymbol{a}{\mathalpha}{latinletters}{`a}
\DeclareMathSymbol{b}{\mathalpha}{latinletters}{`b}
\DeclareMathSymbol{c}{\mathalpha}{latinletters}{`c}
\DeclareMathSymbol{d}{\mathalpha}{latinletters}{`d}
\DeclareMathSymbol{e}{\mathalpha}{latinletters}{`e}
\DeclareMathSymbol{f}{\mathalpha}{latinletters}{`f}
\DeclareMathSymbol{g}{\mathalpha}{latinletters}{`g}
\DeclareMathSymbol{h}{\mathalpha}{latinletters}{`h}
\DeclareMathSymbol{i}{\mathalpha}{latinletters}{`i}
\DeclareMathSymbol{j}{\mathalpha}{latinletters}{`j}
\DeclareMathSymbol{k}{\mathalpha}{latinletters}{`k}
\DeclareMathSymbol{l}{\mathalpha}{latinletters}{`l}
\DeclareMathSymbol{m}{\mathalpha}{latinletters}{`m}
\DeclareMathSymbol{n}{\mathalpha}{latinletters}{`n}
\DeclareMathSymbol{o}{\mathalpha}{latinletters}{`o}
\DeclareMathSymbol{p}{\mathalpha}{latinletters}{`p}
\DeclareMathSymbol{q}{\mathalpha}{latinletters}{`q}
\DeclareMathSymbol{r}{\mathalpha}{latinletters}{`r}
\DeclareMathSymbol{s}{\mathalpha}{latinletters}{`s}
\DeclareMathSymbol{t}{\mathalpha}{latinletters}{`t}
\DeclareMathSymbol{u}{\mathalpha}{latinletters}{`u}
\DeclareMathSymbol{v}{\mathalpha}{latinletters}{`v}
\DeclareMathSymbol{w}{\mathalpha}{latinletters}{`w}
\DeclareMathSymbol{x}{\mathalpha}{latinletters}{`x}
\DeclareMathSymbol{y}{\mathalpha}{latinletters}{`y}
\DeclareMathSymbol{z}{\mathalpha}{latinletters}{`z}
\DeclareMathSymbol{A}{\mathalpha}{latinletters}{`A}
\DeclareMathSymbol{B}{\mathalpha}{latinletters}{`B}
\DeclareMathSymbol{C}{\mathalpha}{latinletters}{`C}
\DeclareMathSymbol{D}{\mathalpha}{latinletters}{`D}
\DeclareMathSymbol{E}{\mathalpha}{latinletters}{`E}
\DeclareMathSymbol{F}{\mathalpha}{latinletters}{`F}
\DeclareMathSymbol{G}{\mathalpha}{latinletters}{`G}
\DeclareMathSymbol{H}{\mathalpha}{latinletters}{`H}
\DeclareMathSymbol{I}{\mathalpha}{latinletters}{`I}
\DeclareMathSymbol{J}{\mathalpha}{latinletters}{`J}
\DeclareMathSymbol{K}{\mathalpha}{latinletters}{`K}
\DeclareMathSymbol{L}{\mathalpha}{latinletters}{`L}
\DeclareMathSymbol{M}{\mathalpha}{latinletters}{`M}
\DeclareMathSymbol{N}{\mathalpha}{latinletters}{`N}
\DeclareMathSymbol{O}{\mathalpha}{latinletters}{`O}
\DeclareMathSymbol{P}{\mathalpha}{latinletters}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{latinletters}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{latinletters}{`R}
\DeclareMathSymbol{S}{\mathalpha}{latinletters}{`S}
\DeclareMathSymbol{T}{\mathalpha}{latinletters}{`T}
\DeclareMathSymbol{U}{\mathalpha}{latinletters}{`U}
\DeclareMathSymbol{V}{\mathalpha}{latinletters}{`V}
\DeclareMathSymbol{W}{\mathalpha}{latinletters}{`W}
\DeclareMathSymbol{X}{\mathalpha}{latinletters}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{latinletters}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{latinletters}{`Z}
\DeclareMathSymbol{\alpha}{\mathord}{greekletters}{"0B}
\DeclareMathSymbol{\beta}{\mathord}{greekletters}{"0C}
\DeclareMathSymbol{\gamma}{\mathord}{greekletters}{"0D}
\DeclareMathSymbol{\delta}{\mathord}{greekletters}{"0E}
\DeclareMathSymbol{\epsilon}{\mathord}{greekletters}{"0F}
\DeclareMathSymbol{\zeta}{\mathord}{greekletters}{"10}
\DeclareMathSymbol{\eta}{\mathord}{greekletters}{"11}
\DeclareMathSymbol{\theta}{\mathord}{greekletters}{"12}
\DeclareMathSymbol{\iota}{\mathord}{greekletters}{"13}
\DeclareMathSymbol{\kappa}{\mathord}{greekletters}{"14}
\DeclareMathSymbol{\lambda}{\mathord}{greekletters}{"15}
\DeclareMathSymbol{\mu}{\mathord}{greekletters}{"16}
\DeclareMathSymbol{\nu}{\mathord}{greekletters}{"17}
\DeclareMathSymbol{\xi}{\mathord}{greekletters}{"18}
\DeclareMathSymbol{\pi}{\mathord}{greekletters}{"19}
\DeclareMathSymbol{\rho}{\mathord}{greekletters}{"1A}
\DeclareMathSymbol{\sigma}{\mathord}{greekletters}{"1B}
\DeclareMathSymbol{\tau}{\mathord}{greekletters}{"1C}
\DeclareMathSymbol{\upsilon}{\mathord}{greekletters}{"1D}
\DeclareMathSymbol{\phi}{\mathord}{greekletters}{"1E}
\DeclareMathSymbol{\chi}{\mathord}{greekletters}{"1F}
\DeclareMathSymbol{\psi}{\mathord}{greekletters}{"20}
\DeclareMathSymbol{\omega}{\mathord}{greekletters}{"21}
\DeclareMathSymbol{\varepsilon}{\mathord}{greekletters}{"22}
\DeclareMathSymbol{\vartheta}{\mathord}{greekletters}{"23}
\DeclareMathSymbol{\varpi}{\mathord}{greekletters}{"24}
\DeclareMathSymbol{\varrho}{\mathord}{greekletters}{"25}
\DeclareMathSymbol{\varsigma}{\mathord}{greekletters}{"26}
\DeclareMathSymbol{\varphi}{\mathord}{greekletters}{"27}
\begin{document}
This is standard: $\alpha^n+\beta^n+x^n+y^n=z^n$.
\mathversion {upright}
This is upright: $\alpha^n+\beta^n+x^n+y^n=z^n$.
\mathversion {normal}
This is standard: $\alpha^n+\beta^n+x^n+y^n=z^n$.
\end{document}

Here is now what one can do for LGR. It got complicated as I wanted also to define \Alpha, \Beta, etc... which usually come from the Latin font, but as they are in the LGR encoded font, I needed to make them available in the standard non-upright math as well (and they are then picked in the cmr font, assuming standard set-up).
\DeclareFontEncoding {LGR}{}{}
\SetSymbolFont {greekletters}{upright}{LGR}{cmr}{m}{n}
% (the LGR encoded CMR font comes with the cbfonts package, and is
% pre-installed at least in TeXLive and presumably also other TeX
% distributions)
% This list defines also `capital' Greek letters,
% including the ones usually represented by Latin letters.
% missing: \varphi, \varepsilon, \varpi, \vartheta, \varrho
%% 'uppercase'
\DeclareMathSymbol {\Alphalgr} {\mathord}{greekletters}{65}
\DeclareMathSymbol {\Betalgr} {\mathord}{greekletters}{66}
\DeclareMathSymbol {\Gammalgr} {\mathord}{greekletters}{71}
\DeclareMathSymbol {\Deltalgr} {\mathord}{greekletters}{68}
\DeclareMathSymbol {\Epsilonlgr} {\mathord}{greekletters}{69}
\DeclareMathSymbol {\Zetalgr} {\mathord}{greekletters}{90}
\DeclareMathSymbol {\Etalgr} {\mathord}{greekletters}{72}
\DeclareMathSymbol {\Thetalgr} {\mathord}{greekletters}{74}
\DeclareMathSymbol {\Iotalgr} {\mathord}{greekletters}{73}
\DeclareMathSymbol {\Kappalgr} {\mathord}{greekletters}{75}
\DeclareMathSymbol {\Lambdalgr} {\mathord}{greekletters}{76}
\DeclareMathSymbol {\Mulgr} {\mathord}{greekletters}{77}
\DeclareMathSymbol {\Nulgr} {\mathord}{greekletters}{78}
\DeclareMathSymbol {\Xilgr} {\mathord}{greekletters}{88}
\DeclareMathSymbol {\Omicronlgr} {\mathord}{greekletters}{79}
\DeclareMathSymbol {\Pilgr} {\mathord}{greekletters}{80}
\DeclareMathSymbol {\Rholgr} {\mathord}{greekletters}{82}
\DeclareMathSymbol {\Sigmalgr} {\mathord}{greekletters}{83}
\DeclareMathSymbol {\Taulgr} {\mathord}{greekletters}{84}
\DeclareMathSymbol {\Upsilonlgr} {\mathord}{greekletters}{85}
\DeclareMathSymbol {\Philgr} {\mathord}{greekletters}{70}
\DeclareMathSymbol {\Chilgr} {\mathord}{greekletters}{81}
\DeclareMathSymbol {\Psilgr} {\mathord}{greekletters}{89}
\DeclareMathSymbol {\Omegalgr} {\mathord}{greekletters}{87}
\DeclareMathSymbol {\Digammalgr} {\mathord}{greekletters}{195}
%% 'lowercase'
\DeclareMathSymbol {\alphalgr} {\mathord}{greekletters}{97}
\DeclareMathSymbol {\betalgr} {\mathord}{greekletters}{98}
\DeclareMathSymbol {\gammalgr} {\mathord}{greekletters}{103}
\DeclareMathSymbol {\deltalgr} {\mathord}{greekletters}{100}
\DeclareMathSymbol {\epsilonlgr} {\mathord}{greekletters}{101}
\DeclareMathSymbol {\zetalgr} {\mathord}{greekletters}{122}
\DeclareMathSymbol {\etalgr} {\mathord}{greekletters}{104}
\DeclareMathSymbol {\thetalgr} {\mathord}{greekletters}{106}
\DeclareMathSymbol {\iotalgr} {\mathord}{greekletters}{105}
\DeclareMathSymbol {\kappalgr} {\mathord}{greekletters}{107}
\DeclareMathSymbol {\lambdalgr} {\mathord}{greekletters}{108}
\DeclareMathSymbol {\mulgr} {\mathord}{greekletters}{109}
\DeclareMathSymbol {\nulgr} {\mathord}{greekletters}{110}
\DeclareMathSymbol {\xilgr} {\mathord}{greekletters}{120}
\DeclareMathSymbol {\omicronlgr} {\mathord}{greekletters}{111}
\DeclareMathSymbol {\pilgr} {\mathord}{greekletters}{112}
\DeclareMathSymbol {\rholgr} {\mathord}{greekletters}{114}
\DeclareMathSymbol {\varsigmalgr}{\mathord}{greekletters}{99}
\DeclareMathSymbol {\sigmalgr} {\mathord}{greekletters}{115}
\DeclareMathSymbol {\taulgr} {\mathord}{greekletters}{116}
\DeclareMathSymbol {\upsilonlgr} {\mathord}{greekletters}{117}
\DeclareMathSymbol {\philgr} {\mathord}{greekletters}{102}
\DeclareMathSymbol {\chilgr} {\mathord}{greekletters}{113}
\DeclareMathSymbol {\psilgr} {\mathord}{greekletters}{121}
\DeclareMathSymbol {\omegalgr} {\mathord}{greekletters}{119}
\DeclareMathSymbol {\digammalgr} {\mathord}{greekletters}{147}
\makeatletter
% \let\Alphastd A\let\Betastd B\let\Epsilonstd E\let\Zetastd Z%
% \let\Etastd N\let\Iotastd I\let\Kappastd K\let\Mustd M%
% \let\Nustd N\let\Omicronstd O\let\Rhostd P\let\Taustd T%
% \let\Chistd X\let\Digammastd F%
% but we wan't them upright (as the other capital Greek letters), hence:
\DeclareMathSymbol{\Alphastd} {\mathord}{operators}{`A}
\DeclareMathSymbol{\Betastd} {\mathord}{operators}{`B}
\DeclareMathSymbol{\Epsilonstd}{\mathord}{operators}{`E}
\DeclareMathSymbol{\Digammastd}{\mathord}{operators}{`F}
\DeclareMathSymbol{\Etastd} {\mathord}{operators}{`H} % not sure here
\DeclareMathSymbol{\Iotastd} {\mathord}{operators}{`I}
\DeclareMathSymbol{\Kappastd} {\mathord}{operators}{`K}
\DeclareMathSymbol{\Mustd} {\mathord}{operators}{`M}
\DeclareMathSymbol{\Nustd} {\mathord}{operators}{`N}
\DeclareMathSymbol{\Omicronstd}{\mathord}{operators}{`O}
\DeclareMathSymbol{\Rhostd} {\mathord}{operators}{`P}
\DeclareMathSymbol{\Taustd} {\mathord}{operators}{`T}
\DeclareMathSymbol{\Chistd} {\mathord}{operators}{`X}
\DeclareMathSymbol{\Zetastd} {\mathord}{operators}{`Z}
\let\digammastd f% <- not satisfactory ?
\let\omicronstd o%
\@for\@tempa:=alpha,beta,gamma,delta,epsilon,zeta,eta,theta,%
iota,kappa,lambda,mu,nu,xi,pi,rho,varsigma,sigma,%
tau,upsilon,phi,chi,psi,omega,Gamma,Delta,Theta,Lambda,%
Xi,Pi,Sigma,Upsilon,Phi,Psi,Omega\do{\expandafter\let
\csname\@tempa std\expandafter\endcsname\csname\@tempa\endcsname}%
\newcommand*\lgrgreek{%
\@for\@tempa:=alpha,beta,gamma,delta,epsilon,zeta,eta,theta,%
iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,varsigma,sigma,%
tau,upsilon,phi,chi,psi,omega,digamma,Digamma,Alpha,Beta,%
Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,%
Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,%
Omega\do{\expandafter\let\csname\@tempa\expandafter\endcsname
\csname\@tempa lgr\endcsname}}%
\newcommand*\stdgreek{%
\@for\@tempa:=alpha,beta,gamma,delta,epsilon,zeta,eta,theta,%
iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,varsigma,sigma,%
tau,upsilon,phi,chi,psi,omega,digamma,Digamma,Alpha,Beta,%
Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,%
Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,%
Omega\do{\expandafter\let\csname\@tempa\expandafter\endcsname
\csname\@tempa std\endcsname}}%
\newcommand*\checkgreekletters{%
\@for\@tempa:=alpha,beta,gamma,delta,epsilon,zeta,eta,theta,%
iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,varsigma,sigma,%
tau,upsilon,phi,chi,psi,omega,digamma,Digamma,Alpha,Beta,%
Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,%
Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,%
Omega\do{\makebox[.75em]{$\csname\@tempa\endcsname$}, }}
\makeatother
\stdgreek % initializes \Alpha, etc...
\begin{document}
This is standard: $\alpha^n+\beta^n+x^n+y^n=z^n$.
\checkgreekletters
\mathversion {upright}\lgrgreek
This is upright: $\alpha^n+\beta^n+x^n+y^n=z^n$.
\checkgreekletters
\mathversion {normal}\stdgreek
This is standard: $\alpha^n+\beta^n+x^n+y^n=z^n$.
\checkgreekletters
\end{document}

OMLencoding and upright latin letters and greek letters, then it should be easy enough using\DeclareMathVersionto declare a math version calledmyuprightmathfor example and then\SetSymbolFont {letters){myuprightmath}<font specification>. Else, one has to use two fonts, one with upright Greek letters and the other one with upright Latin letters. And this means a bunch of\DeclareMathSymbolto re-assign the Greek letters to the desired font, now distinct from the one for Latin letters. – May 27 '13 at 16:39greeklettersshould be declared with\DeclareSymbolFont, and in the normal and bold math versions one would use the standard font forgreekletterswhereas in the specialmyuprightmathmath version one would then havegreekletters(andletters) map to the two upright fonts. – May 27 '13 at 16:42But if one remembers that the use of italic for mathematical variables was precisely to make them stand out from the surrounding normal text, then you can justify reversing the pattern when surrounded by italic text.
– ogerard May 28 '13 at 03:11Sof Leibniz. It was to be written as a very slanted very big thing, and could there have been some sort of contagion among typographers to the other letters? do you know of an informed historical reference on mathematical typography? – May 28 '13 at 16:11