diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-09-21 16:28:01 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-09-21 16:28:01 +0000 |
commit | a26b8a75634b3b2b75fde4ebaa408ccd25112499 (patch) | |
tree | 043094ca2d93dc83d6cc4c1ee6e0ef571af0e76e /Master | |
parent | a9213f82990763f36168844dbb67d4be3ffa114a (diff) |
New primitives prefixing policy for LuaTeX-based formats.
git-svn-id: svn://tug.org/texlive/trunk@15400 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
5 files changed, 74 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/latexconfig/dvilualatex.ini b/Master/texmf-dist/tex/latex/latexconfig/dvilualatex.ini index a35581d9531..f0c47ffaeec 100644 --- a/Master/texmf-dist/tex/latex/latexconfig/dvilualatex.ini +++ b/Master/texmf-dist/tex/latex/latexconfig/dvilualatex.ini @@ -1,7 +1,7 @@ % $Id$ % Karl Berry, originally written 2008. public domain. % -\input luatexiniconfig.tex +\input lualatexiniconfig.tex \input pdftexconfig \pdfoutput=0 % dvi output by default % diff --git a/Master/texmf-dist/tex/latex/latexconfig/lualatex.ini b/Master/texmf-dist/tex/latex/latexconfig/lualatex.ini index 00404d7e71d..225bd4ced4f 100644 --- a/Master/texmf-dist/tex/latex/latexconfig/lualatex.ini +++ b/Master/texmf-dist/tex/latex/latexconfig/lualatex.ini @@ -1,6 +1,6 @@ % $Id$ % Karl Berry, originally written 2008. public domain. -\input luatexiniconfig.tex +\input lualatexiniconfig.tex \input pdftexconfig.tex % pdf output by default. \scrollmode diff --git a/Master/texmf/tex/generic/config/lualatexiniconfig.tex b/Master/texmf/tex/generic/config/lualatexiniconfig.tex new file mode 100644 index 00000000000..2061c9fe54d --- /dev/null +++ b/Master/texmf/tex/generic/config/lualatexiniconfig.tex @@ -0,0 +1,60 @@ +% $Id$ +% Enable and prefix LuaTeX primitives for LaTeX-based formats +% Assumes LuaTeX 0.39.x or greater. +% Manuel Pégourié-Gonnard, 2009. Public domain. +\begingroup +\catcode`\{=1 +\catcode`\}=2 +\directlua{ + % etex and pdftex primitives are enabled without prefixing + tex.enableprimitives('', + tex.extraprimitives('etex', 'pdftex')) + % other primitives are prefixed with luatex (see below) + tex.enableprimitives('luatex', + tex.extraprimitives('core', 'omega', 'aleph', 'luatex')) + } +\endgroup +\endinput + +% Rationale for primitives prefixing. +% +% 1. All current macro packages run smoothly on top of pdf(e)TeX, so those +% primitives are left untouched. +% 2. Other non-TeX82 primitives in LuaTeX may cause name clashes with existing +% macros in macro packages, especially when the use very "natural" names +% such as \outputbox, \mathstyle etc. Such a probability for name clashes is +% highly undesirable if LuaTeX is to replace pdfTeX as the default engine +% some day, and still undesirable even if it does not, anyway, since some +% level of compatibility never hurts. +% 3. The LuaTeX team refused to apply a systematic prefixing policy, but +% kindly provided a tool allowing to apply it. So we chose to use it. +% 4. The 'luatex' prefix was chosen since it is already used as a prefix for +% some primitives, such as \luatexversion: since way, those promitive don't +% end up with a double prefix (see tex.enableprimitive in the luatex manual +% for details). +% 5. The \directlua primitive is provided both with its natural name (allowing +% to easily detect LuaTeX-besed formats) and a prefixed version +% \luatexdirectlua (for consistency with \luatexlatelua). +% 6. Various remarks +% (a) The obvious drawback of such a prefixing policy is that the names used +% by LaTeX or generic macro writer won't match the names used in the +% manual. We hope this is compensated by the gain in backwards +% compatibility. +% (b) All primitives dealing with Unicode math already begin with \U, and +% maybe will match the names of XeTeX primitives some day, so maybe +% prefixing was not necessary/desirable for them. However, we tried to +% make the prefixing rule as simple as possible, so that point (a) doesn't +% get too annoying. +% (c) The final name of some primitive may sound strange, namely those +% already containing the name of an engine, such as \luatexOmegaVersion. +% However, since LuaTeX is not a drop-in replacement for Omega/Aleph, we +% felt it wrong to provide \OmegaVersion. +% (d) Maybe some day we'll realise that it is better to provide all +% primitives without prefixing at all, after all. If this happens, it will +% be easy to add the unprefixed primitives in the format while keeping the +% prefixed names for compatibility. It wouldn't work the other way round +% (ie, realising that we should not provide the unprefixed primitives +% would cause huge compatibility problems for all LuaTeX-specific macro +% packages). + + diff --git a/Master/texmf/tex/generic/config/luatexiniconfig.tex b/Master/texmf/tex/generic/config/luatexiniconfig.tex index 396237e5c50..fd70863e21d 100644 --- a/Master/texmf/tex/generic/config/luatexiniconfig.tex +++ b/Master/texmf/tex/generic/config/luatexiniconfig.tex @@ -1,12 +1,18 @@ % $Id$ -% Enable LuaTeX primitives for INI mode (needed since 0.39.0) -% Élie Roux & Manuel Pégourié-Gonnard, 2009. Public domain. +% Enable and prefix LuaTeX primitives for Plain-based formats +% Assumes LuaTeX 0.39.x or greater. +% Manuel Pégourié-Gonnard, 2009. Public domain. \begingroup \catcode`\{=1 \catcode`\}=2 -\expandafter\ifx\csname luatexversion\endcsname\relax - \let\luatexversion\undefined - \directlua{tex.enableprimitives('', tex.extraprimitives())} -\fi +\directlua{ + % all primitives are enabled without prefixing + tex.enableprimitives('', + tex.extraprimitives()) + % for compatibility with LaTeX-based formats, also provide a prefixed version + % of some primitives too (see lualatexiniconfig.tex) + tex.enableprimitives('luatex', + tex.extraprimitives('core', 'omega', 'aleph', 'luatex')) + } \endgroup \endinput diff --git a/Master/texmf/tex/generic/config/luatexprimitives.tex b/Master/texmf/tex/generic/config/luatexprimitives.tex deleted file mode 100644 index 2a16579847a..00000000000 --- a/Master/texmf/tex/generic/config/luatexprimitives.tex +++ /dev/null @@ -1,19 +0,0 @@ -% $Id$ -% Enable and prefix LuaTeX primitives for LaTeX-based formats -% % Maybe Plain based formats too, for the sake of generic macros? -% Manuel Pégourié-Gonnard, 2009. Public domain. -\begingroup -\catcode`\{=1 -\catcode`\}=2 -\expandafter\ifx\csname luatexversion\endcsname\relax - \let\luatexversion\undefined - \directlua{ - % etex and pdftex primitives are enabled without prefixing - tex.enableprimitives('', - tex.extraprimitives('etex', 'pdftex')) - % other primitives are prefixed with luatex - tex.enableprimitives('luatex', - tex.extraprimitives('omega', 'alpeh', 'luatex')) - } -\fi -\endgroup |