[Tex/LaTex] All Caps in Whole Document

capitalization

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?

Best Answer

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