[texhax] Change Case
Pavel Minev Penev
pavpen at uclink.berkeley.edu
Wed Nov 26 09:47:54 CET 2003
On Wed, Nov 26, 2003 at 10:38:53AM +0800, Raj wrote:
> Dear All,
>
> Like
> \uppercase{uppercase} returns 'UPPERCASE'
> \lowercase{lOwErCaSe} returns 'lowercase'
>
> is there a way to produce "Formal" and "Sentence" cases in TeX/LaTeX.
>
> e.g.
> i want something like
> \formal{proper name} returning 'Proper Name'
> \sentence{this is a sentence} returning 'This is a sentence'
Sure, you can always have macro that chops the first token as a first
argument, and all other tokens up to a marker (one that will *never*
appear in normal text) as a second argument. Try this:
[-- Begin LaTeX code: ---]
\makeatletter
% Split the first letter from all following ones; terminate at
% "@StrEndMarker@" (without quotes). Example:
% \CapitalfirstParse abcDEF at StrEndMarker@
% #1 is {a},
% #2 is {bcDEF}
\def\CapitalfirstParse#1#2 at StrEndMarker@{\uppercase{#1}\lowercase{#2}}
% Add a marker at the end of the string to capitalize, and pass the
% result to the parser:
\newcommand{\Capitalfirst}[1]{\CapitalfirstParse #1 at StrEndMarker@}
\makeatletter
[-- End LaTeX code. ---]
May TeXnology take care of us all,
--
Pav
,.,
,``:'',
Gain your human right of {o ! o} My GPG/PGP key is now available at
privacy: use cryptography! ] -+- [ x-hkp://search.keyserver.net:11371.
\ ! /
`-'
`shell$ gpg --keyserver x-hkp://search.keyserver.net:11371 --recv-key 164C028F`
http://www.againsttcpa.com/index.shtml
More information about the texhax
mailing list