Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

tI use libertine and newtxmath font packages, they provide upright greek letters. However, there is no way to automatically 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?
share|improve this question
    
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 –  patrickvogt Apr 18 '13 at 12:14
    
This may be of interest. –  Jubobs Apr 18 '13 at 12:16
    
@patrick Thanks. It suggest using 'upgreek', which does not help to switch between upright and italic greek letter. –  Aydin Apr 18 '13 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 '13 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}? –  Mobius Pizza Apr 18 '13 at 13:47

2 Answers 2

up vote 8 down vote accepted
+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

share|improve this answer
    
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 '13 at 10:37
    
@Aydin Sorry, but I don't understand: \mathrm doesn't work with Greek letters. –  egreg Apr 22 '13 at 10:42
    
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 '13 at 11:02
    
I modified the question and now it reflects my idea for a solution. –  Aydin Apr 22 '13 at 13:40
    
@Aydin They're both the same –  User 17670 Apr 22 '13 at 15:08

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

share|improve this answer
    
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 '13 at 10:31
    
you can define an own math version upgreek. Then you can switch between upright and italic greek with \mathversion{...} –  Herbert Apr 22 '13 at 11:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.