7

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?

7
  • Welcome to TeX.SX!
    – strpeter
    Jul 4, 2017 at 16:02
  • Could you please show some examples where you found the D specifier in packages?
    – TeXnician
    Jul 4, 2017 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…)
    – cgnieder
    Jul 4, 2017 at 16:05
  • 9
    Clearly they should have gone for :(. Jul 4, 2017 at 17:11
  • 1
    @clemens \endinput is not experimentally supported via \file_input_stop: (release today so either grab from GitHub or wait for CTAN ...)
    – Joseph Wright
    Jul 15, 2017 at 15:20

1 Answer 1

12

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.

6
  • 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, 2017 at 16:08
  • 1
    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, 2017 at 16:38
  • 1
    @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, 2017 at 16:42
  • 1
    @Stone-Zeng To be clear, if you want the \par primitive then 'yes, that's the correct approach at present'.
    – Joseph Wright
    Jul 4, 2017 at 16:43
  • 1
    @Stone-Zeng They all fall within the 'typesetting stuff' area that we've not addressed ...
    – Joseph Wright
    Jul 5, 2017 at 9:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .