15

I use libertine and newtxmath font packages, they provide upright greek letters. However, there is no way to conveniently swith between italic and upright greek letters. I need a command, simillar to what is discussed here, to change normal greek letters to upright bold symbols.

None of the commands \mathrm, \mathbf, \boldsymbol or \bm makes\theta to appear as \uptheta. Moreover, isomath package does not work with the encoding and its typeface is not desired. I don't want to globally switch to upright greek letters or change the font shape.

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[type1]{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{bm} 

\begin{document}
What I get: $\theta \bm{\theta} \mathrm{\theta} \bm{\mathrm{\theta}}$

What I want: $\theta \bm{\theta} \uptheta \bm{\uptheta}$ 
\end{document}

--- Partial Solution ---

I found that a new upgreek command may be defined to replace all greek letter macros (e.g. \theta) with their upside variants (e.g. \uptheta) in its argument. Following example does it for three greek letters. The scope of the command is local, so both variants can be used in a single equation.

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[type1]{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{bm} 

\newcommand{\upgreek}[1]{{
\renewcommand{\beta}{\upbeta}
\renewcommand{\theta}{\uptheta}
\renewcommand{\zeta}{\upzeta}
#1
}}

\begin{document}
$\upgreek{\theta} \bm{\upgreek{\theta}} \theta \bm{\theta}$ 
\end{document}

Questions:

  • Is it safe to patch \mathrm to run \upgreek on its argument?
7
  • Could l2tabu help you? Section 2.3.6 Typesetting upright greek letters? I never used upgreek letters before so this was just a wild guess Apr 18, 2013 at 12:14
  • This may be of interest.
    – jub0bs
    Apr 18, 2013 at 12:16
  • @patrick Thanks. It suggest using 'upgreek', which does not help to switch between upright and italic greek letter.
    – Aydin
    Apr 18, 2013 at 12:23
  • @Jubobs I ckecked it. isomath is not working with libertine, and globally forcing greek letters to upright form is not wanted. I need \mathrm or any other command to modify \theta to appear as \uptheta.
    – Aydin
    Apr 18, 2013 at 12:27
  • I believe the correct command you want is \mathup, not \mathrm. I can't compile the MWE for come reason so I can't offer much help. How about loading amsmath and try \operatorname{\theta}? Apr 18, 2013 at 13:47

2 Answers 2

15
+50

You might want to file a feature request to the developer of newtxmath; in the meantime you can change the definitions of the Greek lowercase letters.

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[type1]{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{bm} 

\makeatletter
\re@DeclareMathSymbol{\alpha}{\mathord}{lettersA}{11}
\re@DeclareMathSymbol{\beta}{\mathord}{lettersA}{12}
\re@DeclareMathSymbol{\gamma}{\mathord}{lettersA}{13}
\re@DeclareMathSymbol{\delta}{\mathord}{lettersA}{14}
\re@DeclareMathSymbol{\epsilon}{\mathord}{lettersA}{15}
\re@DeclareMathSymbol{\zeta}{\mathord}{lettersA}{16}
\re@DeclareMathSymbol{\eta}{\mathord}{lettersA}{17}
\re@DeclareMathSymbol{\theta}{\mathord}{lettersA}{18}
\re@DeclareMathSymbol{\iota}{\mathord}{lettersA}{19}
\re@DeclareMathSymbol{\kappa}{\mathord}{lettersA}{20}
\re@DeclareMathSymbol{\lambda}{\mathord}{lettersA}{21}
\re@DeclareMathSymbol{\mu}{\mathord}{lettersA}{22}
\re@DeclareMathSymbol{\nu}{\mathord}{lettersA}{23}
\iftx@altnu
  \re@DeclareMathSymbol{\nu}{\mathord}{lettersA}{40}
\fi
\re@DeclareMathSymbol{\xi}{\mathord}{lettersA}{24}
\re@DeclareMathSymbol{\pi}{\mathord}{lettersA}{25}
\re@DeclareMathSymbol{\rho}{\mathord}{lettersA}{26}
\re@DeclareMathSymbol{\sigma}{\mathord}{lettersA}{27}
\re@DeclareMathSymbol{\tau}{\mathord}{lettersA}{28}
\re@DeclareMathSymbol{\upsilon}{\mathord}{lettersA}{29}
\re@DeclareMathSymbol{\phi}{\mathord}{lettersA}{30}
\re@DeclareMathSymbol{\chi}{\mathord}{lettersA}{31}
\re@DeclareMathSymbol{\psi}{\mathord}{lettersA}{32}
\re@DeclareMathSymbol{\omega}{\mathord}{lettersA}{33}
\re@DeclareMathSymbol{\varepsilon}{\mathord}{lettersA}{34}
\re@DeclareMathSymbol{\vartheta}{\mathord}{lettersA}{35}
\re@DeclareMathSymbol{\varpi}{\mathord}{lettersA}{36}
\re@DeclareMathSymbol{\varrho}{\mathord}{lettersA}{37}
\re@DeclareMathSymbol{\varsigma}{\mathord}{lettersA}{38}
\re@DeclareMathSymbol{\varphi}{\mathord}{lettersA}{39}
\makeatother

\begin{document}
What I get: $\theta \bm{\theta}$

What I want: $\uptheta \bm{\uptheta}$ 
\end{document}

Note that \mathbf{\theta} won't do any good, only Latin letters are affected by \mathbf.

enter image description here


You can also define \mathup and \mathbfup:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[type1]{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{bm}
\DeclareRobustCommand{\mathup}[1]{\begingroup\changegreek\mathrm{#1}\endgroup}
\DeclareRobustCommand{\mathbfup}[1]{\begingroup\changegreekbf\mathbf{#1}\endgroup}

\makeatletter
\def\changegreek{\@for\next:={%
  alpha,beta,gamma,delta,epsilon,zeta,eta,theta,kappa,lambda,mu,nu,xi,pi,rho,sigma,%
  tau,upsilon,phi,chi,psi,omega,varepsilon,vartheta,varpi,varrho,varsigma,varphi}%
  \do{\expandafter\let\csname\next\expandafter\endcsname\csname\next up\endcsname}}
\def\changegreekbf{\@for\next:={%
  alpha,beta,gamma,delta,epsilon,zeta,eta,theta,kappa,lambda,mu,nu,xi,pi,rho,sigma,%
  tau,upsilon,phi,chi,psi,omega,varepsilon,vartheta,varpi,varrho,varsigma,varphi}%
  \do{\expandafter\def\csname\next\expandafter\endcsname\expandafter{%
    \expandafter\bm\expandafter{\csname\next up\endcsname}}}}
\makeatother

\begin{document}
$\mathup{d}\mathup{\theta}d\theta$

$\mathbfup{d}\mathbfup{\theta}\bm{d}\bm{\theta}$
\end{document}

enter image description here

13
  • Thankx. How can I make this symbol declarations local? I don't want to change the appearance of $\theta$, but $\mathrm{\theta}$. I edited the MWE to be more clear.
    – Aydin
    Apr 22, 2013 at 10:37
  • 1
    @Aydin Sorry, but I don't understand: \mathrm doesn't work with Greek letters.
    – egreg
    Apr 22, 2013 at 10:42
  • 1
    Yes it doesn't and I want it to work. isomath makes it working for greek letters but it has other problems. I can use any other command instead of \mathrm, e.g., \upright{\theta}. What I need is a solution to locally change the appereance of greek letters to be upright, but not globally. One idea is to redefine \mathrm to locally replace any command like \theta with \uptheta.
    – Aydin
    Apr 22, 2013 at 11:02
  • I modified the question and now it reflects my idea for a solution.
    – Aydin
    Apr 22, 2013 at 13:40
  • @Aydin They're both the same
    – User 17670
    Apr 22, 2013 at 15:08
5

with xelatex or lualatex you can choose the french style for upright greek letters and have also commands for the bold one:

\documentclass{report}
\usepackage[math-style=french]{unicode-math}
\usepackage{libertine}
\setmathfont{XITS Math}

\begin{document}
What I get: $\theta \mbftheta \alpha \mbfalpha\mbftheta$ \\

What I want: $\theta \alpha\beta \mbfmu$ 
\end{document}

enter image description here

2
  • I do not want to globally switch to upright greek letters. What is needed, is a solution to temporally switch between upright and slanted greek letters.
    – Aydin
    Apr 22, 2013 at 10:31
  • 1
    you can define an own math version upgreek. Then you can switch between upright and italic greek with \mathversion{...}
    – user2478
    Apr 22, 2013 at 11:12

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.