| 1 |
%% |
| 2 |
%% This is file `ucharcat.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ucharcat.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Source File: textcase.dtx |
| 10 |
%% Copyright 2015 David Carlisle |
| 11 |
%% |
| 12 |
%% This file may be distributed under the terms of the LPPL. |
| 13 |
%% See README for details. |
| 14 |
\NeedsTeXFormat{LaTeX2e} |
| 15 |
\ProvidesPackage{ucharcat} |
| 16 |
[2015/11/19 v0.03 ucharcat for luaLaTeX (DPC)] |
| 17 |
\ifx\directlua\@undefined |
| 18 |
\ifx\Ucharcat\@undefined |
| 19 |
\ifx\XeTeXinterchartokenstate\@undefined |
| 20 |
\PackageError{ucharcat} |
| 21 |
{\string\Ucharcat\space may only be used with xetex and luatex} |
| 22 |
{skipping package} |
| 23 |
\else |
| 24 |
\PackageError{ucharcat} |
| 25 |
{\string\Ucharcat\space is defined in xetex releases from 2015 only} |
| 26 |
{skipping package} |
| 27 |
\fi |
| 28 |
\fi |
| 29 |
\expandafter\endinput |
| 30 |
\fi |
| 31 |
\ifx\newcatcodetable\@undefined |
| 32 |
\chardef\ucharcat@table"7000 |
| 33 |
\directlua{tex.enableprimitives("",{"initcatcodetable"})} |
| 34 |
\initcatcodetable\ucharcat@table |
| 35 |
\else |
| 36 |
\newcatcodetable\ucharcat@table |
| 37 |
\fi |
| 38 |
\directlua{% |
| 39 |
local nt = newtoken or token |
| 40 |
function UcharcatLua() |
| 41 |
local mych = nt.scan_int() |
| 42 |
local mycat = nt.scan_int() |
| 43 |
tex.setcatcode(\the\numexpr\ucharcat@table\relax,mych,mycat) |
| 44 |
tex.sprint(\the\numexpr\ucharcat@table\relax,unicode.utf8.char(mych)) |
| 45 |
end |
| 46 |
} |
| 47 |
\def\Ucharcat{\directlua{UcharcatLua()}} |
| 48 |
\endinput |
| 49 |
%% |
| 50 |
%% End of file `ucharcat.sty'. |