LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Bruno Le Floch <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Tue, 31 May 2011 17:46:51 -0400
text/plain (34 lines)
On 5/29/11, Joseph Wright <[log in to unmask]> wrote:
> On 28/05/2011 18:33, Bruno Le Floch wrote:
>> I have to say that I'm not fully keen either. The reason I'm asking
>> here is that I don't want to put some code out there which shows how
>> to add extra arguments types to xparse: as discussed earlier, this
>> would lead to clashes between packages, and is a bad idea. I don't
>> really have a use case (and I don't think that the OP's example is a
>> real use case). Perhaps for people who like syntax like "\input foo "
>> instead of "\input{foo}"? Or to grab the next word (or whatever)...
> The nearest I've got so far in thinking about it is something like the
> case where you are reading from an external table. There, however, you'd
> normally grab 'up to' some token (tab, space, ',', ...), then split up
> the input with dedicated code. I think that, like verbatim input, the
> idea looks a bit too specialised for coverage by xparse.

Note that verbatim input cannot be done reliably, while this one can.
Actually, I can see it used if someone wants the first word of each
paragraph bold (but who would?):

\DeclareDocumentCommand { \bw }
  { w { ! \token_if_letter_p:N } w { \token_if_letter_p:N } }
  { #1 \textbf {#2} }
\toks_put_right:Nn \tex_everypar:D { \bw }

(where \everypar should have a LaTeX3 interface). This grabs
everything before the first letter as #1, then all letters which
follow as #2, and puts that second argument in bold. It fails if there
is a space or brace between \bw and the following word. There are
probably better ways of doing that, though (I don't know).