| 1 |
%% |
| 2 |
%% This is file `inputnormalization.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% inputnormalization.dtx (with options: `tex-package') |
| 8 |
%% |
| 9 |
%% IMPORTANT NOTICE: |
| 10 |
%% |
| 11 |
%% For the copyright see the source file. |
| 12 |
%% |
| 13 |
%% Any modified versions of this file must be renamed |
| 14 |
%% with new filenames distinct from inputnormalization.tex. |
| 15 |
%% |
| 16 |
%% For distribution of the original source see the terms |
| 17 |
%% for copying and modification in the file inputnormalization.dtx. |
| 18 |
%% |
| 19 |
%% This generated file may be distributed as long as the |
| 20 |
%% original source files, as listed above, are part of the |
| 21 |
%% same distribution. (The sources need not necessarily be |
| 22 |
%% in the same archive or directory.) |
| 23 |
%% Copyright (C) 2020--2021 by Marcel Krueger |
| 24 |
%% |
| 25 |
%% This file may be distributed and/or modified under the |
| 26 |
%% conditions of the LaTeX Project Public License, either |
| 27 |
%% version 1.3 of this license or (at your option) any later |
| 28 |
%% version. The latest version of this license is in: |
| 29 |
%% |
| 30 |
%% http://www.latex-project.org/lppl.txt |
| 31 |
%% |
| 32 |
%% and version 1.3 or later is part of all distributions of |
| 33 |
%% LaTeX version 2005/12/01 or later. |
| 34 |
\ifx\directlua\undefined |
| 35 |
\ifx\XeTeXinputnormalization\undefined |
| 36 |
\begingroup |
| 37 |
\ifx\PackageError\undefined |
| 38 |
\def\PackageError#1#2#3{\errhelp{#3}\errmessage{#1: #2}} |
| 39 |
\fi |
| 40 |
\PackageError{inputnormalization}{LuaTeX or XeTeX required}% |
| 41 |
{inputnormalization requires LuaTeX or XeTeX. |
| 42 |
Maybe you forgot to switch the engine in your editor?} |
| 43 |
\endgroup |
| 44 |
\else |
| 45 |
\let\Uinputnormalization\XeTeXinputnormalization |
| 46 |
\fi |
| 47 |
\else |
| 48 |
\ifx\newluafunction\@undefined |
| 49 |
\input ltluatex |
| 50 |
\fi |
| 51 |
\newcount\Uinputnormalization |
| 52 |
\directlua{ |
| 53 |
local getcount = tex.getcount |
| 54 |
local function ident(buf) return buf end |
| 55 |
local uni_normalize = require'lua-uni-normalize' |
| 56 |
local normalize = {[0] = ident, uni_normalize.NFC, uni_normalize.NFD} |
| 57 |
luatexbase.add_to_callback('process_input_buffer', function(buf) |
| 58 |
return normalize[getcount(\the\allocationnumber)](buf) |
| 59 |
end, 'inputnormalization') |
| 60 |
} |
| 61 |
\fi |
| 62 |
\Uinputnormalization=1 |
| 63 |
\endinput |
| 64 |
%% |
| 65 |
%% End of file `inputnormalization.tex'. |