summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/luatex/luatextra/luatextra.dtx
blob: 6a4ab9bdb871413810d8823b1ae65f4d3f0dc814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
% \iffalse meta-comment
%
% Written in 2009, 2010 by Manuel Pégourié-Gonnard and Élie Roux.
%     <mpg@elzevir.fr>
%     <elie.roux@telecom-bretagne.eu>
%
% This work is under the CC0 license.
%
% This work consists of the main source file luatextra.dtx
% and the derived files
%    luatextra.sty, luatextra.lua, luatextra-latex.tex, luatextra.pdf.
%
% Unpacking:
%    tex luatextra.dtx
% Documentation:
%    pdflatex luatextra.dtx
%
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax

\preamble

Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.

This work is under the CC0 license.
See source file '\inFileName' for details.

\endpreamble

\let\MetaPrefix\DoubleperCent

\generate{%
  \usedir{tex/luatex/luatextra}%
  \file{luatextra.sty}{\from{luatextra.dtx}{package}}%
  \file{luatextra-latex.tex}{\from{luatextra.dtx}{latex}}%
}

\generate{%
  \usedir{doc/luatex/luatextra}%
  \file{test.tex}{\from{luatextra.dtx}{test}}%
}

\def\MetaPrefix{-- }

\def\luapostamble{%
  \MetaPrefix^^J%
  \MetaPrefix\space End of File `\outFileName'.%
}

\def\currentpostamble{\luapostamble}%

\generate{%
  \usedir{tex/luatex/luatextra}%
  \file{luatextra.lua}{\from{luatextra.dtx}{lua}}%%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* files into a directory searched by TeX:}
\Msg{*}
\Msg{*     luatextra.sty luatextra-latex.tex luatextra.lua}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}
\usepackage{metalogo}
\usepackage[bookmarks=true, colorlinks=true]{hyperref}
\usepackage{bookmark}
\usepackage[english]{babel}
\providecommand\eTeX{e\TeX}
\newcommand\pf{\textsf}
\newcommand\file{\texorpdfstring{\nolinkurl}{}}
\newcommand\code{\texttt}
\newcommand*\email[1]{\href{mailto:#1}{#1}}
\begin{document}
  \DocInput{luatextra.dtx}%
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \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
%   Lower-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
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \title{The \textsf{luatextra} package}
% \date{2010/11/08 v0.99}
% \author{%
%   Manuel P\'egouri\'e-Gonnard \email{mpg@elzevir.fr} \\
%   \'Elie Roux \email{elie.roux@telecom-bretagne.eu}}
%
% \maketitle
%
% \begin{abstract}
% The \pf{luatextra} package loads essential and convenient packages for
% \LuaTeX, and provides few additional user-level goodies. It is meant as a
% convenience package for users. Developers should load directly the
% underlying packages they specifically need.
%
% \textbf{Warning.} This package is undergoing major changes, see the
% ``Planned changes'' section on page~\pageref{sec-plan}.
% \end{abstract}
%
% \tableofcontents
%
% \section{Documentation}
%
% The \pf{luatextra} package loads the following essential packages:
% \begin{itemize}
%   \item \pf{luatexbase}: low-level functions for resources handling and
%   compatibility. Divided in sub-packages, like \pf{luatexbase-mcb} (formerly
%   \pf{luamcallbacks}) that allows to register several functions in a
%   callback;
%   \item \pf{lualibs}: additional lua functions (previously \pf{luaextra}) ;
%   \item \pf{luaotfload}: implements extended syntax \emph{à la} \XeTeX\
%   for the \verb+\font+ primitive.
% \end{itemize}
%
% When running \LaTeX\ \pf{luatextra} loads the following additional packages:
% \begin{itemize}
%   \item \pf{metalogo}: provides commands for typesetting the \LuaTeX\
%   and \LuaLaTeX\ logos amongst others;
%   \item \pf{luacode}: provides tools for easy integration of Lua code in
%   \LaTeX;
%   \item \pf{fixltx2e}: fixes bugs or suboptimal things in the \LaTeX\ kernel.
% \end{itemize}
%
% In case you are not yet familiar with the available \LuaLaTeX\ packages, you
% might want to check the document \nolinkurl{lualatex-doc.pdf} from the
% eponymous package.
%
% \subsection{Planned changes} \label{sec-plan}
%
% If, for some reason, you disagree with one of the upcoming changes described
% below, please discuss it on the development list:
% \email{lualatex-dev@tug.org}.
%
% The most major change planned is to make this package compatible with
% \LaTeX\ only. Rationale: it is (or will soon be) only a convenience
% package loading other packages. Users of Plain \TeX\ are assumed not
% to care that much about such convenience. Then, \pf{fontspec} would be
% loaded rather than \pf{luaotfload}.
%
% Note that \pf{luatextra} currently expands on \pf{luatexbase-mcb} by
% proposing solutions for the \verb+define_font+ and \verb+open_read_file+
% callbacks. See the implementation section below for details. In the future,
% this code (only half of which was activated) will be removed, since it seems
% very unlikely that different packages want to (or are able to usefully)
% share these callbacks.  The \code{luatextra} Lua namespace (aka table) will
% then disappear.
%
% All name aliases (for primitives and macro from \pf{luatexbase} and previous
% versions) will be dropped, so as to maintain a the name space clean.  Please
% check section~\ref{rename} for the complete list of what will be dropped.
%
%    \section{Implementation}
%
%    \subsection{Lua module}
%
%    \subsubsection{Initialization and internal functions}
%
%    \begin{macrocode}
%<*lua>
%    \end{macrocode}
%
%    We create the \texttt{luatextra} table that will contain all the
%    functions and variables, and we register it as a normal lua module.
%
%    \begin{macrocode}
module("luatextra", package.seeall)
%    \end{macrocode}
%
%    We initiate the modules table that will contain informations about the
%    loaded modules. And we register the \texttt{luatextra} module. The
%    informations contained in the table describing the module are always the
%    same, it can be taken as a template. See
%    \texttt{luatextra.provides\_module} for more details.
%
%    \begin{macrocode}
luatexbase.provides_module {
    version     = 0.99,
    name        = "luatextra",
    date        = "2010/10/08",
    description = "Additional low level functions for LuaTeX",
    author      = "Elie Roux and Manuel Pegourie-Gonnard",
    copyright   = "Elie Roux, 2009 and Manuel Pegourie-Gonnard, 2010",
    license     = "CC0",
}
local format = string.format
%    \end{macrocode}
%
%    \subsubsection{Multiple callbacks on the \texttt{open\_read\_file}
%    callback\label{sub:orf}}
%
%    |luatexbase| (see documentation for details) cannot really provide a
%    simple and reliable way of registering multiple functions in some
%    callbacks. To be able to do so, the solution we implemented is to
%    register one function in these callbacks, and to create "sub-callbacks"
%    that can accept several functions. That's what we do here for the
%    callback \texttt{open\_read\_file}.
%
%    \begin{macro}{luatextra.open read file}
%
%    This function is the one that will be registered in the callback. It
%    calls new callbacks, that will be created later. These callbacks are:
%
%    \begin{itemize}
%    \item \texttt{pre\_read\_file} in which you can register a function with
%    the signature \texttt{pre\_read\_file(env)}, with \texttt{env} being a
%    table containing the fields \texttt{filename} which is the argument of
%    the callback \texttt{open\_read\_file}, and \texttt{path} which is the
%    result of \texttt{kpse.find\_file}. You can put any field you want in the
%    \texttt{env} table, you can even override the existing fields. This
%    function is called at the very beginning of the callback, it allows for
%    instance to register functions in the other callbacks. It is useless to
%    add a field \texttt{reader} or \texttt{close}, as they will be overriden.
%    \item \texttt{file\_reader} is automatically registered in the
%    \texttt{reader} callback for every file, it has the same signature.
%    \item \texttt{file\_close} is registered in the \texttt{close} callback
%    for every file, and has the same signature.
%    \end{itemize}
%
%    \begin{macrocode}
function luatextra.open_read_file(filename)
    local path = kpse.find_file(filename)
    local env = {
      ['filename'] = filename,
      ['path'] = path,
    }
    luatexbase.call_callback('pre_read_file', env)
    path = env.path
    if not path then
        return
    end
    local f = env.file
    if not f then
        f = io.open(path)
        env.file = f
    end
    if not f then
        return
    end
    env.reader = luatextra.reader
    env.close = luatextra.close
    return env
end
%    \end{macrocode}
%
% \end{macro}
%
%    The two next functions are the one called in the
%    \texttt{open\_read\_file} callback.
%
%    \begin{macrocode}
function luatextra.reader(env)
    local line = (env.file):read()
    line = luatexbase.call_callback('file_reader', env, line)
    return line
end
function luatextra.close(env)
    (env.file):close()
    luatexbase.call_callback('file_close', env)
end
%    \end{macrocode}
%
%    In the callback creation process we need to have default behaviours. Here
%    they are. These are called only when no function is registered in the
%    created callback. See the documentation of \texttt{luatexbase} for
%    more details.
%
%    \begin{macrocode}
function luatextra.default_reader(env, line)
    return line
end
function luatextra.default_close(env)
    return
end
function luatextra.default_pre_read(env)
    return env
end
%    \end{macrocode}
%
%    \subsubsection{Multiple callbacks on the \texttt{define\_font}
%    callback\label{sub:df}}
%
%    The same principle is applied to the \texttt{define\_font} callback. The
%    main difference is that this mechanism is not applied by default. The
%    reason is that the callback most people will register in the
%    \texttt{define\_font} callback is the one from Con\TeX t allowing the use
%    of OT fonts. When the code will be more adapted (not so soon certainly),
%    this mechanism will certainly be used, as it allows more flexibility in
%    the font syntax, the OT font load mechanism, etc.
%
%    The callbacks we register here are the following ones:
%
%    \begin{itemize}
%    \item \texttt{font\_syntax} that takes a table with the fields
%    \texttt{asked\_name}, \texttt{name} and \texttt{size}, and modifies this
%    table to add more information. It must add at least a \texttt{path}
%    field. The structure of the final table is not precisely defined, as it
%    can vary from one syntax to another.
%    \item \texttt{open\_otf\_font} takes the previous table, and must return
%    a valid font structure as described in the Lua\TeX\ manual.
%    \item \texttt{post\_font\_opening} takes the final font table and can
%    modify it, before this table is returned to the \texttt{define\_font}
%    callback.
%    \end{itemize}
%
%    But first, we acknowledge the fact that \texttt{fontforge} has been
%    renamed to \texttt{fontloader}. This check allows older versions of
%    Lua\TeX\ to use \texttt{fontloader}.
%
%    As this mechanism is not loaded by default and certainly won't be until
%    version 1.0 of Lua\TeX , we don't document it further. See the
%    documentation of \texttt{luatextra.sty} (macro
%    \texttt{\string\ltxtra\string@RegisterFontCallback}) to know how to load
%    this mechanism anyway.
%
%    \begin{macrocode}
do
  if tex.luatexversion < 36 then
      fontloader = fontforge
  end
end
function luatextra.find_font(name)
    local types = {'ofm', 'ovf', 'opentype fonts', 'truetype fonts'}
    local path = kpse.find_file(name)
    if path then return path end
    for _,t in pairs(types) do
        path = kpse.find_file(name, t)
        if path then return path end
    end
    return nil
end
function luatextra.font_load_error(error)
    luatextra.module_warning('luatextra', string.format('%s\nloading lmr10 instead...', error))
end
function luatextra.load_default_font(size)
    return font.read_tfm("lmr10", size)
end
function luatextra.define_font(name, size)
    if (size < 0) then size = (- 655.36) * size end
    local fontinfos = {
        asked_name = name,
        name = name,
        size = size
        }
    callback.call('font_syntax', fontinfos)
    name = fontinfos.name
    local path = fontinfos.path
    if not path then
        path = luatextra.find_font(name)
        fontinfos.path = luatextra.find_font(name)
    end
    if not path then
        luatextra.font_load_error("unable to find font "..name)
        return luatextra.load_default_font(size)
    end
    if not fontinfos.filename then
        fontinfos.filename = file.basename(path)
    end
    local ext = file.suffix(path)
    local f
    if ext == 'tfm' or ext == 'ofm' then
        f =  font.read_tfm(name, size)
    elseif ext == 'vf' or ext == 'ovf' then
        f =  font.read_vf(name, size)
    elseif ext == 'ttf' or ext == 'otf' or ext == 'ttc' then
        f = luatexbase.call_callback('open_otf_font', fontinfos)
    else
        luatextra.font_load_error("unable to determine the type of font "..name)
        f = luatextra.load_default_font(size)
    end
    if not f then
        luatextra.font_load_error("unable to load font "..name)
        f = luatextra.load_default_font(size)
    end
    luatexbase.call_callback('post_font_opening', f, fontinfos)
    return f
end
function luatextra.default_font_syntax(fontinfos)
    return
end
function luatextra.default_open_otf(fontinfos)
    return nil
end
function luatextra.default_post_font(f, fontinfos)
    return true
end
function luatextra.register_font_callback()
    luatexbase.add_to_callback('define_font', luatextra.define_font, 'luatextra.define_font')
end
%    \end{macrocode}
%
%    Initialise a few callbacks.
%
%    \begin{macrocode}
    luatexbase.create_callback('pre_read_file', 'simple', luatextra.default_pre_read)
    luatexbase.create_callback('file_reader', 'data', luatextra.default_reader)
    luatexbase.create_callback('file_close', 'simple', luatextra.default_close)
    luatexbase.add_to_callback('open_read_file', luatextra.open_read_file, 'luatextra.open_read_file')
    luatexbase.create_callback('font_syntax', 'simple', luatextra.default_font_syntax)
    luatexbase.create_callback('open_otf_font', 'first', luatextra.default_open_otf)
    luatexbase.create_callback('post_font_opening', 'simple', luatextra.default_post_font)
%    \end{macrocode}
%
%    \begin{macrocode}
%</lua>
%    \end{macrocode}
%
%    \subsection{\TeX\ package}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
%    \subsubsection{Initializations}
%
%    First we prevent multiple loads of the file (useful for plain-\TeX ).
%
%    \begin{macrocode}
\csname ifluatextraloaded\endcsname
\let\ifluatextraloaded\endinput

%    \end{macrocode}
%
%    Then we load \textsf{ifluatex} and identify.
%
%    \begin{macrocode}

\bgroup\expandafter\expandafter\expandafter\egroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
  \expandafter\ifx\csname ifluatex\endcsname\relax
    \input ifluatex.sty
  \fi
\else
  \RequirePackage{ifluatex}
  \NeedsTeXFormat{LaTeX2e}
  \ProvidesPackage{luatextra}
    [2010/10/08 v0.98 LuaTeX extra low-level macros]
\fi

%    \end{macrocode}
%
%    Make sure Lua\TeX\ is being used.
%
%    \begin{macrocode}
\ifluatex\else
  \begingroup
    \expandafter\ifx\csname PackageError\endcsname\relax
      \def\x#1#2#3{\begingroup \newlinechar10
        \errhelp{#3}\errmessage{Package #1 error: #2}\endgroup}
    \else
      \let\x\PackageError
    \fi
  \expandafter\endgroup
  \x{luatextra}{LuaTeX is required for this package. Aborting.}{%
    This package can only be used with the LuaTeX engine^^J%
    (command `lualatex' or `luatex').^^J%
    Package loading has been stopped to prevent additional errors.}
  \expandafter\endinput
