[texhax] tikz vs. expl3

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Jun 27 16:26:20 CEST 2010


On 27/06/2010 12:52, Arno Trautmann wrote:
> Hi all,
>
> I am trying to write a small package with some special drawing
> instructions. Inspired by the articles by Joseph Wright, I am using
> expl3 and xparse. Now I have problems using expl3-Syntax together with
> tikz-instructions: tikz needs explicit spaces (no problem with
> \ExplSyntaxNames) and explicit colons as in [domain=1:3].
>
> So my question: how to handle the colon in the domain-value? I don’t
> want to fall back on l2ε syntax in my code at this position … is there
> any way to tell tikz inside an expl3-code to recognize a colon?
>
> cheers
> Arno

You can use xparse without needing to be inside code blocks. So If you 
only need

\NewDocumentCommand\SomeCommand{m}{%
   \pgfkeys{domain=1:3,#1}% or whatever
}

then there should be no issue.

If we assume that you are using other expl3-like functions, then 
obviously life becomes a bit more complex. Spaces are still not really 
an issue, as "~" is used for a space

\ExplSyntaxOn
% Spaces ignored
\pgfkeys { key~with~spaces = value }
\ExplSyntaxOff

Colons are a bit more awkward, as you've observed. I'd use 
\tl_to_lowercase:n in the usual TeX methods

\group_begin:
   \char_set_lccode:nn { `\@ } { `\: }
   \char_make_other:N \@
\tl_to_lowercase:n {
   \group_end:
   \pgfkeys { key~with~spaces = 1 @ 3 }
}
--
Joseph Wright


More information about the texhax mailing list