summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/newunicodechar
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-19 00:41:21 +0000
committerKarl Berry <karl@freefriends.org>2011-02-19 00:41:21 +0000
commit52e500014dd326e0b82000df453d5b640f9859b8 (patch)
treeb5647ad056cb175e05d8932d7208093b667444d8 /Master/texmf-dist/tex/latex/newunicodechar
parentdc65f1418292cc066bd4856c56b816f4fb4557ed (diff)
new latex package newunicodechar (18feb11)
git-svn-id: svn://tug.org/texlive/trunk@21463 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/newunicodechar')
-rw-r--r--Master/texmf-dist/tex/latex/newunicodechar/newunicodechar.sty135
1 files changed, 135 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/newunicodechar/newunicodechar.sty b/Master/texmf-dist/tex/latex/newunicodechar/newunicodechar.sty
new file mode 100644
index 00000000000..c5bd3520055
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/newunicodechar/newunicodechar.sty
@@ -0,0 +1,135 @@
+%%
+%% 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 by Enrico Gregorio
+%% <Enrico dot Gregorio at univr dot it>
+%% -------------------------------------------------------
+%%
+%% 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}[2008/04/05]
+\ProvidesPackage{newunicodechar}
+ [2011/02/18 v1.0 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 won't work without loading\MessageBreak
+ `inputenc' with the `utf8' option}%
+ \let\newunicodechar\@gobbletwo\endinput}
+
+\@ifpackageloaded{inputenc}{}{\nuc@stop}
+\@ifpackagewith{inputenc}{utf8}{}{\nuc@stop}
+\@ifpackagewith{inputenc}{utf8x}{\nuc@stop}{}
+\def\newunicodechar#1#2{%
+ \@tempswafalse
+ \edef\@tempa{\detokenize{#1}}%
+ \if\relax\@tempa\relax
+ \nuc@emptyargerr
+ \else
+ \edef\@tempb{\expandafter\@car\@tempa\@nil}%
+ \nuc@check
+ \if@tempswa
+ \@ifundefined{u8:\@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:\@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:\@tempa\endcsname}
+\fi
+\def\nuc@check{%
+ \ifcase\numexpr0\expandafter\nuc@getlength\@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'.