\fi
%    \end{macrocode}
%
%    Load packages.
%
%    \begin{macrocode}
\bgroup\expandafter\expandafter\expandafter\egroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
  \input luatexbase.sty
  \input luatexbase-modutils.sty
  \input luatexbase-mcb.sty
  \luatexUseModule{lualibs}
  \input luaotfload.sty
\else
  \RequirePackage{luatexbase}
  \RequirePackage{luatexbase-modutils}
  \RequirePackage{luatexbase-mcb}
  \luatexUseModule{lualibs}
  \RequirePackage{luaotfload}
  %
  \RequirePackage{metalogo}
  \RequirePackage{luacode}
  \RequirePackage{fixltx2e}
\fi
%    \end{macrocode}
%
%    \subsubsection{Primitives and macros renaming}\label{rename}
%
%    \textbf{Warning.} This entire section will be dropped in a future
%    release. Check section~\ref{sec-plan} for what to do if you deperately
%    need it.
%
%    Here we differenciate two very different cases: Lua\TeX\ version < 0.36
%    has no \texttt{tex.enableprimitives} function, and has support for
%    multiple lua states, and for versions > 0.35, the
%    \texttt{tex.enableprimitives} is provided, and the old
%    \texttt{\string\directlua} syntax prints a warning.
%
%    \begin{macrocode}
\ifnum\luatexversion<36
%    \end{macrocode}
%
%    For old versions, we simply rename the primitives. You can note that
%    \texttt{\string\attribute} (and also others) have no
%    \texttt{\string\primitive} before them, because it would make users
%    unable to call \texttt{\string\global\string\luaattribute}, which is a
%    strong restriction. With this method, we can call it, but if
%    \texttt{\string\attribute} was defined before, this means that
%    \texttt{\string\luaattribute} will get its meaning, which is dangerous.
%    Note also that you cannot use multiple states.
%
%    \begin{macrocode}
  \def\directlua{\pdfprimitive\directlua0}
  \def\latelua{\pdfprimitive\latelua0}
  \def\lualate{\pdfprimitive\latelua0}
  \def\luatexattribute{\attribute}
  \def\luatexattributedef{\attributedef}
  \def\luatexclearmarks{\pdfprimitive\luaclearmarks}
  \def\luatexformatname{\pdfprimitive\formatname}
  \def\luatexscantexttokens{\pdfprimitive\scantexttokens}
  \def\luatexcatcodetable{\catcodetable}
  \def\initluatexcatcodetable{\pdfprimitive\initcatcodetable}
  \def\saveluatexcatcodetable{\pdfprimitive\savecatcodetable}
  \def\luaclose{\pdfprimitive\closelua}
