4

I have some macros to distinguish between two varieties of similar objects. So, for example, I need \psi to come out as expected, but \MakeUppercase{\psi} to come out as \Psi. (Obviously my real applications are more complicated than this.) Is this possible to do in any reasonable way?

At the moment, the non-English characters I need are limited to greek, and \eth and \thorn if possible. But I'm writing these papers to be posted to the arXiv, and as I understand it xelatex and lualatex just don't work on arXiv -- even pdflatex is hard enough to wrangle in my experience. So I'm basically restricted to plain old (pdf)latex.


EDIT

For reference, here's what I ended up using.

\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb}
\DeclareSymbolFont{wasy}{U}{wasy}{m}{n}
\DeclareMathSymbol{\thorn}{\mathord}{wasy}{105}
\DeclareMathSymbol{\Thorn}{\mathord}{wasy}{106}

\makeatletter
  \g@addto@macro\@uclclist{%
    \eth\Eth
    \thorn\Thorn
    \alpha\Alpha
    \beta\Beta
    \gamma\Gamma
    \delta\Delta
    \epsilon\Epsilon
    \varepsilon\Varepsilon
    \zeta\Zeta
    \eta\Eta
    \theta\Theta
    \vartheta\Vartheta
    \iota\Iota
    \kappa\Kappa
    \lambda\Lambda
    \mu\Mu
    \nu\Nu
    \xi\Xi
    \omicron\Omicron
    \pi\Pi
    \varpi\Varpi
    \rho\Rho
    \varrho\Varrho
    \sigma\Sigma
    \varsigma\Varsigma
    \tau\Tau
    \upsilon\Upsilon
    \phi\Phi
    \varphi\Varphi
    \chi\Chi
    \psi\Psi
    \omega\Omega
  }
  \newcommand\Eth{\text{\DH}}
  \newcommand\Alpha{\mathrm{A}}
  \newcommand\Beta{\mathrm{B}}
  \newcommand\Epsilon{\mathrm{E}}
  \newcommand\Varepsilon{\mathit{E}}
  \newcommand\Zeta{\mathrm{Z}}
  \newcommand\Eta{\mathrm{H}}
  \newcommand\Vartheta{\varTheta}
  \newcommand\Iota{\mathrm{I}}
  \newcommand\Kappa{\mathrm{K}}
  \newcommand\Mu{\mathrm{M}}
  \newcommand\Nu{\mathrm{N}}
  \newcommand\omicron{o}
  \newcommand\Omicron{\mathrm{O}}
  \newcommand{\Varpi}{\varPi}
  \newcommand\Rho{\mathrm{P}}
  \newcommand\Varrho{\mathit{P}}
  \newcommand\Varsigma{\varSigma}
  \newcommand\Varphi{\varPhi}
  \newcommand\Tau{\mathrm{T}}
  \newcommand\Chi{\mathrm{X}}
\makeatother

Result of iterating through the above code


EDIT 2

I also experimented with combining the two answers with something like the following:

\makeatletter
\newcommand\myMakeUppercase[1]{%%
  \begingroup
  \let\new@uclclist\@uclclist
  \g@addto@macro\new@uclclist{%
    \eth\Eth
    ...
    \omega\Omega
  }
  \let\@uclclist\new@uclclist%
  \MakeUppercase{#1}%
  \endgroup
}
\makeatother

This allows me to just do the upcasing inside my command, and keep the standard casing everywhere else. I'm not totally sure why I had to make a temporary copy of the list. (I guess \g@addto@macro actually changes the data in place???) But it seems to work.

2 Answers 2

5

Quite a curious requirement: usually the problem is how not to make math uppercase, because symbols are not linked to their uppercase variant.

However, you need to update the \@uclclist variable that contains the pairs of letters for uppercasing/lowercasing:

\documentclass{article}

\makeatletter
\g@addto@macro\@uclclist{\psi\Psi\omega\Omega\alpha\Alpha}
\newcommand\Alpha{\mathrm{A}}
\makeatother

\begin{document}

Hello

$\MakeUppercase{Hello World \alpha\omega\psi}:\alpha\omega\psi$

\end{document}

enter image description here

2
  • Well, that's easier to use, alright. Thank you!
    – Mike
    Jun 4, 2015 at 18:34
  • @Mike Supplement it with the characters you need.
    – egreg
    Jun 4, 2015 at 18:35
3

Here's a possibility that I've modeled somewhat on how \MakeUppercase is defined:

\documentclass{article}

\newcommand\myMakeUppercase[1]{%%
  \begingroup
    \let\psi\Psi
    \let\omega\Omega
    \def\alpha{A}%%
    \MakeUppercase{#1}%%
  \endgroup}

\begin{document}

Hello

$\myMakeUppercase{Hello World \alpha\omega\psi}:\alpha\omega\psi$

\end{document}

I am assuming that the characters you want to uppercase are already control sequences. For each such control sequence for which you want an uppercase version, you add a line which is either

\let<cs name><cs name>

or

\def<cs name>{<replacement string>}

enter image description here

1
  • Not as elegant as I had hoped, but it'll do the job. :) Thanks!
    – Mike
    Jun 4, 2015 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .