13

Keeping in mind:

  • TikZ uses space tokens significantly, and
  • expl3 syntax completely disregards whitespace and will only become more prevalent,

is it reasonable to expect a future version of TikZ where expl3 syntax is taken into account? It would obviously be catastrophic if its syntax changed, but is it feasible to do this 'behind the scenes'?

If it is not feasible (I really don't have a good grasp on on TikZ), is there a workaround that does not litter the environment with ~?


Edit for Christian:

They should only be visible to package-writers on the programming layer. Under \ExplSyntaxOn, keys like current page.south west and remember picture 'compress' to currentpage.southwest and rememberpicture respectively. Obviously these keys aren't defined, thus an error. It's only an absolute headache inside a new definition, where catcodes cannot be effectively changed with a simple \ExplSyntaxOff.

  • 1
    Sometimes also the : with catcode letter can be a problem with TikZ. In practice I found using \ExplSyntaxOff and \ExplSyntaxOn again the easiest way (chat.stackexchange.com/transcript/message/13200713#13200713) – cgnieder Jan 19 '14 at 19:51
  • The choice made by the developers of pgfkeys to allow spaces in key names is disputable; but it's not the only point where there's conflict: parsing of TikZ commands is very dependent on spaces anyway. However this is not a concern at the user level, where \ExplSyntaxOff holds. It's quite difficult to program in expl3 using TikZ constructs, but the two (sub)languages really belong to different levels. – egreg Jan 19 '14 at 20:00
  • 1
    The hobby package uses both PGF and LaTeX3 without difficulty, so I'm not sure what the potential problems are. As egreg says, they belong on different levels. – Andrew Stacey Jan 19 '14 at 20:04
  • 1
    @SeanAllred On the other hand if a package doesn't do too much TikZ writing current~ page.south~ west isn't really too hard IMHO – cgnieder Jan 19 '14 at 20:24
  • 1
    @SeanAllred I solved the colon issue for myself with \tl_const:Nx \c_<module>_colon_tl { \token_to_str:N : } and using \c_<module>_colon_tl where needed. – cgnieder Jan 19 '14 at 20:30
7

I think the most sensible answer is 'no' for a couple of reasons.

First, expecting pgf/TikZ to cover arbitrary category code changes is probably not realistic and is a potentially ongoing battle. While expl3 syntax is one example of a significant change to category codes, it's not the only one (various babel options come to mind). I don't think that the TikZ team can be expected to know about all of these, and certainly not to test for all cases. (There's also the technical issue of category codes being fixed if a TikZ construct is used inside a macro or argument to a macro.)

The second reason is more to do with the point of expl3: part of an approach separating out different aspects to how a document is constructed. The expl3 language is meant for 'programming', whereas while TikZ/pgf has a programming element it's much more at the 'document level' (or perhaps the 'design level'). As such, there should be relatively small numbers of cases where the two are interspersed. Where they are, switching \ExplSyntaxOff or using ~ for spaces are both workable. The issue of : tokens is a bit more tricky, but the LaTeX3 team knows that some better interface for creating 'altered' category code tokens is needed in expl3 in general, which should help with this specific case once delivered.

|improve this answer|||||
  • Is there something new about this better interface in expl3 for creating 'altered' category code tokens? – Denis Bitouzé Dec 25 '14 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.