Filippo Zangheri writes:

> Steve Litt ha scritto:
> > I've written a little on the subject here:
> > http://www.troubleshooters.com/lpm/200210/200210.htm#_HeadersandFooters
> 
> Thanks, but I'm unable to find the section where you explain how to
> set a string to lowercase except for the first character.
> 
> Joking ;). Thanks to you now I can set my headers and footers in a
> more neafty manner.
> 
> By the way, have you ever reverse-engineered some tex files in order
> to understand how it could be possible to lowercase everything but
> the first character in a string?

Maybe there's a more efficient way, but this should work.

\def\spezza#1#2\endname{\gdef\prima{#1}\gdef\RESTO{#2}}
\def\minuscolizza#1\endname{\lowercase{\gdef\resto{#1}}}
\def\maiuscolizza#1\endname{\uppercase{\gdef\prima{#1}}}
\def\capitalize#1{%
  \spezza#1\endname%
  \expandafter\minuscolizza\RESTO\endname%
  \expandafter\maiuscolizza\prima\endname%
  \prima\resto}

% test
\capitalize{pippo}
\capitalize{PLUTO}

-- 
Enrico

Reply via email to