diff options
author | Karl Berry <karl@freefriends.org> | 2015-10-01 22:00:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-10-01 22:00:12 +0000 |
commit | b0a27fa1b235b8769c32d6a4af90697503bc5f7f (patch) | |
tree | 8d46da006822aaf3f3637823712a86f545512feb /Master/texmf-dist/source/latex/base | |
parent | dc8208998ecb52e2206b7943b322681502dd0ced (diff) |
latex 2015/10/01
git-svn-id: svn://tug.org/texlive/trunk@38512 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/base')
-rw-r--r-- | Master/texmf-dist/source/latex/base/format.ins | 55 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/latexrelease.ins | 3 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltcounts.dtx | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltdirchk.dtx | 41 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltfinal.dtx | 17 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltfssbas.dtx | 16 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltlists.dtx | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/source/latex/base/ltluatex.dtx | 1552 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltnews23.tex | 257 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltoutenc.dtx | 20 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltoutput.dtx | 79 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltplain.dtx | 113 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltunicode.dtx | 202 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltvers.dtx | 23 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/unpack.ins | 1 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/base/utf8ienc.dtx | 166 |
16 files changed, 2395 insertions, 158 deletions
diff --git a/Master/texmf-dist/source/latex/base/format.ins b/Master/texmf-dist/source/latex/base/format.ins index 9cf0ac42559..22ad59ef232 100644 --- a/Master/texmf-dist/source/latex/base/format.ins +++ b/Master/texmf-dist/source/latex/base/format.ins @@ -75,6 +75,47 @@ and covered by LPPL is defined by the unpacking scripts (with extension .ins) which are part of the distribution. \endpreamble +\def\MetaPrefix{--} +\declarepreamble\luapreamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at http://latex-project.org/bugs.html +(but please observe conditions on bug reports sent to that address!) + + +Copyright 2015 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the LaTeX base system. +-------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file has the LPPL maintenance status "maintained". + +This file may only be distributed together with a copy of the LaTeX +base system. You may however distribute the LaTeX base system without +such generated files. + +The list of all files belonging to the LaTeX base distribution is +given in the file `manifest.txt'. See also `legal.txt' for additional +information. + +The list of derived (unpacked) files belonging to the distribution +and covered by LPPL is defined by the unpacking scripts (with +extension .ins) which are part of the distribution. +\endpreamble +\let\MetaPrefix\DoubleperCent + \declarepreamble\cfgpreamble This is a generated file. @@ -150,6 +191,7 @@ the system are in the document `cfgguide.tex'. \from{ltpage.dtx}{2ekernel} \from{ltoutput.dtx}{2ekernel} \from{ltclass.dtx}{2ekernel} + \from{ltluatex.dtx}{2ekernel} \from{ltfinal.dtx}{2ekernel}} \file{tracefnt.sty}{% \from{ltfsstrc.dtx}{package,trace}} @@ -175,6 +217,9 @@ the system are in the document `cfgguide.tex'. \from{newlfont.dtx}{package} } +% luatex support (TeX part) + +\generate{\file{ltluatex.tex}{\from{ltluatex.dtx}{tex,plain}}} %%%%%%%%%%%%%%%%% CUSTOMISABLE FILES @@ -203,6 +248,16 @@ the system are in the document `cfgguide.tex'. \generateFile{preload.ltx}{t}{% \from{preload.dtx}{preload,cm,xpt,tex}} +%%%%%%%%%%%%%%%%% Lua code + +% This is at the end as the prefix/postamble requirements are +% different to everything else + +\def\MetaPrefix{--} +\usepreamble\luapreamble +\nopostamble +\generate{\file{ltluatex.lua}{\from{ltluatex.dtx}{lua}}} + \endbatchfile diff --git a/Master/texmf-dist/source/latex/base/latexrelease.ins b/Master/texmf-dist/source/latex/base/latexrelease.ins index ae41fd88f91..6d7e28c779f 100644 --- a/Master/texmf-dist/source/latex/base/latexrelease.ins +++ b/Master/texmf-dist/source/latex/base/latexrelease.ins @@ -81,9 +81,11 @@ extension .ins) which are part of the distribution. \generateFile{latexrelease.sty}{t}{% \from{ltvers.dtx} {latexrelease}% \from{latexrelease.dtx}{latexrelease}% + \from{ltdirchk.dtx} {latexrelease}% \from{ltdefns.dtx} {latexrelease}% \from{ltboxes.dtx} {latexrelease}% \from{ltmath.dtx} {latexrelease}% + \from{ltoutenc.dtx} {latexrelease}% \from{ltcounts.dtx} {latexrelease}% \from{ltlength.dtx} {latexrelease}% \from{ltfloat.dtx} {latexrelease}% @@ -94,6 +96,7 @@ extension .ins) which are part of the distribution. \from{ltfssini.dtx} {latexrelease}% \from{ltfssbas.dtx} {latexrelease}% \from{ltfsscmp.dtx} {latexrelease}% + \from{ltluatex.dtx} {latexrelease}% \from{ltfinal.dtx} {latexrelease}% } diff --git a/Master/texmf-dist/source/latex/base/ltcounts.dtx b/Master/texmf-dist/source/latex/base/ltcounts.dtx index 0fb2d8b90a8..1d7a9f68322 100644 --- a/Master/texmf-dist/source/latex/base/ltcounts.dtx +++ b/Master/texmf-dist/source/latex/base/ltcounts.dtx @@ -260,12 +260,14 @@ % initiates resetting the next level down. % \begin{macrocode} %</2ekernel> -%<latexrelease>\IncludeInRelease{2015/01/01}{\@stpelt}{Reset nested counters}% +%<latexrelease>\IncludeInRelease{2015/01/01}{\@stpelt} +%<latexrelease> {Reset nested counters}% %<*2ekernel|latexrelease> \def\@stpelt#1{\global\csname c@#1\endcsname \m@ne\stepcounter{#1}}% %<latexrelease>\EndIncludeInRelease %</2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{0000/00/00}{\@stpelt}{Reset nested counters}%% +%<latexrelease>\IncludeInRelease{0000/00/00}{\@stpelt} +%<latexrelease> {Reset nested counters}%% %<latexrelease>\def\@stpelt#1{\global\csname c@#1\endcsname \z@}% %<latexrelease>\EndIncludeInRelease %<*2ekernel> diff --git a/Master/texmf-dist/source/latex/base/ltdirchk.dtx b/Master/texmf-dist/source/latex/base/ltdirchk.dtx index 11af47cdd7f..96727458b88 100644 --- a/Master/texmf-dist/source/latex/base/ltdirchk.dtx +++ b/Master/texmf-dist/source/latex/base/ltdirchk.dtx @@ -28,7 +28,7 @@ % \fi % % \ProvidesFile{ltdirchk.dtx} -% [2015/01/03 v1.1 LaTeX Kernel (System Dependent Parts)] +% [2015/81/33 v1.2 LaTeX Kernel (System Dependent Parts)] % % \iffalse %%% From File: ltdirchk.dtx @@ -82,7 +82,7 @@ % {documentation improvements mainly from internal/2520} % \changes{v1.0w}{1998/08/17}{(RmS) Documentation improvements.} % -% \CheckSum{606} +% \CheckSum{618} % % \section{\LaTeX\ System Dependent Initialisations} % @@ -225,6 +225,7 @@ \catcode`\}=2 % \end{macrocode} % \changes{v1.1}{2015/01/03}{Enable extra primitives when Lua\TeX{} is used} +% \changes{v1.2}{2015/08/23}{Do not use luatex prefix} % If Lua\TeX{} is in use the extensions and other new primitives % have to be activated: this is done as early as possible. Older % versions of Lua\TeX{} do not hide the primitives: a version check is @@ -237,17 +238,43 @@ % \end{macrocode} % Enable e-TeX/pdfTeX/Umath primitives with their natural names % \begin{macrocode} - \directlua{tex.enableprimitives('',% + \directlua{tex.enableprimitives("",% tex.extraprimitives('etex', 'pdftex', 'umath'))} % \end{macrocode} -% Enable other primitives with |luatex| prefix +% +% In current formats enable primitives with unprefixed names. +% the \textsf{latexrelease} guards allow the primitives to be +% defined with a |\luatex| prefix if older formats are specified. +% \begin{macrocode} +%</initex> +%</dircheck> +%<*initex,latexrelease> +%<latexrelease>\ifx\directlua\undefined\else +%<latexrelease>\IncludeInRelease{2015/10/01}{\luatexluafunction} +%<latexrelease> {LuaTeX (prefixed names)}% + \directlua{tex.enableprimitives("",% + tex.extraprimitives("omega", "aleph", "luatex"))} +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}{\luatexluafunction} +%<latexrelease> {LuaTeX (prefixed names)}% +%<latexrelease>\directlua{ +%<latexrelease> tex.enableprimitives( +%<latexrelease> "luatex", +%<latexrelease> tex.extraprimitives("core","omega", "aleph", "luatex") +%<latexrelease> ) +%<latexrelease>} +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\fi +%</initex,latexrelease> +%<*dircheck> +%<*initex> +% \end{macrocode} +% % \begin{macrocode} - \directlua{tex.enableprimitives('luatex', - tex.extraprimitives('core', 'omega', 'aleph', 'luatex')) - } \fi \fi % \end{macrocode} +% % That distraction over, back to the basics of a format. % \begin{macrocode} \catcode`\#=6 diff --git a/Master/texmf-dist/source/latex/base/ltfinal.dtx b/Master/texmf-dist/source/latex/base/ltfinal.dtx index d1d95dcd259..13c3a748177 100644 --- a/Master/texmf-dist/source/latex/base/ltfinal.dtx +++ b/Master/texmf-dist/source/latex/base/ltfinal.dtx @@ -190,7 +190,8 @@ %<latexrelease> \errmessage{No room for a new #3}% %<latexrelease> \fi} %<latexrelease> \def\newXeTeXintercharclass{% -%<latexrelease> \xe@alloc@\xe@alloc@intercharclass\XeTeXcharclass\chardef\@cclv} +%<latexrelease> \xe@alloc@\xe@alloc@intercharclass +%<latexrelease> \XeTeXcharclass\chardef\@cclv} %<latexrelease> \fi %<latexrelease>\EndIncludeInRelease %<*2ekernel> @@ -684,13 +685,13 @@ % \fi % \else % \typeout{^^J^^J^^J% -% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J% -% !! Patch file `ltpatch.ltx' (for version <\fmtversion@topatch>)^^J% -% !! is not suitable for version <\fmtversion> of LaTeX.^^J^^J% -% !! Please check if initex found an old patch file:^^J% -% !! --- if so, rename it or delete it, and redo the^^J% -% !! initex run.^^J% -% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}% +% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J% +% !! Patch file `ltpatch.ltx' (for version <\fmtversion@topatch>)^^J% +% !! is not suitable for version <\fmtversion> of LaTeX.^^J^^J% +% !! Please check if initex found an old patch file:^^J% +% !! --- if so, rename it or delete it, and redo the^^J% +% !! initex run.^^J% +% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}% % \batchmode \@@end % \fi % \let\fmtversion@topatch\relax diff --git a/Master/texmf-dist/source/latex/base/ltfssbas.dtx b/Master/texmf-dist/source/latex/base/ltfssbas.dtx index 502f22f6fda..16bfa18cf2f 100644 --- a/Master/texmf-dist/source/latex/base/ltfssbas.dtx +++ b/Master/texmf-dist/source/latex/base/ltfssbas.dtx @@ -1331,7 +1331,7 @@ %<latexrelease> {Font substituation in preamble}% %<*2ekernel|latexrelease> \def\wrong@fontshape{% - \csname D@\f@encoding\endcsname % install defaults if in math + \csname D@\f@encoding\endcsname % install defaults if in math % \end{macrocode} % We remember the wanted |\curr@fontshape| combination % which we will need in a moment. @@ -1452,7 +1452,7 @@ %<latexrelease>\IncludeInRelease{0000/00/00}{\wrong@fontshape}% %<latexrelease> {Font substituation in preamble}% %<latexrelease>\def\wrong@fontshape{% -%<latexrelease> \csname D@\f@encoding\endcsname % install defaults if in math +%<latexrelease> \csname D@\f@encoding\endcsname %<latexrelease> \edef\reserved@a{\csname\curr@fontshape\endcsname}% %<latexrelease> \ifx\last@fontshape\reserved@a %<latexrelease> \errmessage{Corrupted NFSS tables}% @@ -1466,13 +1466,15 @@ %<latexrelease> \let\f@family\default@family %<latexrelease> \fi \fi %<latexrelease> \fi -%<latexrelease> \@font@warning{Font shape `\expandafter\string\reserved@a' -%<latexrelease> \expandafter\@gobble\string\@undefined\MessageBreak -%<latexrelease> using `\curr@fontshape' instead\@wrong@font@char}% +%<latexrelease> \@font@warning{Font shape +%<latexrelease> `\expandafter\string\reserved@a' +%<latexrelease> \expandafter\@gobble\string\@undefined +%<latexrelease> \MessageBreak +%<latexrelease> using `\curr@fontshape' instead\@wrong@font@char}% %<latexrelease> \global\let\last@fontshape\reserved@a %<latexrelease> \gdef\@defaultsubs{% -%<latexrelease> \@font@warning{Some font shapes were not available, defaults -%<latexrelease> substituted.\@gobbletwo}}% +%<latexrelease> \@font@warning{Some font shapes were not available, +%<latexrelease> defaults substituted.\@gobbletwo}}% %<latexrelease> \global\expandafter\expandafter\expandafter\let %<latexrelease> \expandafter\reserved@a %<latexrelease> \csname\curr@fontshape\endcsname diff --git a/Master/texmf-dist/source/latex/base/ltlists.dtx b/Master/texmf-dist/source/latex/base/ltlists.dtx index e71835583d9..b120870433c 100644 --- a/Master/texmf-dist/source/latex/base/ltlists.dtx +++ b/Master/texmf-dist/source/latex/base/ltlists.dtx @@ -749,7 +749,7 @@ % \begin{macrocode} %<latexrelease>\IncludeInRelease{0000/00/00}{\@doendpe}{clubpenalty fix}% %<latexrelease>\def\@doendpe{\@endpetrue -%<latexrelease> \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar +%<latexrelease> \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar %<latexrelease> {{\setbox\z@\lastbox}\everypar{}\@endpefalse}} %<latexrelease>\EndIncludeInRelease % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/base/ltluatex.dtx b/Master/texmf-dist/source/latex/base/ltluatex.dtx new file mode 100755 index 00000000000..8a19d74af39 --- /dev/null +++ b/Master/texmf-dist/source/latex/base/ltluatex.dtx @@ -0,0 +1,1552 @@ +% \iffalse meta-comment +% +% Copyright 2015 +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% It may be distributed and/or modified under the conditions of +% the LaTeX Project Public License (LPPL), either version 1.3c of +% this license or (at your option) any later version. The latest +% version of this license is in the file: +% +% http://www.latex-project.org/lppl.txt +% +% +% +%<2ekernel>%%% From File: ltluatex.dtx +%<plain>\ifx\newluafunction\undefined\else\expandafter\endinput\fi +%<tex>\ifx +%<tex> \ProvidesFile\undefined\begingroup\def\ProvidesFile +%<tex> #1#2[#3]{\endgroup\immediate\write-1{File: #1 #3}} +%<tex>\fi +%<plain>\ProvidesFile{ltluatex.tex} +%<*driver> +\ProvidesFile{ltluatex.dtx} +%</driver> +%<*tex> +[2015/09/24 v1.0a +%</tex> +%<plain> LuaTeX support for plain TeX (core) +%<*tex> +] +\edef\etatcatcode{\the\catcode`\@} +\catcode`\@=11 +%</tex> +%<*driver> +\documentclass{ltxdoc} +\GetFileInfo{ltluatex.dtx} +\begin{document} +\title{\filename\\(Lua\TeX{}-specific support)} +\author{David Carlisle and Joseph Wright\footnote{Significant portions + of the code here are adapted/simplified from the packages \textsf{luatex} and + \textsf{luatexbase} written by Heiko Oberdiek, \'{E}lie Roux, + Manuel P\'{e}gouri\'{e}-Gonnar and Philipp Gesang.}} +\date{\filedate} +\maketitle +\setcounter{tocdepth}{2} +\tableofcontents +\DocInput{\filename} +\end{document} +%</driver> +% \fi +% +% +% \section{Overview} +% +% Lua\TeX{} adds a number of engine-specific functions to \TeX{}. Several of +% these require set up that is best done in the kernel or need related support +% functions. This file provides \emph{basic} support for Lua\TeX{} at the +% \LaTeXe{} kernel level plus as a loadable file which can be used with +% plain \TeX{} and \LaTeX{}. +% +% This file contains code for both \TeX{} (to be stored as part of the format) +% and Lua (to be loaded at the start of each job). In the Lua code, the kernel +% uses the namespace |luatexbase|. +% +% The following |\count| registers are used here for register allocation: +% \begin{itemize} +% \item[\texttt{\string\e@alloc@attribute@count}] Attributes (default~258) +% \item[\texttt{\string\e@alloc@ccodetable@count}] Category code tables +% (default~259) +% \item[\texttt{\string\e@alloc@luafunction@count}] Lua functions +% (default~260) +% \item[\texttt{\string\e@alloc@whatsit@count}] User whatsits (default~261) +% \item[\texttt{\string\e@alloc@bytecode@count}] Lua bytecodes (default~262) +% \item[\texttt{\string\e@alloc@luachunk@count}] Lua chunks (default~263) +% \end{itemize} +% (|\count 256| is used for |\newmarks| allocation and |\count 257| +% is used for\linebreak +% |\newXeTeXintercharclass| with Xe\TeX{}, with code defined in +% \texttt{ltfinal.dtx}). +% With any \LaTeXe{} kernel from 2015 onward these registers are part of +% the block in the extended area reserved by the kernel (prior to 2015 the +% \LaTeXe{} kernel did not provide any functionality for the extended +% allocation area). +% +% \section{Core \TeX{} functionality} +% +% The commands defined here are defined for +% possible inclusion in a future \LaTeX{} format, however also extracted +% to the file |ltluatex.tex| which may be used with older \LaTeX\ +% formats, and with plain \TeX. +% +% \noindent +% \DescribeMacro{\newattribute} +% |\newattribute{|\meta{attribute}|}|\\ +% Defines a named \cs{attribute}, indexed from~$1$ +% (\emph{i.e.}~|\attribute0| is never defined). Attributes initially +% have the marker value |-"7FFFFFFF| (`unset') set by the engine. +% +% \noindent +% \DescribeMacro{\newcatcodetable} +% |\newcatcodetable{|\meta{catcodetable}|}|\\ +% Defines a named \cs{catcodetable}, indexed from~$1$ +% (|\catcodetable0| is never assigned). A new catcode table will be +% populated with exactly those values assigned by Ini\TeX{} (as described +% in the Lua\TeX{} manual). +% +% \noindent +% \DescribeMacro{\newluafunction} +% |\newluafunction{|\meta{function}|}|\\ +% Defines a named \cs{luafunction}, indexed from~$1$. (Lua indexes +% tables from $1$ so |\luafunction0| is not available). +% +% \noindent +% \DescribeMacro{\newwhatsit} +% |\newwhatsit{|\meta{whatsit}|}|\\ +% Defines a custom \cs{whatsit}, indexed from~$1$. +% +% \noindent +% \DescribeMacro{\newluabytecode} +% |\newluabytecode{|\meta{bytecode}|}|\\ +% Allocates a number for lua bytecode register, indexed from~$1$. +% +% \noindent +% \DescribeMacro{\newluachunkname} +% |newluachunkname{|\meta{chunkname}|}|\\ +% Allocates a number for lua chunk register, indexed from~$1$. +% Also enters the name of the regiser (without backslash) into the +% \verb|lua.name| table to be used in stack traces. +% +% \noindent +% \DescribeMacro{\catcodetable@initex} +% \DescribeMacro{\catcodetable@string} +% \DescribeMacro{\catcodetable@latex} +% \DescribeMacro{\catcodetable@atletter} +% Predefined category code tables with the obvious assignments. Note +% that the |latex| and |atletter| tables set the full Unicode range +% to the codes predefined by the kernel. +% +% \noindent +% \DescribeMacro{\setattribute} +% \DescribeMacro{\unsetattribute} +% |\setattribute{|\meta{attribute}|}{|\meta{value}|}|\\ +% |\unsetattribute{|\meta{attribute}|}|\\ +% Set and unset attributes in a manner analogous to |\setlength|. Note that +% attributes take a marker value when unset so this operation is distinct +% from setting the value to zero. +% +% \section{Plain \TeX\ interface} +% +% The \textsf{ltluatex} interface may be used with plain \TeX\ using +% |\input{ltluatex}| this inputs |ltluatex.tex| which inputs +% |etex.src| (or |etex.sty| if used with \LaTeX) +% if it is not already input, and then defines some internal commands to +% allow the \textsf{ltluatex} interface to be defined. +% +% The \textsf{luatexbase} package interface may also be used in plain \TeX, +% as before, by inputting the package |\input luatexbase.sty|. The new +% version of \textsf{luatexbase} is based on this \textsf{ltluatex} +% code but implements a compatibility layer providing the interface +% of the original package. +% +% \section{Lua functionality} +% +% \begingroup +% +% \begingroup\lccode`~=`_ +% \lowercase{\endgroup\let~}_ +% \catcode`_=12 +% +% \subsection{Allocators in Lua} +% +% \DescribeMacro{new_attribute} +% |luatexbase.new_attribute(|\meta{attribute}|)|\\ +% Returns an allocation number for the \meta{attribute}, indexed from~$1$. +% The attribute will be initialised with the marker value |-"7FFFFFFF| +% (`unset'). The attribute allocation sequence is shared with the \TeX{} +% code but this function does \emph{not} define a token using +% |\attributedef|. +% The attribute name is recorded in the |attributes| table. A +% metatable is provided so that the table syntax can be used +% consistently for attributes declared in \TeX\ or lua. +% +% \noindent +% \DescribeMacro{new_whatsit} +% |luatexbase.new_whatsit(|\meta{whatsit}|)|\\ +% Returns an allocation number for the custom \meta{whatsit}, indexed from~$1$. +% +% \noindent +% \DescribeMacro{new_bytecode} +% |luatexbase.new_bytecode(|\meta{bytecode}|)|\\ +% Returns an allocation number for a bytecode register, indexed from~$1$. +% The optional \meta{name} argument is just used for logging. +% +% \noindent +% \DescribeMacro{new_chunkname} +% |luatexbase.new_chunkname(|\meta{chunkname}|)|\\ +% Returns an allocation number for a lua chunk name for use with +% |\directlua| and |\latelua|, indexed from~$1$. +% The number is returned and also \meta{name} argument is added to the +% |lua.name| array at that index. +% +% +% \subsection{Lua access to \TeX{} register numbers} +% +% \DescribeMacro{registernumber} +% |luatexbase.registernumer(|\meta{name}|)|\\ +% Sometimes (notably in the case of Lua attributes) it is necessary to +% access a register \emph{by number} that has been allocated by \TeX{}. +% This package provides a function to look up the relevant number +% using Lua\TeX{}'s internal tables. After for example +% |\newattribute\myattrib|, |\myattrib| would be defined by (say) +% |\myattrib=\attribute15|. |luatexbase.registernumer("myattrib")| +% would then return the register number, $15$ in this case. If the string passed +% as argument does not correspond to a token defined by |\attributedef|, +% |\countdef| or similar commands, the Lua value |false| is returned. +% +% As an example, consider the input: +%\begin{verbatim} +% \newcommand\test[1]{% +% \typeout{#1: \expandafter\meaning\csname#1\endcsname^^J +% \space\space\space\space +% \directlua{tex.write(luatexbase.registernumber("#1") or "bad input")}% +% }} +% +% \test{undefinedrubbish} +% +% \test{space} +% +% \test{hbox} +% +% \test{@MM} +% +% \test{@tempdima} +% \test{@tempdimb} +% +% \test{strutbox} +% +% \test{sixt@@n} +% +% \attrbutedef\myattr=12 +% \myattr=200 +% \test{myattr} +% +%\end{verbatim} +% +% If the demonstration code is processed with Lua\LaTeX{} then the following +% would be produced in the log and terminal output. +%\begin{verbatim} +% undefinedrubbish: \relax +% bad input +% space: macro:-> +% bad input +% hbox: \hbox +% bad input +% @MM: \mathchar"4E20 +% 20000 +% @tempdima: \dimen14 +% 14 +% @tempdimb: \dimen15 +% 15 +% strutbox: \char"B +% 11 +% sixt@@n: \char"10 +% 16 +% myattr: \attribute12 +% 12 +%\end{verbatim} +% +% Notice how undefined commands, or commands unrelated to registers +% do not produce an error, just return |false| and so print +% |bad input| here. Note also that commands defined by |\newbox| work and +% return the number of the box register even though the actual command +% holding this number is a |\chardef| defined token (there is no +% |\boxdef|). +% +% \subsection{Module utilities} +% +% \DescribeMacro{provides_module} +% |luatexbase.provides_module(|\meta{info}|)|\\ +% This function is used by modules to identify themselves; the |info| should be +% a table containing information about the module. The required field +% |name| must contain the name of the module. It is recommended to provide a +% field |date| in the usual \LaTeX{} format |yyyy/mm/dd|. Optional fields +% |version| (a string) and |description| may be used if present. This +% information will be recorded in the log. Other fields are ignored. +% +% \noindent +% \DescribeMacro{module_info} +% \DescribeMacro{module_warning} +% \DescribeMacro{module_error} +% |luatexbase.module_info(|\meta{module}, \meta{text}|)|\\ +% |luatexbase.module_warning(|\meta{module}, \meta{text}|)|\\ +% |luatexbase.module_error(|\meta{module}, \meta{text}|)|\\ +% These functions are similar to \LaTeX{}'s |\PackageError|, |\PackageWarning| +% and |\PackageInfo| in the way they format the output. No automatic line +% breaking is done, you may still use |\n| as usual for that, and the name of +% the package will be prepended to each output line. +% +% Note that |luatexbase.module_error| raises an actual Lua error with |error()|, +% which currently means a call stack will be dumped. While this may not +% look pretty, at least it provides useful information for tracking the +% error down. +% +% \subsection{Callback management} +% +% \noindent +% \DescribeMacro{add_to_callback} +% |luatexbase.add_to_callback(|^^A +% \meta{callback}, \meta{function}, \meta{description}|)| +% Registers the \meta{function} into the \meta{callback} with a textual +% \meta{description} of the function. Functions are inserted into the callback +% in the order loaded. +% +% \noindent +% \DescribeMacro{remove_from_callback} +% |luatexbase.remove_from_callback(|\meta{callback}, \meta{description}|)| +% Removes the callback function with \meta{description} from the \meta{callback}. +% The removed function and its description +% are returned as the results of this function. +% +% \noindent +% \DescribeMacro{in_callback} +% |luatexbase.in_callback(|\meta{callback}, \meta{description}|)| +% Checks if the \meta{description} matches one of the functions added +% to the list for the \meta{callback}, returning a boolean value. +% +% \noindent +% \DescribeMacro{disable_callback} +% |luatexbase.disable_callback(|\meta{callback}|)| +% Sets the \meta{callback} to \texttt{false} as described in the Lua\TeX{} +% manual for the underlying \texttt{callback.register} built-in. Callbacks +% will only be set to false (and thus be skipped entirely) if there are +% no functions registered using the callback. +% +% \noindent +% \DescribeMacro{callback_descriptions} +% A list of the descriptions of functions registered to the specified +% callback is returned. |{}| is returned if there are no functions registered. +% +% \noindent +% \DescribeMacro{create_callback} +% |luatexbase.create_callback(|\meta{name},meta{type},\meta{default}|)| +% Defines a user defined callback. The last argument is a default +% functtion of |false|. +% +% \noindent +% \DescribeMacro{call_callback} +% |luatexbase.call_callback(|\meta{name},\ldots|)| +% Calls a user defined callback with the supplied arguments. +% +% \endgroup +% +% \CheckSum{484} +% \StopEventually{} +% +% \section{Implementation} +% +% \begin{macrocode} +%<*2ekernel|tex|latexrelease> +%<2ekernel|latexrelease>\ifx\directlua\@undefined\else +% \end{macrocode} +% +% +% \subsection{Minimum Lua\TeX{} version} +% +% Lua\TeX{} has changed a lot over time. In the kernel support for ancient +% versions is not provided: trying to build a format with a very old binary +% therefore gives some information in the log and loading stops. The cut-off +% selected here relates to the tree-searching behaviour of |require()|: +% from version~0.60, Lua\TeX{} will correctly find Lua files in the |texmf| +% tree without `help'. +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2015/10/01} +%<latexrelease> {\newluafunction}{LuaTeX}% +\ifnum\luatexversion<60 % + \wlog{***************************************************} + \wlog{* LuaTeX version too old for ltluatex support *} + \wlog{***************************************************} + \expandafter\endinput +\fi +% \end{macrocode} +% +% \subsection{Older \LaTeX{}/Plain \TeX\ setup} +% +% \begin{macrocode} +%<*tex> +% \end{macrocode} +% +% Older \LaTeX{} formats don't have the primitives with `native' names: +% sort that out. If they already exist this will still be safe. +% \begin{macrocode} +\directlua{tex.enableprimitives("",tex.extraprimitives("luatex"))} +% \end{macrocode} +% +% \begin{macrocode} +\ifx\e@alloc\@undefined +% \end{macrocode} +% +% In pre-2014 \LaTeX{}, or plain \TeX{}, load |etex.{sty,src}|. +% \begin{macrocode} + \ifx\documentclass\@undefined + \ifx\loccount\@undefined + \input{etex.src}% + \fi + \catcode`\@=11 % + \outer\expandafter\def\csname newfam\endcsname + {\alloc@8\fam\chardef\et@xmaxfam} + \else + \RequirePackage{etex} + \expandafter\def\csname newfam\endcsname + {\alloc@8\fam\chardef\et@xmaxfam} + \expandafter\let\expandafter\new@mathgroup\csname newfam\endcsname + \fi +% \end{macrocode} +% +% \subsubsection{Fixes to \texttt{etex.src}/\texttt{etex.sty}} +% +% These could and probably should be made directly in an +% update to etex.src which already has some luatex-specific +% code, but does not define the correct range for luatex. +% +% \begin{macrocode} +% 2015-07-13 higher range in luatex +\edef \et@xmaxregs {\ifx\directlua\@undefined 32768\else 65536\fi} +% luatex/xetex also allow more math fam +\edef \et@xmaxfam {\ifx\Umathchar\@undefined\sixt@@n\else\@cclvi\fi} +% \end{macrocode} +% +% \begin{macrocode} +\count 270=\et@xmaxregs % locally allocates \count registers +\count 271=\et@xmaxregs % ditto for \dimen registers +\count 272=\et@xmaxregs % ditto for \skip registers +\count 273=\et@xmaxregs % ditto for \muskip registers +\count 274=\et@xmaxregs % ditto for \box registers +\count 275=\et@xmaxregs % ditto for \toks registers +\count 276=\et@xmaxregs % ditto for \marks classes +% \end{macrocode} +% +% and 256 or 16 fam. (Done above due to plain/\LaTeX\ differences in +% \textsf{ltluatex}.) +% \begin{macrocode} +% \outer\def\newfam{\alloc@8\fam\chardef\et@xmaxfam} +% \end{macrocode} +% +% End of proposed changes to \texttt{etex.src} +% +% \subsubsection{luatex specific settings} +% +% Switch to global cf |luatex.sty| to leave room for inserts +% not really needed for luatex but possibly most compatible +% with existing use. +% \begin{macrocode} +\expandafter\let\csname newcount\expandafter\expandafter\endcsname + \csname globcount\endcsname +\expandafter\let\csname newdimen\expandafter\expandafter\endcsname + \csname globdimen\endcsname +\expandafter\let\csname newskip\expandafter\expandafter\endcsname + \csname globskip\endcsname +\expandafter\let\csname newbox\expandafter\expandafter\endcsname + \csname globbox\endcsname +% \end{macrocode} +% +% Define|\e@alloc| as in latex (the existing macros in |etex.src| +% hard to extend to further register types as they assume specific +% 26x and 27x count range. For compatibility the existing register +% allocation is not changed. +% +% \begin{macrocode} +\chardef\e@alloc@top=65535 +\let\e@alloc@chardef\chardef +% \end{macrocode} +% +% \begin{macrocode} +\def\e@alloc#1#2#3#4#5#6{% + \global\advance#3\@ne + \e@ch@ck{#3}{#4}{#5}#1% + \allocationnumber#3\relax + \global#2#6\allocationnumber + \wlog{\string#6=\string#1\the\allocationnumber}}% +% \end{macrocode} +% +% \begin{macrocode} +\gdef\e@ch@ck#1#2#3#4{% + \ifnum#1<#2\else + \ifnum#1=#2\relax + #1\@cclvi + \ifx\count#4\advance#1 10 \fi + \fi + \ifnum#1<#3\relax + \else + \errmessage{No room for a new \string#4}% + \fi + \fi}% +% \end{macrocode} +% +% Two simple \LaTeX\ macros used in |ltlatex.sty|. +% \begin{macrocode} +\long\def\@gobble#1{} +\long\def\@firstofone#1{#1} +% \end{macrocode} +% +% \begin{macrocode} +% Fix up allocations not to clash with |etex.src|. +% \end{macrocode} +% +% \begin{macrocode} +\expandafter\csname newcount\endcsname\e@alloc@attribute@count +\expandafter\csname newcount\endcsname\e@alloc@ccodetable@count +\expandafter\csname newcount\endcsname\e@alloc@luafunction@count +\expandafter\csname newcount\endcsname\e@alloc@whatsit@count +\expandafter\csname newcount\endcsname\e@alloc@bytecode@count +\expandafter\csname newcount\endcsname\e@alloc@luachunk@count +% \end{macrocode} +% +% End of conditional setup for plain \TeX\ / old \LaTeX. +% \begin{macrocode} +\fi +%</tex> +% \end{macrocode} +% +% +% \subsection{Attributes} +% +% \begin{macro}{\newattribute} +% \changes{v1.0a}{2015/09/24}{Macro added} +% As is generally the case for the Lua\TeX{} registers we start here +% from~$1$. Notably, some code assumes that |\attribute0| is never used so +% this is important in this case. +% \begin{macrocode} +\ifx\e@alloc@attribute@count\@undefined + \countdef\e@alloc@attribute@count=258 +\fi +\def\newattribute#1{% + \e@alloc\attribute\attributedef + \e@alloc@attribute@count\m@ne\e@alloc@top#1% +} +\e@alloc@attribute@count=\z@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setattribute} +% \begin{macro}{\unsetattribute} +% Handy utilities. +% \begin{macrocode} +\def\setattribute#1#2{#1=\numexpr#2\relax} +\def\unsetattribute#1{#1=-"7FFFFFFF\relax} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Category code tables} +% +% \begin{macro}{\newcatcodetable} +% \changes{v1.0a}{2015/09/24}{Macro added} +% Category code tables are allocated with a limit half of that used by Lua\TeX{} +% for everything else. At the end of allocation there needs to be an +% initialisation step. Table~$0$ is already taken (it's the global one for +% current use) so the allocation starts at~$1$. +% \begin{macrocode} +\ifx\e@alloc@ccodetable@count\@undefined + \countdef\e@alloc@ccodetable@count=259 +\fi +\def\newcatcodetable#1{% + \e@alloc\catcodetable\chardef + \e@alloc@ccodetable@count\m@ne{"8000}#1% + \initcatcodetable\allocationnumber +} +\e@alloc@ccodetable@count=\z@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\catcodetable@initex} +% \changes{v1.0a}{2015/09/24}{Macro added} +% \begin{macro}{\catcodetable@string} +% \changes{v1.0a}{2015/09/24}{Macro added} +% \begin{macro}{\catcodetable@latex} +% \changes{v1.0a}{2015/09/24}{Macro added} +% \begin{macro}{\catcodetable@atletter} +% \changes{v1.0a}{2015/09/24}{Macro added} +% Save a small set of standard tables. The Unicode data is read +% here in a group avoiding any global definitions: that needs a bit +% of effort so that in package/plain mode there is no effect on any +% settings already in force. +% \begin{macrocode} +\newcatcodetable\catcodetable@initex +\newcatcodetable\catcodetable@string +\begingroup + \def\setrangecatcode#1#2#3{% + \ifnum#1>#2 % + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {% + \catcode#1=#3 % + \expandafter\setrangecatcode\expandafter + {\number\numexpr#1 + 1\relax}{#2}{#3} + }% + } + \@firstofone{% + \catcodetable\catcodetable@initex + \catcode0=12 % + \catcode13=12 % + \catcode37=12 % + \setrangecatcode{65}{90}{12}% + \setrangecatcode{97}{122}{12}% + \catcode92=12 % + \catcode127=12 % + \savecatcodetable\catcodetable@string + \endgroup + }% +\newcatcodetable\catcodetable@latex +\newcatcodetable\catcodetable@atletter +\begingroup + \let\ENDGROUP\endgroup + \let\begingroup\relax + \let\endgroup\relax + \let\global\relax + \let\gdef\def + \input{unicode-letters.def}% + \let\endgroup\ENDGROUP + \@firstofone{% + \catcode64=12 % + \savecatcodetable\catcodetable@latex + \catcode64=11 % + \savecatcodetable\catcodetable@atletter + } +\endgroup +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Named Lua functions} +% +% \begin{macro}{\newluafunction} +% \changes{v1.0a}{2015/09/24}{Macro added} +% Much the same story for allocating Lua\TeX{} functions except here they are +% just numbers so are allocated in the same way as boxes. Lua index from~$1$ +% so once again slot~$0$ is skipped. +% \begin{macrocode} +\ifx\e@alloc@luafunction@count\@undefined + \countdef\e@alloc@luafunction@count=260 +\fi +\def\newluafunction{% + \e@alloc\luafunction\e@alloc@chardef + \e@alloc@luafunction@count\m@ne\e@alloc@top +} +\e@alloc@luafunction@count=\z@ +% \end{macrocode} +% \end{macro} +% +% \subsection{Custom whatsits} +% +% \begin{macro}{\newwhatsit} +% \changes{v1.0a}{2015/09/24}{Macro added} +% These are only settable from Lua but for consistency are definable +% here. +% \begin{macrocode} +\ifx\e@alloc@whatsit@count\@undefined + \countdef\e@alloc@whatsit@count=261 +\fi +\def\newwhatsit#1{% + \e@alloc\whatsit\e@alloc@chardef + \e@alloc@whatsit@count\m@ne\e@alloc@top#1% +} +\e@alloc@whatsit@count=\z@ +% \end{macrocode} +% \end{macro} +% +% \subsection{Lua bytecode registers} +% +% \begin{macro}{\newluabytecode} +% \changes{v1.0a}{2015/09/24}{Macro added} +% These are only settable from Lua but for consistency are definable +% here. +% \begin{macrocode} +\ifx\e@alloc@bytecode@count\@undefined + \countdef\e@alloc@bytecode@count=262 +\fi +\def\newluabytecode#1{% + \e@alloc\luabytecode\e@alloc@chardef + \e@alloc@bytecode@count\m@ne\e@alloc@top#1% +} +\e@alloc@bytecode@count=\z@ +% \end{macrocode} +% \end{macro} +% +% \subsection{Lua chunk registers} + +% \begin{macro}{\newluachunkname} +% \changes{v1.0a}{2015/09/24}{Macro added} +% As for bytecode registers, but in addition we need to add a string +% to the \verb|lua.name| table to use in stack tracing. We use the +% name of the command passed to the allocator, with no backslash. +% \begin{macrocode} +\ifx\e@alloc@luachunk@count\@undefined + \countdef\e@alloc@luachunk@count=263 +\fi +\def\newluachunkname#1{% + \e@alloc\luachunk\e@alloc@chardef + \e@alloc@luachunk@count\m@ne\e@alloc@top#1% + {\escapechar\m@ne + \directlua{lua.name[\the\allocationnumber]="\string#1"}}% +} +\e@alloc@luachunk@count=\z@ +% \end{macrocode} +% \end{macro} +% +% \subsection{Lua loader} +% +% Load the Lua code at the start of every job. +% For the conversion of \TeX{} into numbers at the Lua side we need some +% known registers: for convenience we use a set of systematic names, which +% means using a group around the Lua loader. +% \begin{macrocode} +%<2ekernel>\everyjob\expandafter{% +%<2ekernel> \the\everyjob + \begingroup + \attributedef\attributezero=0 % + \chardef \charzero =0 % +% \end{macrocode} +% Note name change required on older luatex, for hash table access. +% \begin{macrocode} + \countdef \CountZero =0 % + \dimendef \dimenzero =0 % + \mathchardef \mathcharzero =0 % + \muskipdef \muskipzero =0 % + \skipdef \skipzero =0 % + \toksdef \tokszero =0 % + \directlua{require("ltluatex")} + \endgroup +%<2ekernel>} +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2015/09/24} +%<latexrelease> {\newluafunction}{LuaTeX}% +%<latexrelease>\let\e@alloc@attribute@count\@undefined +%<latexrelease>\let\newattribute\@undefined +%<latexrelease>\let\setattribute\@undefined +%<latexrelease>\let\unsetattribute\@undefined +%<latexrelease>\let\e@alloc@ccodetable@count\@undefined +%<latexrelease>\let\newcatcodetable\@undefined +%<latexrelease>\let\catcodetable@initex\@undefined +%<latexrelease>\let\catcodetable@string\@undefined +%<latexrelease>\let\catcodetable@latex\@undefined +%<latexrelease>\let\catcodetable@atletter\@undefined +%<latexrelease>\let\e@alloc@luafunction@count\@undefined +%<latexrelease>\let\newluafunction\@undefined +%<latexrelease>\let\e@alloc@luafunction@count\@undefined +%<latexrelease>\let\newwhatsit\@undefined +%<latexrelease>\let\e@alloc@whatsit@count\@undefined +%<latexrelease>\let\newluabytecode\@undefined +%<latexrelease>\let\e@alloc@bytecode@count\@undefined +%<latexrelease>\let\newluachunkname\@undefined +%<latexrelease>\let\e@alloc@luachunk@count\@undefined +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<2ekernel|latexrelease>\fi +%</2ekernel|tex|latexrelease> +% \end{macrocode} +% +% \subsection{Lua module preliminaries} +% +% \begingroup +% +% \begingroup\lccode`~=`_ +% \lowercase{\endgroup\let~}_ +% \catcode`_=12 +% +% \begin{macrocode} +%<*lua> +% \end{macrocode} +% +% Some set up for the Lua module which is needed for all of the Lua +% functionality added here. +% +% \begin{macro}{luatexbase} +% \changes{v1.0a}{2015/09/24}{Table added} +% Set up the table for the returned functions. This is used to expose +% all of the public functions. +% \begin{macrocode} +luatexbase = luatexbase or { } +local luatexbase = luatexbase +% \end{macrocode} +% \end{macro} +% +% Some Lua best practice: use local versions of functions where possible. +% \begin{macrocode} +local string_gsub = string.gsub +local tex_count = tex.count +local tex_setattribute = tex.setattribute +local tex_setcount = tex.setcount +local texio_write_nl = texio.write_nl +% \end{macrocode} +% +% \subsection{Lua module utilities} +% +% \subsubsection{Module tracking} +% +% \begin{macro}{modules} +% \changes{v1.0a}{2015/09/24}{Function modified} +% To allow tracking of module usage, a structure is provided to store +% information and to return it. +% \begin{macrocode} +local modules = modules or { } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{provides_module} +% \changes{v1.0a}{2015/09/24}{Function added} +% Modelled on |\ProvidesPackage|, we store much the same information but +% with a little more structure. +% \begin{macrocode} +local function provides_module(info) + if not (info and info.name) then + luatexbase_error("Missing module name for provides_modules") + return + end + local function spaced(text) + return text and (" " .. text) or "" + end + texio_write_nl( + "log", + "Lua module: " .. info.name + .. spaced(info.date) + .. spaced(info.version) + .. spaced(info.description) + ) + modules[info.name] = info +end +luatexbase.provides_module = provides_module +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Module messages} +% +% There are various warnings and errors that need to be given. For warnings +% we can get exactly the same formatting as from \TeX{}. For errors we have to +% make some changes. Here we give the text of the error in the \LaTeX{} format +% then force an error from Lua to halt the run. Splitting the message text is +% done using |\n| which takes the place of |\MessageBreak|. +% +% First an auxiliary for the formatting: this measures up the message +% leader so we always get the correct indent. +% \begin{macrocode} +local function msg_format(mod, msg_type, text) + local leader = "" + local cont + if mod == "LaTeX" then + cont = string_gsub(leader, ".", " ") + leader = leader .. "LaTeX: " + else + first_head = leader .. "Module " .. msg_type + cont = "(" .. mod .. ")" + .. string_gsub(first_head, ".", " ") + first_head = leader .. "Module " .. mod .. " " .. msg_type .. ":" + end + if msg_type == "Error" then + first_head = "\n" .. first_head + end + if string.sub(text,-1) ~= "\n" then + text = text .. " " + end + return first_head .. " " + .. string_gsub( + text + .. "on input line " + .. tex.inputlineno, "\n", "\n" .. cont .. " " + ) + .. "\n" +end +% \end{macrocode} +% +% \begin{macro}{module_info} +% \changes{v1.0a}{2015/09/24}{Function added} +% \begin{macro}{module_warning} +% \changes{v1.0a}{2015/09/24}{Function added} +% \begin{macro}{module_error} +% \changes{v1.0a}{2015/09/24}{Function added} +% Write messages. +% \begin{macrocode} +local function module_info(mod, text) + texio_write_nl("log", msg_format(mod, "Info", text)) +end +luatexbase.module_info = module_info +local function module_warning(mod, text) + texio_write_nl("term and log",msg_format(mod, "Warning", text)) +end +luatexbase.module_warning = module_warning +local function module_error(mod, text) + error(msg_format(mod, "Error", text)) +end +luatexbase.module_error = module_error +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Dedicated versions for the rest of the code here. +% \begin{macrocode} +local function luatexbase_warning(text) + module_warning("luatexbase", text) +end +local function luatexbase_error(text) + module_error("luatexbase", text) +end +% \end{macrocode} +% +% +% \subsection{Accessing register numbers from Lua} +% +% Collect up the data from the \TeX{} level into a Lua table: from +% version~0.80, Lua\TeX{} makes that easy. +% \begin{macrocode} +local luaregisterbasetable = { } +local registermap = { + attributezero = "assign_attr" , + charzero = "char_given" , + CountZero = "assign_int" , + dimenzero = "assign_dimen" , + mathcharzero = "math_given" , + muskipzero = "assign_mu_skip" , + skipzero = "assign_skip" , + tokszero = "assign_toks" , +} +local i, j +local createtoken +if tex.luatexversion >79 then + createtoken = newtoken.create +end +local hashtokens = tex.hashtokens +local luatexversion = tex.luatexversion +for i,j in pairs (registermap) do + if luatexversion < 80 then + luaregisterbasetable[hashtokens()[i][1]] = + hashtokens()[i][2] + else + luaregisterbasetable[j] = createtoken(i).mode + end +end +% \end{macrocode} +% +% \begin{macro}{registernumber} +% Working out the correct return value can be done in two ways. For older +% Lua\TeX{} releases it has to be extracted from the |hashtokens|. On the +% other hand, newer Lua\TeX{}'s have |newtoken|, and whilst |.mode| isn't +% currently documented, Hans Hagen pointed to this approach so we should be +% OK. +% \begin{macrocode} +local registernumber +if luatexversion < 80 then + function registernumber(name) + local nt = hashtokens()[name] + if(nt and luaregisterbasetable[nt[1]]) then + return nt[2] - luaregisterbasetable[nt[1]] + else + return false + end + end +else + function registernumber(name) + local nt = createtoken(name) + if(luaregisterbasetable[nt.cmdname]) then + return nt.mode - luaregisterbasetable[nt.cmdname] + else + return false + end + end +end +luatexbase.registernumber = registernumber +% \end{macrocode} +% \end{macro} +% +% \subsection{Attribute allocation} +% +% \begin{macro}{new_attribute} +% \changes{v1.0a}{2015/09/24}{Function added} +% As attributes are used for Lua manipulations its useful to be able +% to assign from this end. +% \begin{macrocode} +local attributes=setmetatable( +{}, +{ +__index = function(t,key) +return registernumber(key) or nil +end} +) +luatexbase.attributes=attributes +% \end{macrocode} +% +% \begin{macrocode} +local function new_attribute(name) + tex_setcount("global", "e@alloc@attribute@count", + tex_count["e@alloc@attribute@count"] + 1) + if tex_count["e@alloc@attribute@count"] > 65534 then + luatexbase_error("No room for a new \\attribute") + return -1 + end + attributes[name]= tex_count["e@alloc@attribute@count"] + texio_write_nl("Lua-only attribute " .. name .. " = " .. + tex_count["e@alloc@attribute@count"]) + return tex_count["e@alloc@attribute@count"] +end +luatexbase.new_attribute = new_attribute +% \end{macrocode} +% \end{macro} +% +% \subsection{Custom whatsit allocation} +% +% \begin{macro}{new_whatsit} +% Much the same as for attribute allocation in Lua +% \begin{macrocode} +local function new_whatsit(name) + tex_setcount("global", "e@alloc@whatsit@count", + tex_count["e@alloc@whatsit@count"] + 1) + if tex_count["e@alloc@whatsit@count"] > 65534 then + luatexbase_error("No room for a new custom whatsit") + return -1 + end + texio_write_nl("Custom whatsit " .. (name or "") .. " = " .. + tex_count["e@alloc@whatsit@count"]) + return tex_count["e@alloc@whatsit@count"] +end +luatexbase.new_whatsit = new_whatsit +% \end{macrocode} +% \end{macro} +% +% \subsection{Bytecode register allocation} +% +% \begin{macro}{new_bytecode} +% Much the same as for attribute allocation in Lua. +% The optional \meta{name} argument is used in the log if given. +% \begin{macrocode} +local function new_bytecode(name) + tex_setcount("global", "e@alloc@bytecode@count", + tex_count["e@alloc@bytecode@count"] + 1) + if tex_count["e@alloc@bytecode@count"] > 65534 then + luatexbase_error("No room for a new bytecode register") + return -1 + end + texio_write_nl("Lua bytecode " .. (name or "") .. " = " .. + tex_count["e@alloc@bytecode@count"]) + return tex_count["e@alloc@bytecode@count"] +end +luatexbase.new_bytecode = new_bytecode +% \end{macrocode} +% \end{macro} +% +% \subsection{Lua chunk name allocation} +% +% \begin{macro}{new_chunkname} +% As for bytecode registers but also store the name in the +% |lua.name| table. +% \begin{macrocode} +local function new_chunkname(name) + tex_setcount("global", "e@alloc@luachunk@count", + tex_count["e@alloc@luachunk@count"] + 1) + local chunkname_count = tex_count["e@alloc@luachunk@count"] + chunkname_count = chunkname_count + 1 + if chunkname_count > 65534 then + luatexbase_error("No room for a new chunkname") + return -1 + end + lua.name[chunkname_count]=name + texio_write_nl("Lua chunkname " .. (name or "") .. " = " .. + chunkname_count .. "\n") + return chunkname_count +end +luatexbase.new_chunkname = new_chunkname +% \end{macrocode} +% \end{macro} +% +% \subsection{Lua callback management} +% +% The native mechanism for callbacks in Lua allows only one per function. +% That is extremely restrictive and so a mechanism is needed to add and +% remove callbacks from the appropriate hooks. +% +% \subsubsection{Housekeeping} +% +% The main table: keys are callback names, and values are the associated lists +% of functions. More precisely, the entries in the list are tables holding the +% actual function as |func| and the identifying description as |description|. +% Only callbacks with a non-empty list of functions have an entry in this +% list. +% \begin{macrocode} +local callbacklist = callbacklist or { } +% \end{macrocode} +% +% Numerical codes for callback types, and name-to-value association (the +% table keys are strings, the values are numbers). +% \begin{macrocode} +local list, data, exclusive, simple = 1, 2, 3, 4 +local types = { + list = list, + data = data, + exclusive = exclusive, + simple = simple, +} +% \end{macrocode} +% +% Now, list all predefined callbacks with their current type, based on the +% Lua\TeX{} manual version~0.80. A full list of the currently-available +% callbacks can be obtained using +% \begin{verbatim} +% \directlua{ +% for i,_ in pairs(callback.list()) do +% texio.write_nl("- " .. i) +% end +% } +% \bye +% \end{verbatim} +% in plain Lua\TeX{}. (Some undocumented callbacks are omitted as they are +% to be removed.) +% \begin{macrocode} +local callbacktypes = callbacktypes or { +% \end{macrocode} +% Section 4.1.1: file discovery callbacks. +% \begin{macrocode} + find_read_file = exclusive, + find_write_file = exclusive, + find_font_file = data, + find_output_file = data, + find_format_file = data, + find_vf_file = data, + find_map_file = data, + find_enc_file = data, + find_sfd_file = data, + find_pk_file = data, + find_data_file = data, + find_opentype_file = data, + find_truetype_file = data, + find_type1_file = data, + find_image_file = data, +% \end{macrocode} +% Section 4.1.2: file reading callbacks. +% \begin{macrocode} + open_read_file = exclusive, + read_font_file = exclusive, + read_vf_file = exclusive, + read_map_file = exclusive, + read_enc_file = exclusive, + read_sfd_file = exclusive, + read_pk_file = exclusive, + read_data_file = exclusive, + read_truetype_file = exclusive, + read_type1_file = exclusive, + read_opentype_file = exclusive, +% \end{macrocode} +% Section 4.1.3: data processing callbacks. +% \begin{macrocode} + process_input_buffer = data, + process_output_buffer = data, + process_jobname = data, + token_filter = exclusive, +% \end{macrocode} +% Section 4.1.4: node list processing callbacks. +% \begin{macrocode} + buildpage_filter = simple, + pre_linebreak_filter = list, + linebreak_filter = list, + post_linebreak_filter = list, + hpack_filter = list, + vpack_filter = list, + pre_output_filter = list, + hyphenate = simple, + ligaturing = simple, + kerning = simple, + mlist_to_hlist = list, +% \end{macrocode} +% Section 4.1.5: information reporting callbacks. +% \begin{macrocode} + pre_dump = simple, + start_run = simple, + stop_run = simple, + start_page_number = simple, + stop_page_number = simple, + show_error_hook = simple, + show_error_message = simple, + show_lua_error_hook = simple, + start_file = simple, + stop_file = simple, +% \end{macrocode} +% Section 4.1.6: PDF-related callbacks. +% \begin{macrocode} + finish_pdffile = data, + finish_pdfpage = data, +% \end{macrocode} +% Section 4.1.7: font-related callbacks. +% \begin{macrocode} + define_font = exclusive, +% \end{macrocode} +% Undocumented callbacks which are likely to get documented. +% \begin{macrocode} + find_cidmap_file = data, + pdf_stream_filter_callback = data, +} +luatexbase.callbacktypes=callbacktypes +% \end{macrocode} +% +% \begin{macro}{callback.register} +% \changes{v1.0a}{2015/09/24}{Function modified} +% Save the original function for registering callbacks and prevent the +% original being used. The original is saved in a place that remains +% available so other more sophisticated code can override the approach +% taken by the kernel if desired. +% \begin{macrocode} +local callback_register = callback_register or callback.register +function callback.register() + luatexbase_error("Attempt to use callback.register() directly\n") +end +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Handlers} +% +% The handler function is registered into the callback when the +% first function is added to this callback's list. Then, when the callback +% is called, then handler takes care of running all functions in the list. +% When the last function is removed from the callback's list, the handler +% is unregistered. +% +% More precisely, the functions below are used to generate a specialized +% function (closure) for a given callback, which is the actual handler. +% +% Handler for |data| callbacks. +% \begin{macrocode} +local function data_handler(name) + return function(data, ...) + local i + for _,i in ipairs(callbacklist[name]) do + data = i.func(data,...) + end + return data + end +end +% \end{macrocode} +% Handler for |exclusive| callbacks. We can assume |callbacklist[name]| is not +% empty: otherwise, the function wouldn't be registered in the callback any +% more. +% \begin{macrocode} +local function exclusive_handler(name) + return function(...) + return callbacklist[name][1].func(...) + end +end +% \end{macrocode} +% Handler for |list| callbacks. +% \begin{macrocode} +local function list_handler(name) + return function(head, ...) + local ret + local alltrue = true + local i + for _,i in ipairs(callbacklist[name]) do + ret = i.func(head, ...) + if ret == false then + luatexbase_warning( + "Function `i.description' returned false\n" + .. "in callback `name'" + ) + break + end + if ret ~= true then + alltrue = false + head = ret + end + end + return alltrue and true or head + end +end +% \end{macrocode} +% Handler for |simple| callbacks. +% \begin{macrocode} +local function simple_handler(name) + return function(...) + local i + for _,i in ipairs(callbacklist[name]) do + i.func(...) + end + end +end +% \end{macrocode} +% +% Keep a handlers table for indexed access. +% \begin{macrocode} +local handlers = { + [data] = data_handler, + [exclusive] = exclusive_handler, + [list] = list_handler, + [simple] = simple_handler, +} +% \end{macrocode} +% +% \subsubsection{Public functions for callback management} +% +% Defining user callbacks perhaps should be in package code, +% but impacts on |add_to_callback|. +% If a default function is not required, may may be declared as |false|. +% First we need a list of user callbacks. +% \begin{macrocode} +local user_callbacks_defaults = { } +% \end{macrocode} +% +% \begin{macro}{create_callback} +% \changes{v1.0a}{2015/09/24}{Function added} +% The allocator itself. +% \begin{macrocode} +local function create_callback(name, ctype, default) + if not name or + name == "" or + callbacktypes[name] or + not(default == false or type(default) == "function") + then + luatexbase_error("Unable to create callback " .. name) + end + user_callbacks_defaults[name] = default + callbacktypes[name] = types[ctype] +end +luatexbase.create_callback = create_callback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{call_callback} +% \changes{v1.0a}{2015/09/24}{Function added} +% Call a user defined callback. First check arguments. +% \begin{macrocode} +local function call_callback(name,...) + if not name or + name == "" or + user_callbacks_defaults[name] == nil + then + luatexbase_error("Unable to call callback " .. name) + end + local l = callbacklist[name] + local f + if not l then + f = user_callbacks_defaults[name] + if l == false then + return nil + end + else + f = handlers[callbacktypes[name]](name) + end + return f(...) +end +luatexbase.call_callback=call_callback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{add_to_callback} +% \changes{v1.0a}{2015/09/24}{Function added} +% Add a function to a callback. First check arguments. +% \begin{macrocode} +local function add_to_callback(name, func, description) + if + not name or + name == "" or + not callbacktypes[name] or + type(func) ~= "function" or + not description or + description == "" then + luatexbase_error( + "Unable to register callback.\n\n" + .. "Correct usage:\n" + .. "add_to_callback(<callback>, <function>, <description>)" + ) + return + end +% \end{macrocode} +% Then test if this callback is already in use. If not, initialise its list +% and register the proper handler. +% \begin{macrocode} + local l = callbacklist[name] + if l == nil then + l = { } + callbacklist[name] = l +% \end{macrocode} +% If it is not a user defined callback use the primitive callback register. +% \begin{macrocode} + if user_callbacks_defaults[name] == nil then + callback_register(name, handlers[callbacktypes[name]](name)) + end + end +% \end{macrocode} +% Actually register the function and give an error if more than one +% |exclusive| one is registered. +% \begin{macrocode} + local f = { + func = func, + description = description, + } + local priority = #l + 1 + if callbacktypes[name] == exclusive then + if #l == 1 then + luatexbase_error( + "Cannot add second callback to exclusive function\n`" .. + name .. "'") + end + end + table.insert(l, priority, f) +% \end{macrocode} +% Keep user informed. +% \begin{macrocode} + texio_write_nl( + "Inserting `" .. description .. "' at position " + .. priority .. " in `" .. name .. "'." + ) +end +luatexbase.add_to_callback = add_to_callback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{remove_from_callback} +% \changes{v1.0a}{2015/09/24}{Function added} +% Remove a function from a callback. First check arguments. +% \begin{macrocode} +local function remove_from_callback(name, description) + if + not name or + name == "" or + not callbacktypes[name] or + not description or + description == "" then + luatexbase_error( + "Unable to remove function from callback.\n\n" + .. "Correct usage:\n" + .. "remove_from_callback(<callback>, <description>)" + ) + return + end + local l = callbacklist[name] + if not l then + luatexbase_error( + "No callback list for `" .. name .. "'\n") + end +% \end{macrocode} +% Loop over the callback's function list until we find a matching entry. +% Remove it and check if the list is empty: if so, unregister the +% callback handler. +% \begin{macrocode} + local index = false + local i,j + local cb = {} + for i,j in ipairs(l) do + if j.description == description then + index = i + break + end + end + if not index then + luatexbase_error( + "No callback `" .. description .. "' registered for `" .. + name .. "'\n") + return + end + cb = l[index] + table.remove(l, index) + texio_write_nl( + "Removing `" .. description .. "' from `" .. name .. "'." + ) + if #l == 0 then + callbacklist[name] = nil + callback_register(name, nil) + end + return cb.func,cb.description +end +luatexbase.remove_from_callback = remove_from_callback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{in_callback} +% \changes{v1.0a}{2015/09/24}{Function added} +% Look for a function description in a callback. +% \begin{macrocode} +local function in_callback(name, description) + if not name + or name == "" + or not callbacktypes[name] + or not description then + return false + end + local i + for _, i in pairs(callbacklist[name]) do + if i.description == description then + return true + end + end + return false +end +luatexbase.in_callback = in_callback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{disable_callback} +% \changes{v1.0a}{2015/09/24}{Function added} +% As we subvert the engine interface we need to provide a way to access +% this functionality. +% \begin{macrocode} +local function disable_callback(name) + if(callbacklist[name] == nil) then + callback_register(name, false) + else + luatexbase_error("Callback list for " .. name .. " not empty") + end +end +luatexbase.disable_callback = disable_callback +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{callback_descriptions} +% \changes{v1.0a}{2015/09/24}{Function added} +% List the descriptions of functions registered for the given callback. +% \begin{macrocode} +local function callback_descriptions (name) + local d = {} + if not name + or name == "" + or not callbacktypes[name] + then + return d + else + local i + for k, i in pairs(callbacklist[name] or {}) do + d[k]= i.description + end + end + return d +end +luatexbase.callback_descriptions =callback_descriptions +% \end{macrocode} +% \end{macro} +% \endgroup +% +% \begin{macrocode} +%</lua> +% \end{macrocode} +% +% Reset the catcode of |@|. +% \begin{macrocode} +%<tex>\catcode`\@=\etatcatcode\relax +% \end{macrocode} +% +% +% \Finale diff --git a/Master/texmf-dist/source/latex/base/ltnews23.tex b/Master/texmf-dist/source/latex/base/ltnews23.tex new file mode 100644 index 00000000000..30d98b5b5ba --- /dev/null +++ b/Master/texmf-dist/source/latex/base/ltnews23.tex @@ -0,0 +1,257 @@ +% \iffalse meta-comment +% +% Copyright 2015 +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the LaTeX base system. +% ------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This file has the LPPL maintenance status "maintained". +% +% The list of all files belonging to the LaTeX base distribution is +% given in the file `manifest.txt'. See also `legal.txt' for additional +% information. +% +% The list of derived (unpacked) files belonging to the distribution +% and covered by LPPL is defined by the unpacking scripts (with +% extension .ins) which are part of the distribution. +% +% \fi +% Filename: ltnews23.tex +% +% This is issue 23 of LaTeX News. + +\documentclass{ltnews} +\usepackage[T1]{fontenc} + +\usepackage{lmodern,url,hologo} + +\makeatletter % -- provide command introduced in new release + % so this typesets with an old format + +% Check we are not in the preamble of a composite document +\def\@tempa{\@latex@error{Can be used only in preamble}\@eha} +\ifx\DeclareTextCommandDefault\@tempa +\else + \DeclareTextCommandDefault\textcommabelow[1] + {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex + \hbox{\check@mathfonts\fontsize\ssf@size\z@ + \math@fontsfalse\selectfont,}\hidewidth}\egroup} +\fi +\makeatother + +\publicationmonth{October} +\publicationyear{2015} + +\publicationissue{23} + +\begin{document} + +\maketitle + +\tableofcontents + +\section{Enhanced support for \hologo{LuaTeX}} + +As noted in \LaTeX\ News 22, the 2015/01/01 release of \LaTeX, +introduced built in support for extended TeX systems. + +The range of allocated register numbers (for example, for count +registers) is now set according to the underlying engine capabilities +to 256, 32768 or 65536. Additional allocators were also added for the +facilities added by \hologo{eTeX} (\verb|\newmark|) and \hologo{XeTeX} +(\verb|\newXeTeXintercharclass|). At that time however the work to +incorporate additional allocators for \hologo{LuaTeX} was not ready for +distribution. + +The main feature of this release is that by default it includes +allocators for \hologo{LuaTeX} provided features, such as lua +functions, bytecode registers, catcode tables and lua callbacks. +Previously these features have been provided by the contributed +\package{luatex} (Heiko Oberdiek) and \package{luatexbase} +(\'{E}lie Roux, + Manuel P\'{e}gouri\'{e}-Gonnard and Philipp Gesang) +packages. However just as +noted with the \package{etex} package in the previous release, it is +better if allocation is handled by the format to avoid problems with +conflicts between different allocation schemes, or definitions made +before a package-defined allocation scheme is enabled. + +The facilities incorporated into the format this release, and +described below, are closely modelled on the \package{luatexbase} +package and we thank the authors, and especially \'{E}lie Roux, for +help in arranging this transition. + +The implementation of these \hologo{LuaTeX} features has been +redesigned to match the allocation system introduced in the 2015/01/01 +\LaTeX\ release, and there are some other differences to the previous +\package{luatexbase} package. However, as noted below, +\package{luatexbase} is being updated in line with this \LaTeX\ release +to provide the previous interface as a wrapper around the new +implementation, so we expect the majority of documents using +\package{luatexbase} to work without change. + +\subsection{Names of \hologo{LuaTeX} primitive commands} + +The 2015/01/01 \LaTeX\ release for the first time initialised +\hologo{LuaTeX} in \textsf{latex.ltx} if \hologo{LuaTeX} is being +used. Following the convention used in the contributed +\textsf{lualatex.ini} file used to set up the format for earlier +releases, most \hologo{LuaTeX}-specific primitives were defined with +names prefixed by \texttt{luatex}. This was designed to minimize name +clashes but had the disadvantage that names did not match the +\hologo{LuaTeX} manual, or the names used in other formats, and +produced some awkward command names such as \verb|\luatexluafunction|. +From this release the names are enabled without the \texttt{luatex} +prefix. + +In practice this change should not affect many documents, relatively +few packages access the primitive commands, and many of those are +already set up to work with prefixed or unprefixed names, so that they +work with multiple formats. + +For package writers, if you want to ensure that your code works with +this and earlier releases, use unprefixed names in the package and +ensure that they are defined by using code such as: +\begin{verbatim} +\directlua{tex.enableprimitives("", + tex.extraprimitives( + "omega", "aleph", "luatex"))} +\end{verbatim} +Conversely if your document uses a package relying on prefixed names +then you can add: +\begin{verbatim} +\directlua{tex.enableprimitives("luatex", + tex.extraprimitives( + "omega", "aleph", "luatex"))} +\end{verbatim} +to your document. + +Note the compatibility layer offered by the \package{luatexbase} package +described below makes several commands available under both names. + +As always, this change can be reverted using:\\ +\verb|\RequirePackage[2015/01/01]{latexrelease}|\\ +at the start of the document. + + + +\subsection{\TeX\ commands for allocation in \hologo{LuaTeX}} +For detailed descriptions of the new allocation commands see the +documented sources in \textsf{ltluatex.dtx} or chapter N of +\textsf{source2e} however the following new allocation commands are +defined by default in \hologo{LuaTeX}: +\verb|\newattribute|, +\verb|\newcatcodetable|, +\verb|\newluafunction| and +\verb|\newwhatsit|. +In addition, the commands \verb|\setattribute| and +\verb|\unsetattribute| are defined to set and unset lua attributes +(integer values similar to counters, but attached to nodes). Finally +several catcode tables are predefined: +\verb|\catcodetable@initex|, +\verb|\catcodetable@string|, +\verb|\catcodetable@latex|, +\verb|\catcodetable@atletter|. + +\subsection{Predefined lua functions} +If used with \hologo{LuaTeX}, \LaTeX\ will initialise a lua table, +\textsf{luatexbase}, with functions supporting allocation and also +the registering of lua callback functions. + +\subsection{Support for older releases and plain \TeX} +The \hologo{LuaTeX} allocation functionality made available in this +release is also available in plain \TeX\ and older \LaTeX\ releases +in the files \textsf{ltluatex.tex} and \textsf{ltluatex.lua} which may be +used simply by including the \TeX\ file: \verb|\input{ltluatex}|. +An alternative for old LaTeX releases is to use:\\ +\verb|\RequirePackage[2015/10/01]{latexrelease}|\\ +which will update the kernel to the current release, including +\hologo{LuaTeX} support. + +\subsection{Additional \hologo{LuaTeX} support packages} +In addition to the base \LaTeX\ release two packages have been +contributed to the \textsf{contrib} area on CTAN. The +\package{ctablestack} package offers some commands to help package +writers control the \hologo{LuaTeX} \textsf{catcodetable} +functionality, and the \package{luatexbase} package replaces the +previously available package of the same name, providing a compatible +interface but implemented over the \package{ltluatex} code. + +\section{More Floats and Inserts} +If \hologo{eTeX} is available, the number of registers allocated in +the format to hold floats such as figures is increased from 18 to 52. + +The extended allocation system introduced in 2015/01/01 means that in +most cases it is no longer necessary to load the \package{etex} +package. Many classes and packages that previously loaded this package +no longer do so. Unfortunately in some circumstances where a package +or class previously used the \package{etex} \verb|\reserveinserts| +command, it is possible for a document that previously worked to +generate an error ``no room for a new insert''. In practice this error +can always be avoided by declaring inserts earlier, before the +registers below 256 are all allocated, however it would be better not +to require packages to be re-ordered and in some cases the re-ordering +is complicated due to delayed allocations in \verb|\AtBeginDocument|. + +In this release a new implementation of +\verb|\newinsert| is used which allocates inserts from the previously +allocated float lists once the classical register allocation has run +out. This allows an extra 52 (or in \hologo{LuaTeX}, 64 thousand) +insert allocations which is more than enough for practical documents +(by default, \LaTeX\ only uses two insert allocations). + +\section{Updated Unicode data} + + +The file \textsf{unicode-letters.def} recording catcodes, upper and +lower case mappings and other properties for Unicode characters has +been regenerated using the data files from Unicode~8. + +\section{Support for Comma Accent} +The command \verb|\textcommabelow| has been added to the format. +This is mainly used for the Romanian letters +\textcommabelow{S}\textcommabelow{s}\textcommabelow{T}\textcommabelow{t}. +This was requested in latex/4414 in the \LaTeX\ bug tracker. + +\section{Extended \package{inputenc}} +The \texttt{utf8} option for \package{inputenc} has been extended to support +the letters s and t with comma accent, +U+0218\,--\,U+021b. Similarly circumflex w and y U+0174\,--\,U+0177 are defined. +Also U+00a0 and U+00ad are declared by default, and defined to be +\verb|\nobreakspace| and \verb|\-| respectively. + +The error message given on undefined UTF-8 input characters +now displays the Unicode number +in U+\textit{hex} format in addition +to showing the character. + +\section{Pre-release Releases} +The patch level mechanism has been used previously to identify \LaTeX\ +releases that have small patches applied to the main release, without +changing the main format date. + +The mechanism has now been extended to allow identification of +pre-release versions of the software (which may or may not be released +via CTAN) but can be identified with a banner such as\\ +{\catcode`\<=13 \def<{\string<} \catcode`\>=13 \def>{\string>}% +\verb|LaTeX2e <2015/10/01> pre-release-1|}\\ +Internally this is identified as a patch release with a negative patch +level. + +\section{Updates in tools} + +The \package{multicol} package has been updated to fix the interaction +with ``here'' floats that land on the same page as the start or end of +a \textsf{multicols} environment. + +\end{document} diff --git a/Master/texmf-dist/source/latex/base/ltoutenc.dtx b/Master/texmf-dist/source/latex/base/ltoutenc.dtx index 889567794cc..a7932198327 100644 --- a/Master/texmf-dist/source/latex/base/ltoutenc.dtx +++ b/Master/texmf-dist/source/latex/base/ltoutenc.dtx @@ -44,7 +44,7 @@ %<*driver> % \fi \ProvidesFile{ltoutenc.dtx} - [2015/02/21 v1.99n LaTeX Kernel (font encodings)] + [2015/08/28 v1.99m LaTeX Kernel (font encodings)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltoutenc.dtx} @@ -66,7 +66,7 @@ %</driver> % \fi % -% \CheckSum{2799} +% \CheckSum{2825} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -1472,7 +1472,22 @@ % % \begin{macrocode} \let\ldots\dots +% \end{macrocode} +% \changes{v1.99m}{2015/02/16}{Added \cs{textcommabelow} latex/4414} +% Default definition of comma below. +% \begin{macrocode} %</2ekernel> +%<latexrelease>\IncludeInRelease{2015/10/01}{\textcommabelow}{comma accent}% +%<*2ekernel|latexrelease> +\DeclareTextCommandDefault\textcommabelow[1] + {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex + \hbox{\check@mathfonts\fontsize\ssf@size\z@ + \math@fontsfalse\selectfont,}\hidewidth}\egroup} +%<latexrelease>\EndIncludeInRelease +%</2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{0000/00/00}{\textcommabelow}{comma accent}% +%<latexrelease>\let\textcommabelow\@undefined +%<latexrelease>\EndIncludeInRelease % \end{macrocode} % % \changes{v1.6d}{1994/10/30}{Moved math commands here from ltmath.} @@ -1556,6 +1571,7 @@ {\hmode@bgroup \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup} % \end{macrocode} +% % Declare the text symbols. % \begin{macrocode} \DeclareTextSymbol{\AE}{OT1}{29} diff --git a/Master/texmf-dist/source/latex/base/ltoutput.dtx b/Master/texmf-dist/source/latex/base/ltoutput.dtx index 4e04c4b064c..1cb7ec5dec1 100644 --- a/Master/texmf-dist/source/latex/base/ltoutput.dtx +++ b/Master/texmf-dist/source/latex/base/ltoutput.dtx @@ -30,14 +30,14 @@ %%% From File: ltoutput.dtx %<flafter>\ProvidesPackage{flafter} %<fltrace>\ProvidesPackage{fltrace} -%<flafter,fltrace> [2015/07/12 v1.2n +%<flafter,fltrace> [2015/09/05 v1.3a %<flafter> Standard LaTeX floats after reference (FMi)] %<fltrace> Tracing LaTeX floats algorithm (FMi)] % %<*driver> % \fi \ProvidesFile{ltoutput.dtx} - [2015/07/06 v1.2n LaTeX Kernel (Output Routine)] + [2015/09/05 v1.3a LaTeX Kernel (Output Routine)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltoutput.dtx} @@ -52,7 +52,7 @@ %</driver> % \fi % -% \CheckSum{3696} +% \CheckSum{3800} % % % \iffalse @@ -691,32 +691,50 @@ % \end{macrocode} % % DEFINITION OF FLOAT BOXES: +% \changes{v1.3a}{2015/09/205} +% {extended \cs{@freelist}} % \begin{macrocode} -\newinsert\bx@A -\newinsert\bx@B -\newinsert\bx@C -\newinsert\bx@D -\newinsert\bx@E -\newinsert\bx@F -\newinsert\bx@G -\newinsert\bx@H -\newinsert\bx@I -\newinsert\bx@J -\newinsert\bx@K -\newinsert\bx@L -\newinsert\bx@M -\newinsert\bx@N -\newinsert\bx@O -\newinsert\bx@P -\newinsert\bx@Q -\newinsert\bx@R -% \end{macrocode} -% -% \begin{macrocode} -\gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E - \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J - \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N - \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R} +%</2ekernel> +%<latexrelease>\IncludeInRelease{2015/10/01}% +%<latexrelease> {\bx@ZZ}{Extended float list}% +%<*2ekernel|latexrelease> +\let\@elt\newinsert +%<*2ekernel> +\def\@freelist{% + \@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E + \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J + \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N + \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R} +\@freelist +%</2ekernel> +\ifx\numexpr\@undefined\else +\def\reserved@a{% + \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V + \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z + \@elt\bx@AA\@elt\bx@BB\@elt\bx@CC\@elt\bx@DD\@elt\bx@EE + \@elt\bx@FF\@elt\bx@GG\@elt\bx@HH\@elt\bx@II\@elt\bx@JJ + \@elt\bx@KK\@elt\bx@LL\@elt\bx@MM\@elt\bx@NN + \@elt\bx@OO\@elt\bx@PP\@elt\bx@QQ\@elt\bx@RR + \@elt\bx@SS\@elt\bx@TT\@elt\bx@UU\@elt\bx@VV + \@elt\bx@WW\@elt\bx@XX\@elt\bx@YY\@elt\bx@ZZ} +\reserved@a +\def\@elt{\noexpand\@elt\noexpand} +\edef\@freelist{\@freelist\reserved@a} +\fi +\let\reserved@a\relax +\let\@elt\relax +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\bx@ZZ}{Extended float list}% +%<latexrelease>\def\@freelist{% +%<latexrelease> \@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E +%<latexrelease> \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J +%<latexrelease> \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N +%<latexrelease> \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R} +%<latexrelease> \insc@unt=234 +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % % \begin{macrocode} @@ -3920,8 +3938,9 @@ % \texttt{flafter} to make the tracing work. % \begin{macrocode} \@ifpackageloaded{flafter} - {\PackageWarningNoLine{fltrace}{Load 'fltrace' before 'flafter'\MessageBreak - Attempting to recover by reloading 'flafter'}% + {\PackageWarningNoLine + {fltrace}{Load 'fltrace' before 'flafter'\MessageBreak + Attempting to recover by reloading 'flafter'}% % \end{macrocode} % Hide the fact that \texttt{flafter} was already loaded and then % request it anew. diff --git a/Master/texmf-dist/source/latex/base/ltplain.dtx b/Master/texmf-dist/source/latex/base/ltplain.dtx index f14969b31d0..7f1f5a8eaee 100644 --- a/Master/texmf-dist/source/latex/base/ltplain.dtx +++ b/Master/texmf-dist/source/latex/base/ltplain.dtx @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltplain.dtx} - [2015/06/19 v2.0h LaTeX Kernel (Plain TeX)] + [2015/08/30 v2.1a LaTeX Kernel (Plain TeX)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltplain.dtx} @@ -50,7 +50,7 @@ %</driver> % \fi % -% \CheckSum{1204} +% \CheckSum{1343} % % \changes{v1.0a}{1994/03/08} % {Remove need for a driver file.} @@ -533,7 +533,8 @@ % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{2015/01/01}{\e@ch@ck}{Extended Allocation}% +%<latexrelease>\IncludeInRelease{2015/10/01} +%<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}% % \end{macrocode} % % \begin{macrocode} @@ -551,13 +552,38 @@ \fi % \end{macrocode} % Check we are below the extended limit. +% \changes{v2.0i}{2015/08/06} +% {Add \cs{string} in case argument is not an unexpandable primitive} % \begin{macrocode} \ifnum#1<#3\relax \else - \errmessage{No room for a new #4}% + \errmessage{No room for a new \string#4}% \fi \fi}% - +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2015/01/01}% +%<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}% +%<latexrelease>\gdef\e@ch@ck#1#2#3#4{% +%<latexrelease> \ifnum#1<#2\else +%<latexrelease> \ifnum#1=#2\relax +%<latexrelease> #1\@cclvi +%<latexrelease> \ifx\count#4\advance#1 10 \fi +%<latexrelease> \fi +%<latexrelease> \ifnum#1<#3\relax +%<latexrelease> \else +%<latexrelease> \errmessage{No room for a new #4}% +%<latexrelease> \fi +%<latexrelease> \fi}% +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\e@ch@ck}{Extended Allocation (checking)}% +%<latexrelease>\let\e@ch@ck\@undefined +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2015/01/01}% +%<latexrelease> {\extrafloats}{Extra floats}% % \end{macrocode} % \end{macro} % @@ -614,18 +640,17 @@ %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}% -%<latexrelease> {\e@ch@ck}{Extended Allocation}% -%<latexrelease>\let\e@ch@ck\@undefined +%<latexrelease> {\extrafloats}{Extra floats}% %<latexrelease>\let\float@count\@undefined %<latexrelease>\let\extrafloats\@undefined %<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\alloc@} % \begin{macrocode} -%<*2ekernel> \def\alloc@#1#2#3#4#5{\global\advance\count1#1\@ne \ch@ck#1#4#2% make sure there's still room \allocationnumber\count1#1% @@ -635,6 +660,18 @@ % \end{macro} % % \begin{macro}{\newinsert} +% \changes{v2.1a}{2015/08/30}{new \cs{newinsert} implementation} +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2015/10/01} +%<latexrelease> {\newinsert}{Extended \newinsert}% +% \end{macrocode} +% \begin{macrocode} +\ifx\numexpr\@undefined +% \end{macrocode} +% If e-\TeX\ is not available use the original plain \TeX\ +% definition of |\newinsert|. % \begin{macrocode} \def\newinsert#1{\global\advance\insc@unt \m@ne \ch@ck0\insc@unt\count @@ -645,6 +682,66 @@ \global\chardef#1\allocationnumber \wlog{\string#1=\string\insert\the\allocationnumber}} % \end{macrocode} +% \begin{macrocode} +\else +% \end{macrocode} +% The highest register allowed with |\insert|. +% \begin{macrocode} +\ifx\directlua\@undefined + \chardef\e@insert@top255 +\else + \chardef\e@insert@top\e@alloc@top +\fi +% \end{macrocode} +% If the classic registers are exausted, take an insert from the free float list +% and use |\extrafloats| to add a new float to that list. +% \begin{macrocode} +\def\newinsert#1{% +\@tempswafalse +\ifnum\count10<\insc@unt +\ifnum\count11<\insc@unt +\ifnum\count12<\insc@unt +\ifnum\count14<\insc@unt + \@tempswatrue +\fi\fi\fi\fi +\if@tempswa +\global\advance\insc@unt\m@ne +\allocationnumber\insc@unt +\else + \extrafloats\@ne + \@next\@currbox\@freelist + {\ifnum\@currbox<\e@insert@top + \allocationnumber\@currbox + \else + \ch@ck0\m@ne\insert + \fi}% + {\ch@ck0\m@ne\insert}% +\fi +\global\chardef#1\allocationnumber +\wlog{\string#1=\string\insert\the\allocationnumber}% +} +% \end{macrocode} +% \begin{macrocode} +\fi +%</2ekernel|latexrelease> +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\newinsert}{Extended \newinsert}% +%<latexrelease>\let\e@insert@top\@undefined +%<latexrelease>\def\newinsert#1{\global\advance\insc@unt \m@ne +%<latexrelease> \ch@ck0\insc@unt\count +%<latexrelease> \ch@ck1\insc@unt\dimen +%<latexrelease> \ch@ck2\insc@unt\skip +%<latexrelease> \ch@ck4\insc@unt\box +%<latexrelease> \allocationnumber\insc@unt +%<latexrelease> \global\chardef#1\allocationnumber +%<latexrelease> \wlog{\string#1=\string\insert\the\allocationnumber}} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} % \end{macro} % % \begin{macro}{\ch@ck} diff --git a/Master/texmf-dist/source/latex/base/ltunicode.dtx b/Master/texmf-dist/source/latex/base/ltunicode.dtx index b122b27f17f..957883ccc21 100644 --- a/Master/texmf-dist/source/latex/base/ltunicode.dtx +++ b/Master/texmf-dist/source/latex/base/ltunicode.dtx @@ -44,7 +44,7 @@ % %<*driver> \ProvidesFile{ltunicode.dtx} - [2015/06/20 v1.0i LaTeX Kernel (Unicode data)] + [2015/08/10 v1.0l LaTeX Kernel (Unicode data)] \documentclass{ltxdoc} \begin{document} \DocInput{\jobname.dtx} @@ -90,14 +90,17 @@ % \end{macrocode} % % \begin{macro}{\gobble} +% \begin{macro}{\gobblethree} % \begin{macro}{\firsttoken} % Standard utilities. % \begin{macrocode} \long\def\gobble#1{} +\long\def\gobblethree#1#2#3{} \long\def\firsttoken#1#2\relax{#1} % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\storedpar} % A simple piece of test set up: the final line of the read file will be @@ -458,31 +461,52 @@ % \end{macro} % % \changes{v1.0g}{2015/03/26}{Add missing \cs{global} in definition of \cs{C}} +% \changes{v1.0j}{2015/08/05}{Compress data for caseless letters} +% \changes{v1.0j}{2015/08/05}{Save some space by dropping end-of-line +% percent chars} % \begin{macro}{\unicodeletter, \unicodenonletter} -% \begin{macro}{\writeunicodedata} +% \begin{macro}{\writeunicodedatafull} +% \begin{macro}{\writeunicodedatacompact} % For `letters', we always want to write the data to file, and the only % question here is if the character has case mappings or these point back -% to the character itself. +% to the character itself. If there are no mappings or the mappings are +% all equivalent to the same code point then use a shorter version of +% the write macro. % \begin{macrocode} \def\unicodeletter#1#2#3{% - \writeunicodedata\L{#1}{#2}{#3}% + \ifx\relax#2#3\relax + \writeunicodedatacompact\l{#1}% + \else + \ifnum 0% + \ifnum"#1="\ifx\relax#2\relax#1 \else#2 \fi\else1\fi + \ifnum"#1="\ifx\relax#3\relax#1 \else#3 \fi\else1\fi + >0 % + \writeunicodedatafull\L{#1}{#2}{#3}% + \else + \writeunicodedatacompact\l{#1}% + \fi + \fi } % \end{macrocode} % Cased non-letters can also exist: they can be detected as they have at -% least one case mapping. Write these in much the same way as letters. +% least one case mapping. Write these in much the same way as letters, +% but always with a full mapping (must be the case to require the entry +% at all). % \begin{macrocode} \def\unicodenonletter#1#2#3{% \ifx\relax#2#3\relax \else - \writeunicodedata\C{#1}{#2}{#3}% + \writeunicodedatafull\C{#1}{#2}{#3}% \fi } % \end{macrocode} % Actually write the data. In all cases both upper- and lower-case mappings % are given, so there is a need to test that both were actually available and -% if not set up to do nothing. +% if not set up to do nothing. Cases where both mappings are no-ops will +% already have been filtered out and are written in a shorter form: this +% saves a significant amount of space in the file. % \begin{macrocode} -\def\writeunicodedata#1#2#3#4{% +\def\writeunicodedatafull#1#2#3#4{% \immediate\write\unicodewrite{% \space\space \string#1\space @@ -493,16 +517,23 @@ #3 % \fi \ifx\relax#4\relax - #2 % + #2% \else - #4 % + #4% \fi - \expandafter\gobble\string\% + }% +} +\def\writeunicodedatacompact#1#2{% + \immediate\write\unicodewrite{% + \space\space + \string#1\space + #2% }% } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % There is now a lead-in section which creates the macros which take the % processed data and do the code assignments. Everything is done within a @@ -542,6 +573,7 @@ \global\Umathcode"#1="0"01"#1 % \fi } + \def\l#1 {\L#1 #1 #1 } \ifx\Umathcode\undefined \let\Umathcode\XeTeXmathcode \fi @@ -636,9 +668,12 @@ \repeat % \end{macrocode} % +% \changes{v1.0j}{2015/08/05}{Compress East Asian width data by recording +% ranges for code points of type \texttt{ID}} % \begin{macro}{\parseunicodedata@auxii} % \begin{macro}{\parseunicodedata@auxiii} % \begin{macro}{\parseunicodedata@auxiv} +% \begin{macro}{\parseunicodedata@auxv} % \begin{macro}{\ID} % \begin{macro}{\OP} % \begin{macro}{\CL} @@ -648,10 +683,44 @@ % \begin{macro}{\CM} % The final file to read, |LineBreak.txt|, uses the same format as\\ % |EastAsianWidth.txt|. As such, only the final parts of the parser have to be -% redefined. +% redefined. The first stage here is to check if the line breaking class +% is known, and if so if it is equal to |ID| (class one). % \begin{macrocode} \def\parseunicodedata@auxii#1..#2..#3\relax#4{% - \parseunicodedata@auxiii{#1}{#4}% + \ifcsname #4\endcsname + \ifnum\csname #4\endcsname=\@ne + \expandafter\expandafter\expandafter\parseunicodedata@auxiii + \else + \expandafter\expandafter\expandafter\parseunicodedata@auxiv + \fi + \else + \expandafter\gobblethree + \fi + {#1}{#2}{#4}% +} +% \end{macrocode} +% For ranges of class \texttt{ID}, the entire range is written to the data +% file as a single block: no need to check on the width data. +% \begin{macrocode} +\def\parseunicodedata@auxiii#1#2#3{% + \immediate\write\unicodewrite{% + \space\space + \expandafter\string\csname #3\endcsname + \space + #1 \ifx\relax#2\relax#1\else#2\fi + }% +} +% \end{macrocode} +% For other cases, loop over each code point separately. If the +% code point is of width |F|, |H| or |W| then the line breaking +% property is written to the data file. The earlier check means that +% this only happens for characters of classes \texttt{OP} (opener), +% \texttt{CL} (closer), \texttt{EX} (exclamation), \texttt{IS} (infix sep), +% \texttt{NS} (non-starter) and \texttt{CM} (combining marks) characters +% (the latter need to be transparent to the mechanism). +% \begin{macrocode} +\def\parseunicodedata@auxiv#1#2#3{% + \parseunicodedata@auxv{#1}{#3}% \ifx\relax#2\relax \else \count@="#1 % @@ -660,46 +729,28 @@ \ifnum\count@<"#2 % \advance\count@\@ne \sethex\temp{\count@}% - \expandafter\parseunicodedata@auxiii\expandafter{\temp}{#4}% + \expandafter\parseunicodedata@auxv\expandafter{\temp}{#3}% \repeat \endgroup \fi } -% \end{macrocode} -% Adding data to the processed file depends on two factors: the -% classification in the line-breaking file and (possibly) the width data -% too. Any characters of class \texttt{ID} (ideograph) are stored: they -% always need special treatment. For characters of classes \texttt{OP} -% (opener), \texttt{CL} (closer), \texttt{EX} (exclamation), \texttt{IS} -% (infix sep) and \texttt{NS} (non-starter) the data is stored if the -% character is full, half or wide width. The same is true for -% \texttt{CM} (combining marks) characters, which need to be transparent -% to the mechanism. -% \begin{macrocode} -\def\parseunicodedata@auxiii#1#2{% - \ifcsname #2\endcsname - \ifnum\csname #2\endcsname=1 % - \parseunicodedata@auxiv{#1}{#2}% - \else - \ifnum 0% - \if F\csname EAW@#1\endcsname 1\fi - \if H\csname EAW@#1\endcsname 1\fi - \if W\csname EAW@#1\endcsname 1\fi - >0 % - \parseunicodedata@auxiv{#1}{#2}% - \fi - \fi +\def\parseunicodedata@auxv#1#2{% + \ifnum 0% + \if F\csname EAW@#1\endcsname 1\fi + \if H\csname EAW@#1\endcsname 1\fi + \if W\csname EAW@#1\endcsname 1\fi + >0 % + \immediate\write\unicodewrite{% + \space\space + \expandafter\string\csname #2\endcsname + \space + #1% + }% \fi } -\def\parseunicodedata@auxiv#1#2{% - \immediate\write\unicodewrite{% - \space\space - \expandafter\string\csname #2\endcsname - \space - #1 % - \expandafter\gobble\string\% - }% -} +% \end{macrocode} +% The East Asian width class mappings. +% \begin{macrocode} \def\ID{1} \def\OP{2} \def\CL{3} @@ -718,9 +769,15 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % -% \changes{v1.0h}{2015/05/11}{Apply cateogry codes to East Asian +% \changes{v1.0h}{2015/05/11}{Apply category codes to East Asian % chars in all cases} +% \changes{v1.0j}{2015/08/05}{Move the stop point for Lua\TeX{}} +% \changes{v1.0j}{2015/08/05}{Only set \cs{XeTeXcharclass} from +% East Asian char data} +% \changes{v1.0k}{2015/08/06}{Add missing \cs{endgroup}} +% \changes{v1.0l}{2015/08/10}{Add missing \cs{endgroup}} % Before actually reading the line breaking data file, the appropriate % temporary code is added to the output. As described above, only a limited % number of classes need to be covered: they are hard-coded as classes @@ -729,21 +786,29 @@ \verbatimcopy \begingroup \ifx\XeTeXchartoks\XeTeXcharclass - \def\ID#1 {\global\catcode"#1=11 } - \def\OP#1 {} - \let\CL\OP - \let\EX\OP - \let\IS\OP - \let\NS\OP - \let\CM\OP + \endgroup\expandafter\endinput \else - \def\ID#1 {\global\XeTeXcharclass"#1=1 \global\catcode"#1=11 } - \def\OP#1 {\global\XeTeXcharclass"#1=2 } - \def\CL#1 {\global\XeTeXcharclass"#1=3 } - \def\EX#1 {\global\XeTeXcharclass"#1=3 } - \def\IS#1 {\global\XeTeXcharclass"#1=3 } - \def\NS#1 {\global\XeTeXcharclass"#1=3 } - \def\CM#1 {\global\XeTeXcharclass"#1=256 } + \def\setclass#1#2#3{% + \ifnum#1>#2 % + \expandafter\gobble + \else + \expandafter\firstofone + \fi + {% + \global\XeTeXcharclass#1=#3 % + \expandafter\setclass\expandafter + {\number\numexpr#1+1\relax}{#2}{#3}% + }% + }% + \def\gobble#1{} + \def\firstofone#1{#1} + \def\ID#1 #2 {\setclass{"#1}{"#2}{1}} + \def\OP#1 {\setclass{"#1}{"#1}{2}} + \def\CL#1 {\setclass{"#1}{"#1}{3}} + \def\EX#1 {\setclass{"#1}{"#1}{3}} + \def\IS#1 {\setclass{"#1}{"#1}{3}} + \def\NS#1 {\setclass{"#1}{"#1}{3}} + \def\CM#1 {\setclass{"#1}{"#1}{256}} \fi \endverbatimcopy % \end{macrocode} @@ -757,18 +822,6 @@ \repeat % \end{macrocode} % -% \changes{v1.0h}{2015/05/11}{Move the stop point for Lua\TeX{}} -% Lua\TeX{} and older versions of Xe\TeX{} stop here: character classes are a -% Xe\TeX{}-only concept. -% \begin{macrocode} -\verbatimcopy -\endgroup -\ifx\XeTeXchartoks\XeTeXcharclass - \expandafter\endinput -\fi -\endverbatimcopy -% \end{macrocode} -% % \changes{v1.0a}{2015/03/25}{Use \cs{hskip} rather than \cs{hspace} % in glue settings} % Set up material to be inserted between character classes. @@ -776,6 +829,7 @@ % work with plain as well as \LaTeXe{}. % \begin{macrocode} \verbatimcopy +\endgroup \gdef\xtxHanGlue{\hskip0pt plus 0.1em\relax} \gdef\xtxHanSpace{\hskip0.2em plus 0.2em minus 0.1em\relax} \global\XeTeXinterchartoks 0 1 = {\xtxHanSpace} diff --git a/Master/texmf-dist/source/latex/base/ltvers.dtx b/Master/texmf-dist/source/latex/base/ltvers.dtx index 1f90d0366e6..b27ebed2e97 100644 --- a/Master/texmf-dist/source/latex/base/ltvers.dtx +++ b/Master/texmf-dist/source/latex/base/ltvers.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltvers.dtx} - [2015/07/06 v1.0u LaTeX Kernel (Version Info)] + [2015/08/23 v1.0v LaTeX Kernel (Version Info)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltvers.dtx} @@ -55,7 +55,7 @@ %</driver> % \fi % -% \CheckSum{131} +% \CheckSum{150} % % \section{Version Identification} % First we identify the date and version number of this release of @@ -93,10 +93,10 @@ %</2ekernel> %<latexrelease>\edef\latexreleaseversion %<*2ekernel|latexrelease> - {2015/01/01} + {2015/10/01} %</2ekernel|latexrelease> %<*2ekernel> -\def\patch@level{2} +\def\patch@level{0} % \end{macrocode} % \end{macro} % \end{macro} @@ -145,15 +145,24 @@ % % \changes{v1.0p}{2015/01/22}{Preserve any \cs{everyjob} material inserted % by a loader (\texttt{.ini} file)} +% \changes{v1.0v}{2015/08/23}{Allow negative patchlevel for pre-release} % \begin{macrocode} \ifnum\patch@level=0 \everyjob\expandafter{\the\everyjob \typeout{\fmtname \space<\fmtversion>}} - \immediate\write16{\fmtname \space<\fmtversion>} - \else + \immediate + \write16{\fmtname \space<\fmtversion>} + \else\ifnum\patch@level>0 \everyjob\expandafter{\the\everyjob \typeout{\fmtname \space<\fmtversion> patch level \patch@level}} - \immediate\write16{\fmtname \space<\fmtversion> patch level \patch@level} + \immediate + \write16{\fmtname \space<\fmtversion> patch level \patch@level} + \else + \everyjob\expandafter{\the\everyjob + \typeout{\fmtname \space<\fmtversion> pre-release\patch@level}} + \immediate + \write16{\fmtname \space<\fmtversion> pre-release\patch@level} + \fi \fi %</2ekernel> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/base/unpack.ins b/Master/texmf-dist/source/latex/base/unpack.ins index 8b89ac975d0..d3a9c322e65 100644 --- a/Master/texmf-dist/source/latex/base/unpack.ins +++ b/Master/texmf-dist/source/latex/base/unpack.ins @@ -41,7 +41,6 @@ { \def\ProvidesFile#1\end#2{} -\def\everyjob#1\endinput{\fi} \@@input ltvers.dtx \Msg{**********************************************} \Msg{*} diff --git a/Master/texmf-dist/source/latex/base/utf8ienc.dtx b/Master/texmf-dist/source/latex/base/utf8ienc.dtx index a6756eabd4a..0c12a5d211b 100644 --- a/Master/texmf-dist/source/latex/base/utf8ienc.dtx +++ b/Master/texmf-dist/source/latex/base/utf8ienc.dtx @@ -47,7 +47,7 @@ %</driver> % \fi % -% \CheckSum{1232} +% \CheckSum{1361} % % \newpage % @@ -219,7 +219,7 @@ %<+ts1> \ProvidesFile{ts1enc.dfu} %<+x2> \ProvidesFile{x2enc.dfu} %<+all> \ProvidesFile{utf8enc.dfu} - [2015/06/27 v1.1n UTF-8 support for inputenc] + [2015/09/07 v1.1p UTF-8 support for inputenc] % \end{macrocode} % % \begin{macrocode} @@ -295,8 +295,11 @@ % can't produce multiline strings without some precaution. % \changes{v1.1b}{2004/02/09}{No newlines allowed in error messages} % \changes{v1.1g}{2005/09/27}{Real spaces do not show up so use \cs{space}} +% \changes{v1.1o}{2015/08/28}{Show Unicode number of character in hex} % \begin{macrocode} - \PackageError{inputenc}{Unicode\space char\space \string#1\space + \PackageError{inputenc}{Unicode\space char\space\expandafter + \UTFviii@splitcsname\string#1\relax + \MessageBreak not\space set\space up\space for\space use\space with\space LaTeX}\@eha \else\expandafter @@ -508,7 +511,8 @@ % totally (and we are too lazy to reread the Unicode book to see if % this is the correct algorithm).\footnote{We were hoping to also % find in his work the \TeX{} code for going the other way: from -% UTF-8 octets to Unicode slot number, but no luck!} +% UTF-8 octets to Unicode slot number, but no luck! +% This has now been added as \cs{decode@UTFviii}} % \begin{macrocode} \else\ifnum\count@<"800\relax \parse@UTFviii@a,% @@ -554,12 +558,134 @@ \uccode`#3\count@ \uppercase{\gdef\UTFviii@tmp{#2#3#4}}} % \end{macrocode} +% \end{macro} % +% \begin{macro}{\decode@UTFviii} +% \changes{v1.1o}{2015/08/28}{Macro added} +% In the reverse direction, take a sequence of octects(bytes) +% representing a character in UTF-8 and construct the Unicode number. +% The sequence is terminated by |\relax|. +% +% In this version, if the sequence is not valid UTF-8 you probably +% get a low level arithmetic error from |\numexpr| or stray characters +% at the end. Getting a better error message would be somewhat expensive. +% As the main use is for reporting characters in messages, this is done +% just using expansion, so |\numexpr| is used, A stub returning 0 is defined +% if |\numexpr| is not available. % \begin{macrocode} -\endgroup +\ifx\numexpr\@undefined +% \end{macrocode} +% +% \begin{macrocode} +\gdef\decode@UTFviii#1{0} +% \end{macrocode} +% +% \begin{macrocode} +\else +% \end{macrocode} +% +% If the input is malformed UTF-8 there may not be enough closing ) so +% add 5 so there are always some remaining then cleanup and remove +% any remaining ones at the end. This avoids |\numexpr| parse errors +% while outputting a package error. +% \begin{macrocode} +\gdef\decode@UTFviii#1\relax{% + \expandafter\UTFviii@cleanup + \the\numexpr\dec@de@UTFviii#1\relax)))))\@empty} +% \end{macrocode} +% +% \begin{macrocode} +\gdef\UTFviii@cleanup#1)#2\@empty{#1} +% \end{macrocode} +% +% \begin{macrocode} +\gdef\dec@de@UTFviii#1{% +\ifx\relax#1% +\else + \ifnum`#1>"EF + ((((`#1-"F0)% + \else + \ifnum`#1>"DF + (((`#1-"E0)% + \else + \ifnum`#1>"BF + ((`#1-"C0)% + \else + \ifnum`#1>"7F + )*64+(`#1-"80)% + \else + +`#1 % + \fi + \fi + \fi + \fi + \expandafter\dec@de@UTFviii +\fi} +% \end{macrocode} +% +% \begin{macrocode} +\fi % \end{macrocode} % \end{macro} % +% \begin{macro}{\UTFviii@hexnumber} +% \changes{v1.1o}{2015/08/28}{Macro added} +% Convert a number to a sequence of uppercase hex digits. +% If |\numexpr| is not available, it returns its argument unchanged. +% \begin{macrocode} +\ifx\numexpr\@undefined +% \end{macrocode} +% \begin{macrocode} +\global\let\UTFviii@hexnumber\@firstofone +\global\UTFviii@hexdigit\hexnumber@ +% \end{macrocode} +% \begin{macrocode} +\else +% \end{macrocode} +% \begin{macrocode} +\gdef\UTFviii@hexnumber#1{% +\ifnum#1>15 % +\expandafter\UTFviii@hexnumber\expandafter{\the\numexpr(#1-8)/16\relax}% +\fi +\UTFviii@hexdigit{\numexpr#1\ifnum#1>0-((#1-8)/16)*16\fi\relax}% +} +% \end{macrocode} +% +% Almost but not quite |\hexnumber@|. +% \begin{macrocode} +\gdef\UTFviii@hexdigit#1{\ifcase\numexpr#1\relax + 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or + A\or B\or C\or D\or E\or F\fi} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UTFviii@splitcsname} +% \changes{v1.1o}{2015/08/28}{Macro added} +% Split a csname representing a unicode character and return +% the character and (if |\numexpr| is defined) the unicode number in hex. +% \begin{macrocode} +\ifx\numexpr\@undefined +\gdef\UTFviii@splitcsname#1:#2\relax{#2}} +\else +\gdef\UTFviii@splitcsname#1:#2\relax{% +% \end{macrocode} +% Need to pre-expand the argument to ensure cleanup in case of mal-formed UTF-8. +% \begin{macrocode} +#2 (U+\expandafter\UTFviii@hexnumber\expandafter{% + \the\numexpr\decode@UTFviii#2\relax}) +} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\endgroup +% \end{macrocode} +% % \begin{macrocode} \@onlypreamble\DeclareUnicodeCharacter % \end{macrocode} @@ -692,10 +818,6 @@ % and ultimately what a character is and what a character representation % and/or name is. % -% Viewed this a way, the result has, perhaps puzzling, just two (we think) -% gaps in the second 128 `Unicode slots' (00A0 and 00AD): neither of these -% is really a character, of course. -% % It is unclear the extent to which entries in this table should % resemble the closely related ones in the 8-bit \texttt{inputenc} files. % The Unicode standard claims that the first 256 slots `are' ASCII and @@ -709,12 +831,14 @@ % % \subsection{The mapping table} % -% Note that the first argument must be a 4-hex-digit number greater -% than \texttt{00BF}. +% Note that the first argument must be a hex-digit number greater +% than \texttt{00BF} and at most \texttt{10FFFF}. % % There are few notes about inconsistencies etc at the end of the table. % +% \changes{v1.1o}{2015/08/28}{Add U+00A0 and U+00AD} % \begin{macrocode} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00A0}{\nobreakspace} %<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00A1}{\textexclamdown} %<all,ts1,ly1>\DeclareUnicodeCharacter{00A2}{\textcent} %<all,ts1,t1,ot1,ly1>\DeclareUnicodeCharacter{00A3}{\textsterling} @@ -729,6 +853,7 @@ \DeclareUnicodeCharacter{00AB}{\guillemotleft} %</all,x2,t2c,t2b,t2a,t1,ot2,ly1,lcy> %<all,ts1>\DeclareUnicodeCharacter{00AC}{\textlnot} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{00AD}{\-} %<all,ts1,ly1,utf8>\DeclareUnicodeCharacter{00AE}{\textregistered} %<all,ts1>\DeclareUnicodeCharacter{00AF}{\textasciimacron} %<all,ts1,ly1>\DeclareUnicodeCharacter{00B0}{\textdegree} @@ -869,6 +994,14 @@ %<all,t1>\DeclareUnicodeCharacter{016F}{\r u} %<all,t1>\DeclareUnicodeCharacter{0170}{\H U} %<all,t1>\DeclareUnicodeCharacter{0171}{\H u} +% \end{macrocode} +% +% \changes{v1.1p}{2015/09/07}{Welsh circumflex combinations} +% \begin{macrocode} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0174}{\^W} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0175}{\^w} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0176}{\^Y} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0177}{\^y} %<all,t1,ly1>\DeclareUnicodeCharacter{0178}{\"Y} %<all,t1>\DeclareUnicodeCharacter{0179}{\@tabacckludge'Z} %<all,t1>\DeclareUnicodeCharacter{017A}{\@tabacckludge'z} @@ -877,6 +1010,17 @@ %<all,t1,ly1>\DeclareUnicodeCharacter{017D}{\v Z} %<all,t1,ly1>\DeclareUnicodeCharacter{017E}{\v z} %<all,ts1,ly1>\DeclareUnicodeCharacter{0192}{\textflorin} +% \end{macrocode} +% +% \changes{v1.1o}{2015/08/28}{comma accent latex/4414} +% \begin{macrocode} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0218}{\textcommabelow S} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{0219}{\textcommabelow s} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{021A}{\textcommabelow T} +%<all,t1,ot1,ly1>\DeclareUnicodeCharacter{021B}{\textcommabelow t} +% \end{macrocode} +% +% \begin{macrocode} %<all,ly1,utf8>\DeclareUnicodeCharacter{02C6}{\textasciicircum} %<all,ts1>\DeclareUnicodeCharacter{02C7}{\textasciicaron} %<all,ly1,utf8>\DeclareUnicodeCharacter{02DC}{\textasciitilde} |