From 95bdae3d8a40af1f2f82f786dc29d3761fe431f1 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 16 May 2023 03:01:57 +0000 Subject: CTAN sync 202305160301 --- macros/latex/contrib/sanitize-umlaut/CHANGES.md | 10 ++++ macros/latex/contrib/sanitize-umlaut/README.md | 4 +- .../contrib/sanitize-umlaut/sanitize-umlaut.pdf | Bin 453171 -> 418743 bytes .../contrib/sanitize-umlaut/sanitize-umlaut.sty | 57 +++++++++++++++++--- .../contrib/sanitize-umlaut/sanitize-umlaut.tex | 59 ++++++++++++++++++--- 5 files changed, 114 insertions(+), 16 deletions(-) (limited to 'macros/latex/contrib/sanitize-umlaut') diff --git a/macros/latex/contrib/sanitize-umlaut/CHANGES.md b/macros/latex/contrib/sanitize-umlaut/CHANGES.md index 017517874a..c0ef059149 100644 --- a/macros/latex/contrib/sanitize-umlaut/CHANGES.md +++ b/macros/latex/contrib/sanitize-umlaut/CHANGES.md @@ -17,6 +17,16 @@ and this project adheres to +## [1.3.0] - 2023-05-15 + +### Added +- Support for lualatex and xelatex + +### Changed +- The style file `sanitize-umlaut.sty` is UTF-8 encoded now and contains umlauts + + + ## [1.2.1] - 2022-06-29 ### Fixed diff --git a/macros/latex/contrib/sanitize-umlaut/README.md b/macros/latex/contrib/sanitize-umlaut/README.md index 9d7da8de81..baf2e60bc3 100644 --- a/macros/latex/contrib/sanitize-umlaut/README.md +++ b/macros/latex/contrib/sanitize-umlaut/README.md @@ -1,7 +1,7 @@ -# The LaTeX package sanitize-umlaut - version 1.2.1 (2022/06/29) +# The LaTeX package sanitize-umlaut - version 1.3.0 (2023/05/15) -> Copyright (c) 2016-2022 by Prof. Dr. Dr. Thomas F. Sturm +> Copyright (c) 2016-2023 by Prof. Dr. Dr. Thomas F. Sturm > This work may be distributed and/or modified under the > conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf index abb30adb4a..57988417f8 100644 Binary files a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf and b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf differ diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty index 65041d2112..634f09be0d 100644 --- a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty +++ b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty @@ -1,8 +1,9 @@ -%% The LaTeX package sanitize-umlaut - version 1.2.1 (2022/06/29) +% !TeX encoding=UTF-8 +%% The LaTeX package sanitize-umlaut - version 1.3.0 (2023/05/15) %% sanitize-umlaut.sty: Sanitize umlauts for makeindex %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016-2022 by Prof. Dr. Dr. Thomas F. Sturm +%% Copyright (c) 2016-2023 by Prof. Dr. Dr. Thomas F. Sturm %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -18,7 +19,7 @@ %% This work consists of all files listed in README %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{sanitize-umlaut}[2022/06/29 version 1.2.1 sanitize umlauts] +\ProvidesPackage{sanitize-umlaut}[2023/05/15 version 1.3.0 sanitize umlauts] \def\sanitize@unicode@char#1#2{% \@namedef{u8:\detokenize{#1}}{#2}% @@ -115,9 +116,53 @@ \def\sanitize@umlaut{}% \PackageWarning{sanitize-umlaut}{encoding \inputencodingname\space is not supported} \fi\fi\fi\fi\fi\fi + \AtBeginDocument{\edef\@sanitize{\unexpanded\expandafter{\@sanitize}\unexpanded\expandafter{\sanitize@umlaut}}} \else - \let\sanitize@umlaut\sanitize@umlaut@utfviii - \PackageWarning{sanitize-umlaut}{encoding unknown. utf8 is selected as fallback (possibly nonsense)} + \ExplSyntaxOn + + \bool_lazy_or:nnTF { \sys_if_engine_luatex_p: }{ \sys_if_engine_xetex_p: } + { + \cs_new_protected_nopar:Npn \__sanuml_index:n #1 + { + \__sanuml_index_original:w { #1 } + } + + \cs_new_protected_nopar:Npn \__sanuml_index:nn #1#2 + { + \__sanuml_index_original:w [ #1 ] { #2 } + } + + \PackageInfo{sanitize-umlaut}{use~LaTeX3~token~replacement~for~\c_sys_engine_str} + \AddToHook{begindocument} + { + \cs_set_eq:NN \__sanuml_index_original:w \index + + \RenewDocumentCommand \index { o m } + { + \tl_set:Nn \l_tmpa_tl { #2 } + \tl_replace_all:Nnn \l_tmpa_tl { ä }{ "a } + \tl_replace_all:Nnn \l_tmpa_tl { ö }{ "o } + \tl_replace_all:Nnn \l_tmpa_tl { ü }{ "u } + \tl_replace_all:Nnn \l_tmpa_tl { Ä }{ "A } + \tl_replace_all:Nnn \l_tmpa_tl { Ö }{ "O } + \tl_replace_all:Nnn \l_tmpa_tl { Ü }{ "U } + \tl_replace_all:Nnn \l_tmpa_tl { ß }{ "s } + \IfNoValueTF {#1} + { + \exp_args:NV \__sanuml_index:n \l_tmpa_tl + } + { + \exp_args:NnV \__sanuml_index:nn {#1} \l_tmpa_tl + } + } + } + } + { + \PackageWarning{sanitize-umlaut}{no~input~encoding~detected.~utf8~is~selected~as~fallback~(possibly~nonsense)} + \let\sanitize@umlaut\sanitize@umlaut@utfviii + \AtBeginDocument{\edef\@sanitize{\unexpanded\expandafter{\@sanitize}\unexpanded\expandafter{\sanitize@umlaut}}} + } + + \ExplSyntaxOff \fi -\AtBeginDocument{\edef\@sanitize{\unexpanded\expandafter{\@sanitize}\unexpanded\expandafter{\sanitize@umlaut}}} diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex index 25e9284e1d..85520b7c94 100644 --- a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex +++ b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex @@ -2,11 +2,11 @@ % !TeX encoding=UTF-8 % !TeX spellcheck=en_US %% -%% The LaTeX package sanitize-umlaut - version 1.2.1 (2022/06/29) +%% The LaTeX package sanitize-umlaut - version 1.3.0 (2023/05/15) %% sanitize-umlaut.tex: Manual %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016-2022 by Prof. Dr. Dr. Thomas F. Sturm +%% Copyright (c) 2016-2023 by Prof. Dr. Dr. Thomas F. Sturm %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -27,8 +27,8 @@ \usepackage{% sanitize-umlaut} -\def\version{1.2.1}% -\def\datum{2022/06/29}% +\def\version{1.3.0}% +\def\datum{2023/05/15}% \hypersetup{ pdftitle={Manual for the sanitize-umlaut package}, @@ -50,8 +50,8 @@ \end{tcolorbox} {\large Thomas F.~Sturm% \footnote{Prof.~Dr.~Dr.~Thomas F.~Sturm, Institut f\"{u}r Mathematik und Informatik, - Universit\"{a}t der Bundeswehr M\"{u}nchen, D-85577 Neubiberg, Germany; - email: \href{mailto:thomas.sturm@unibw.de}{thomas.sturm@unibw.de}}\par\medskip + University of the Bundeswehr Munich, D-85577 Neubiberg, Germany; + email: \href{mailto:thomas.sturm@unibw.de}{thomas.sturm@unibw.de}}\par\medskip \normalsize\url{https://www.ctan.org/pkg/sanitize-umlaut}\par \url{https://github.com/T-F-S/sanitize-umlaut} } @@ -63,7 +63,7 @@ MakeIndex and friends with |pdflatex|. This means, that inside |\index| an umlaut can be used as \texttt{"U} or \texttt{Ü}. In both cases, the letter is written as \texttt{"U} into the raw index file for correct processing with MakeIndex - and |pdflatex|. + and |pdflatex|. |lualatex| and |xelatex| are also supported with a different approach. \end{absquote} \begin{tcolorbox}[breakable,enhanced jigsaw,title={Contents},fonttitle=\bfseries\Large, @@ -97,7 +97,8 @@ The package is intended \begin{itemize} \item for documents in German language using the babel package with a setting identical or similar to \myverb{\usepackage[ngerman]{babel}}. -\item for documents which are processed by |latex| or |pdflatex| (not |lualatex| or |xelatex|). +\item for documents which are processed by |latex| or |pdflatex| (also for |lualatex| or |xelatex|, + but with more compilation overhead). \item for documents with an index which is processed using the MakeIndex program. \item for authors who like to use \myverb{\index{Übermaß}} instead of @@ -145,6 +146,10 @@ patches some relevant parts of two-octets characters during |\index| back to pre 2022 June behaviour. Obviously, you loose |\protected| here, if you load |sanitize-umlaut|. +|sanitize-umlaut| version 1.3.0 (or newer) also supports |lualatex| and |xelatex| +with a different approach. Here, |\index| is patched such that its argument +is processed to replace umlauts. + \subsection{Future} As always, the future is dark and difficult to see. Further changes of |inputenc| implementation may force further changes of |sanitize-umlaut|. @@ -165,6 +170,7 @@ is assumed as engine. For example: \end{dispListing} For |utf8| (UTF-8), modern \LaTeX\ does not need this package inclusion any more! +Also, for |lualatex| and |xelatex| this has to be omitted. Just some few encodings are supported by |sanitize-umlaut|. These are the most important for German language texts: @@ -211,6 +217,7 @@ which are written to the \myverb{.idx} file. \end{tabular}} +\clearpage \subsection{Technical Information} The package uses \myverb{\inputencodingname} (set by \LaTeX\ and the |inputencoding| package) @@ -222,6 +229,14 @@ document. It adds some encoding redefinitions to this macro. If another package (besides |babel|) also changes this macro or uses it outside \myverb{\index}, strange things may happen. +If \myverb{\inputencodingname} is \emph{not} present, the package checks, if +the current engine is |luatex| or |xetex| and patches the \myverb{\index} macro +itself. All umlauts inside the argument of \myverb{\index} are replaced by their +|babel| shorthand codes using \LaTeX3 token replacement. +This increases compilation time considerably compared to the \myverb{\@sanitize} hack +for |pdflatex|. A very rough figure is approximately a plus of 0.8 seconds per +10000 \myverb{\index} calls (will differ on other maschines and other example codes). + \clearpage \section{Application Examples}% @@ -357,4 +372,32 @@ Test äöüÄÖÜß. \end{fullexample} +\begin{fullexample}{run arara} +% !TeX encoding=UTF-8 +% arara: lualatex +\documentclass[a4paper,12pt]{article} +\usepackage{fontspec} +\usepackage[ngerman]{babel} +\usepackage[makeindex]{imakeidx} +\indexsetup{level=\section*,noclearpage} +\makeindex[name=personen,title=Personenregister,options=-s german.ist -g] +\makeindex[name=allgemein,title=Allgemeines Register,options=-s german.ist -g] +\usepackage{sanitize-umlaut} +\begin{document} +\section{Example with multiple indexes for lualatex} +Test äöüÄÖÜß. +\index[personen]{Huber, Hans} \index[personen]{Hübner, Jörg} +\index[allgemein]{Aber} \index[allgemein]{Arg} +\index[allgemein]{Ärger} \index[allgemein]{Ofen} +\index[allgemein]{Ö - wie schön} \index[allgemein]{oberhalb} +\index[allgemein]{Ufer} \index[allgemein]{Übermaß} +\index[allgemein]{Latex=\LaTeX} \index[allgemein]{Ärger>Index} +Test äöüÄÖÜß. +\clearpage +\printindex[allgemein] +\printindex[personen] +\end{document} +\end{fullexample} + + \end{document} -- cgit v1.2.3