summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/newunicodechar
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-11-13 23:35:53 +0000
committerKarl Berry <karl@freefriends.org>2012-11-13 23:35:53 +0000
commit4776da14c604f45e9c7a51a4efb48e9e97ec3dd1 (patch)
tree14f7b73e7ca63d86636e038beb0e2680f4693b20 /Master/texmf-dist/source/latex/newunicodechar
parent2bd3a97e68ab7bbf790cb6cfcc49c2d9dae3e51d (diff)
newunicodechar (13nov12)
git-svn-id: svn://tug.org/texlive/trunk@28253 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/newunicodechar')
-rw-r--r--Master/texmf-dist/source/latex/newunicodechar/newunicodechar.dtx73
-rw-r--r--Master/texmf-dist/source/latex/newunicodechar/newunicodechar.ins4
2 files changed, 42 insertions, 35 deletions
diff --git a/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.dtx b/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.dtx
index 96e996cb844..75e06376619 100644
--- a/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.dtx
+++ b/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2011 by Enrico Gregorio
+% Copyright (C) 2011-2012 by Enrico Gregorio
% <Enrico dot Gregorio at univr dot it>
% -------------------------------------------------------
%
@@ -30,7 +30,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2008/04/05]
%<package>\ProvidesPackage{newunicodechar}
%<*package>
- [2011/02/18 v1.0 Defining Unicode characters]
+ [2012/11/12 v1.1 Defining Unicode characters]
%</package>
%
%<*driver>
@@ -48,7 +48,7 @@
%</driver>
% \fi
%
-% \CheckSum{193}
+% \CheckSum{200}
%
% \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
@@ -67,6 +67,7 @@
% Right brace \} Tilde \~}
%
%
+% \changes{v1.1}{2012/11/12}{Added support for \mbox{\textsf{inputenx}}}
% \changes{v1.0}{2011/02/15}{Initial version}
%
% \GetFileInfo{newunicodechar.dtx}
@@ -97,8 +98,8 @@
%\end{verbatim}
% where |xxx| may be the actual character we input or a combination of
% strange characters. This happens because the \texttt{utf8} option
-% given to \textsf{inputenc} defines the \LaTeX{} meaning of many
-% Unicode characters, but, of course, not all of them.
+% given to \textsf{inputenc} or \textsf{inputenx} defines the \LaTeX{}
+% meaning of many Unicode characters, but, of course, not all of them.
%
% For example, one might want to write some Latin words with prosodic
% marks, i.e., the diacritics that tell whether a vowel is long or
@@ -168,12 +169,13 @@
% \section{Usage}
%
% The package requires the use of a Unicode engine, i.e., \XeLaTeX{}
-% or \LuaLaTeX{}, or, with (pdf)\LaTeX{}, the \textsf{inputenc}
-% package along with the \texttt{utf8} option. It won't work with the
-% \texttt{utf8x} option that employs a completely different mechanism
-% for parsing Unicode characters in (pdf)\LaTeX{}. It should be said
-% that \texttt{utf8x} defines many more characters than \texttt{utf8},
-% so that the present package wouldn't be needed.
+% or \LuaLaTeX{}, or, with (pdf)\LaTeX{}, the \textsf{inputenc} or
+% \textsf{inputenx} package along with the \texttt{utf8} option. It
+% won't work with the \texttt{utf8x} option that employs a completely
+% different mechanism for parsing Unicode characters in
+% (pdf)\LaTeX{}. It should be said that \texttt{utf8x} defines many
+% more characters than \texttt{utf8}, so that the present package
+% wouldn't be needed.
%
% Of course the \LaTeX{} document must be written using a Unicode
% savvy editor.
@@ -363,46 +365,51 @@
%
% \subsection{Eight bit engines}
% From now on we can assume an eight bit engine is used; we check that
-% inputenc has been loaded with the right option, otherwise we define
-% |\newunicodechar| to swallow its arguments, after a warning.
+% \textsf{inputenc} or \textsf{inputenx} has been loaded with the
+% right option, otherwise we define |\newunicodechar| to swallow its
+% arguments, after a warning. We need to first check for
+% \textsf{inputenx} because it loads \textsf{inputenc}.
+% \changes{v1.1}{2012/11/12}{Added support for \mbox{\textsf{inputenx}}}
% \begin{macrocode}
\def\nuc@stop{\PackageWarningNoLine{newunicodechar}
{This package won't work without loading\MessageBreak
- `inputenc' with the `utf8' option}%
+ `inputenc' or `inputenx' with the `utf8' option}%
\let\newunicodechar\@gobbletwo\endinput}
-
-\@ifpackageloaded{inputenc}{}{\nuc@stop}
-\@ifpackagewith{inputenc}{utf8}{}{\nuc@stop}
-\@ifpackagewith{inputenc}{utf8x}{\nuc@stop}{}
+\@ifpackageloaded{inputenx}
+ {\def\nuc@tempa{inputenx}}
+ {\@ifpackageloaded{inputenc}{\def\nuc@tempa{inputenc}}{\nuc@stop}}
+\@ifpackagewith{\nuc@tempa}{utf8}{}{\nuc@stop}
+\@ifpackagewith{\nuc@tempa}{utf8x}{\nuc@stop}{}
% \end{macrocode}
% \begin{macro}{\newunicodechar}
% The main macro. We set the temporary switch to false and put in
-% |\@tempa| the first argument, but detokenized, since it consists of
+% |\nuc@tempa| the first argument, but detokenized, since it consists of
% active characters. We check that it's not empty and access to its
-% first token that we put into \@tempb. Then we call |\nuc@check| and
-% if it sets the temporary switch to true, we execute the definition,
-% since the first argument is a valid UTF-8 character, but we issue a
-% warning if it already has a meaning. All we need to do is to define
-% the macro |\csname u8:\@tempa\endcsname|, because that's how
-% inputenc acts. The part between |\ifdefined| and the corresponding
-% |\fi| will be executed only with the \texttt{verbose} option.
+% first token that we put into |\@tempb|. Then we call |\nuc@check|
+% and if it sets the temporary switch to true, we execute the
+% definition, since the first argument is a valid UTF-8 character, but
+% we issue a warning if it already has a meaning. All we need to do is
+% to define the macro |\csname u8:\nuc@tempa\endcsname|, because that's
+% how \textsf{inputenc} acts. The part between |\ifdefined| and the
+% corresponding |\fi| will be executed only with the \texttt{verbose}
+% option.
% \begin{macrocode}
\def\newunicodechar#1#2{%
\@tempswafalse
- \edef\@tempa{\detokenize{#1}}%
- \if\relax\@tempa\relax
+ \edef\nuc@tempa{\detokenize{#1}}%
+ \if\relax\nuc@tempa\relax
\nuc@emptyargerr
\else
- \edef\@tempb{\expandafter\@car\@tempa\@nil}%
+ \edef\@tempb{\expandafter\@car\nuc@tempa\@nil}%
\nuc@check
\if@tempswa
- \@ifundefined{u8:\@tempa}{}
+ \@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:\@tempa}{#2}%
+ \@namedef{u8:\nuc@tempa}{#2}%
\fi
\fi
}
@@ -420,7 +427,7 @@
\fi}
\ifdefined\nuc@verbose
\def\nuc@meaning{\expandafter\expandafter\expandafter
- \strip@prefix\expandafter\meaning\csname u8:\@tempa\endcsname}
+ \strip@prefix\expandafter\meaning\csname u8:\nuc@tempa\endcsname}
\fi
% \end{macrocode}
% We select the action based on the length of the first argument; in
@@ -434,7 +441,7 @@
% temporary switch to true.
% \begin{macrocode}
\def\nuc@check{%
- \ifcase\numexpr0\expandafter\nuc@getlength\@tempa\@nil
+ \ifcase\numexpr0\expandafter\nuc@getlength\nuc@tempa\@nil
\or %0
\nuc@onebyteerr\or %1
\nuc@ch@ck{192}\or %2
diff --git a/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.ins b/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.ins
index 5806394c2e1..6352c94d153 100644
--- a/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.ins
+++ b/Master/texmf-dist/source/latex/newunicodechar/newunicodechar.ins
@@ -1,4 +1,4 @@
-% Copyright (C) 2011 by Enrico Gregorio
+% Copyright (C) 2011-2012 by Enrico Gregorio
% <Enrico dot Gregorio at univr dot it>
% -------------------------------------------------------
%
@@ -28,7 +28,7 @@
This is a generated file.
-Copyright (C) 2011 by Enrico Gregorio
+Copyright (C) 2011-2012 by Enrico Gregorio
<Enrico dot Gregorio at univr dot it>
-------------------------------------------------------