3

Simple task here: I want to use the \MakeUppercase{} command, but I have some text that must be protected to remain lower case. Specifically, elemental symbols (e.g. PbI\textsubscript{2}, where the 'b' needs to remain lower case. Is there some way of protecting lower case letters from \MakeUppercase{}?

lockstep
  • 250,273
jon692
  • 177
  • Welcome to TeX.SE. Are we talking about just one lowercase letter, or could there be several lowercase letters that must be protected from being converted to uppercase? – Mico Sep 22 '17 at 21:15
  • input the b as \lowercase{b}. –  Sep 22 '17 at 21:29
  • If you're happy to switch to \MakeTextUppercase with the textcase package then you can use \NoCaseChange{...} to protect the case. (I think there's a package option to redefine \MakeUppercase as \MakeTextUppercase.) – Nicola Talbot Sep 23 '17 at 10:59

1 Answers1

3

Define a macro for it. I suggest considering chemformula for chemistry documents.

\documentclass{article}
\usepackage{chemformula} % also loads xparse

\NewDocumentCommand{\LI}{}{\ch{PbI2}}

\begin{document}

Here is lead iodide \LI{} and
\MakeUppercase{also \LI{} here}

Here's a reaction: \ch{Pb + I2 -> PbI2}

\end{document}

Note that \newcommand would not work, but \NewDocumentCommand makes the macro safe against \MakeUppercase.

enter image description here

egreg
  • 1,121,712
  • 1
    @jkmey If you use \ch{PbI2} in text that ends up inside \MakeUppercase, the b would be uppercased as well. By hiding it in a “protected” macro, \MakeUppercase will do nothing to it. – egreg Sep 22 '17 at 21:40