Hello,
may I ask if the primitives \partokenname, \partokencontext will be
implemented into LuaTeX? They were implemented in pdftex and XeTeX into
TeXlive sources.
I would very much welcome their implementation in LuaTeX, I need then on
OpTeX macros.
Regards
Petr Olsak
-----------
texk/web2c/NEWS:
- new primitives \partokenname and \partokencontext allow overriding the
name of the internally-emitted \par token at blank lines, the end of
vboxes, etc.
-----------
\pdftexprimitive{\Syntax{\Tex{\partokenname} \Whatever{control-sequence}}}
\bookmark{\tex{partokenname}}
\TeX{} inserts the {\it par-token} at empty lines and at various more
places
into the input stream. Its meaning is {\it end-paragraph} by default and it
can be changed (by \type{\def}, for example). Its name is \type{\par} by
default
and you can change its name by
\type{\partokenname}\Something{control-sequence}.
The name of the {\it par-token} is given \Something{control-sequence}.
The setting performed by \type{\partokenname} is global.
The no-\type{\long} macros throw the error ``runaway argument'' if
{\it par-token} is scanned to its parameter regardless its name.
The following example releases the name \type{\par} to the ``user name
space'',
i.e.\ users can define and use \type{\par} as they need without any
influence
to behavior of internal \TeX{} algorithms.
\starttyping
\catcode`\_=11
\let\_par=\par
\partokenname\_par
Hello world.\end
\stoptyping
The token with name \type{\_par} is auto-emitted at the empty line and
before
\type{\end} primitive in this example.
The no-\type{\long} macros can read parameters with \type{\par}
but \type{\_par} is prohibited.
\pdftexprimitive{\Syntax{\Tex{\partokencontext} \Whatever{number}}}
\bookmark{\tex{partokencontext}}
The {\it par-token} (i.e.\ the token with the name \type{\par} or with
the name given by \type{\partokenname}) is inserted into the
input stream depending on the \type{\partokencontext} value. Its value
can be:
0: {\it par-token} is inserted at empty lines (more exactly, when a token
category 5 is found in the state~$N$ of reading a line) and before
\type{\end}, \type{\vskip}, \type{\hrule}, \type{\unvbox}, and
\type{\halign}
when \TeX{} is in horizontal mode and at various error recovery cases.
1: {\it par-token} is inserted as above and moreover at the end of
\type{\vbox}, \type{\vtop}, and \type{\vcenter} if \TeX{} is in
horizontal mode.
2: {\it par-token} is inserted as above and moreover at the end of
\type{\insert}, \type{\vadjust}, \type{\output}, \type{\noalign},
and items of \type{\valign} if \TeX{} is in horizontal mode.
Default is \type{\partokencontext=0}, i.e.\ the cases 1 and 2 are
processed by
direct call of {\it end-paragraph} routine without emitted {\it par-token}.
This is classical \TeX{} behavior. If \type{\partokencontext=1} then
\TeX\ inserts
{\it par-token} in additional cases: when vertical boxes are completed but
horizotal mode is not finished. The settings \type{\partokencontext=2}
deactivates all cases where classical \TeX\ uses direct {\it end-paragraph}
routine and {\it par-token} is inserted in such cases.
The setting value to the register \type{\partokencontext} is local.