[texhax] Change Case
Raj
texuser74 at netscape.net
Wed Nov 26 10:15:23 CET 2003
what about
\formal{proper name} returning 'Proper Name'
i want to capitalize only the first character of all the words.
raj
pavpen at uclink.berkeley.edu wrote:
>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,
>
>
--
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop at Netscape!
http://shopnow.netscape.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/texhax/attachments/20031126/7369ce5b/attachment.htm
More information about the texhax
mailing list