在数学模式下将 MakeUppercase 应用于非英文字符

在数学模式下将 MakeUppercase 应用于非英文字符

我有一些宏来区分两种相似的对象。因此,例如,我需要\psi按预期输出,但\MakeUppercase{\psi}输出为\Psi。(显然我的实际应用程序比这更复杂。)是否有可能以任何合理的方式做到这一点?

目前,我需要的非英语字符仅限于希腊语,如果可能的话\eth还有 和\thorn。但我写这些论文是为了发布到 arXiv 上,据我所知,xelatex 和 lualatex 在 arXiv 上不起作用——就我的经验而言,即使是 pdflatex 也很难处理。所以我基本上只能使用普通的 (pdf)latex。


编辑

作为参考,以下是我最终使用的内容。

\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

迭代上述代码的结果


编辑2

我还尝试将这两个答案结合起来,如下所示:

\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

这样我就可以在命令中执行升序转换,并在其他地方保留标准大小写。我不太清楚为什么我必须制作列表的临时副本。(我猜\g@addto@macro实际上是在更改数据???)但它似乎有效。

答案1

这是一个相当奇怪的要求:通常问题是如何不是将数学运算变为大写,因为符号与它们的大写变体无关。

但是,您需要更新\@uclclist包含大写/小写字母对的变量:

\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}

在此处输入图片描述

答案2

\MakeUppercase以下是我对如何定义的可能性的建模:

\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}

我假设您想要大写的字符已经是控制序列。对于您想要大写版本的每个这样的控制序列,您可以添加一行,该行可以是

\let<cs name><cs name>

或者

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

在此处输入图片描述

相关内容