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?

18
  • 6
    Why would you want to do such a thing? :P
    – Alenanno
    Commented Jan 10, 2016 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
    Commented Jan 10, 2016 at 15:03
  • 3
    @Alenanno That's why \uppercase isn't a latex command, use \MakeUppercase{\ae} Commented Jan 10, 2016 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. Commented Jan 10, 2016 at 15:18
  • @DavidCarlisle Oh good to know. Are there characters that wouldn't work even then?
    – Alenanno
    Commented Jan 10, 2016 at 15:19

1 Answer 1

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

You must log in to answer this question.

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