6

In expl3.pdf 3.2.5, I have noticed that the :D specifier means "DO NOT USE" and "programmers outside the kernel team should not use these functions". But I also find that these functions are appeared in some packages written in LaTeX3.

So can anybody tell me that whether I can use them after all?

  • Welcome to TeX.SX! – strpeter Jul 4 '17 at 16:02
  • Could you please show some examples where you found the D specifier in packages? – TeXnician Jul 4 '17 at 16:02
  • @TeXnician Although I try to avoid them I sometimes use those primitives (the obvious being \tex_endinput:D for example , but also \tex_penalty:D and probably others…) – clemens Jul 4 '17 at 16:05
  • @JosephWright I usually end all code files with \endinput and include a change history of the file after it… – clemens Jul 4 '17 at 16:13
  • 7
    Clearly they should have gone for :(. – Federico Poloni Jul 4 '17 at 17:11
10

The :D specifier is used exclusively for primitives (all primitives are initial \<engine>_<name>:D), and ideas none should appear outside of the core team code. (Broadly that means outside of l3kernel but there are some special cases where we expect :D names to be used in limited places in other kernel-level code.)

However, it's clear that there are areas that the team have not yet covered in expl3 or where interaction with LaTeX2e requires direct access to primitives. For interim work on modules where there are currently no official interfaces, the team recommend that code addressing such cases be formulated as

\cs_new_eq:NN \__module_name:w \engine_name:D % Probably :w ...

and the latter name is used in such places: this leaves only a single line to be adjusted as the team address such issues. It is also likely to be worth raising these with the team either directly on or LaTeX-L. For example, I am recently added support for \pdffilesize and similar as experimental additions to l3file as a result of such requests.

For working with LaTeX2e, where we might expect the code never to 'move on', one would usual stick to the 'classical' name.

  • Perhaps worth noting that at one point everything was renamed as :D then renamed again so even the kernel didn't use those names directly. We've somewhat modified that position as it can hinder rather than aid clarity: at the lowest level one does need to know that a primitive is in use. – Joseph Wright Jul 4 '17 at 16:08
  • For example, I need to use \par in my code. So the way is \cs_new_eq:NN \_xxx_par: \tex_par:D, right? – stone-zeng Jul 4 '17 at 16:38
  • @Stone-Zeng \par is a tricky one as it interacts with the galley (both in LaTeX2e and expl3),and as the name is special (TeX inserts the token \par not the \par primitive when for example dealing with a blank line). Normally I'd say you just want \par rather than the primitive, though without a use case it's a bit tricky. (I'm currently re-reading some l3galley code, and that requires that only our code messes with 'raw' \tex_par:D tokens. OK, it's not really used so not an issue ...). – Joseph Wright Jul 4 '17 at 16:42
  • @Stone-Zeng To be clear, if you want the \par primitive then 'yes, that's the correct approach at present'. – Joseph Wright Jul 4 '17 at 16:43
  • And how about \fill, \hfil, \hfill etc.? – stone-zeng Jul 5 '17 at 1:01

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.