\else
%    \end{macrocode}
%
%    From TeXLive 2009, all primitives should be provided with the |luatex|
%    prefix. For TeXLive 2008, we provide some primitives with this prefix too,
%    to keep backward compatibility.
%
%    \begin{macrocode}
  \directlua{tex.enableprimitives('luatex', {'attribute'})}
  \directlua{tex.enableprimitives('luatex', {'attributedef'})}
  \directlua{tex.enableprimitives('luatex', {'clearmarks'})}
  \directlua{tex.enableprimitives('luatex', {'formatname'})}
  \directlua{tex.enableprimitives('luatex', {'scantexttokens'})}
  \directlua{tex.enableprimitives('luatex', {'catcodetable'})}
  \directlua{tex.enableprimitives('luatex', {'latelua'})}
  \directlua{tex.enableprimitives('luatex', {'initcatcodetable'})}
  \directlua{tex.enableprimitives('luatex', {'savecatcodetable'})}
  \directlua{tex.enableprimitives('luatex', {'closelua'})}
  \let\lualate\luatexlatelua
  \let\initluatexcatcodetable\luatexinitcatcodetable
  \let\saveluatexcatcodetable\luatexsavecatcodetable
  \let\luaclose\luatexcloselua
\fi
%    \end{macrocode}
%
%    We provide some functions for backward compatibility with old versions of
%    luatextra.
%
%    \begin{macrocode}
\let\newluaattribute\newluatexattribute
\let\luaattribute\luatexattribute
\let\unsetluaattribute\unsetluatexattribute
\let\initluacatcodetable\initluatexcatcodetable
\let\luasetcatcoderange\luatexsetcatcoderange
\let\newluacatcodetable\newluatexcatcodetable
\let\setluaattribute\setluatexattribute
\let\luaModuleError\luatexModuleError
\let\luaRequireModule\luatexRequireModule
\let\luaUseModule\luatexUseModule
%    \end{macrocode}
%
%    \subsection{Callbacks}
%
%    We load the \texttt{lua} file.
%
%    \begin{macrocode}
\directlua{dofile(kpse.find_file("luatextra.lua"))}
%    \end{macrocode}
%
%    A small macro to register the \texttt{define\_font} callback from
%    \textsf{luatextra}.
%
%    \begin{macrocode}
\def\ltxtra@RegisterFontCallback{
  \directlua{luatextra.register_font_callback()}
}
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
%    \section{Test file}
%
%    Very minimal, just check that the package correctly loads.
%
%    \begin{macrocode}
%<*test>
\RequirePackage{luatextra}
\stop
%</test>
%    \end{macrocode}
%
%
% \Finale
\endinput