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
Frank Mittelbach <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Fri, 21 Apr 2017 17:35:09 +0200
text/plain (47 lines)
Am 21.04.2017 um 16:49 schrieb Benedikt Vitecek:
> For a command I used the argument specifier d<> (which I thought was a
> good idea),
> which doesn’t work properly in combination with ‚babel‘ and the language
> option
> ‚spanish‘:
>   \documentclass[spanish]{scrartcl}
>   \usepackage{babel}
>   \usepackage{xparse}
>   \NewDocumentCommand \Something { d<> m }
>     {
>       Optional: #1 \\
>       Mandatory: #2
>     }
>   \begin{document}
>   \Something<Hello>{World}
>   \end{document}

the problem is that babel only enables < as an active character after 
begin document, i.e., when you make that definition in the preamble "<" 
is still a normal character (\catcode 12 presumably, not checked).

After \begin{document} it is an active char and therefore the xparse 
scanning no longer matches.

If you move the definition there your document works as expected.

In my opinion there is nothing xparse or expl could do here, it needs a 
different shorthand interface in babel --- it might be that there is 
something there to enable shortcuts already in the preamble

This is a tricky area as babel hides the fact for a reason: there are 
probably a good number of  packages that would fall over if the 
mechanism is exposed while they are setting up their internals.

Basically, this is an issue with legacy code that is difficult to 
resolve in a perfect way as long as those interfaces aren't universally 
available but are added by packages.

This is all a bit of hand-waving as I haven't looked at the babel 
internals for a while; so perhaps Javier or somebody else can give a 
more accurate answer.