0

Is there a way to force the text of an entire document to be typeset in all upper case with the exception of any math?

  • 6
    Why would you want to do such a thing? :P – Alenanno Jan 10 '16 at 14:57
  • Also, even if you wanted all caps (not small caps), not all characters are supported. \uppercase{\ae} is the same as \ae. – Alenanno Jan 10 '16 at 15:03
  • 3
    @Alenanno That's why \uppercase isn't a latex command, use \MakeUppercase{\ae} – David Carlisle Jan 10 '16 at 15:15
  • If you mean caps and small caps just use \scshape if you want all (large) caps then it would be easiest of you had an all caps font, that usually isn't available. – David Carlisle Jan 10 '16 at 15:18
  • @DavidCarlisle Oh good to know. Are there characters that wouldn't work even then? – Alenanno Jan 10 '16 at 15:19
3

In principle you can use the OpenType case feature or its fontspec interface Letters=Uppercase

I can demonstrate with Caps and small Caps

enter image description here

Which comes from

\documentclass{article}

\usepackage{fontspec}

%\setmainfont{TeX Gyre Pagella}[Letters=Uppercase]
\setmainfont{TeX Gyre Pagella}[Letters=SmallCaps]

\begin{document}

One two three $1=0$ and $\theta=x$

\end{document}

However if you switch the commented \setmainfont then you just get lots of warnings looking like

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Letters=Uppercase' (+case) not available for font 'TeX
* Gyre Pagella' with script 'Latin' and language 'Default'.
*************************************************

and the output is just as input with no transformation.

So, if your actual font has the case opentype feature set that's all you need.

If not, then you could view it as a transliteration and use teckit in xetex or a lua callback in luatex, there were recent answers describing this for cyrillic but the system could work for case change as well (don't use my input_buffer callback suggestion for luatex, as you will mess up all the latex commands using lowercase ascii:-)

for xetex

Using XeTeX for automatic transliteration of cyrillic letters

or for luatex

Create a mapping for transliteration from cyrillic to latin in LuaLaTeX

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.