%% %% This is file `newunicodechar.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% newunicodechar.dtx (with options: `package') %% %% This is a generated file. %% %% Copyright (C) 2011-2018 by Enrico Gregorio %% %% ------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3c of this license or (at your option) any %% later version. The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions %% of LaTeX version 2005/12/01 or later. %% %% This work has the LPPL maintenance status `maintained'. %% %% The Current Maintainer of this work is Enrico Gregorio. %% %% This work consists of the files %% newunicodechar.dtx %% newunicodechar.ins %% and the derived file newunicodechar.sty. %% \NeedsTeXFormat{LaTeX2e}[2018/04/01] \ProvidesPackage{newunicodechar} [2018/04/08 v1.2 Defining Unicode characters] \@ifundefined{eTeXversion} {\PackageError{newunicodechar}{LaTeX engine too old, aborting} {Please upgrade your TeX system}\@@end}{} \DeclareOption{verbose}{\let\nuc@verbose=T} \ProcessOptions\relax \def\nuc@onebyteerr{\PackageError{newunicodechar} {ASCII character requested} {Only characters above U+007F may be defined; you asked for\MessageBreak a plain ASCII character and your definition has been ignored.}} \def\nuc@emptyargerr{\PackageError{newunicodechar} {Empty argument} {You shouldn't write \protect\newunicodechar{}{...}}} \def\nuc@invalidargerr{\PackageError{newunicodechar} {Invalid argument} {The first argument to \protect\newunicodechar\space is either\MessageBreak too long or an invalid sequence of bytes}} \begingroup \catcode`\^=7 \catcode30=12 \catcode`\!=12 % for safety \edef\next{\@gobble^^^^0021} \expandafter\endgroup \ifx\next\@empty % Start of code for Unicode engines \chardef\nuc@atcode=\catcode`\~ \catcode`\~=\active \def\newunicodechar#1#2{% \if\relax\detokenize{#1}\relax \nuc@emptyargerr \else \if\relax\detokenize\expandafter{\@cdr#1\@nil}\relax \ifnum`#1>\string"7F \catcode`#1=\active \begingroup\lccode`\~=`#1 \lowercase{\endgroup\protected\def~}{#2}% \else \nuc@onebyteerr \fi \else \nuc@invalidargerr \fi \fi} \catcode`\~=\nuc@atcode \@onlypreamble\newunicodechar \expandafter\endinput \fi % End of code for Unicode engines \def\nuc@stop{\PackageWarningNoLine{newunicodechar} {This package only works if the document\MessageBreak encoding is `utf8'}% \let\newunicodechar\@gobbletwo\endinput} \edef\@tempa{\detokenize{utf8}} \edef\@tempb{\detokenize\expandafter{\inputencodingname}} \ifx\@tempb\@tempa\else \nuc@stop \fi \def\newunicodechar#1#2{% \@tempswafalse \edef\nuc@tempa{\detokenize{#1}}% \if\relax\nuc@tempa\relax \nuc@emptyargerr \else \edef\@tempb{\expandafter\@car\nuc@tempa\@nil}% \nuc@check \if@tempswa \@ifundefined{u8:\nuc@tempa}{} {\PackageWarning{newunicodechar} {Redefining Unicode character\ifdefined\nuc@verbose; it meant\MessageBreak ***\space\space\nuc@meaning\space\space***\MessageBreak before your redefinition\fi}}% \@namedef{u8:\nuc@tempa}{#2}% \fi \fi } \def\nuc@getlength#1{% \ifx#1\@nil \expandafter\relax \else +1\expandafter\nuc@getlength \fi} \ifdefined\nuc@verbose \def\nuc@meaning{\expandafter\expandafter\expandafter \strip@prefix\expandafter\meaning\csname u8:\nuc@tempa\endcsname} \fi \def\nuc@check{% \ifcase\numexpr0\expandafter\nuc@getlength\nuc@tempa\@nil \or %0 \nuc@onebyteerr\or %1 \nuc@ch@ck{192}\or %2 \nuc@ch@ck{224}\or %3 \nuc@ch@ck{240}\else %4 \nuc@invalidargerr \fi} \def\nuc@ch@ck#1{% \expandafter\ifnum\expandafter`\@tempb<#1\relax \nuc@invalidargerr \else \@tempswatrue \fi } \@onlypreamble\newunicodechar \endinput %% %% End of file `newunicodechar.sty'.