[texhax] Enumerating sentences in arguments to macros

Alexandru Scorpan ascorpan at math.ufl.edu
Tue Nov 9 11:51:48 CET 2004

> I'm trying to make some LaTeX-macros and would like to extract the 
> first sentence of an argument to my macro. Is it possible to somehow 
> enumerate the sentences in an argument?

You could go Plain TeX a bit, using something like

	{first sentence = #1.  Oh, and here's the rest = #2}

Then this should act more or less like

\mycommand Blah. Blih. Bluh.\mystop

would print

first sentence = Blah.  Oh, and here's the rest = Blih. Bluh.

Notice that \mystop does not need to be defined, and any other suitable 
delimiter could be used instead.  When \mycommand runs, it reads 
everything up to "." as the first arg, then everything up to \mystop as 
the second arg. Both the first period and \mystop are gobbled in the 
process (and thus you need to provide the period again).

-- Alex

More information about the texhax mailing list