[texhax] Read and process single characters

Uwe Lück uwe.lueck at web.de
Mon Jul 4 22:23:50 CEST 2005

At 16:50 24.06.05, Torsten Wagner wrote:

>e.g. I like to make the first letter of a word capital, independent of 
>what the user typed in.
>so that
>\mycommand{my text}
>\mycommand{My text}
>results both in
>My text

Look as well what I have found by chance
(if only for historical interest -- Uwe):

Date: Mon, 09 May 2005 19:12:32 +0100
From: "P.Taylor" <P.Taylor at rhul.ac.uk>
To: Alex Torkhov <mail at atorkhov.pp.ru>
Subject: Re: [texhax] First character of a string
Cc: texhax at tug.org

Simplistically, something like the following
\def \firstofmany #1#2\sentinel {#1}
\def \firstchar #1{\firstofmany #1\sentinel}
Of course, there are many caveats : TeX deals in
tokens, not characters; #1 must not contain \sentinel,
#1 must not be empty, and so on ...
Philip Taylor
Alex Torkhov wrote:
 > How can I make function in TeX that returns first character of its param?

More information about the texhax mailing list