summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltfinal.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/base/ltfinal.dtx')
-rw-r--r--macros/latex/base/ltfinal.dtx136
1 files changed, 126 insertions, 10 deletions
diff --git a/macros/latex/base/ltfinal.dtx b/macros/latex/base/ltfinal.dtx
index aa4219723a..19f82934aa 100644
--- a/macros/latex/base/ltfinal.dtx
+++ b/macros/latex/base/ltfinal.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2020
-% The LaTeX3 Project and any individual authors listed elsewhere
+% Copyright (C) 1993-2021
+% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltfinal.dtx}
- [2020-09-26 v2.2j LaTeX Kernel (Final Settings)]
+ [2021/04/18 v2.2o LaTeX Kernel (Final Settings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfinal.dtx}
@@ -57,7 +57,7 @@
%
%
% \section{Final settings}
-% This section contains the final settings for \LaTeX. It initialises
+% This section contains the final settings for \LaTeX. It initializes
% some debugging and typesetting parameters, sets the default
% |\catcode|s and uc/lc codes, and inputs the hyphenation file.
%
@@ -90,6 +90,9 @@
% \changes{v2.0s}{2016/10/15}{Tidy up status of char 127}
% \changes{v2.2i}{2020/08/21}{Integration of new hook management interface}
%
+%
+%
+%
% \subsection{Debugging}
%
% By default, \LaTeX{} shows statistics:
@@ -150,7 +153,7 @@
%\begin{macro}{\newXeTeXintercharclass}
% \changes{v2.0a}{2014/12/30}{macro added}
% \changes{v2.0b}{2015/01/23}{use reserved count 257}
-% \changes{v2.0f}{2015/04/28}{define \cs{xe@alloc@intercharclass} for compatibility with older xelatex initilisation}
+% \changes{v2.0f}{2015/04/28}{define \cs{xe@alloc@intercharclass} for compatibility with older xelatex initialization}
%\begin{macro}{\xe@alloc@intercharclass}
%\begin{macro}{\e@alloc@intercharclass@top}
% \changes{v2.0j}{2016/01/04}{Start allocation at one not three}
@@ -239,7 +242,73 @@
% \end{macro}
% \end{macro}
%
-%
+% \begin{macro}{trace_stack_levels}
+% Now define the Lua function to emulate \cs{tracingstacklevels} and
+% install it in the \texttt{input_level_string} callback.
+% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+% \end{macrocode}
+% In \texttt{latexrelease} mode we always remove the function from
+% the callback, then add the correct version later.
+% \begin{macrocode}
+%<latexrelease>\ifx\directlua\@undefined
+%<latexrelease>\else
+%<latexrelease> \directlua{%
+%<latexrelease> if luatexbase.callbacktypes['input_level_string'] and %
+%<latexrelease> luatexbase.in_callback('input_level_string','tracingstacklevels') then
+%<latexrelease> luatexbase.remove_from_callback('input_level_string','tracingstacklevels')
+%<latexrelease> end}%
+%<latexrelease>\fi
+%<latexrelease>\IncludeInRelease{2021/06/01}{trace_stack_levels}%
+%<latexrelease> {Lua trace_stack_levels function}%
+\ifx\directlua\@undefined
+\else
+%<*2ekernel>
+ \expanded{%
+ \everyjob{\the\everyjob
+ \noexpand%\directlua
+%</2ekernel>
+ \directlua{%
+ local function trace_stack_levels (input_ptr)
+ local tracingstacklevels = tex.count.tracingstacklevels
+ if tex.tracingmacros > 0 or input_ptr < tracingstacklevels then
+ if tracingstacklevels > 0 then
+ if input_ptr < tracingstacklevels then
+ return "\string\n\string~" .. string.rep(".",input_ptr)
+ else
+ return "\string~\string~"
+ end
+ else
+ return "\string\n"
+ end
+ else
+ return ""
+ end
+ end
+%<latexrelease> if luatexbase.callbacktypes['input_level_string'] then
+ luatexbase.add_to_callback('input_level_string',
+ trace_stack_levels,'tracingstacklevels')
+%<latexrelease> end
+ }%
+%<*2ekernel>
+ }}%
+%</2ekernel>
+\fi
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>
+% \end{macrocode}
+% Then for the full rollback, just do nothing, since the function
+% was already taken out of the rollback above.
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}{trace_stack_levels}%
+%<latexrelease> {Lua trace_stack_levels function}%
+%<latexrelease>% Nothing here
+%<latexrelease>\EndIncludeInRelease
+%</2ekernel|latexrelease>
+%<*2ekernel>
+% \end{macrocode}
+% \end{macro}
%
% The default values of the picture and |\fbox| parameters:
% \begin{macrocode}
@@ -522,12 +591,13 @@
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2017/04/15}%
-%<latexrelease> {\document@default@language}{Save language for hyphenation}%
+%<latexrelease> {\document@default@language}{Save language for hyphenation}%
\let\document@default@language\m@ne
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
-%<latexrelease> {\document@default@language}{Save language for hyphenation}%
+%<latexrelease> {\document@default@language}{Save language for hyphenation}%
+%
%<latexrelease>\let\document@default@language\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
@@ -562,6 +632,52 @@
\fi
% \end{macrocode}
%
+% For pdf\TeX\ preload and enable automatic glyph to Unicode mapping
+% for more reliable copy and paste support.
+% \changes{v2.2l}{2021/01/21}{Load glyphtounicode.tex for pdf\TeX}
+% \changes{v2.2m}{2021/02/25}{Improve speed of ToUnicode everyjob loading code}
+%
+% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease> {\pdfgentounicode}{Preload glyphtounicode}%
+\ifx \pdfgentounicode \@undefined \else
+%<*2ekernel>
+ \ifnum 0=0%
+ \ifdefined\pdftexversion
+% \pdftexversion<140 does not have \pdfgentounicode, so we only check higher values
+ \ifnum \pdftexversion=140 \ifnum\pdftexrevision<22 1\fi\fi
+ \fi
+ \relax
+%</2ekernel>
+ \input glyphtounicode
+%<*2ekernel>
+ \else
+ \begingroup
+ \everyeof{\noexpand}\endlinechar-1
+ \edef\x{\endgroup
+ \everyjob{\the\everyjob\@@input glyphtounicode }%
+ }\x
+ \fi
+%</2ekernel>
+ \pdfgentounicode=1
+\fi
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+% When rolling back we can't unload the glyphtounicode mappings, but we
+% can reset |\pdfgentounicode| to ensure that they aren't used.
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\pdfgentounicode}{Preload glyphtounicode}%
+%<latexrelease>\ifx \pdfgentounicode \@undefined \else
+%<latexrelease> \pdfgentounicode=0
+%<latexrelease>\fi
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+% \end{macrocode}
+%
% \subsection{Input encoding}
%
% \changes{v2.1a}{2018/03/25}{default to UTF-8}
@@ -632,7 +748,7 @@
%
% \begin{macro}{\UseRawInputEncoding}
% \changes{v2.1a}{2018/03/25}{Macro added}
-% Reset 8 bit characters to catcode 12 so the input endcoing matches the ``Raw''
+% Reset 8 bit characters to catcode 12 so the input encoding matches the ``Raw''
% font encoding.
% Useful for special behaviours, or for compatibility with older \LaTeX\ formats.
% \changes{v2.1b}{2018/04/06}{Undo changes to \cs{DeclareFontEncoding@} and
@@ -939,7 +1055,7 @@
\expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
% \end{macrocode}
% Tell UTF-8 processing to process chars even though we are in an \cs{protected@edef}.
-% \changes{v2.1h}{2019/09/14}{Expand UTF8 chrs when case changing (github/177)}
+% \changes{v2.1h}{2019/09/14}{Expand UTF8 chars when case changing (github/177)}
% \begin{macrocode}
\let\UTF@two@octets@noexpand\@empty
\let\UTF@three@octets@noexpand\@empty