| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% The LaTeX Project and any individual authors listed elsewhere |
| 5 |
% in this file. |
| 6 |
% |
| 7 |
% This file is part of the LaTeX base system. |
| 8 |
% ------------------------------------------- |
| 9 |
% |
| 10 |
% It may be distributed and/or modified under the |
| 11 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 12 |
% of this license or (at your option) any later version. |
| 13 |
% The latest version of this license is in |
| 14 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2008 or later. |
| 17 |
% |
| 18 |
% This file has the LPPL maintenance status "maintained". |
| 19 |
% |
| 20 |
% The list of all files belonging to the LaTeX base distribution is |
| 21 |
% given in the file `manifest.txt'. See also `legal.txt' for additional |
| 22 |
% information. |
| 23 |
% |
| 24 |
% The list of derived (unpacked) files belonging to the distribution |
| 25 |
% and covered by LPPL is defined by the unpacking scripts (with |
| 26 |
% extension .ins) which are part of the distribution. |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \iffalse |
| 31 |
%%% From File: ltfinal.dtx |
| 32 |
% |
| 33 |
%<*driver> |
| 34 |
% \fi |
| 35 |
\ProvidesFile{ltfinal.dtx} |
| 36 |
[2025/09/23 v2.3h LaTeX Kernel (Final Settings)] |
| 37 |
% \iffalse |
| 38 |
\documentclass{ltxdoc} |
| 39 |
\GetFileInfo{ltfinal.dtx} |
| 40 |
\title{\filename} |
| 41 |
\date{\filedate} |
| 42 |
\author{% |
| 43 |
Johannes Braams\and |
| 44 |
David Carlisle\and |
| 45 |
Alan Jeffrey\and |
| 46 |
Leslie Lamport\and |
| 47 |
Frank Mittelbach\and |
| 48 |
Chris Rowley\and |
| 49 |
Rainer Sch\"opf} |
| 50 |
\begin{document} |
| 51 |
\MaintainedByLaTeXTeam{latex} |
| 52 |
\maketitle |
| 53 |
\DocInput{ltfinal.dtx} |
| 54 |
\end{document} |
| 55 |
%</driver> |
| 56 |
% \fi |
| 57 |
% |
| 58 |
% |
| 59 |
% \section{Final settings} |
| 60 |
% |
| 61 |
% This section contains the final settings for \LaTeX. It initializes |
| 62 |
% some debugging and typesetting parameters, sets the default |
| 63 |
% |\catcode|s and uc/lc codes, and inputs the hyphenation file. |
| 64 |
% |
| 65 |
% |
| 66 |
% |
| 67 |
% \MaybeStop{} |
| 68 |
% |
| 69 |
% \changes{v0.1a}{1994/03/07}{Initial version, split from latex.dtx} |
| 70 |
% \changes{v0.1a}{1994/03/07}{Remove oldcomments environment} |
| 71 |
% \changes{v0.1c}{1994/04/21}{Added comments, set the catcodes of |
| 72 |
% 128--255.} |
| 73 |
% \changes{v0.1d}{1994/04/23}{Check that \cs{font@submax} is still zero} |
| 74 |
% \changes{v0.1e}{1994/05/02}{Set all the catcodes} |
| 75 |
% \changes{v0.1f}{1994/05/03}{Set the catcode of control-J to be |
| 76 |
% `other', for use in messages.} |
| 77 |
% \changes{v0.1g}{1994/05/05}{Added empty errhelp.} |
| 78 |
% \changes{v0.1h}{1994/05/13}{Added package ot1enc, and defined |
| 79 |
% \cs{@acci}, \cs{@accii} and \cs{@acciii}.} |
| 80 |
% \changes{v0.1j}{1994/05/18}{Corrected the lccode for d-bar.} |
| 81 |
% \changes{v0.1k}{1994/05/19}{Removed \cs{makeat...}} |
| 82 |
% \changes{v1.0n}{1994/05/31}{Renamed lthyphen.* to lthyphen.*.} |
| 83 |
% \changes{v1.0o}{1994/11/17} |
| 84 |
% {\cs{@tempa} to \cs{reserved@a}} |
| 85 |
% \changes{v1.0p}{1994/12/01} |
| 86 |
% {Renamed lthyphen.* to hyphen.*.} |
| 87 |
% \changes{v1.0r}{1995/06/05} |
| 88 |
% {Added \cs{MakeUppercase} and \cs{MakeLowercase}.} |
| 89 |
% \changes{v1.0s}{1995/06/06} |
| 90 |
% {Made \cs{MakeUppercase} and \cs{MakeLowercase} brace their |
| 91 |
% argument.} |
| 92 |
% \changes{v2.0r}{2016/10/15}{Require e\TeX{}} |
| 93 |
% \changes{v2.0s}{2016/10/15}{Tidy up status of char 127} |
| 94 |
% \changes{v2.2i}{2020/08/21}{Integration of new hook management interface} |
| 95 |
% |
| 96 |
% |
| 97 |
% |
| 98 |
% |
| 99 |
% \subsection{Debugging} |
| 100 |
% |
| 101 |
% By default, \LaTeX{} shows statistics: |
| 102 |
% \begin{macrocode} |
| 103 |
%<*2ekernel> |
| 104 |
\tracingstats1 |
| 105 |
% \end{macrocode} |
| 106 |
% |
| 107 |
% \subsection{Typesetting parameters} |
| 108 |
% |
| 109 |
% \begin{macro}{\@lowpenalty} |
| 110 |
% \begin{macro}{\@medpenalty} |
| 111 |
% \begin{macro}{\@highpenalty} |
| 112 |
% These are penalties used internally. |
| 113 |
% \begin{macrocode} |
| 114 |
\newcount\@lowpenalty |
| 115 |
\newcount\@medpenalty |
| 116 |
\newcount\@highpenalty |
| 117 |
% \end{macrocode} |
| 118 |
% \end{macro} |
| 119 |
% \end{macro} |
| 120 |
% \end{macro} |
| 121 |
% |
| 122 |
% |
| 123 |
%\begin{macro}{\newmarks} |
| 124 |
% \changes{v2.0a}{2014/12/30}{macro added} |
| 125 |
% \changes{v2.0b}{2015/01/23}{use reserved count 256} |
| 126 |
% \changes{v2.0g}{2015/06/19}{Use $-1$ for first range to get contiguous allocation} |
| 127 |
% Allocate extended marks types if etex is active. |
| 128 |
% Placed here at the end of the format |
| 129 |
% to increase compatibility with count allocations |
| 130 |
% in earlier releases. |
| 131 |
% \begin{macrocode} |
| 132 |
%</2ekernel> |
| 133 |
%<*2ekernel|latexrelease> |
| 134 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 135 |
%<latexrelease> {\newmarks}{Extended Allocation}% |
| 136 |
% \end{macrocode} |
| 137 |
% |
| 138 |
% \begin{macrocode} |
| 139 |
\ifx\marks\@undefined\else |
| 140 |
\def\newmarks{% |
| 141 |
\e@alloc\marks \e@alloc@chardef{\count256}\m@ne\e@alloc@top} |
| 142 |
\fi |
| 143 |
% \end{macrocode} |
| 144 |
% |
| 145 |
% \begin{macrocode} |
| 146 |
%</2ekernel|latexrelease> |
| 147 |
%<latexrelease>\EndIncludeInRelease |
| 148 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 149 |
%<latexrelease> {\newmarks}{Extended Allocation}% |
| 150 |
%<latexrelease>\let\newmarks\@undefined |
| 151 |
%<latexrelease>\EndIncludeInRelease |
| 152 |
%<*2ekernel> |
| 153 |
% \end{macrocode} |
| 154 |
% \end{macro} |
| 155 |
% |
| 156 |
% |
| 157 |
% |
| 158 |
% Allocate 3 mark classes to be used in \cs{markboth} and |
| 159 |
% \cs{markright}. Should be done earlier but for that definition of |
| 160 |
% \cs{newmarks} needs moving (which it should I guess). |
| 161 |
% \changes{v2.2s}{2022/04/03}{Integration of new mark management interface} |
| 162 |
% \begin{macrocode} |
| 163 |
%</2ekernel> |
| 164 |
%<*2ekernel|latexrelease> |
| 165 |
%<latexrelease>\IncludeInRelease{2022/06/01}% |
| 166 |
%<latexrelease> {2e-left}{Delayed legacy marks}% |
| 167 |
\NewMarkClass {2e-left} |
| 168 |
\NewMarkClass {2e-right} |
| 169 |
\NewMarkClass {2e-right-nonempty} |
| 170 |
% \end{macrocode} |
| 171 |
% No rollback really, the marks will remain. |
| 172 |
% \begin{macrocode} |
| 173 |
%</2ekernel|latexrelease> |
| 174 |
%<latexrelease>\EndIncludeInRelease |
| 175 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 176 |
%<latexrelease> {2e-left}{Delayed legacy marks}% |
| 177 |
%<latexrelease> |
| 178 |
%<latexrelease>\EndIncludeInRelease |
| 179 |
%<*2ekernel> |
| 180 |
% \end{macrocode} |
| 181 |
|
| 182 |
|
| 183 |
% |
| 184 |
%\begin{macro}{\newXeTeXintercharclass} |
| 185 |
% \changes{v2.0a}{2014/12/30}{macro added} |
| 186 |
% \changes{v2.0b}{2015/01/23}{use reserved count 257} |
| 187 |
% \changes{v2.0f}{2015/04/28}{define \cs{xe@alloc@intercharclass} for compatibility with older xelatex initialization} |
| 188 |
%\begin{macro}{\xe@alloc@intercharclass} |
| 189 |
%\begin{macro}{\e@alloc@intercharclass@top} |
| 190 |
% \changes{v2.0j}{2016/01/04}{Start allocation at one not three} |
| 191 |
% \changes{v2.0k}{2016/01/05}{Remove duplicated code} |
| 192 |
% Allocate |\XeTeXintercharclass| types if xetex is active. |
| 193 |
% previously defined in |xetex.ini|. |
| 194 |
% |
| 195 |
% \begin{macrocode} |
| 196 |
%</2ekernel> |
| 197 |
%<*2ekernel|latexrelease> |
| 198 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 199 |
%<latexrelease> {\newXeTeXintercharclass}{Extended Allocation}% |
| 200 |
% \end{macrocode} |
| 201 |
% |
| 202 |
% Classes allocated 1 to 4094 (or 254 on older xetex) |
| 203 |
% (In earlier XeLaTeX versions 1, 2 and 3 were pre-set for CJK). |
| 204 |
% \changes{v2.0g}{2015/06/19}{Use $-1$ for first range to get contiguous allocation} |
| 205 |
% \changes{v2.0q}{2016/04/22}{XeTeX 0.99996 has 4096 char classes not 256} |
| 206 |
% \begin{macrocode} |
| 207 |
\ifx\XeTeXcharclass\@undefined |
| 208 |
\else |
| 209 |
% \end{macrocode} |
| 210 |
% \begin{macrocode} |
| 211 |
\ifdim\the\XeTeXversion\XeTeXrevision\p@>0.99993\p@ |
| 212 |
\chardef\e@alloc@intercharclass@top=4095 |
| 213 |
\else |
| 214 |
\chardef\e@alloc@intercharclass@top=255 |
| 215 |
\fi |
| 216 |
% \end{macrocode} |
| 217 |
% \begin{macrocode} |
| 218 |
\def\newXeTeXintercharclass{% |
| 219 |
\e@alloc\XeTeXcharclass |
| 220 |
\chardef\xe@alloc@intercharclass\m@ne\e@alloc@intercharclass@top} |
| 221 |
\fi |
| 222 |
% \end{macrocode} |
| 223 |
% |
| 224 |
% \begin{macrocode} |
| 225 |
%</2ekernel|latexrelease> |
| 226 |
%<latexrelease>\EndIncludeInRelease |
| 227 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 228 |
%<latexrelease> {\newXeTeXintercharclass}{Extended Allocation}% |
| 229 |
%<latexrelease> \ifx\XeTeXcharclass\@undefined |
| 230 |
%<latexrelease> \else |
| 231 |
%<latexrelease> \def\xe@alloc@#1#2#3#4#5{\global\advance#1\@ne |
| 232 |
%<latexrelease> \xe@ch@ck#1#4#2% |
| 233 |
%<latexrelease> \allocationnumber#1% |
| 234 |
%<latexrelease> \global#3#5\allocationnumber |
| 235 |
%<latexrelease> \wlog{\string#5=\string#2\the\allocationnumber}} |
| 236 |
%<latexrelease> \def\xe@ch@ck#1#2#3{% |
| 237 |
%<latexrelease> \ifnum#1<#2\else |
| 238 |
%<latexrelease> \errmessage{No room for a new #3}% |
| 239 |
%<latexrelease> \fi} |
| 240 |
%<latexrelease> \def\newXeTeXintercharclass{% |
| 241 |
%<latexrelease> \xe@alloc@\xe@alloc@intercharclass |
| 242 |
%<latexrelease> \XeTeXcharclass\chardef\@cclv} |
| 243 |
%<latexrelease> \fi |
| 244 |
%<latexrelease>\EndIncludeInRelease |
| 245 |
%<*2ekernel|latexrelease> |
| 246 |
%<latexrelease>\IncludeInRelease{2016/02/01}% |
| 247 |
%<latexrelease> {\xe@alloc@intercharclass}{Start of XeTeX class allocator}% |
| 248 |
\ifx\XeTeXcharclass\@undefined |
| 249 |
\else |
| 250 |
\countdef\xe@alloc@intercharclass=257 |
| 251 |
\xe@alloc@intercharclass=\z@ |
| 252 |
\fi |
| 253 |
%</2ekernel|latexrelease> |
| 254 |
%<latexrelease>\EndIncludeInRelease |
| 255 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 256 |
%<latexrelease> {\xe@alloc@intercharclass}{Start of XeTeX class allocator}% |
| 257 |
%<latexrelease> \ifx\XeTeXcharclass\@undefined |
| 258 |
%<latexrelease> \else |
| 259 |
%<latexrelease> \xe@alloc@intercharclass=\thr@@ |
| 260 |
%<latexrelease> \fi |
| 261 |
%<latexrelease>\EndIncludeInRelease |
| 262 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 263 |
%<latexrelease> {\xe@alloc@intercharclass}{Start of XeTeX class allocator}% |
| 264 |
%<latexrelease> \ifx\XeTeXcharclass\@undefined |
| 265 |
%<latexrelease> \else |
| 266 |
%<latexrelease> \newcount\xe@alloc@intercharclass |
| 267 |
%<latexrelease> \xe@alloc@intercharclass=\thr@@ |
| 268 |
%<latexrelease> \fi |
| 269 |
%<latexrelease>\EndIncludeInRelease |
| 270 |
%<*2ekernel> |
| 271 |
% \end{macrocode} |
| 272 |
% \end{macro} |
| 273 |
% \end{macro} |
| 274 |
% \end{macro} |
| 275 |
% |
| 276 |
% \begin{macro}{trace_stack_levels} |
| 277 |
% Now define the Lua function to emulate \cs{tracingstacklevels} and |
| 278 |
% install it in the |input_level_string| callback. |
| 279 |
% \begin{macrocode} |
| 280 |
%</2ekernel> |
| 281 |
%<*2ekernel|latexrelease> |
| 282 |
% \end{macrocode} |
| 283 |
% In \texttt{latexrelease} mode we always remove the function from |
| 284 |
% the callback, then add the correct version later. |
| 285 |
% \begin{macrocode} |
| 286 |
%<latexrelease>\ifx\directlua\@undefined |
| 287 |
%<latexrelease>\else |
| 288 |
%<latexrelease> \directlua{% |
| 289 |
%<latexrelease> if luatexbase.callbacktypes['input_level_string'] and % |
| 290 |
%<latexrelease> luatexbase.in_callback('input_level_string','tracingstacklevels') then |
| 291 |
%<latexrelease> luatexbase.remove_from_callback('input_level_string','tracingstacklevels') |
| 292 |
%<latexrelease> end}% |
| 293 |
%<latexrelease>\fi |
| 294 |
%<latexrelease>\IncludeInRelease{2021/06/01}{trace_stack_levels}% |
| 295 |
%<latexrelease> {Lua trace_stack_levels function}% |
| 296 |
\ifx\directlua\@undefined |
| 297 |
\else |
| 298 |
%<*2ekernel> |
| 299 |
\expanded{% |
| 300 |
\everyjob{\the\everyjob |
| 301 |
\noexpand%\directlua |
| 302 |
%</2ekernel> |
| 303 |
\directlua{% |
| 304 |
local function trace_stack_levels (input_ptr) |
| 305 |
local tracingstacklevels = tex.count.tracingstacklevels |
| 306 |
if tex.tracingmacros > 0 or input_ptr < tracingstacklevels then |
| 307 |
if tracingstacklevels > 0 then |
| 308 |
if input_ptr < tracingstacklevels then |
| 309 |
return "\string\n\string~" .. string.rep(".",input_ptr) |
| 310 |
else |
| 311 |
return "\string~\string~" |
| 312 |
end |
| 313 |
else |
| 314 |
return "\string\n" |
| 315 |
end |
| 316 |
else |
| 317 |
return "" |
| 318 |
end |
| 319 |
end |
| 320 |
%<latexrelease> if luatexbase.callbacktypes['input_level_string'] then |
| 321 |
luatexbase.add_to_callback('input_level_string', |
| 322 |
trace_stack_levels,'tracingstacklevels') |
| 323 |
%<latexrelease> end |
| 324 |
}% |
| 325 |
%<*2ekernel> |
| 326 |
}}% |
| 327 |
%</2ekernel> |
| 328 |
\fi |
| 329 |
%<latexrelease>\EndIncludeInRelease |
| 330 |
%<latexrelease> |
| 331 |
% \end{macrocode} |
| 332 |
% Then for the full rollback, just do nothing, since the function |
| 333 |
% was already taken out of the rollback above. |
| 334 |
% \begin{macrocode} |
| 335 |
%<latexrelease>\IncludeInRelease{0000/00/00}{trace_stack_levels}% |
| 336 |
%<latexrelease> {Lua trace_stack_levels function}% |
| 337 |
%<latexrelease>% Nothing here |
| 338 |
%<latexrelease>\EndIncludeInRelease |
| 339 |
%</2ekernel|latexrelease> |
| 340 |
%<*2ekernel> |
| 341 |
% \end{macrocode} |
| 342 |
% \end{macro} |
| 343 |
% |
| 344 |
% The default values of the picture and |\fbox| parameters: |
| 345 |
% \begin{macrocode} |
| 346 |
\unitlength = 1pt |
| 347 |
\fboxsep = 3pt |
| 348 |
\fboxrule = .4pt |
| 349 |
% \end{macrocode} |
| 350 |
% The saved value of \TeX's |\maxdepth|: |
| 351 |
% \begin{macrocode} |
| 352 |
\@maxdepth = \maxdepth |
| 353 |
% \end{macrocode} |
| 354 |
% |\vsize| initialized because a |\clearpage| with |\vsize < \topskip| |
| 355 |
% causes trouble. |
| 356 |
% |\@colroom| and |\@colht| also initialized because |\vsize| may be |
| 357 |
% set to them if a |\clearpage| is done before the |\begin{document}| |
| 358 |
% |
| 359 |
% \begin{macrocode} |
| 360 |
\vsize = 1000pt |
| 361 |
\@colroom = \vsize |
| 362 |
\@colht = \vsize |
| 363 |
% \end{macrocode} |
| 364 |
% Initialise |\textheight| |\textwidth| and page style, to avoid |
| 365 |
% internal errors if they are not set by the class. |
| 366 |
% \changes{v0.1b}{1994/04/18} |
| 367 |
% {Initialise \cs{textheight}, \cs{textwidth} and page style} |
| 368 |
% \begin{macrocode} |
| 369 |
\textheight=.5\maxdimen |
| 370 |
\textwidth=\textheight |
| 371 |
\ps@empty |
| 372 |
% \end{macrocode} |
| 373 |
% |
| 374 |
% \subsection{Lccodes for hyphenation} |
| 375 |
% |
| 376 |
% \changes{v2.0a}{2015/01/03}{Unicode data loading added} |
| 377 |
% \changes{v2.0c}{2015/01/24}{Skip T1-code entirely with Unicode engines} |
| 378 |
% \changes{v2.0d}{2015/03/26}{Use renamed |
| 379 |
% \texttt{unicode-letters.def}} |
| 380 |
% \changes{v2.0i}{2015/12/10}{Use new common Unicode data loaders} |
| 381 |
% \changes{v2.0j}{2016/01/04}{Do not set up inter character classes for |
| 382 |
% XeTeX} |
| 383 |
% \changes{v2.0l}{2016/01/05}{Correct \textsf{latexrelease} guards} |
| 384 |
% \changes{v2.0l}{2016/01/05}{Ensure old definitions for inter-character |
| 385 |
% class toks are available using \textsf{latexrelease}} |
| 386 |
% \changes{v2.0m}{2016/01/05}{Undefine XeTeX classes when using patching |
| 387 |
% an older kernel} |
| 388 |
% \changes{v2.0l}{2016/01/05}{Missing brace} |
| 389 |
% \changes{v2.0p}{2016/01/05}{Only apply XeTeX change if XeTeX is in use} |
| 390 |
% For $7$- and $8$-bit engines the assumption of T1 encodings is the |
| 391 |
% basis for the hyphenation patterns. That's not the case for the Unicode |
| 392 |
% engines, where the assumption is engine-native working. The common |
| 393 |
% loader system provides access to data from the Unicode Consortium |
| 394 |
% covering not only |\lccode| but also other related data. The |
| 395 |
% |\lccode| part of that at least needs to be loaded before hyphenation is |
| 396 |
% tackled: Xe\TeX{} follows the standard \TeX{} route of building patterns |
| 397 |
% into the format. Lua\TeX{} doesn't require this data be loaded \emph{here} |
| 398 |
% but it does need to be loaded somewhere. Rather than test for the Unicode |
| 399 |
% engines by name, the approach here is to look for the extended math mode |
| 400 |
% handling both provide: any other engine developed in this area will |
| 401 |
% presumably also provide |\Umathcode|. |
| 402 |
% \begin{macrocode} |
| 403 |
\ifnum 0% |
| 404 |
\ifx\Umathcode\@undefined\else 1\fi |
| 405 |
\ifx\XeTeXmathcode\@undefined\else 1\fi |
| 406 |
>\z@ |
| 407 |
\message{ Unicode character data,} |
| 408 |
\input{load-unicode-data} |
| 409 |
%</2ekernel> |
| 410 |
%<latexrelease>\IncludeInRelease{2016/02/01}% |
| 411 |
%<latexrelease> {\XeTeXintercharclasses}{XeTeX character classes}% |
| 412 |
%<latexrelease> \ifx\XeTeXinterchartoks\undefined |
| 413 |
%<latexrelease> \else |
| 414 |
%<latexrelease> \begingroup |
| 415 |
%<latexrelease> \chardef\XeTeXcharclassID = 0 % |
| 416 |
%<latexrelease> \chardef\XeTeXcharclassOP = 0 % |
| 417 |
%<latexrelease> \chardef\XeTeXcharclassCL = 0 % |
| 418 |
%<latexrelease> \chardef\XeTeXcharclassEX = 0 % |
| 419 |
%<latexrelease> \chardef\XeTeXcharclassIS = 0 % |
| 420 |
%<latexrelease> \chardef\XeTeXcharclassNS = 0 % |
| 421 |
%<latexrelease> \chardef\XeTeXcharclassCM = 0 % |
| 422 |
%<latexrelease> \input{load-unicode-xetex-classes} |
| 423 |
%<latexrelease> \endgroup |
| 424 |
%<latexrelease> \global\let\xtxHanGlue\undefined |
| 425 |
%<latexrelease> \global\let\xtxHanSpace\undefined |
| 426 |
%<latexrelease> \global\XeTeXinterchartoks 0 1 = {} |
| 427 |
%<latexrelease> \global\XeTeXinterchartoks 0 2 = {} |
| 428 |
%<latexrelease> \global\XeTeXinterchartoks 0 3 = {} |
| 429 |
%<latexrelease> \global\XeTeXinterchartoks 1 0 = {} |
| 430 |
%<latexrelease> \global\XeTeXinterchartoks 2 0 = {} |
| 431 |
%<latexrelease> \global\XeTeXinterchartoks 3 0 = {} |
| 432 |
%<latexrelease> \global\XeTeXinterchartoks 1 1 = {} |
| 433 |
%<latexrelease> \global\XeTeXinterchartoks 1 2 = {} |
| 434 |
%<latexrelease> \global\XeTeXinterchartoks 1 3 = {} |
| 435 |
%<latexrelease> \global\XeTeXinterchartoks 2 1 = {} |
| 436 |
%<latexrelease> \global\XeTeXinterchartoks 2 2 = {} |
| 437 |
%<latexrelease> \global\XeTeXinterchartoks 2 3 = {} |
| 438 |
%<latexrelease> \global\XeTeXinterchartoks 3 1 = {} |
| 439 |
%<latexrelease> \global\XeTeXinterchartoks 3 2 = {} |
| 440 |
%<latexrelease> \global\XeTeXinterchartoks 3 3 = {} |
| 441 |
%<latexrelease> \fi |
| 442 |
%<latexrelease>\EndIncludeInRelease |
| 443 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 444 |
%<latexrelease> {\XeTeXintercharclasses}{XeTeX character classes}% |
| 445 |
%<latexrelease> \ifx\XeTeXinterchartoks\undefined |
| 446 |
%<latexrelease> \else |
| 447 |
%<latexrelease> \input{load-unicode-xetex-classes} |
| 448 |
%<latexrelease> \gdef\xtxHanGlue{\hskip0pt plus 0.1em\relax} |
| 449 |
%<latexrelease> \gdef\xtxHanSpace{\hskip0.2em plus 0.2em minus 0.1em\relax} |
| 450 |
%<latexrelease> \global\XeTeXinterchartoks 0 1 = {\xtxHanSpace} |
| 451 |
%<latexrelease> \global\XeTeXinterchartoks 0 2 = {\xtxHanSpace} |
| 452 |
%<latexrelease> \global\XeTeXinterchartoks 0 3 = {\nobreak\xtxHanSpace} |
| 453 |
%<latexrelease> \global\XeTeXinterchartoks 1 0 = {\xtxHanSpace} |
| 454 |
%<latexrelease> \global\XeTeXinterchartoks 2 0 = {\nobreak\xtxHanSpace} |
| 455 |
%<latexrelease> \global\XeTeXinterchartoks 3 0 = {\xtxHanSpace} |
| 456 |
%<latexrelease> \global\XeTeXinterchartoks 1 1 = {\xtxHanGlue} |
| 457 |
%<latexrelease> \global\XeTeXinterchartoks 1 2 = {\xtxHanGlue} |
| 458 |
%<latexrelease> \global\XeTeXinterchartoks 1 3 = {\nobreak\xtxHanGlue} |
| 459 |
%<latexrelease> \global\XeTeXinterchartoks 2 1 = {\nobreak\xtxHanGlue} |
| 460 |
%<latexrelease> \global\XeTeXinterchartoks 2 2 = {\nobreak\xtxHanGlue} |
| 461 |
%<latexrelease> \global\XeTeXinterchartoks 2 3 = {\xtxHanGlue} |
| 462 |
%<latexrelease> \global\XeTeXinterchartoks 3 1 = {\xtxHanGlue} |
| 463 |
%<latexrelease> \global\XeTeXinterchartoks 3 2 = {\xtxHanGlue} |
| 464 |
%<latexrelease> \global\XeTeXinterchartoks 3 3 = {\nobreak\xtxHanGlue} |
| 465 |
%<latexrelease> \fi |
| 466 |
%<latexrelease>\EndIncludeInRelease |
| 467 |
%<*2ekernel> |
| 468 |
% \end{macrocode} |
| 469 |
% \changes{v2.0d}{2015/02/03}{Set \cs{lccode} for \texttt{-} with Unicode |
| 470 |
% engines} |
| 471 |
% There is one over-ride that makes sense here (see below for the same for |
| 472 |
% $8$-bit engines): setting the lccode for |-| to itself. |
| 473 |
% \begin{macrocode} |
| 474 |
\lccode`\- =`\- % default hyphen char |
| 475 |
% \end{macrocode} |
| 476 |
% The alternative is that a ``traditional'' engine is in use. |
| 477 |
% \begin{macrocode} |
| 478 |
\else |
| 479 |
% \end{macrocode} |
| 480 |
% \changes{v1.1b}{1998/05/20}{Set up lccodes before loading |
| 481 |
% hyphenation files: pr/2639} |
| 482 |
% We set things up so that hyphenation files can assume that the |
| 483 |
% default (T1) lccodes are in use (at present this also sets up the |
| 484 |
% uccodes). |
| 485 |
% We temporarily define |\reserved@a| to apply |\reserved@c| to |
| 486 |
% all the numbers in the range of its arguments. |
| 487 |
% \begin{macrocode} |
| 488 |
\def\reserved@a#1#2{% |
| 489 |
\@tempcnta#1\relax |
| 490 |
\@tempcntb#2\relax |
| 491 |
\reserved@b |
| 492 |
} |
| 493 |
\def\reserved@b{% |
| 494 |
\ifnum\@tempcnta>\@tempcntb\else |
| 495 |
\reserved@c\@tempcnta |
| 496 |
\advance\@tempcnta\@ne |
| 497 |
\expandafter\reserved@b |
| 498 |
\fi |
| 499 |
} |
| 500 |
% \end{macrocode} |
| 501 |
% Depending on the \TeX{} version, we might not be allowed to do |
| 502 |
% this for non-ASCII characters. |
| 503 |
% \changes{v1.0n}{1994/06/09}{For \TeX2, do not set codes for higher |
| 504 |
% half of character table.} |
| 505 |
% \begin{macrocode} |
| 506 |
\def\reserved@c#1{% |
| 507 |
\count@=#1\advance\count@ by -"20 |
| 508 |
\uccode#1=\count@ |
| 509 |
\lccode#1=#1 |
| 510 |
} |
| 511 |
\reserved@a{`\a}{`\z} |
| 512 |
\reserved@a{"A0}{"BC} |
| 513 |
\reserved@a{"E0}{"FF} |
| 514 |
% \end{macrocode} |
| 515 |
% The upper case characters need their |\uccode| and |\lccode| values |
| 516 |
% set, and their |\sfcode| set to 999. |
| 517 |
% \begin{macrocode} |
| 518 |
\def\reserved@c#1{% |
| 519 |
\count@=#1\advance\count@ by "20 |
| 520 |
\uccode#1=#1 |
| 521 |
\lccode#1=\count@ |
| 522 |
\sfcode#1=999 |
| 523 |
} |
| 524 |
\reserved@a{`\A}{`\Z} |
| 525 |
\reserved@a{"80}{"9C} |
| 526 |
\reserved@a{"C0}{"DF} |
| 527 |
% \end{macrocode} |
| 528 |
% Well, it would be nice if that were correct, but unfortunately, the |
| 529 |
% Cork encoding contains some odd slots whose uccode or lccode isn't |
| 530 |
% quite what you'd expect. |
| 531 |
% \begin{macrocode} |
| 532 |
\uccode`\^^Y=`\I % dotless i |
| 533 |
\lccode`\^^Y=`\^^Y % dotless i |
| 534 |
\uccode`\^^Z=`\J % dotless j, ae in OT1 |
| 535 |
\lccode`\^^Z=`\^^Z % dotless j, ae in OT1 |
| 536 |
\lccode`\^^9d=`\i % dotted I |
| 537 |
\uccode`\^^9d=`\^^9d % dotted I |
| 538 |
\lccode`\^^9e=`\^^9e % d-bar |
| 539 |
\uccode`\^^9e=`\^^d0 % d-bar |
| 540 |
% \end{macrocode} |
| 541 |
% Finally here is one that helps hyphenation in the OT1 encoding. |
| 542 |
% \changes{v1.0z}{1996/10/31} |
| 543 |
% {Added extra \cs{lcode}, hoping it does no harm in T1 (pr/1969)} |
| 544 |
% \begin{macrocode} |
| 545 |
\lccode`\^^[=`\^^[ % oe in OT1 |
| 546 |
% \end{macrocode} |
| 547 |
% |
| 548 |
% And we also set the |\lccode| of |\-| and |\textcompwordmark| so |
| 549 |
% that they do not prevent hyphenation in the remainder of the word |
| 550 |
% (as suggested by Lars Helstr\"om). |
| 551 |
% \changes{v1.1e}{2003/10/13} |
| 552 |
% {Added extra \cs{lccode} for \cs{-} and \cs{textcompwordmark}} |
| 553 |
% \begin{macrocode} |
| 554 |
\lccode`\- =`\- % default hyphen char |
| 555 |
\lccode 127=127 % alternate hyphen char |
| 556 |
\lccode 23 =23 % textcompwordmark in T1 |
| 557 |
% \end{macrocode} |
| 558 |
% |
| 559 |
% End of the conditional to select either Unicode or T1 encoding defaults. |
| 560 |
% \begin{macrocode} |
| 561 |
\fi |
| 562 |
% \end{macrocode} |
| 563 |
% |
| 564 |
% \changes{v2.2b}{2020/07/08} |
| 565 |
% {Add a last-minute hook for \textsf{expl3}} |
| 566 |
% At this stage, we can install any last-minute \textsf{expl3} set-up. |
| 567 |
% \begin{macrocode} |
| 568 |
\@expl@finalise@setup@@ |
| 569 |
\def\@expl@finalise@setup@@{} |
| 570 |
% \end{macrocode} |
| 571 |
% |
| 572 |
% This is as good a place as any to active a few Xe\TeX{}-specific |
| 573 |
% settings |
| 574 |
% \begin{macrocode} |
| 575 |
\ifx\XeTeXuseglyphmetrics\@undefined |
| 576 |
\else |
| 577 |
\XeTeXuseglyphmetrics=1 % |
| 578 |
\XeTeXdashbreakstate=1 % |
| 579 |
\fi |
| 580 |
% \end{macrocode} |
| 581 |
% |
| 582 |
% \subsection{Hyphenation} |
| 583 |
% |
| 584 |
% \changes{v0.1a}{1994/03/07}{move code here from lhyphen.dtx} |
| 585 |
% \changes{v0.1a}{1994/03/07} |
| 586 |
% {use \cs{InputIfFileExists} not \cs{IfFileExists}} |
| 587 |
% \changes{v1.0x}{1995/11/01} |
| 588 |
% {(DPC) Switch meaning of \cs{@addtofilelist} for cfg files}% |
| 589 |
% The following code will be compiled into the format file. It checks |
| 590 |
% for the existence of \texttt{hyphen.cfg} in inputs that file if |
| 591 |
% found. Otherwise it inputs \texttt{hyphen.ltx}. Note that these |
| 592 |
% are loaded in \emph{before} the |\catcode|s are set, so local |
| 593 |
% hyphenation files can use 8-bit input. |
| 594 |
% |
| 595 |
% We try to load the customized hyphenation description file. |
| 596 |
% \begin{macrocode} |
| 597 |
\InputIfFileExists{hyphen.cfg} |
| 598 |
{\typeout{===========================================^^J% |
| 599 |
Local configuration file hyphen.cfg used^^J% |
| 600 |
===========================================}% |
| 601 |
\def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}% |
| 602 |
} |
| 603 |
{\input{hyphen.ltx}} |
| 604 |
\let\@addtofilelist\@gobble |
| 605 |
% \end{macrocode} |
| 606 |
% |
| 607 |
% \begin{macro}{\l@nohyphenation} |
| 608 |
% \changes{v2.0t}{2017/03/09}{ensure \cs{l@nohyphenation} is defined.} |
| 609 |
% \begin{macrocode} |
| 610 |
\ifx\l@nohyphenation \@undefined |
| 611 |
\newlanguage\l@nohyphenation |
| 612 |
\fi |
| 613 |
% \end{macrocode} |
| 614 |
% \end{macro} |
| 615 |
% |
| 616 |
% |
| 617 |
% \begin{macro}{\document@default@language} |
| 618 |
% Default document language. -1 acts as language 0, but used as a flag in |\document| |
| 619 |
% to see if it has been set in the preamble. |
| 620 |
% \changes{v2.1f}{2018/08/24}{Add to latexrelease (github/68)} |
| 621 |
% \begin{macrocode} |
| 622 |
%</2ekernel> |
| 623 |
%<*2ekernel|latexrelease> |
| 624 |
%<latexrelease>\IncludeInRelease{2017/04/15}% |
| 625 |
%<latexrelease> {\document@default@language}{Save language for hyphenation}% |
| 626 |
\let\document@default@language\m@ne |
| 627 |
%</2ekernel|latexrelease> |
| 628 |
%<latexrelease>\EndIncludeInRelease |
| 629 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 630 |
%<latexrelease> {\document@default@language}{Save language for hyphenation}% |
| 631 |
% |
| 632 |
%<latexrelease>\let\document@default@language\@undefined |
| 633 |
%<latexrelease>\EndIncludeInRelease |
| 634 |
%<*2ekernel> |
| 635 |
% \end{macrocode} |
| 636 |
% \end{macro} |
| 637 |
% |
| 638 |
% |
| 639 |
% |
| 640 |
% \subsection{Font loading} |
| 641 |
% Fonts loaded during the formatting process might already have |
| 642 |
% changed the |\font@submax| from |0pt| to something higher. |
| 643 |
% If so, we put out a bold warning. |
| 644 |
% \changes{v0.1l}{1994/05/20}{Use new font warning commands} |
| 645 |
% \changes{v1.1c}{2000/08/23}{Fix typo in warning} |
| 646 |
% \begin{macrocode} |
| 647 |
\ifdim \font@submax >\z@ |
| 648 |
\@font@warning{Size substitutions with differences\MessageBreak |
| 649 |
up to \font@submax\space have occurred.\MessageBreak |
| 650 |
\MessageBreak |
| 651 |
Please check the transcript file |
| 652 |
carefully\MessageBreak |
| 653 |
and redo the format generation if necessary! |
| 654 |
\@gobbletwo}% |
| 655 |
\errhelp{Only stopped, to give you time to |
| 656 |
read the above message.} |
| 657 |
\errmessage{} |
| 658 |
% \end{macrocode} |
| 659 |
% We reset the macro. Otherwise every user will get a warning on |
| 660 |
% every job. |
| 661 |
% \begin{macrocode} |
| 662 |
\def\font@submax{0pt} |
| 663 |
\fi |
| 664 |
% \end{macrocode} |
| 665 |
% |
| 666 |
% For pdf\TeX\ preload and enable automatic glyph to Unicode mapping |
| 667 |
% for more reliable copy and paste support. |
| 668 |
% \changes{v2.2l}{2021/01/21}{Load glyphtounicode.tex for pdf\TeX} |
| 669 |
% \changes{v2.2m}{2021/02/25}{Improve speed of ToUnicode everyjob loading code} |
| 670 |
% |
| 671 |
% \begin{macrocode} |
| 672 |
%</2ekernel> |
| 673 |
%<*2ekernel|latexrelease> |
| 674 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 675 |
%<latexrelease> {\pdfgentounicode}{Preload glyphtounicode}% |
| 676 |
\ifx \pdfgentounicode \@undefined \else |
| 677 |
%<*2ekernel> |
| 678 |
\ifnum 0=0% |
| 679 |
\ifdefined\pdftexversion |
| 680 |
% \pdftexversion<140 does not have \pdfgentounicode, so we only check higher values |
| 681 |
\ifnum \pdftexversion=140 \ifnum\pdftexrevision<22 1\fi\fi |
| 682 |
\fi |
| 683 |
\relax |
| 684 |
%</2ekernel> |
| 685 |
\input glyphtounicode |
| 686 |
%<*2ekernel> |
| 687 |
\else |
| 688 |
\begingroup |
| 689 |
\everyeof{\noexpand}\endlinechar-1 |
| 690 |
\edef\x{\endgroup |
| 691 |
\everyjob{\the\everyjob\@@input glyphtounicode }% |
| 692 |
}\x |
| 693 |
\fi |
| 694 |
%</2ekernel> |
| 695 |
\pdfgentounicode=1 |
| 696 |
\fi |
| 697 |
%</2ekernel|latexrelease> |
| 698 |
%<latexrelease>\EndIncludeInRelease |
| 699 |
% \end{macrocode} |
| 700 |
% When rolling back we can't unload the glyphtounicode mappings, but we |
| 701 |
% can reset |\pdfgentounicode| to ensure that they aren't used. |
| 702 |
% \begin{macrocode} |
| 703 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 704 |
%<latexrelease> {\pdfgentounicode}{Preload glyphtounicode}% |
| 705 |
%<latexrelease>\ifx \pdfgentounicode \@undefined \else |
| 706 |
%<latexrelease> \pdfgentounicode=0 |
| 707 |
%<latexrelease>\fi |
| 708 |
%<latexrelease>\EndIncludeInRelease |
| 709 |
%<*2ekernel> |
| 710 |
% \end{macrocode} |
| 711 |
% |
| 712 |
% \subsection{Input encoding} |
| 713 |
% |
| 714 |
% \changes{v2.1a}{2018/03/25}{default to UTF-8} |
| 715 |
% Starting with the 2018 \LaTeX\ release default the inputencoding |
| 716 |
% to UTF-8. Unless the format is being used with luatex, xetex, enctex or mltex. |
| 717 |
% |
| 718 |
% This is done in a way largely compatible with older releases: |utf8.def| is input just as if\\ |
| 719 |
% |\usepackage[utf8]{inputenc}|\\ |
| 720 |
% had been used, however rather than input the whole package a minimal core part just enough to support |
| 721 |
% loading the UTF-8 encoding files is defined here. |
| 722 |
% |
| 723 |
% If a document re-specifies UTF-8 this is silently ignored. |
| 724 |
% |
| 725 |
% \begin{macrocode} |
| 726 |
%</2ekernel> |
| 727 |
%<*2ekernel|latexrelease> |
| 728 |
% \end{macrocode} |
| 729 |
% |
| 730 |
% Check that a classic 8-bit tex engine is being used (LaTeX or PDFLaTeX). |
| 731 |
% |
| 732 |
% \begin{macrocode} |
| 733 |
%<latexrelease>\IncludeInRelease{2018/04/01}% |
| 734 |
%<latexrelease> {\UTFviii@invalid}{UTF-8 default}% |
| 735 |
% \end{macrocode} |
| 736 |
% |
| 737 |
% |
| 738 |
% Skip this section in Unicode TeX, or if MLTeX and EncTeX are enabled. |
| 739 |
% \begin{macrocode} |
| 740 |
\ifnum0% |
| 741 |
\ifx\Umathcode\@undefined\else 1\fi |
| 742 |
\ifx\mubyte\@undefined\else 1\fi |
| 743 |
\ifx\charsubdef\@undefined\else 1\fi |
| 744 |
=\z@ |
| 745 |
% \end{macrocode} |
| 746 |
% |
| 747 |
% \begin{macrocode} |
| 748 |
\def\saved@space@catcode{10} |
| 749 |
\let\@inpenc@test\relax |
| 750 |
\def\IeC{% |
| 751 |
\ifx\protect\@typeset@protect |
| 752 |
\expandafter\@firstofone |
| 753 |
\else |
| 754 |
\noexpand\IeC |
| 755 |
\fi |
| 756 |
} |
| 757 |
% \end{macrocode} |
| 758 |
% |
| 759 |
% Make characters active for UTF-8 input formats |
| 760 |
% \begin{macrocode} |
| 761 |
\@tempcnta=1 |
| 762 |
\loop |
| 763 |
\catcode\@tempcnta=13 % |
| 764 |
\advance\@tempcnta\@ne % |
| 765 |
\ifnum\@tempcnta<32 % |
| 766 |
\repeat % |
| 767 |
\catcode0=15 % null |
| 768 |
\catcode9=10 % tab |
| 769 |
\catcode10=12 % ctrl J |
| 770 |
\catcode12=13 % ctrl L |
| 771 |
\catcode13=5 % newline |
| 772 |
\@tempcnta=128 |
| 773 |
\loop |
| 774 |
\catcode\@tempcnta=13 |
| 775 |
\advance\@tempcnta\@ne |
| 776 |
\ifnum\@tempcnta<256 |
| 777 |
\repeat |
| 778 |
% \end{macrocode} |
| 779 |
% |
| 780 |
% \begin{macro}{\UseRawInputEncoding} |
| 781 |
% \changes{v2.1a}{2018/03/25}{Macro added} |
| 782 |
% Reset 8 bit characters to catcode 12 so the input encoding matches the ``Raw'' |
| 783 |
% font encoding. |
| 784 |
% Useful for special behaviours, or for compatibility with older \LaTeX\ formats. |
| 785 |
% \changes{v2.1b}{2018/04/06}{Undo changes to \cs{DeclareFontEncoding@} and |
| 786 |
% definition of \cs{DeclareUnicodeCharacter}} |
| 787 |
% \changes{v2.1c}{2018/04/07}{Undefine \cs{inputencodingname}} |
| 788 |
% \begin{macrocode} |
| 789 |
\def\UseRawInputEncoding{% |
| 790 |
\let\inputencodingname\@undefined % revert |
| 791 |
\let\DeclareFontEncoding@\DeclareFontEncoding@saved % revert |
| 792 |
\let\DeclareUnicodeCharacter\@undefined % revert |
| 793 |
\@tempcnta=1 |
| 794 |
\loop |
| 795 |
\catcode\@tempcnta=15 % |
| 796 |
\advance\@tempcnta\@ne % |
| 797 |
\ifnum\@tempcnta<32 % |
| 798 |
\repeat % |
| 799 |
\catcode0=15 % null |
| 800 |
\catcode9=10 % tab |
| 801 |
\catcode10=12 % ctrl J |
| 802 |
\catcode12=13 % ctrl L |
| 803 |
\catcode13=5 % newline |
| 804 |
\@tempcnta=128 |
| 805 |
\loop |
| 806 |
\catcode\@tempcnta=12 |
| 807 |
\advance\@tempcnta\@ne |
| 808 |
\ifnum\@tempcnta<256 |
| 809 |
\repeat |
| 810 |
} |
| 811 |
% \end{macrocode} |
| 812 |
% \end{macro} |
| 813 |
% |
| 814 |
% \begin{macro}{\DeclareFontEncoding@saved} |
| 815 |
% Saved version of |\DeclareFontEncoding@| before \texttt{utf8.def} |
| 816 |
% modifies it for use in |\UseRawInputEncoding| above. |
| 817 |
% \begin{macrocode} |
| 818 |
\let\DeclareFontEncoding@saved\DeclareFontEncoding@ |
| 819 |
% \end{macrocode} |
| 820 |
% \end{macro} |
| 821 |
% |
| 822 |
% \changes{v2.1d}{2018/04/08}{Delay full UTF-8 handling to \cs{everyjob}} |
| 823 |
% \changes{v2.18}{2018/05/11}{Make invalid UTF-8 also safe, for legacy filesystem encodings} |
| 824 |
% \begin{macrocode} |
| 825 |
\edef\inputencodingname{utf8}% |
| 826 |
\input{utf8.def} |
| 827 |
\let\UTFviii@undefined@err@@\UTFviii@undefined@err |
| 828 |
\let\UTFviii@invalid@err@@\UTFviii@invalid@err |
| 829 |
\let\UTFviii@two@octets@@\UTFviii@two@octets |
| 830 |
\let\UTFviii@three@octets@@\UTFviii@three@octets |
| 831 |
\let\UTFviii@four@octets@@\UTFviii@four@octets |
| 832 |
%<2ekernel>\def\UTFviii@undefined@err#1{\@gobble#1}% |
| 833 |
%<2ekernel>\let\UTFviii@invalid@err\string |
| 834 |
%<2ekernel>\let\UTFviii@two@octets\string |
| 835 |
%<2ekernel>\let\UTFviii@three@octets\string |
| 836 |
%<2ekernel>\let\UTFviii@four@octets\string |
| 837 |
%<2ekernel>\everyjob\expandafter{\the\everyjob |
| 838 |
%<2ekernel>\let\UTFviii@undefined@err\UTFviii@undefined@err@@ |
| 839 |
%<2ekernel>\let\UTFviii@invalid@err\UTFviii@invalid@err@@ |
| 840 |
%<2ekernel>\let\UTFviii@two@octets\UTFviii@two@octets@@ |
| 841 |
%<2ekernel>\let\UTFviii@three@octets\UTFviii@three@octets@@ |
| 842 |
%<2ekernel>\let\UTFviii@four@octets\UTFviii@four@octets@@ |
| 843 |
%<2ekernel>} |
| 844 |
\let\@inpenc@test\@undefined |
| 845 |
\let\saved@space@catcode\@undefined |
| 846 |
% \end{macrocode} |
| 847 |
% |
| 848 |
% For formats not set up for UTF-8 default, set the C0 controls to catcode 15. |
| 849 |
% \begin{macrocode} |
| 850 |
\else |
| 851 |
\@tempcnta=0 |
| 852 |
\loop |
| 853 |
\catcode\@tempcnta=15 % |
| 854 |
\advance\@tempcnta\@ne % |
| 855 |
\ifnum\@tempcnta<32 % |
| 856 |
\repeat % |
| 857 |
\catcode0=15 % null |
| 858 |
\catcode9=10 % tab |
| 859 |
\catcode10=12 % ctrl J |
| 860 |
\catcode12=13 % ctrl L |
| 861 |
\catcode13=5 % newline |
| 862 |
% \end{macrocode} |
| 863 |
% |
| 864 |
% \begin{macrocode} |
| 865 |
\let\UseRawInputEncoding\relax |
| 866 |
% \end{macrocode} |
| 867 |
% |
| 868 |
% This ends the skipped code in Unicode engines: |
| 869 |
% \begin{macrocode} |
| 870 |
\fi |
| 871 |
%</2ekernel|latexrelease> |
| 872 |
%<latexrelease>\EndIncludeInRelease |
| 873 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 874 |
%<latexrelease> {\UTFviii@invalid}{UTF-8 default}% |
| 875 |
% \end{macrocode} |
| 876 |
% |
| 877 |
% The first block of commands got only introduced in 2019 but we |
| 878 |
% revert all of Unicode support in one go not jump to the |
| 879 |
% intermediate version. |
| 880 |
% \begin{macrocode} |
| 881 |
%<latexrelease> \let\UTFviii@two@octets@combine\@undefined |
| 882 |
%<latexrelease> \let\UTFviii@three@octets@combine\@undefined |
| 883 |
%<latexrelease> \let\UTFviii@four@octets@combine\@undefined |
| 884 |
%<latexrelease> \let\UTFviii@two@octets@string\@undefined |
| 885 |
%<latexrelease> \let\UTFviii@three@octets@string\@undefined |
| 886 |
%<latexrelease> \let\UTFviii@four@octets@string\@undefined |
| 887 |
%<latexrelease> \let\UTFviii@two@octets@noexpand\@undefined |
| 888 |
%<latexrelease> \let\UTFviii@three@octets@noexpand\@undefined |
| 889 |
%<latexrelease> \let\UTFviii@four@octets@noexpand\@undefined |
| 890 |
% \end{macrocode} |
| 891 |
% |
| 892 |
% \begin{macrocode} |
| 893 |
%<latexrelease>\@tempcnta=0 |
| 894 |
%<latexrelease>\loop |
| 895 |
%<latexrelease> \catcode\@tempcnta=15 |
| 896 |
%<latexrelease> \advance\@tempcnta\@ne |
| 897 |
%<latexrelease>\ifnum\@tempcnta<32 |
| 898 |
%<latexrelease>\repeat % |
| 899 |
%<latexrelease>\catcode9=10 % tab |
| 900 |
%<latexrelease>\catcode10=12 % ctrl J |
| 901 |
%<latexrelease>\catcode12=13 % ctrl L |
| 902 |
%<latexrelease>\catcode13=5 % newline |
| 903 |
%<latexrelease>\@tempcnta=128 |
| 904 |
%<latexrelease>\loop |
| 905 |
%<latexrelease>\catcode\@tempcnta=12 |
| 906 |
%<latexrelease>\advance\@tempcnta\@ne |
| 907 |
%<latexrelease>\ifnum\@tempcnta<256 |
| 908 |
%<latexrelease>\repeat |
| 909 |
%<latexrelease>\let\IeC\@undefined |
| 910 |
%<latexrelease>\def\DeclareFontEncoding@#1#2#3{% |
| 911 |
%<latexrelease> \expandafter |
| 912 |
%<latexrelease> \ifx\csname T@#1\endcsname\relax |
| 913 |
%<latexrelease> \def\cdp@elt{\noexpand\cdp@elt}% |
| 914 |
%<latexrelease> \xdef\cdp@list{\cdp@list\cdp@elt{#1}% |
| 915 |
%<latexrelease> {\default@family}{\default@series}% |
| 916 |
%<latexrelease> {\default@shape}}% |
| 917 |
%<latexrelease> \expandafter\let\csname#1-cmd\endcsname\@changed@cmd |
| 918 |
%<latexrelease> \else |
| 919 |
%<latexrelease> \@font@info{Redeclaring font encoding #1}% |
| 920 |
%<latexrelease> \fi |
| 921 |
%<latexrelease> \global\@namedef{T@#1}{#2}% |
| 922 |
%<latexrelease> \global\@namedef{M@#1}{\default@M#3}% |
| 923 |
%<latexrelease> \xdef\LastDeclaredEncoding{#1}% |
| 924 |
%<latexrelease> } |
| 925 |
%<latexrelease> \let\UseRawInputEncoding\@undefined |
| 926 |
%<latexrelease> \let\DeclareFontEncoding@saved\@undefined |
| 927 |
%<latexrelease> \let\inputencodingname\@undefined |
| 928 |
%<latexrelease>\EndIncludeInRelease |
| 929 |
% \end{macrocode} |
| 930 |
% |
| 931 |
% \begin{macrocode} |
| 932 |
%<*2ekernel> |
| 933 |
% \end{macrocode} |
| 934 |
% |
| 935 |
% We temporarily define |\reserved@a| to apply |\reserved@c| to all the |
| 936 |
% numbers in the range of its arguments. |
| 937 |
% \begin{macrocode} |
| 938 |
\def\reserved@a#1#2{% |
| 939 |
\@tempcnta#1\relax |
| 940 |
\@tempcntb#2\relax |
| 941 |
\reserved@b |
| 942 |
} |
| 943 |
\def\reserved@b{% |
| 944 |
\ifnum\@tempcnta>\@tempcntb\else |
| 945 |
\reserved@c\@tempcnta |
| 946 |
\advance\@tempcnta\@ne |
| 947 |
\expandafter\reserved@b |
| 948 |
\fi |
| 949 |
} |
| 950 |
% \end{macrocode} |
| 951 |
% \changes{v0.1e}{1994/05/02}{Added setting the special catcodes.} |
| 952 |
% \changes{v0.1f}{1994/05/02}{Set the catcode of control-J.} |
| 953 |
% Set the special catcodes (although some of these are useless, since an |
| 954 |
% error will have occurred if the catcodes have changed). Note that |
| 955 |
% |^^J| has catcode `other' for use in warning messages. |
| 956 |
% \begin{macrocode} |
| 957 |
\catcode`\ =10 |
| 958 |
\catcode`\#=6 |
| 959 |
\catcode`\$=3 |
| 960 |
\catcode`\%=14 |
| 961 |
\catcode`\&=4 |
| 962 |
\catcode`\\=0 |
| 963 |
\catcode`\^=7 |
| 964 |
\catcode`\_=8 |
| 965 |
\catcode`\{=1 |
| 966 |
\catcode`\}=2 |
| 967 |
\catcode`\~=13 |
| 968 |
\catcode`\@=11 |
| 969 |
\catcode`\^^I=10 |
| 970 |
\catcode`\^^J=12 |
| 971 |
\catcode`\^^L=13 |
| 972 |
\catcode`\^^M=5 |
| 973 |
% \end{macrocode} |
| 974 |
% \changes{v0.1e}{1994/05/02}{Added setting the `other' catcodes.} |
| 975 |
% Set the `other' catcodes. |
| 976 |
% \begin{macrocode} |
| 977 |
\def\reserved@c#1{\catcode#1=12\relax} |
| 978 |
\reserved@c{`\!} |
| 979 |
\reserved@c{`\"} |
| 980 |
\reserved@a{`\'}{`\?} |
| 981 |
\reserved@c{`\[} |
| 982 |
\reserved@c{`\]} |
| 983 |
\reserved@c{`\`} |
| 984 |
\reserved@c{`\|} |
| 985 |
% \end{macrocode} |
| 986 |
% \changes{v0.1e}{1994/05/02}{Added setting the `letter' catcodes.} |
| 987 |
% Set the `letter' catcodes. |
| 988 |
% \begin{macrocode} |
| 989 |
\def\reserved@c#1{\catcode#1=11\relax} |
| 990 |
\reserved@a{`\A}{`\Z} |
| 991 |
\reserved@a{`\a}{`\z} |
| 992 |
% \end{macrocode} |
| 993 |
% \changes{v0.1e}{1994/05/02}{Made slot 127 illegal} |
| 994 |
% \changes{v1.0n}{1994/11/18} |
| 995 |
% {re-allow slots 127--255} |
| 996 |
% All the characters in the range 0--31 and 127--255 are illegal, |
| 997 |
% \emph{except} tab (|^^I|), nl (|^^J|), ff (|^^L|) and cr (|^^M|). |
| 998 |
% |
| 999 |
% |
| 1000 |
% \subsection{Lccodes and uccodes} |
| 1001 |
% |
| 1002 |
% \changes{v1.1b}{1998/05/20}{Set up uc/lccodes after loading |
| 1003 |
% hyphenation files: pr/2639} |
| 1004 |
% We now again set up the default (T1) uc/lccodes. |
| 1005 |
% The lower case characters need their |\uccode| and |\lccode| values |
| 1006 |
% set. Some of this is a repeat of the set-up before loading |
| 1007 |
% hyphenation files. |
| 1008 |
% Depending on the \TeX{} version, we might not be allowed to do |
| 1009 |
% this for non-ASCII characters. |
| 1010 |
% \changes{v1.0n}{1994/06/09}{For \TeX2, do not set codes for higher |
| 1011 |
% half of character table.} |
| 1012 |
% \changes{v2.0a}{2015/01/03}{Skip resetting codes with Unicode engines} |
| 1013 |
% For the Unicode engines (Xe\TeX{} and Lua\TeX{}) there is no need to |
| 1014 |
% do any of this: they use hyphenation data which does not alter any |
| 1015 |
% of the set up and so this entire block is skipped. |
| 1016 |
% \begin{macrocode} |
| 1017 |
\ifnum 0% |
| 1018 |
\ifx\Umathcode\@undefined\else 1\fi |
| 1019 |
\ifx\XeTeXmathcode\@undefined\else 1\fi |
| 1020 |
>\z@ |
| 1021 |
\else |
| 1022 |
\def\reserved@c#1{% |
| 1023 |
\count@=#1\advance\count@ by -"20 |
| 1024 |
\uccode#1=\count@ |
| 1025 |
\lccode#1=#1 |
| 1026 |
} |
| 1027 |
\reserved@a{`\a}{`\z} |
| 1028 |
\reserved@a{"A0}{"BC} |
| 1029 |
\reserved@a{"E0}{"FF} |
| 1030 |
% \end{macrocode} |
| 1031 |
% The upper case characters need their |\uccode| and |\lccode| values |
| 1032 |
% set, and their |\sfcode| set to 999. |
| 1033 |
% \begin{macrocode} |
| 1034 |
\def\reserved@c#1{% |
| 1035 |
\count@=#1\advance\count@ by "20 |
| 1036 |
\uccode#1=#1 |
| 1037 |
\lccode#1=\count@ |
| 1038 |
\sfcode#1=999 |
| 1039 |
} |
| 1040 |
\reserved@a{`\A}{`\Z} |
| 1041 |
\reserved@a{"80}{"9C} |
| 1042 |
\reserved@a{"C0}{"DF} |
| 1043 |
% \end{macrocode} |
| 1044 |
% Well, it would be nice if that were correct, but unfortunately, the |
| 1045 |
% Cork encoding contains some odd slots whose uccode or lccode isn't |
| 1046 |
% quite what you'd expect. |
| 1047 |
% \begin{macrocode} |
| 1048 |
\uccode`\^^Y=`\I % dotless i |
| 1049 |
\lccode`\^^Y=`\^^Y % dotless i |
| 1050 |
\uccode`\^^Z=`\J % dotless j, ae in OT1 |
| 1051 |
\lccode`\^^Z=`\^^Z % dotless j, ae in OT1 |
| 1052 |
\lccode`\^^9d=`\i % dotted I |
| 1053 |
\uccode`\^^9d=`\^^9d % dotted I |
| 1054 |
\lccode`\^^9e=`\^^9e % d-bar |
| 1055 |
\uccode`\^^9e=`\^^d0 % d-bar |
| 1056 |
% \end{macrocode} |
| 1057 |
% Finally here is one that helps hyphenation in the OT1 encoding. |
| 1058 |
% \changes{v1.0z}{1996/10/31} |
| 1059 |
% {Added extra \cs{lcode}, hoping it does no harm in T1 (pr/1969)} |
| 1060 |
% \begin{macrocode} |
| 1061 |
\lccode`\^^[=`\^^[ % oe in OT1 |
| 1062 |
\fi % End of reset block for 8-bit engines |
| 1063 |
% \end{macrocode} |
| 1064 |
% |
| 1065 |
% \begin{macro}{\BCPdata} |
| 1066 |
% \changes{v2.3a}{2023/04/16}{Command added} |
| 1067 |
% A stub for use by \pkg{babel}, \pkg{polyglossia}, etc. |
| 1068 |
% \begin{macrocode} |
| 1069 |
\ExplSyntaxOn |
| 1070 |
\newcommand*\BCPdata[1]{ |
| 1071 |
\str_case:nn {#1} |
| 1072 |
{ |
| 1073 |
{ language } { en } |
| 1074 |
{ region } { US } |
| 1075 |
{ script } { Latn } |
| 1076 |
{ tag } { en-US } |
| 1077 |
} |
| 1078 |
} |
| 1079 |
\ExplSyntaxOff |
| 1080 |
% \end{macrocode} |
| 1081 |
% \end{macro} |
| 1082 |
% |
| 1083 |
% \subsection{Case changing} |
| 1084 |
% |
| 1085 |
% \begin{macro}{\MakeUppercase} |
| 1086 |
% \begin{macro}{\MakeLowercase} |
| 1087 |
% \begin{macro}{\MakeTitlecase} |
| 1088 |
% \begin{macro}{\NoCaseChange} |
| 1089 |
% \begin{macro}{\AddToNoCaseChangeList} |
| 1090 |
% \begin{macro}{\CaseSwitch} |
| 1091 |
% \begin{macro}{\DeclareCaseChangeEquivalent} |
| 1092 |
% \begin{macro}{\DeclareLowercaseMapping} |
| 1093 |
% \begin{macro}{\DeclareTitlecaseMapping} |
| 1094 |
% \begin{macro}{\DeclareUppercaseMapping} |
| 1095 |
% \begin{macro}{\DeclareLowercaseExclusions} |
| 1096 |
% \begin{macro}{\DeclareTitlecaseExclusions} |
| 1097 |
% \begin{macro}{\DeclareUppercaseExclusions} |
| 1098 |
% \begin{macro}{\@uclclist} |
| 1099 |
% |
| 1100 |
% |
| 1101 |
% \changes{v1.1a}{1997/10/20}{Removed \cs{aa} and \cs{AA} from |
| 1102 |
% \cs{@uclclist} as these are macros.} |
| 1103 |
% \changes{v2.2r}{2022/02/20}{use \cs{text_lowercase:n}}% |
| 1104 |
% And whilst we're doing things with uc/lc tables, here are two |
| 1105 |
% commands to upper- and lower-case a string. |
| 1106 |
% |
| 1107 |
% |
| 1108 |
% \changes{v2.1h}{2019/09/14}{Expand UTF8 chars when case changing (github/177)} |
| 1109 |
% \changes{v2.2r}{2022/02/20} |
| 1110 |
% {Use \cs{@expl@text@uppercase@@n}, removing local redefinition of \cs{UTF@two@octets@noexpand}}% |
| 1111 |
% \changes{v2.2t}{2022/04/21}{Support \cs{noexpand} in argument of \cs{@expl@text@uppercase@@n}} |
| 1112 |
% \changes{v2.2v}{2022/06/30}{Just use \cs{text_lowercase:n} without \cs{protectd@edf} gh/881x}% |
| 1113 |
% \changes{v2.2w}{2022/07/04}{Introduced \cs{CaseSwitch}, \cs{DeclareCaseChangeEquivalent} and \cs{MakeTitlecase} to support hooking into case changing gh/889}% |
| 1114 |
% \changes{v2.2x}{2022/10/26}{Introduce optional argument for case-changing commands} |
| 1115 |
% \changes{v2.2x}{2022/10/26}{Make case changing commands language-aware} |
| 1116 |
% \changes{v2.2x}{2022/10/26}{Auto-detect \pkg{babel} locale} |
| 1117 |
% \changes{v2.3a}{2023/04/11}{Use new generic mechanism to detect locale} |
| 1118 |
% \changes{v2.3d}{2024/11/12}{Use updated titlecase-first function in \pkg{expl3}} |
| 1119 |
% \changes{v2.3d}{2024/11/12}{Add option to titlecase first or all words} |
| 1120 |
% \changes{v2.3f}{2025/06/04}{Add default for titlecasing} |
| 1121 |
% Wrappers around the L3 case changing functions. |
| 1122 |
% |\protected| to make them mostly safe as replacements for |uppercase| |
| 1123 |
% and |\lowercase|. |
| 1124 |
% |
| 1125 |
% In |
| 1126 |
%\begin{verbatim} |
| 1127 |
% \markboth{\MakeUppercase\contentsname} |
| 1128 |
% {\MakeUppercase\contentsname} |
| 1129 |
%\end{verbatim} |
| 1130 |
% then the uppercasing is only done to the first letter of the |
| 1131 |
% contents name, since the mark expands out to: |
| 1132 |
%\begin{verbatim} |
| 1133 |
% \mark{\MakeUppercase Table of Contents} |
| 1134 |
% {\MakeUppercase Table of Contents} |
| 1135 |
%\end{verbatim} |
| 1136 |
% In order to get round this, we redefine |\MakeUppercase| and |
| 1137 |
% |\MakeLowercase| to grab their argument and brace it. |
| 1138 |
% |
| 1139 |
% Earlier versions needed to process |\@uclclist| in an |\edef| |
| 1140 |
% to handle legacy input encodings, but recent (2022) expl3 versions |
| 1141 |
% handle non-UTF8 text natively so we simply call the |\text_...case:n| |
| 1142 |
% functions. |
| 1143 |
% \begin{macrocode} |
| 1144 |
\ExplSyntaxOn |
| 1145 |
\keys_define:nn { __kernel } |
| 1146 |
{ |
| 1147 |
lang .str_set:N = \reserved@a , |
| 1148 |
locale .str_set:N = \reserved@a , |
| 1149 |
words .choices:nn = |
| 1150 |
{ all , first } |
| 1151 |
{ \str_set:Nn \reserved@b {#1} } |
| 1152 |
} |
| 1153 |
\cs_new_protected:Npn \@@text@case@aux #1#2#3 |
| 1154 |
{ |
| 1155 |
\cs_set_nopar:Npn \reserved@a { } |
| 1156 |
\cs_set_nopar:Npn \reserved@b { first } |
| 1157 |
\tl_if_blank:nTF {#2} |
| 1158 |
{ |
| 1159 |
\str_set:Nx \reserved@a |
| 1160 |
{ \BCPdata { casing } } |
| 1161 |
\str_if_empty:NT \reserved@a |
| 1162 |
{ |
| 1163 |
\str_set:Nx \reserved@a |
| 1164 |
{ \BCPdata { language } } |
| 1165 |
} |
| 1166 |
} |
| 1167 |
{ \keys_set:nn { __kernel } {#2} } |
| 1168 |
\use:c { text_ #1 :Vn } \reserved@a {#3} |
| 1169 |
} |
| 1170 |
% \end{macrocode} |
| 1171 |
% The odd use of \emph{three} spaces here is needed as \pkg{ltcmd} uses the |
| 1172 |
% name with one and two spaces to give a `friendly' error message for a runaway |
| 1173 |
% argument: that means we can't use it here. |
| 1174 |
% \begin{macrocode} |
| 1175 |
\exp_args_generate:n { cnx } |
| 1176 |
\cs_set_protected:Npn \reserved@a #1 |
| 1177 |
{ |
| 1178 |
\cs_generate_variant:cn { text_ \str_lowercase:n {#1} case:nn } { V } |
| 1179 |
\ExpandArgs { cnx } \NewExpandableDocumentCommand |
| 1180 |
{ Make#1case } |
| 1181 |
{ O{} +m } |
| 1182 |
{ \exp_not:c { Make#1case \c_space_tl \c_space_tl \c_space_tl } [####1] {####2} } |
| 1183 |
} |
| 1184 |
\reserved@a { Upper } |
| 1185 |
\reserved@a { Lower } |
| 1186 |
\reserved@a { Title } |
| 1187 |
% \end{macrocode} |
| 1188 |
% These don't get covered above so we do them manually. |
| 1189 |
% \begin{macrocode} |
| 1190 |
\cs_generate_variant:Nn \text_titlecase_all:nn { V } |
| 1191 |
\cs_generate_variant:Nn \text_titlecase_first:nn { V } |
| 1192 |
% \end{macrocode} |
| 1193 |
% \changes{v2.2y}{2022/11/30}{Set \cs{oe}/\cs{OE} equal to act as a marker for \pkg{babel}} |
| 1194 |
% \changes{v2.2z}{2023/03/28}{Use groups for gh/1021} |
| 1195 |
% Currently, \pkg{babel} uses the equivalence of \cs{oe} and \cs{OE} to force casing of |
| 1196 |
% some material, most notably in \cs{today}. To enable that to work, we have to set those |
| 1197 |
% commands equal even though the current case changing code does not work using this |
| 1198 |
% approach. |
| 1199 |
% \begin{macrocode} |
| 1200 |
\cs_new_protected:cpn { MakeLowercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2 |
| 1201 |
{{ |
| 1202 |
\let \OE \oe |
| 1203 |
\@@text@case@aux { lowercase } {#1} {#2} |
| 1204 |
}} |
| 1205 |
\cs_new_protected:cpn { MakeUppercase \c_space_tl \c_space_tl \c_space_tl } [#1] #2 |
| 1206 |
{{ |
| 1207 |
\let \oe \OE |
| 1208 |
\@@text@case@aux { uppercase } {#1} {#2} |
| 1209 |
}} |
| 1210 |
\cs_new_protected:cpn { MakeTitlecase \c_space_tl \c_space_tl \c_space_tl } [#1] #2 |
| 1211 |
{{ |
| 1212 |
\let \oe \OE |
| 1213 |
\@@text@case@aux { titlecase_ \reserved@b } {#1} {#2} |
| 1214 |
}} |
| 1215 |
% \end{macrocode} |
| 1216 |
% |
| 1217 |
% \changes{v2.2u}{2022/06/02}{Add \cs{NoCaseChange}} |
| 1218 |
% \changes{v2.2u}{2022/06/30}{Add \cs{AddToNoCaseChangeList}} |
| 1219 |
% \changes{v2.3b}{2023/04/19}{Add \cs{DeclareLowercaseMapping}, |
| 1220 |
% \cs{DeclareTitlecaseMapping} and \cs{DeclareUppercaseMapping}} |
| 1221 |
% \changes{v2.3c}{2023/05/30}{Fix a typo in implementation of |
| 1222 |
% \cs{DeclareLowercaseMapping}, etc.} |
| 1223 |
% |\NoCaseChange| protects its argument from the case change functions. |
| 1224 |
% |
| 1225 |
% |\AddToNoCaseChangeList| Allows new commands to protect their arguments, eg |
| 1226 |
% |AddToNoCaseChangeList{\eqref}| would protect the argument of |\eqref| |
| 1227 |
% in the same way as the argument of |\ref|. |
| 1228 |
% \begin{macrocode} |
| 1229 |
\cs_new_protected_nopar:Npn\AddToNoCaseChangeList |
| 1230 |
{\tl_put_right:Nn \l_text_case_exclude_arg_tl} |
| 1231 |
\AddToNoCaseChangeList{ \NoCaseChange } |
| 1232 |
\cs_new_protected:Npn \NoCaseChange #1 {#1} |
| 1233 |
\cs_new_eq:NN \CaseSwitch \text_case_switch:nnnn |
| 1234 |
\cs_new_eq:NN \DeclareCaseChangeEquivalent |
| 1235 |
\text_declare_case_equivalent:Nn |
| 1236 |
\NewDocumentCommand \DeclareLowercaseMapping { o m m } |
| 1237 |
{ |
| 1238 |
\IfNoValueTF {#1} |
| 1239 |
{ \text_declare_lowercase_mapping:nn } |
| 1240 |
{ \text_declare_lowercase_mapping:nnn {#1} } |
| 1241 |
{#2} {#3} |
| 1242 |
} |
| 1243 |
\NewDocumentCommand \DeclareTitlecaseMapping { o m m } |
| 1244 |
{ |
| 1245 |
\IfNoValueTF {#1} |
| 1246 |
{ \text_declare_titlecase_mapping:nn } |
| 1247 |
{ \text_declare_titlecase_mapping:nnn {#1} } |
| 1248 |
{#2} {#3} |
| 1249 |
} |
| 1250 |
\NewDocumentCommand \DeclareUppercaseMapping { o m m } |
| 1251 |
{ |
| 1252 |
\IfNoValueTF {#1} |
| 1253 |
{ \text_declare_uppercase_mapping:nn } |
| 1254 |
{ \text_declare_uppercase_mapping:nnn {#1} } |
| 1255 |
{#2} {#3} |
| 1256 |
} |
| 1257 |
% \end{macrocode} |
| 1258 |
% |
| 1259 |
% \changes{v2.3g}{2025-07-01}{Add \cs{DeclareLowercaseExclusions}, |
| 1260 |
% \cs{DeclareTitlecaseExclusions} and \cs{DeclareUppercaseExclusions}} |
| 1261 |
% \begin{macrocode} |
| 1262 |
\cs_new_protected:Npn \DeclareLowercaseExclusions #1 |
| 1263 |
{ |
| 1264 |
\clist_map_inline:nn {#1} |
| 1265 |
{ \text_declare_lowercase_exclusion:n {##1} } |
| 1266 |
} |
| 1267 |
\cs_new_protected:Npn \DeclareTitlecaseExclusions #1 |
| 1268 |
{ |
| 1269 |
\clist_map_inline:nn {#1} |
| 1270 |
{ \text_declare_titlecase_exclusion:n {##1} } |
| 1271 |
} |
| 1272 |
\cs_new_protected:Npn \DeclareUppercaseExclusions #1 |
| 1273 |
{ |
| 1274 |
\clist_map_inline:nn {#1} |
| 1275 |
{ \text_declare_uppercase_exclusion:n {##1} } |
| 1276 |
} |
| 1277 |
\ExplSyntaxOff |
| 1278 |
% \end{macrocode} |
| 1279 |
% |
| 1280 |
% \changes{v2.2q}{2021/09/06}{Correctly upper and lowercase |
| 1281 |
% \cs{ij} and \cs{IJ} (gh/658)} |
| 1282 |
% \begin{macrocode} |
| 1283 |
\def\@uclclist{\oe\OE\o\O\ae\AE |
| 1284 |
\dh\DH\dj\DJ\l\L\ng\NG\ss\SS\ij\IJ\th\TH} |
| 1285 |
% \end{macrocode} |
| 1286 |
% |
| 1287 |
% \end{macro} |
| 1288 |
% \end{macro} |
| 1289 |
% \end{macro} |
| 1290 |
% \end{macro} |
| 1291 |
% \end{macro} |
| 1292 |
% \end{macro} |
| 1293 |
% \end{macro} |
| 1294 |
% \end{macro} |
| 1295 |
% \end{macro} |
| 1296 |
% \end{macro} |
| 1297 |
% \end{macro} |
| 1298 |
% \end{macro} |
| 1299 |
% \end{macro} |
| 1300 |
% \end{macro} |
| 1301 |
% |
| 1302 |
% \changes{v1.0h}{1994/05/13}{Added output enc stuff} |
| 1303 |
% \changes{v1.0i}{1994/05/16}{moved output enc stuff to lfonts} |
| 1304 |
% |
| 1305 |
% \changes{v0.1a}{1994/03/07}{Add code from the old dump.dtx} |
| 1306 |
% |
| 1307 |
% \subsection{Automatic insertion of \cs{par} tokens} |
| 1308 |
% \changes{v2.3h}{2025/09/23}{Setting \cs{partokencontext}} |
| 1309 |
% Since 2022 the major \TeX\ engines have a parameter, \cs{partokencontext}, |
| 1310 |
% that controls whether a \cs{par} token is added if \TeX\ is in horizontal mode |
| 1311 |
% at the end of \cs{vbox} and similar contexts. This gives more control |
| 1312 |
% than the classical behaviour where the internal \textit{end paragraph} routine |
| 1313 |
% is invoked with no explicit token being added. |
| 1314 |
% |
| 1315 |
% Setting \cs{partokencontext} to 2 ensures a literal \cs{par} is |
| 1316 |
% used in all contexts, setting to 0 reverts to the classic \TeX\ behavior. |
| 1317 |
% \begin{macrocode} |
| 1318 |
%</2ekernel> |
| 1319 |
%<*2ekernel|latexrelease> |
| 1320 |
%<latexrelease>\IncludeInRelease{2025/11/01}% |
| 1321 |
%<latexrelease> {\partokencontext}{automatic par insertion}% |
| 1322 |
\ifdefined\partokencontext\partokencontext=\tw@\fi |
| 1323 |
%</2ekernel|latexrelease> |
| 1324 |
%<latexrelease>\EndIncludeInRelease |
| 1325 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1326 |
%<latexrelease> {\partokencontext}{automatic par insertion}% |
| 1327 |
%<latexrelease>\ifdefined\partokencontext\partokencontext=\z@\fi |
| 1328 |
%<latexrelease>\EndIncludeInRelease |
| 1329 |
%<*2ekernel> |
| 1330 |
% \end{macrocode} |
| 1331 |
% |
| 1332 |
% \subsection{Applying Patch files} |
| 1333 |
% Between major releases, small patches will be distributed in |
| 1334 |
% files |ltpatch.ltx| which must be added at this point. |
| 1335 |
% \changes{v1.0m}{1994/06/08}{Add patch file system} |
| 1336 |
% \changes{v2.0h}{2015/06/23} |
| 1337 |
% {set \cs{patch@level} in ltvers rather than in ltfinal/ltpatch} |
| 1338 |
% |
| 1339 |
% Patch file code removed. |
| 1340 |
% \begin{macrocode} |
| 1341 |
%\IfFileExists{ltpatch.ltx} |
| 1342 |
% {\typeout{=================================^^J% |
| 1343 |
% Applying patch file ltpatch.ltx^^J% |
| 1344 |
% =================================} |
| 1345 |
% \def\fmtversion@topatch{unknown} |
| 1346 |
% \input{ltpatch.ltx} |
| 1347 |
% \ifx\fmtversion\fmtversion@topatch |
| 1348 |
% \ifx\patch@level\@undefined |
| 1349 |
% \typeout{^^J^^J^^J% |
| 1350 |
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J% |
| 1351 |
% !! Patch file `ltpatch.ltx' not suitable for this^^J% |
| 1352 |
% !! version of LaTeX.^^J^^J% |
| 1353 |
% !! Please check if initex found an old patch file:^^J% |
| 1354 |
% !! --- if so, rename it or delete it, and redo the^^J% |
| 1355 |
% !! initex run.^^J% |
| 1356 |
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}% |
| 1357 |
% \batchmode \@@end |
| 1358 |
% \else |
| 1359 |
% \end{macrocode} |
| 1360 |
% \changes{v1.0q}{1995/04/21} |
| 1361 |
% {Allow initial patch level 0} |
| 1362 |
% \changes{v1.0t}{1995/06/13} |
| 1363 |
% {Add patch level string more carefully} |
| 1364 |
% The code below adds the `patch level' string to the first |\typeout| |
| 1365 |
% in the startup banner. |
| 1366 |
% \begin{macrocode} |
| 1367 |
% \def\fmtversion@topatch{0}% |
| 1368 |
% \ifx\fmtversion@topatch\patch@level\else |
| 1369 |
% \def\reserved@a\typeout##1##2\reserved@a{% |
| 1370 |
% \typeout{##1 patch level \patch@level}##2} |
| 1371 |
% \everyjob\expandafter\expandafter\expandafter{% |
| 1372 |
% \expandafter\reserved@a\the\everyjob\reserved@a} |
| 1373 |
% \let\reserved@a\relax |
| 1374 |
% \the\everyjob |
| 1375 |
% \fi |
| 1376 |
% \fi |
| 1377 |
% \else |
| 1378 |
% \typeout{^^J^^J^^J% |
| 1379 |
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J% |
| 1380 |
% !! Patch file `ltpatch.ltx' (for version <\fmtversion@topatch>)^^J% |
| 1381 |
% !! is not suitable for version <\fmtversion> of LaTeX.^^J^^J% |
| 1382 |
% !! Please check if initex found an old patch file:^^J% |
| 1383 |
% !! --- if so, rename it or delete it, and redo the^^J% |
| 1384 |
% !! initex run.^^J% |
| 1385 |
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}% |
| 1386 |
% \batchmode \@@end |
| 1387 |
% \fi |
| 1388 |
% \let\fmtversion@topatch\relax |
| 1389 |
% }{} |
| 1390 |
% \end{macrocode} |
| 1391 |
% |
| 1392 |
% \changes{v2.2}{2019-10-02}{Load \textsf{ltexpl}} |
| 1393 |
% \changes{v2.2a}{2020-06-04}{Load \textsf{ltexpl} in \texttt{ltdefns}} |
| 1394 |
% |
| 1395 |
% \subsection{Freeing Memory} |
| 1396 |
% |
| 1397 |
% \begin{macro}{\reserved@a} |
| 1398 |
% \begin{macro}{\reserved@b} |
| 1399 |
% \changes{v1.0v}{1995/10/17}{reset here after the \cs{input} above} |
| 1400 |
% And just to make sure nobody relies on those definitions of |
| 1401 |
% |\reserved@b| and friends. |
| 1402 |
% These macros are reserved for use in the kernel. \emph{Do not use |
| 1403 |
% them as general scratch macros}. |
| 1404 |
% \begin{macrocode} |
| 1405 |
\let\reserved@a\@filelist |
| 1406 |
\let\reserved@b=\@undefined |
| 1407 |
\let\reserved@c=\@undefined |
| 1408 |
\let\reserved@d=\@undefined |
| 1409 |
\let\reserved@e=\@undefined |
| 1410 |
\let\reserved@f=\@undefined |
| 1411 |
% \end{macrocode} |
| 1412 |
% \end{macro} |
| 1413 |
% \end{macro} |
| 1414 |
% |
| 1415 |
% \begin{macro}{\toks} |
| 1416 |
% \changes{v1.0y}{1996/07/10} |
| 1417 |
% {Free up memory from scratch registers /2213} |
| 1418 |
% \begin{macrocode} |
| 1419 |
\toks0{} |
| 1420 |
\toks2{} |
| 1421 |
\toks4{} |
| 1422 |
\toks6{} |
| 1423 |
\toks8{} |
| 1424 |
% \end{macrocode} |
| 1425 |
% \end{macro} |
| 1426 |
% |
| 1427 |
% \begin{macro}{\errhelp} |
| 1428 |
% \changes{v0.1g}{1994/05/05}{Set error help empty.} |
| 1429 |
% \changes{v1.1d}{2000/09/01}{Set error help empty at very end |
| 1430 |
% (pr/449 done correctly).} |
| 1431 |
% Empty the error help message, which may have some rubbish: |
| 1432 |
% \begin{macrocode} |
| 1433 |
\errhelp{} |
| 1434 |
% \end{macrocode} |
| 1435 |
% \end{macro} |
| 1436 |
% |
| 1437 |
% \subsection{Initialise file list} |
| 1438 |
% |
| 1439 |
% \begin{macro}{\@providesfile} |
| 1440 |
% \changes{v1.0v}{1995/10/17}{reset macro} |
| 1441 |
% Initialise for use in the document. During initex a modified version |
| 1442 |
% has been used which leaves debugging information for |latexbug.tex|. |
| 1443 |
% \begin{macrocode} |
| 1444 |
\def\@providesfile#1[#2]{% |
| 1445 |
\wlog{File: #1 #2}% |
| 1446 |
\expandafter\xdef\csname ver@#1\endcsname{#2}% |
| 1447 |
\endgroup} |
| 1448 |
% \end{macrocode} |
| 1449 |
% \end{macro} |
| 1450 |
% |
| 1451 |
% \begin{macro}{\@filelist} |
| 1452 |
% \changes{v1.0w}{1995/10/19}{Move after \cs{reserved@a} setting} |
| 1453 |
% \begin{macro}{\@addtofilelist} |
| 1454 |
% Reset |\@filelist| so files input while making the format are not |
| 1455 |
% listed. The list built up so far may take up a lot of memory and so |
| 1456 |
% it is moved to |\reserved@a| where it will be overwritten as soon |
| 1457 |
% as almost any \LaTeX\ command is issued in a class file. |
| 1458 |
% However the |latexbug.tex| program will be able to access this |
| 1459 |
% information and insert it into a bug report. |
| 1460 |
% \begin{macrocode} |
| 1461 |
\let\@filelist\@gobble |
| 1462 |
\def\@addtofilelist#1{\xdef\@filelist{\@filelist,#1}}% |
| 1463 |
% \end{macrocode} |
| 1464 |
% \end{macro} |
| 1465 |
% \end{macro} |
| 1466 |
% |
| 1467 |
% \subsection{Preparation for supporting PDF in backends} |
| 1468 |
% |
| 1469 |
% At the current point in time, basic support for PDF in |
| 1470 |
% backends is not part of \LaTeX{} core; it is provided by external |
| 1471 |
% packages. At some time in the future that work will be placed |
| 1472 |
% into the kernel but for now it is separate and has to be |
| 1473 |
% explicitly loaded in the document. |
| 1474 |
% |
| 1475 |
% In that code there is a command \cs{IfPDFManagementActiveTF} |
| 1476 |
% which can be used by packages in order to execute different |
| 1477 |
% code depending on the whether this basic backend support is loaded. |
| 1478 |
% |
| 1479 |
% To make this also work properly when this external package is not |
| 1480 |
% loaded at all, we here add this command already in the |
| 1481 |
% kernel (with a trivial definition); thus any package can |
| 1482 |
% query this loading state in all circumstances. |
| 1483 |
% Once this basic PDF backend |
| 1484 |
% support gets moved to the kernel, this definition will vanish |
| 1485 |
% again from here or, rather, it will be replaced by a real test. |
| 1486 |
% |
| 1487 |
% \begin{macro}{\IfPDFManagementActiveTF} |
| 1488 |
% So long as the code for the basic backend support for PDF is not |
| 1489 |
% loaded, the test that is implicit here will |
| 1490 |
% always return the false branch. |
| 1491 |
% Once this code is loaded, this definition will get |
| 1492 |
% replaced by a real test (as it is then possible that the |
| 1493 |
% management code is either activated or not activated). |
| 1494 |
% \changes{v2.2p}{2021/08/08}{Default definition added (gh/640)} |
| 1495 |
% \begin{macrocode} |
| 1496 |
\let \IfPDFManagementActiveTF \@secondoftwo |
| 1497 |
% \end{macrocode} |
| 1498 |
% |
| 1499 |
% The T/F variants are defined in a way that they continue to work |
| 1500 |
% when the main definition changes. |
| 1501 |
% \changes{v2.3e}{2025/03/01}{Provide T F variants of |
| 1502 |
% \cs{IfPDFManagementActiveTF} (gh/1522)} |
| 1503 |
% \begin{macrocode} |
| 1504 |
\long\def\IfPDFManagementActiveT#1{\IfPDFManagementActiveTF{#1}{}} |
| 1505 |
\def\IfPDFManagementActiveF{\IfPDFManagementActiveTF{}} |
| 1506 |
% \end{macrocode} |
| 1507 |
% \end{macro} |
| 1508 |
% |
| 1509 |
% |
| 1510 |
% |
| 1511 |
% \subsection{Do some temporary work for pre-release} |
| 1512 |
% |
| 1513 |
% This is a good place to load code that hasn't yet been |
| 1514 |
% integrated into the other files \ldots |
| 1515 |
% \begin{macrocode} |
| 1516 |
% \end{macrocode} |
| 1517 |
% |
| 1518 |
% \subsection{Some last minute initializations \ldots} |
| 1519 |
% |
| 1520 |
% Load the first aid set of definitions for external packages that await updates. |
| 1521 |
% \changes{v2.2j}{2020/09/26} |
| 1522 |
% {Load first aid file if existing} |
| 1523 |
% \begin{macrocode} |
| 1524 |
\@input{latex2e-first-aid-for-external-files.ltx} |
| 1525 |
% \end{macrocode} |
| 1526 |
% |
| 1527 |
% |
| 1528 |
% \subsection{Dumping the format} |
| 1529 |
% Finally we make |@| into a letter, ensure the format will |
| 1530 |
% be in the `normal' error mode, and dump everything into the |
| 1531 |
% format file. |
| 1532 |
% \changes{v1.0t}{1995/06/13} |
| 1533 |
% {Call \cs{errorstopmode}} |
| 1534 |
% \begin{macrocode} |
| 1535 |
\makeatother |
| 1536 |
\errorstopmode |
| 1537 |
\dump |
| 1538 |
%</2ekernel> |
| 1539 |
% \end{macrocode} |
| 1540 |
% |
| 1541 |
% \Finale |
| 1542 |
% |