diff options
Diffstat (limited to 'macros/latex/contrib/ucs/ucs.dtx')
-rw-r--r-- | macros/latex/contrib/ucs/ucs.dtx | 128 |
1 files changed, 116 insertions, 12 deletions
diff --git a/macros/latex/contrib/ucs/ucs.dtx b/macros/latex/contrib/ucs/ucs.dtx index 1b2c866fe1..053662393b 100644 --- a/macros/latex/contrib/ucs/ucs.dtx +++ b/macros/latex/contrib/ucs/ucs.dtx @@ -2,13 +2,16 @@ % -*-coding: utf-8; mode: latex;-*- % %<*driver> -\ProvidesFile{ucs.dtx}[2013/05/11 v2.2 +\ProvidesFile{ucs.dtx}[2022/08/07 v2.3 UCS: Master document for generating documentation for ucs.sty] % \documentclass{ltxdoc} -\usepackage[postscript]{ucs} +%\usepackage[postscript]{ucls} \usepackage[utf8x]{inputenc} -\usepackage[univerb]{ucsutils} +%\usepackage[univerb]{ucsutils} +\def\SetUnicodeOption#1{} + +\setcounter{section}{-1} \usepackage[T2A,T1]{fontenc} \usepackage[hyperindex,unicode]{hyperref} %\makeatletter @@ -62,7 +65,7 @@ % \expandafter\let\expandafter\percent\csname @percentchar\endcsname % \let\ucsdocmfour1^^A % \let\xsection\section -%\ProvidesFile{ucs-doc.tex}[2004/10/17 Main documentation for package ucs] +%\ProvidesFile{ucs-doc.tex}[2022/108/07 Main documentation for package ucs] % %\ifx\ucsdocmfour\undefined %\documentclass{ltxdoc} @@ -78,7 +81,8 @@ %\fi % %\title{\texttt{ucs.sty} - Unicode Support} -%\author{Dominique~P.~G.~Unruh\\Wolfgang Jeltsch} +%\author{Dominique~P.~G.~Unruh\\Wolfgang Jeltsch\\David Carlisle (2022 +%update)\thanks{\url{https://github.com/LaTeX-Package-Repositories/ucs}}} %\maketitle % %\MakeShortVerb{\|} @@ -130,6 +134,45 @@ % %\tableofcontents % +%\section{2022 Update Notes} +% \large\bfseries +% When |ucs/uf8x| was first written, its Unicode support was far +% more extensive than the standard release, and users could simply +% opt in via the |[utf8x]| option. In the years since then Standard +% \LaTeX\ Unicode support has been extended and enabled by default. +% Various features such as filenames, |\label| arguments and upper/lower +% case changing now work by default with UTF-8, but assuming the standard +% implementation. +% +% With the June 2022 \LaTeX\ release these incompatibilities meant +% that simply loading |inputenc| with the |utf8x| option could produce +% low level \TeX\ errors. +% +% The original maintainers kindly allowed the \LaTeX\ project members +% to make this |2022/08/07 v2.3| release. +% +% The remaining documentation is unchanged but version 2.3 introduces +% the following changes +% +% \begin{itemize} +% \item If a document uses |\usepackage[utf8x]{inputenc}| when the +% |ucs| package has \emph{not} been loaded, a message is issued on the +% terminal, and the standard |[utf8]| option is used instead. +% +% The warning can be avoided by simply deleting\\ +% |\usepackage[utf8x]{inputenc}|\\ +% as UTF-8 is the default encoding. +% +% \item If the |ucs| package is loaded explicitly, then the |utf8x.def| +% file is input in the normal way. |utf8x.def| and |ucs.sty| have both +% been modified to be more compatible with current \LaTeX\ releases. +% Notably making the active characters |\protected| so that they work +% with the new |\MakeUppercase|. +% +% \end{itemize} +% +% \normalsize\normalfont +% %\section{Usage} % %Simply use |\usepackage{ucs}| and |\usepackage[utf8x]{inputenc}|, @@ -295,8 +338,7 @@ %\def\acuteacc{\textsc{U+0301 combining acute accent}} %In some cases, Unicode documents contain sequences like \latinc\space\acuteacc %(producing {^^A -%\SetUnicodeOption{combine}\unichar{"63}^^A -%\unichar{"301}\SetUnicodeOption{nocombine}}). In order to typeset them +%\'c). In order to typeset them %correctly, we cannot render \latinc immediately when it occurs, %instead we have to wait whether some combining character is going to %follow. @@ -454,6 +496,33 @@ % ^^A FIXME: What is the following code for? Is it for people who want to use ucs.sty with Plain TeX % ^^A or ConTeXt? \catcode`\@11 + +\ifx\AddToHook\@undefined\else +\AddToHook{package/hyperref/after}{% + \def\HyPsd@expand@utfvii{% + \count@"C2 + \@tempcnta"E0 + \def\UTFviii@tmp{% +\expandafter\def\expandafter~\expandafter####\expandafter1\expandafter{~{####1}}% +}% + \UTFviii@loop + \count@"E0 + \@tempcnta"F0 + \def\UTFviii@tmp{% +\expandafter\def\expandafter~\expandafter####\expandafter1\expandafter####\expandafter2\expandafter{~{####1}{####2}}% +}% + \UTFviii@loop + \count@"F0 + \@tempcnta"F5 + \def\UTFviii@tmp{% +\expandafter\def\expandafter~\expandafter####\expandafter1\expandafter####\expandafter2\expandafter####\expandafter3\expandafter{~{####1}{####2}{####3}}% +}% + \UTFviii@loop + + } +} +\fi + \ifx\@gobble\undefined\def\@gobble#1{}\fi \ifx\@gobbletwo\undefined\def\@gobbletwo#1#2{}\fi \ifx\@gobblethree\undefined\def\@gobblethree#1#2#3{}\fi @@ -654,7 +723,7 @@ % % \begin{macrocode} \ifx\ProvidesPackage\undefined\else -\ProvidesPackage{ucs}[2013/05/11 v2.2 UCS: Unicode input support]% +\ProvidesPackage{ucs}[2022/08/07 v2.3 UCS: Unicode input support]% \fi % \end{macrocode} % ^^A FIXME: We should update the date of ucs.sty even if the file ucs.sty has not changed, but the @@ -1953,7 +2022,7 @@ % \begin{macrocode} ^^B\def\uc@vbsetchar#1#2{% ^^B \catcode#1\active -^^B \begingroup\uccode`\~#1\uppercase{\endgroup\edef~}{#2}} +^^B \begingroup\uccode`\~#1\uppercase{\endgroup\protected\edef~}{#2}} % \end{macrocode} % \end{macro} % @@ -2058,7 +2127,42 @@ % \begin{macrocode} %<*utf8x.def> \ifx\ProvidesFile\undefined\else -\ProvidesFile{utf8x.def}[2004/10/17 UCS: Input encoding UTF-8]% +\ProvidesFile{utf8x.def}[2022/08/07 UCS: Input encoding UTF-8]% + +\ifx\uc@char@notloaded\@undefined + +\PackageNoteNoLine{ucs}{% +utf8x\space disabled,\space assuming\space standard\space utf8\space processing\MessageBreak +load\space ucs\space package\space to\space force\space utf8x\space processing} + +\let\ucs@parse@XML@charref\parse@XML@charref +\let\ucs@parse@UTFviii@a\parse@UTFviii@a +\let\ucs@parse@UTFviii@b\parse@UTFviii@b +\AddToHook{begindocument/end}{% +\let\parse@XML@charref\ucs@parse@XML@charref +\let\parse@UTFviii@a\ucs@parse@UTFviii@a +\let\parse@UTFviii@b\ucs@parse@UTFviii@b +} + +\protected\def\unichar#1{% +\begingroup +\count@#1\relax +\ifnum\count@>127 +\parse@XML@charref +\else +\edef\UTFviii@tmp{\char\the\count@\relax}% +\fi +\expandafter +\endgroup +\UTFviii@tmp +} +% +\def\inputencodingname{utf8} +% need to re-input this to undo the RawInputEncoding +\input{utf8.def}% +% +\expandafter\expandafter\expandafter\endinput +\fi \fi % \end{macrocode} % Only load this file once. If it has already been loaded, just execute @@ -2144,7 +2248,7 @@ \uccode`\u`\u% \uppercase{% \endgroup - \edef~% + \protected\edef~% #3{\noexpand\expandafter\noexpand\ifx\noexpand\csname u8-\number\count255-#4\noexpand\endcsname\relax \begingroup % \end{macrocode} @@ -2183,7 +2287,7 @@ \uccode`\~\count255 %SPACE \uppercase{% \endgroup - \edef~}% + \protected\edef~}% {\noexpand\utf@viii@err{\number\count255}}% \advance\count255by1\relax \repeat}% |