## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 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 >>]

 Subject: Re: Using d<> and babel with option spanish From: Benedikt Vitecek <[log in to unmask]> Reply To: Mailing list for the LaTeX3 project <[log in to unmask]> Date: Sun, 23 Apr 2017 10:50:39 +0200 Content-Type: text/plain Parts/Attachments: text/plain (42 lines)
> What happens if you do your definition \AtBeginDocument?  Does babel
> turn on shorthands too late for that?

I’ve tried it before and sadly it doesn’t work and produces the same output:

\documentclass[spanish]{scrartcl}
\usepackage{babel}
\usepackage{xparse}
\ExplSyntaxOn
\AtBeginDocument{
\NewDocumentCommand \Something { d<> m }
{
Optional: #1 \\
Mandatory: #2 \\
Other:
}
}
\ExplSyntaxOff
\begin{document}
\Something<Hello>{World}
\end{document}

> Here at some point the
> command you define must grab an argument delimited by ">".  Given how
> TeX works, we need to know what category code this ">" will have.  In
> principle it could be conceivable to do that depending on the category
> code of the "<" that started the argument, or depending on the current
> category code of ">"

I am glad that this is the first (maybe second) time I have to deal with category codes,
it seems to be quite complicated.

I think what I might be able to do locally is to check if the „m“ argument grabs the token
„<„ (which I should be able to test with \str_if_eq:nn {#2} { < } ), define a macro which collects the
next tokens until it encounters a „>“ (again tested with \str_if_eq:nn) and then maybe call my
main command again.

This is only a rough idea and I would need to figure out how to implement it, but it could solve (at least
for me) the category code problem.

Ben