diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-23 00:18:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-23 00:18:01 +0000 |
commit | c5eb42407f4dca7e0651d9f78eac32007261407b (patch) | |
tree | a6cc17dd8fccf0a6ba67dcb4b3b1cbf21019a12c | |
parent | a6f953f4816835c3e6460c8623361f6cc7978ee5 (diff) |
new lualatex package luainputenc
git-svn-id: svn://tug.org/texlive/trunk@13903 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luainputenc/README | 90 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luainputenc/inputenc.sty.diff | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luainputenc/luainputenc.pdf | bin | 0 -> 136487 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/lualatex/luainputenc/Makefile | 92 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/luainputenc/luainputenc.dtx | 1240 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luainputenc/eu2enc.def | 37 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luainputenc/eu2lmr.fd | 82 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.lua | 259 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.sty | 255 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luainputenc/lutf8.def | 114 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luainputenc/lutf8x.def | 154 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-luatex.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/luainputenc.tlpsrc | 0 |
14 files changed, 2349 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/lualatex/luainputenc/README b/Master/texmf-dist/doc/lualatex/luainputenc/README new file mode 100644 index 00000000000..80a5f4c833a --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/luainputenc/README @@ -0,0 +1,90 @@ + The luainputenc LaTeX2e package + + +luainputenc is an adaptation of inputenc for LuaTeX, as the old inputenc does +not work (at all) with the LuaTeX engine. + +You need luatextra to use this package. + +Please note that you have to use this package even for UTF-8 encoded sources. +This is needed for compatibility with non-Unicode fonts and may be worked around +in the future. + +This package automatically calls the old inputenc when running with pdfTeX, and +xetex-inputenc when running XeTeX, so you can safely use it with all your +documents. + +Please see luatextra-reference.pdf for an introduction. + +This package is developed on <http://github.com/eroux/lualatex/tree/master>. + +Installation +------------ + +Here are the recommended installation methods (preferred first). + +1. If you are using TeX Live 2008 or later, use 'tlmgr install luainputenc'. +Alternatively, try your (TeX or Linux) distribution's package management system. + +2. a. Grab luainputenc.tds.zip on the CTAN. + b. Unzip it at the root of one or your TDS trees. + c. You may need to update some filename database after, see your TeX +distribution's manual for details. + +3. a. Grab the sources from CTAN or github. + b. Run 'make install TEXMF=/path/to/texmf'. + c. See 2c. + +4. Try to figure it out by looking at the Makefile and comments in the sources. + + +Manifest +-------- + +Source files: + luainputenc.dtx the single file source & doc + luainputenc.pdf the documentation + +Derived files: + luainputenc.pdf the documentation + luainputenc.sty the LaTeX package + luainputenc.lua the lua functions for encoding translation + lutf8.def replacement for utf8.def + lutf8x.def idem, with new functionalities for Unicode fonts + eu2enc.def definition of the EU2 (Unicode) font encoding + for LuaTeX + eu2lmr.fd: lmodern font definition for the EU2 encoding + inputenc.sty.diff: patch for inputenc.sty to load luainputenc + automatically if running LuaTeX + +License +------- + +This work is under the CC0 license, with an additional restriction: +the article 6 of the LaTeX Project Public License (lppl), that applies to code +that has been taken from LaTeX files. + +You can find the text of the lppl at + +The lppl can be found at http://www.latex-project.org/lppl.txt + +You can find the CC0 full text at + +http://creativecommons.org/publicdomain/zero/1.0/legalcode + +The file luainputenc.dtx contains code with the lppl restriction as well as the +derived files + luainputenc.sty + lutf8.def + lutf8x.def + +For further details about their license, please see the comments in these files. + +The other derived files are + luainputenc.lua + inputenc.sty.diff + eu2enc.def + eu2lmr.fd + +These files are under the CC0 license only. + diff --git a/Master/texmf-dist/doc/lualatex/luainputenc/inputenc.sty.diff b/Master/texmf-dist/doc/lualatex/luainputenc/inputenc.sty.diff new file mode 100644 index 00000000000..80e17e3c746 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/luainputenc/inputenc.sty.diff @@ -0,0 +1,24 @@ + + \ifnum\@tempcnta<`#2\relax + \advance\@tempcnta\@ne + \repeat} ++ ++\begingroup\expandafter\expandafter\expandafter\endgroup ++\expandafter\ifx\csname XeTeXversion\endcsname\relax\else ++ \RequirePackage{xetex-inputenc} ++ \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xetex-inputenc}} ++ \ProcessOptions* ++ \expandafter\endinput ++\fi ++\begingroup\expandafter\expandafter\expandafter\endgroup ++\expandafter\ifx\csname directlua\endcsname\relax\else ++ \RequirePackage{luainputenc} ++ \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{luainputenc}} ++ \ProcessOptions* ++ \expandafter\endinput ++\fi ++ + \ProcessOptions + \endinput + %% + diff --git a/Master/texmf-dist/doc/lualatex/luainputenc/luainputenc.pdf b/Master/texmf-dist/doc/lualatex/luainputenc/luainputenc.pdf Binary files differnew file mode 100644 index 00000000000..8c063918cfe --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/luainputenc/luainputenc.pdf diff --git a/Master/texmf-dist/source/lualatex/luainputenc/Makefile b/Master/texmf-dist/source/lualatex/luainputenc/Makefile new file mode 100644 index 00000000000..68e17ca6e87 --- /dev/null +++ b/Master/texmf-dist/source/lualatex/luainputenc/Makefile @@ -0,0 +1,92 @@ +# Makefile for luainputenc. + +NAME = luainputenc +DOC = $(NAME).pdf +DTX = $(NAME).dtx + +# Files grouped by generation mode +COMPILED = $(DOC) +UNPACKED = eu2enc.def lutf8.def lutf8x.def eu2lmr.fd inputenc.sty.diff \ + luainputenc.sty luainputenc.lua +SOURCE = $(DTX) README Makefile +GENERATED = $(COMPILED) $(UNPACKED) + +# Files grouped by installation location +UNPACKED_DOC = inputenc.sty.diff +RUNFILES = $(filter-out $(UNPACKED_DOC), $(UNPACKED)) +DOCFILES = $(DOC) $(UNPACKED_DOC) README +SRCFILES = $(DTX) Makefile + +# The following definitions should be equivalent +# ALL_FILES = $(RUNFILES) $(DOCFILES) $(SRCFILES) +ALL_FILES = $(GENERATED) $(SOURCE) + +# Installation locations +FORMAT = lualatex +RUNDIR = $(TEXMF)/tex/$(FORMAT)/$(NAME) +DOCDIR = $(TEXMF)/doc/$(FORMAT)/$(NAME) +SRCDIR = $(TEXMF)/source/$(FORMAT)/$(NAME) +TEXMF = ./texmf + +CTAN_ZIP = $(NAME).zip +TDS_ZIP = $(NAME).tds.zip +ZIPS = $(CTAN_ZIP) $(TDS_ZIP) + +DO_TEX = tex --interaction=batchmode $< >/dev/null +DO_PDFLATEX = pdflatex --interaction=batchmode $< >/dev/null +DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) >/dev/null 2>&1 + +all: $(GENERATED) +doc: $(COMPILED) +unpack: $(UNPACKED) +ctan: $(CTAN_ZIP) +tds: $(TDS_ZIP) +world: all ctan + +$(COMPILED): $(DTX) + $(DO_PDFLATEX) + $(DO_MAKEINDEX) + $(DO_PDFLATEX) + $(DO_PDFLATEX) + +$(UNPACKED): $(DTX) + $(DO_TEX) + +$(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP) + @echo "Making $@ for CTAN upload." + @$(RM) -- $@ + @zip -9 $@ $^ >/dev/null + +define run-install +@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) +@mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR) +@mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR) +endef + +$(TDS_ZIP): TEXMF=./tmp-texmf +$(TDS_ZIP): $(ALL_FILES) + @echo "Making TDS-ready archive $@." + @$(RM) -- $@ + $(run-install) + @cd $(TEXMF) && zip -9 ../$@ -r . >/dev/null + @$(RM) -r -- $(TEXMF) + +.PHONY: install manifest clean mrproper + +install: $(ALL_FILES) + @echo "Installing in '$(TEXMF)'." + $(run-install) + +manifest: + @echo "Source files:" + @for f in $(SOURCE); do echo $$f; done + @echo "" + @echo "Derived files:" + @for f in $(GENERATED); do echo $$f; done + +clean: + @$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg + +mrproper: clean + @$(RM) -- $(GENERATED) $(ZIPS) + diff --git a/Master/texmf-dist/source/lualatex/luainputenc/luainputenc.dtx b/Master/texmf-dist/source/lualatex/luainputenc/luainputenc.dtx new file mode 100644 index 00000000000..d52c48f60cc --- /dev/null +++ b/Master/texmf-dist/source/lualatex/luainputenc/luainputenc.dtx @@ -0,0 +1,1240 @@ +% \iffalse meta-comment +% +% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +% +% This work is under the CC0 license. As an exception, the files +% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +% See these file for more details. +% +% People who helped on this package: +% Javier Bezos +% Will Robertson +% Hans Hagen +% Heiko Oberdiek +% Javier Mugica +% +% This work consists of the main source file luainputenc.dtx +% and the derived files +% luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +% eu2enc.def, eu2lmr.fd and luainputenc.pdf +% +% Unpacking: +% tex luainputenc.dtx +% Documentation: +% pdflatex luainputenc.dtx +% +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: luainputenc 2009/04/15 v0.93 inputenc package for LuaTeX} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax + +\preamble +This is a generated file. + +Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> + +This work is under the CC0 license. As an exception, the files +luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +See these file for more details. + +People who helped on this package: + Javier Bezos + Will Robertson + Hans Hagen + Heiko Oberdiek + Javier Mugica + +This work consists of the main source file luainputenc.dtx +and the derived files + luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, + eu2enc.def, eu2lmr.fd and luainputenc.pdf + +\endpreamble + +\let\MetaPrefix\DoubleperCent + +\generate{% + \usedir{tex/lualatex/luainputenc}% + \file{luainputenc.sty}{\from{luainputenc.dtx}{package}}% + \file{lutf8.def}{\from{luainputenc.dtx}{def}}% + \file{lutf8x.def}{\from{luainputenc.dtx}{defx}}% + \file{eu2enc.def}{\from{luainputenc.dtx}{eu2}}% + \file{eu2lmr.fd}{\from{luainputenc.dtx}{lmr}}% +} + +% The following hacks are to generate a lua file with lua comments starting by +% -- instead of %% + +\def\MetaPrefix{-- } + +\def\luapostamble{% + \MetaPrefix^^J% + \MetaPrefix\space End of File `\outFileName'.% +} + +\def\currentpostamble{\luapostamble}% + +\generate{% + \usedir{tex/lualatex/luainputenc}% + \file{luainputenc.lua}{\from{luainputenc.dtx}{lua}}% +} + +\nopreamble +\nopostamble + +\generate{% + \file{inputenc.sty.diff}{\from{luainputenc.dtx}{patch}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* files into a directory searched by TeX:} +\Msg{*} +\Msg{* luainputenc.sty luainputenc.lua lutf8.def lutf8x.def} +\Msg{* eu2enc.def eu2lmr.fd} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +% \iffalse +%<package> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{luainputenc} +%<package> [2009/04/15 v0.93 inputenc package for LuaTeX] +%<package> +% \fi +%<*driver> +\documentclass{ltxdoc} +\usepackage[lmargin=5cm, textwidth=14cm]{geometry} +\EnableCrossrefs +\CodelineIndex +\begin{document} + \DocInput{luainputenc.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{0} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \GetFileInfo{luainputenc.sty} +% +% \title{The \textsf{luainputenc} package} +% \date{2009/04/15 v0.93} +% \author{Elie Roux \\ \texttt{elie.roux@telecom-bretagne.eu}} +% +% \maketitle +% +% \begin{abstract} +% Input encoding management for Lua\TeX . For an introduction on this package (among others), please refer to \texttt{luatex-reference.pdf}. +% \end{abstract} +% +% \tableofcontents +% +% \section{Documentation} +% +% \subsection{Introduction} +% +% One the the most interesting new features of Lua\TeX\ is the fact that it is (like Omega/Aleph) not limited to 256 characters, and can now understand Unicode. The problem is that it does not read input the way older engines (like pdf\TeX) do, and thus \textsf{inputenc} is totally broken with Lua\TeX . This package aims at replacing \textsf{inputenc} for Lua\TeX , by adapting the way Lua\TeX\ handles input, and the way \textsf{inputenc} handles UTF-8. This package has two very distinct modes: 8-bit and UTF-8. +% +% \subsection{Overview of 8-bit mode} +% +% This package \textbf{does not} map 8-bit encodings to utf8. It allows Lua\TeX\ to read 8-bit characters, by converting each byte into a unicode character with the same character number. The resulting unicode characters are not true UTF-8, they are what we will call ``fake UTF-8". For example the byte 225 will be converted into the unicode character with number 225 (two bytes long). It will be true UTF-8 only if the encoding is latin1. +% +% Here is how it works: the 8-bit encodings are converted into fake UTF-8, so that the corresponding tokens are chars with the good numbers. Then (like \textsf{inputenc}) it reads the char numbers, and converts it into LICR (\LaTeX\ Internal Character Representation), with the font encoding. +% +% \textsf{luainputenc} only changes the input behaviour, it does not change the ouput behaviour (when files are written for example). The consequence is that files will still be written by Lua\TeX\ in UTF-8 (fake UTF-8 in this case), even if the asked input encoding is a 8-bit encoding. In most cases it's not a problem, as most files will be written in LICR, meaning ASCII, which is both 8-bit and UTF-8. The problem comes when characters with a number $>$ 128 are written in a 8-bit encoding. This may happen if you use |\protect| in a section for example. In these cases, Lua\TeX\ will write fake UTF-8, and try to read 8-bit encoding, so it will get confused. +% +% The proposed solution is to unactivate the input conversion when we read certain files or extentions. This package should work with no change for most documents, but if you cook your own aux files with an unknown extention, you may have to force the package to read some files in UTF-8 instead of 8-bit. See comments in the \texttt{.sty} file to know the useful commands. +% +% \subsection{Overview of UTF-8 mode} +% +% The behaviour of \textsf{inputenc} in utf8 mode is to read the input byte by byte, and decide if the character we are in is 1, 2, 3 or 4 bytes long, and then read other bytes accordingly. This behaviour fails with Lua\TeX\ because it reads input character by character (characters do not have a fixed number of bytes in unicode). The result is thus an error. +% +% All characters recognized by \TeX\ are active characters, that correspond to a LICR macro. Then \textsf{inputenc} reads the \texttt{*.dfu} files that contain the correspondance between these LICR macros and a character number in the fonts for different font encodings (T1, OT1, etc.). +% +% \subsubsection{legacy mode} +% +% \textsf{luainputenc} can get this behaviour (we will call it \emph{legacy mode}, but another difference implied by the fact that Lua\TeX\ can read more than 256 characters is that fonts can also have more than 256 characters. Lua\TeX\ can thus read unicode fonts. If we want to use unicode fonts (OTF for example), we can't use the \emph{legacy mode} anymore, as it would mean that we would have to rewrite a specially long \texttt{unicode.dfu} file, and it would be totally inefficient, as for instance \texttt{\'e} (unicode character number 233) would be mapped to \texttt{\string\'e}, and then mapped back to \texttt{\string\char\ 233}. +% +% \subsubsection{unicode font mode} +% +% To fix this, the most simple solution is to desactivate all activated characters, thus typing \texttt{\'e} will directly call \texttt{\string\char\ 233} in the unicode fonts, and produce a \texttt{\'e}. We will call this behaviour the \emph{unicode font mode}. To enable this mode, you can use the option \texttt{unactivate} in \textsf{luainputenc}, and you must use the font encoding \texttt{EU2} provided by this package too. See section \ref{s:eu2} for more details about \texttt{EU2}. To use this mode with \texttt{EU2}, you must be able to open OTF fonts. A simple way to do so it by using the package \textsf{luaotfload}. +% +% \subsubsection{mixed mode} +% +% But the \emph{unicode font mode} has a strong limitation (that will certainly dissapear with time): it cannot use non-unicode fonts. If you want to mix unicode fonts and old fonts, you'll have to use the \emph{mixed mode}. In this mode you can type some parts of your document in \emph{legacy mode} and some in \emph{unicode font mode}. The reason why we chose not to integrate this choice in the \emph{legacy mode} is that we wanted to have a mode that preserved most of the backward compatibility, to safely compile old documents; the \emph{mixed mode} introduces new things that may break old documents. To get the \emph{mixed mode}, you must pass the option \texttt{lutf8x} to \textsf{luainputenc}. This mode is the most experimental. +% +% \section{Files} +% +% This package contains a \texttt{.sty} file for both \LaTeX\ and Plain, a patch for inputenc to use \textsf{luainputenc} so that you can process old documents without changing anything, and the lua functions. +% +% \subsection{\texttt{inputenc.sty} patch} +% +% A good thing would be to patch \textsf{inputenc} to load \textsf{luainputenc} instead, so that you don't have to change your documents to load \textsf{luainputenc} especially. The \LaTeX\ team is extremely conservative and does not want this patch applied (maybe we will find a solution later). Here is a patch for inputenc.sty: +% +% \iffalse +%<*patch> +% \fi +% +% +% \begin{macrocode} + + \ifnum\@tempcnta<`#2\relax + \advance\@tempcnta\@ne + \repeat} ++ ++\begingroup\expandafter\expandafter\expandafter\endgroup ++\expandafter\ifx\csname XeTeXversion\endcsname\relax\else ++ \RequirePackage{xetex-inputenc} ++ \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xetex-inputenc}} ++ \ProcessOptions* ++ \expandafter\endinput ++\fi ++\begingroup\expandafter\expandafter\expandafter\endgroup ++\expandafter\ifx\csname directlua\endcsname\relax\else ++ \RequirePackage{luainputenc} ++ \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{luainputenc}} ++ \ProcessOptions* ++ \expandafter\endinput ++\fi ++ + \ProcessOptions + \endinput + %% + +% \end{macrocode} +% +% \iffalse +%</patch> +% \fi +% +% \subsection{\texttt{luainputenc.sty}} +% +% This file has some code from \texttt{inputenc.sty}, but also provides new options, and new macros to convert from 8-bit to fake UTF-8. +% +% \iffalse +%<*package> +% \fi +% +% \begin{macrocode} +% +%% This file was adapted from inputenc.sty, which copyright is: +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 +%% 2005 2006 The LaTeX3 Project. +%% +%% inputenc.sty is under the lppl version 1.3c or later, and can be +%% found in the base LaTeX system. +%% +%% The lppl can be found at http://www.latex-project.org/lppl.txt +%% +%% The changes to inputenc.sty are Copyright 2009 Elie Roux, and are +%% under the CC0 license. +%% +%% The changes are LuaTeX support. +%% +%% This file is distributed under the CC0 license, with clause 6 of the +%% lppl as additional restrictions. + +% \end{macrocode} +% +% First we check if we are called with Lua\TeX , (pdf)\TeX or Xe\TeX . If we are called with pdf\TeX , we default to \textsf{inputenc}, and to \textsf{xetex-inputenc} if we are called with Xe\TeX . We also remap the new options to \texttt{utf8} in these cases. +% +% \begin{macrocode} + +\RequirePackage{ifluatex} +\RequirePackage{ifxetex} + +\ifxetex + \RequirePackage{xetex-inputenc} + \DeclareOption{unactivate}{\PassOptionsToPackage{utf8}{xetex-inputenc}} + \DeclareOption{lutf8}{\PassOptionsToPackage{utf8}{xetex-inputenc}} + \DeclareOption{lutf8x}{\PassOptionsToPackage{utf8}{xetex-inputenc}} + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xetex-inputenc}} + \ProcessOptions* + \expandafter\endinput +\fi + +\ifluatex\else + \RequirePackage{inputenc} + \DeclareOption{unactivate}{\PassOptionsToPackage{utf8}{inputenc}} + \DeclareOption{lutf8}{\PassOptionsToPackage{utf8}{inputenc}} + \DeclareOption{lutf8x}{\PassOptionsToPackage{utf8}{inputenc}} + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{inputenc}} + \ProcessOptions* + \expandafter\endinput +\fi + +% \end{macrocode} +% +% Here we know we are called with Lua\TeX . We first require \textsf{luatextra}, then we load the \texttt{lua} file. +% +% \begin{macrocode} + +\RequirePackage{luatextra} + +\luaUseModule{luainputenc} + +% \end{macrocode} +% +% Here is some code from \textsf{inputenc}. +% +% \begin{macrocode} + +\def\DeclareInputMath#1{% + \@inpenc@test + \bgroup + \uccode`\~#1% + \uppercase{% + \egroup + \def~% + }% +} +\def\DeclareInputText#1#2{% + \def\reserved@a##1 ${}% + \def\reserved@b{#2}% + \ifcat_\expandafter\reserved@a\meaning\reserved@b$ $_% + \DeclareInputMath{#1}{#2}% + \else + \DeclareInputMath{#1}{\IeC{#2}}% + \fi +} +\def\IeC{% + \ifx\protect\@typeset@protect + \expandafter\@firstofone + \else + \noexpand\IeC + \fi +} +% \end{macrocode} +% +% We changed a little the behaviour of this macro: we removed |\@inpenc@loop\^^?\^^ff|, because it made no sense in UTF-8 mode. We will call this line for 8-bit encodings. +% +% \begin{macrocode} +\def\inputencoding#1{% + \the\inpenc@prehook + \gdef\@inpenc@test{\global\let\@inpenc@test\relax}% + \edef\@inpenc@undefined{\noexpand\@inpenc@undefined@{#1}}% + \edef\inputencodingname{#1}% + \@inpenc@loop\^^A\^^H% + \@inpenc@loop\^^K\^^K% + \@inpenc@loop\^^N\^^_% + \advance\endlinechar\@M + \xdef\saved@space@catcode{\the\catcode`\ }% + \catcode`\ 9\relax + \input{#1.def}% + \advance\endlinechar-\@M + \catcode`\ \saved@space@catcode\relax + \ifx\@inpenc@test\relax\else + \PackageWarning{inputenc}% + {No characters defined\MessageBreak + by input encoding change to `#1'\MessageBreak}% + \fi + \the\inpenc@posthook +} +\newtoks\inpenc@prehook +\newtoks\inpenc@posthook +\def\@inpenc@undefined@#1{\PackageError{inputenc}% + {Keyboard character used is undefined\MessageBreak + in inputencoding `#1'}% + {You need to provide a definition with + \noexpand\DeclareInputText\MessageBreak or + \noexpand\DeclareInputMath before using this key.}}% +\def\@inpenc@loop#1#2{% + \@tempcnta`#1\relax + \loop + \catcode\@tempcnta\active + \bgroup + \uccode`\~\@tempcnta + \uppercase{% + \egroup + \let~\inpenc@undefined + }% + \ifnum\@tempcnta<`#2\relax + \advance\@tempcnta\@ne + \repeat} + +% \end{macrocode} +% +% Here we declare our options. Note that we remap \texttt{utf8} to \texttt{lutf8}, because we use out \texttt{lutf8.def} instead of \textsf{inputenc}'s \texttt{utf8.def}. +% +% \begin{macrocode} + +\DeclareOption{utf8}{% + \inputencoding{lutf8}% +} + +\DeclareOption{lutf8}{% + \inputencoding{lutf8}% +} + +\DeclareOption{utf8x}{% + \inputencoding{lutf8}% +} + +\DeclareOption{lutf8x}{% + \inputencoding{lutf8x}% +} + +% \end{macrocode} +% +% For the \texttt{unactivate} option, for \emph{unicode font mode}, we just don't do anything. +% +% \begin{macrocode} + +\DeclareOption{unactivate}{% + \edef\inputencodingname{unactivate}% +} + +% \end{macrocode} +% +% All other options are 8-bit encodings, so we activate the translation into fake UTF-8, and we execute the loop we removes from |\inputencoding|. +% +% \begin{macrocode} + +\DeclareOption*{% + \lIE@activate % + \@inpenc@loop\^^?\^^ff% + \inputencoding{\CurrentOption}% +} + +% \end{macrocode} +% +% |\lIE@setstarted| and |\lIE@setstopped| are called when the fake UTF-8 translation must be activated or desactivated. You can call them several successive times. They are called very often, even if the package is not activated (for example if it's loaded with the utf8 option), but they act only if the package is activated. +% +% \begin{macrocode} + +\newcommand*\lIE@setstarted[0]{% + \ifnum\lIE@activated=1 % + \luadirect{luainputenc.setstarted()}% + \fi % +} + +\newcommand*\lIE@setstopped[0]{% + \ifnum\lIE@activated=1 % + \luadirect{luainputenc.setstopped()}% + \fi % +} + +% \end{macrocode} +% +% The following 5 macros are made to declare a file that will have to be read in fake UTF-8 and not in 8-bit. These files are the ones that will be generated by \TeX . In \textbf{no way} this means you can include true UTF-8 files, it means that you can include files that have been written by Lua\TeX\ with \textsf{luainputenc}, which means files in fake UTF-8. The macros are very simple, when you call them with a file name (the same as the one you will use with \string\input ), it will read it with or without the fake UTF-8 translation. This package includes a whole bunch of extentions that will be read in fake UTF-8, so the occasions to use these macros will be rare, but if you use them, please report it to the package maintainer. +% +% \begin{macro}{\lIE@SetUtfFile} +% +% If you call this macro with a file name, each time you will input this file, it will be read in fake UTF-8. You can call it with a file that you generate with Lua\TeX\ and that you want to include. +% +% \begin{macrocode} + +\newcommand*\lIE@SetUtfFile[1]{% + \luadirect{luainputenc.set_unicode_file([[#1]])}% +} + +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\lIE@SetNonUtfFile} +% +% Same as the previous macro, except that the file will be read as 8-bit. This macro is useful if there is an exception in an extention (see further comments). +% +% \begin{macrocode} + +\newcommand*\lIE@SetNonUtfFile[1]{% + \luadirect{luainputenc.set_non_unicode_file([[#1]])}% +} + +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\lIE@UnsetFile} +% +% This macro gives a file the default behaviour of its extention. +% +% \begin{macrocode} + +\newcommand*\lIE@UnsetFile[1]{% + \luadirect{luainputenc.unset_file([[#1]])}% +} + +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\lIE@SetUtfExt} +% +% You can tell \textsf{luainputenc} to treat all files with a particular extention in a certain way. The way the file extention is checked is to compare the four last characters of the filename. So if your extention has only three letters, you must include the preceding dot. This macro tells \textsf{luainputenc} to read all files from an extention in fake UTF-8. +% +% \begin{macrocode} + +\newcommand*\lIE@SetUtfExt[1]{% + \luadirect{luainputenc.set_unicode_extention([[#1]])}% +} + +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\lIE@SetUtfExt} +% +% Same as before, but the files will be read in 8-bit. +% +% \begin{macrocode} + +\newcommand*\lIE@SetNonUtfExt[1]{ + \luadirect{luainputenc.set_non_unicode_extention([[#1]])} +} + +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\lIE@InputUtfFile} +% +% This macro inputs a file in fake UTF-8. It has the ``feature" to unset the behaviour on the file you will call, so to be safe, you must call them with files for which the behaviour has not been set. +% +% \begin{macrocode} + + +\newcommand*\lIE@InputUtfFile[1]{% + \lIE@SetUtfFile{#1}% + \input #1% + \lIE@UnsetFile{#1}% +} + +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\lIE@InputNonUtfFile} +% +% Same as before, but to read a file as 8-bit. +% +% \begin{macrocode} + +\newcommand*\lIE@InputNonUtfFile[1]{% + \lIE@SetNonUtfFile{#1}% + \input #1% + \lIE@UnsetFile{#1}% +} + +% \end{macrocode} +% +% \end{macro} +% +% Two definitions to put the previous two macros in the user space. +% +% \begin{macrocode} + +\newcommand*\InputUtfFile[1]{% + \lIE@InputUtfFile{#1}% +} + +\newcommand*\InputNonUtfFile[1]{% + \lIE@InputNonUtfFile{#1}% +} + +\newcount\lIE@activated + +\newcommand*{\lIE@activate}[0]{% + \lIE@activated=1 % + \lIE@setstarted % +} + +\newcommand*{\lIE@FromInputenc}[1]{% + \ifnum\lIE@activated=0 % + \lIE@activate % + \fi% +} + +\ProcessOptions* + +% \end{macrocode} +% +% \iffalse +%</package> +% \fi +% +% \iffalse +%<*def> +% \fi +% +% \subsection{\texttt{lutf8.def}} +% +% \begin{macrocode} +%% This file was adapted from utf8.def, which copyright is: +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +%% 2004 2005 2006 The LaTeX3 Project. +%% +%% utf8.def is under the lppl version 1.3c or later, and can be found +%% in the base LaTeX system. +%% +%% The lppl can be found at http://www.latex-project.org/lppl.txt +%% +%% The changes to utf8.def are Copyright 2009 Elie Roux, and are under +%% the CC0 license. +%% +%% The changes are LuaTeX support. +%% +%% This file is distributed under the CC0 license, with clause 6 of the +%% lppl as additional restrictions. + +% \end{macrocode} +% +% Most of the file is taken from \texttt{utf8.def}, the main changes are commented. A lot of code was removed, especially the codes that analysed the unicode characters byte by byte. +% +% \begin{macrocode} + + +\ProvidesFile{lutf8.def} + [2009/04/15 v0.93 UTF-8 support for luainputenc] + +\makeatletter +\catcode`\ \saved@space@catcode + +\@inpenc@test + +\ifx\@begindocumenthook\@undefined + \makeatother + \endinput \fi + +% \end{macrocode} +% +% This function is changed a lot. Its aim is to map the character (first argument) to a macro (second argument). In \texttt{utf8.def} it was complicated as unicode was analyzed byte by byte. With Lua\TeX\ it is extremely simple, we just have to activate the character, and call a traditional |\DeclareInputTeXt|. +% +% \begin{macrocode} + +\gdef\DeclareUnicodeCharacter#1#2{% + \@tempcnta"#1% + \catcode\@tempcnta\active % + \DeclareInputText{\the\@tempcnta}{#2}% +} + +\@onlypreamble\DeclareUnicodeCharacter + +\def\cdp@elt#1#2#3#4{% + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding + #1}% + \catcode`\ 9\relax}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% +} +\cdp@list + +\def\DeclareFontEncoding@#1#2#3{% + \expandafter % + \ifx\csname T@#1\endcsname\relax % + \def\cdp@elt{\noexpand\cdp@elt}% + \xdef\cdp@list{\cdp@list\cdp@elt{#1}% + {\default@family}{\default@series}% + {\default@shape}}% + \expandafter\let\csname#1-cmd\endcsname\@changed@cmd % + \begingroup % + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding #1}}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% + \endgroup + \else + \@font@info{Redeclaring font encoding #1}% + \fi + \global\@namedef{T@#1}{#2}% + \global\@namedef{M@#1}{\default@M#3}% + \xdef\LastDeclaredEncoding{#1}% +} + +\DeclareUnicodeCharacter{00A9}{\textcopyright} +\DeclareUnicodeCharacter{00AA}{\textordfeminine} +\DeclareUnicodeCharacter{00AE}{\textregistered} +\DeclareUnicodeCharacter{00BA}{\textordmasculine} +\DeclareUnicodeCharacter{02C6}{\textasciicircum} +\DeclareUnicodeCharacter{02DC}{\textasciitilde} +\DeclareUnicodeCharacter{200C}{\textcompwordmark} +\DeclareUnicodeCharacter{2026}{\textellipsis} +\DeclareUnicodeCharacter{2122}{\texttrademark} +\DeclareUnicodeCharacter{2423}{\textvisiblespace} + +% \end{macrocode} +% +% \iffalse +%</def> +% \fi +% +% \iffalse +%<*defx> +% \fi +% +% \subsection{\texttt{lutf8x.def}} +% +% \begin{macrocode} +%% This file was adapted from utf8.def, which copyright is: +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +%% 2004 2005 2006 The LaTeX3 Project. +%% +%% utf8.def is under the lppl version 1.3c or later, and can be found +%% in the base LaTeX system. +%% +%% The lppl can be found at http://www.latex-project.org/lppl.txt +%% +%% The changes to utf8.def are Copyright 2009 Elie Roux, and are under +%% the CC0 license. +%% +%% The changes are LuaTeX support. +%% +%% This file is distributed under the CC0 license, with clause 6 of the +%% lppl as additional restrictions. + +% \end{macrocode} +% +% This file is mostly the code from \texttt{lutf.def}, but it adds mechanisms to pass from \emph{legacy mode} to \emph{unicode font mode}. The trick is to put in a lua table all characters that are activated by the \emph{legacy mode}, and to unactivate them when we switch to \emph{unicode font mode}. This is made (almost) entirely in lua. The difficult part is the changes in |\DeclareFontEncoding|. +% +% \begin{macrocode} + +\ProvidesFile{lutf8x.def} + [2009/04/15 v0.93 UTF-8 support for luainputenc] + +\makeatletter +\catcode`\ \saved@space@catcode + +\@inpenc@test + +\ifx\@begindocumenthook\@undefined + \makeatother + \endinput \fi + +% \end{macrocode} +% +% We change it a little to add the activated character in the lua table. +% +% \begin{macrocode} + +\gdef\DeclareUnicodeCharacter#1#2{% + \@tempcnta"#1% + \luadirect{luainputenc.declare_character('\the\@tempcnta')}% + \catcode\@tempcnta\active % + \DeclareInputText{\the\@tempcnta}{#2}% +} + +\@onlypreamble\DeclareUnicodeCharacter + +\def\cdp@elt#1#2#3#4{% + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding + #1}% + \catcode`\ 9\relax}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% +} +\cdp@list + +% \end{macrocode} +% +% The macros to change from/to \emph{legacy mode} to/from \emph{unicode font mode}. +% +% \begin{macrocode} + +\def\lIE@ActivateUnicodeCatcodes{% +\luadirect{luainputenc.activate_characters()}% +} + +\def\lIE@DesactivateUnicodeCatcodes{% +\luadirect{luainputenc.desactivate_characters()}% +} + +\def\lIE@CharactersActivated{% +\luadirect{luainputenc.force_characters_activated()} +} + +\edef\lIE@EU{EU2} + +% \end{macrocode} +% +% We add some code to automatically activate or unactivate characters according to the encoding changes. Note that we override |\@@enc@update|, which may pose some problems if a package of yours does it too. Fortunately this package is the only one that does it in \TeX Live. +% +% \begin{macrocode} + +\def\DeclareFontEncoding@#1#2#3{% + \edef\lIE@test{#1}% + \ifx\lIE@test\lIE@EU % + \ifx\LastDeclaredEncoding\lIE@EU\else % + \lIE@CharactersActivated % + \lIE@DesactivateUnicodeCatcodes % + \fi + \gdef\@@enc@update{% + \edef\lIE@test{#1}% + \ifx\f@encoding\lIE@EU % + \lIE@DesactivateUnicodeCatcodes % + \else % + \lIE@ActivateUnicodeCatcodes % + \fi + \expandafter\let\csname\cf@encoding-cmd\endcsname\@changed@cmd + \expandafter\let\csname\f@encoding-cmd\endcsname\@current@cmd + \default@T + \csname T@\f@encoding\endcsname + \csname D@\f@encoding\endcsname + \let\enc@update\relax + \let\cf@encoding\f@encoding + } + \else % + \expandafter % + \ifx\csname T@#1\endcsname\relax % + \def\cdp@elt{\noexpand\cdp@elt}% + \xdef\cdp@list{\cdp@list\cdp@elt{#1}% + {\default@family}{\default@series}% + {\default@shape}}% + \expandafter\let\csname#1-cmd\endcsname\@changed@cmd % + \begingroup % + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding #1}}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% + \endgroup + \else + \@font@info{Redeclaring font encoding #1}% + \fi + \fi % + \global\@namedef{T@#1}{#2}% + \global\@namedef{M@#1}{\default@M#3}% + \xdef\LastDeclaredEncoding{#1}% +} + +\DeclareUnicodeCharacter{00A9}{\textcopyright} +\DeclareUnicodeCharacter{00AA}{\textordfeminine} +\DeclareUnicodeCharacter{00AE}{\textregistered} +\DeclareUnicodeCharacter{00BA}{\textordmasculine} +\DeclareUnicodeCharacter{02C6}{\textasciicircum} +\DeclareUnicodeCharacter{02DC}{\textasciitilde} +\DeclareUnicodeCharacter{200C}{\textcompwordmark} +\DeclareUnicodeCharacter{2026}{\textellipsis} +\DeclareUnicodeCharacter{2122}{\texttrademark} +\DeclareUnicodeCharacter{2423}{\textvisiblespace} + +% \end{macrocode} +% +% \iffalse +%</defx> +% \fi +% +% \iffalse +%<*eu2> +% \fi +% +% \subsection{\texttt{eu2enc.def}\label{s:eu2}} +% +% This file is extremely short. It just declares the encoding, with the default font. The default font here is lmr, which means that \LaTeX\ will read \texttt{eu2lmr.fd}. The problem is that all unicode fonts are OTF fonts, so \texttt{eu2lmr.fd} will call OTF fonts. Thus, to use \texttt{EU2}, you need to be able to read OTF fonts. The package \textsf{luaotfload} is a good choice to be able to do so. +% +% \begin{macrocode} + +\ProvidesFile{eu2enc.def}[2009/04/15 v0.1 + a unicode font encoding for LuaTeX.] +\DeclareFontEncoding{EU2}{}{} +\DeclareErrorFont{EU2}{lmr}{m}{n}{10} +\DeclareFontSubstitution{EU2}{lmr}{m}{n} + +% \end{macrocode} +% +% \iffalse +%</eu2> +% \fi +% +% \iffalse +%<*lmr> +% \fi +% +% \subsection{\texttt{eu2lmr.fd}} +% +% This file simply describes the default (lmr) font of the \texttt{EU2} encoding. It loads the otf fonts with some default features enabled. This file may change, don't rely on it too much. +% +% \begin{macrocode} + +\ProvidesFile{eu2lmr.fd} + [2009/04/15 v0.1 Font defs for Latin Modern for LuaTeX's EU2 encoding] +\DeclareFontFamily{EU2}{lmr}{} +\DeclareFontShape{EU2}{lmr}{m}{n}% + {<-5.5> "lmroman5-regular:+tlig;+tsub;+liga" + <5.5-6.5> "lmroman6-regular:+tlig;+tsub;+liga" + <6.5-7.5> "lmroman7-regular:+tlig;+tsub;+liga" + <7.5-8.5> "lmroman8-regular:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-regular:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-regular:+tlig;+tsub;+liga" + <11-15> "lmroman12-regular:+tlig;+tsub;+liga" + <15-> "lmroman17-regular:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{m}{sl}% + {<-8.5> "lmroman8-oblique:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-oblique:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-oblique:+tlig;+tsub;+liga" + <11-15> "lmroman12-oblique:+tlig;+tsub;+liga" + <15-> "lmroman17-oblique:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{m}{it}% + {<-7.5> "lmroman7-italic:+tlig;+tsub;+liga" + <7.5-8.5> "lmroman8-italic:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-italic:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-italic:+tlig;+tsub;+liga" + <11-> "lmroman12-italic:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{m}{sc}% + {<-> "lmroman10-capsregular:+tlig;+tsub;+liga"}{} +% +% Is this the right 'shape'?: +\DeclareFontShape{EU2}{lmr}{m}{scsl}% + {<-> "lmroman10-capsoblique:+tlig;+tsub;+liga"}{} +%%%%%%% bold series +\DeclareFontShape{EU2}{lmr}{b}{n} + {<-> "lmroman10-demi:+tlig;+tsub;+liga"}{} +\DeclareFontShape{EU2}{lmr}{b}{sl} + {<-> "lmroman10-demioblique:+tlig;+tsub;+liga"}{} +%%%%%%%% bold extended series +\DeclareFontShape{EU2}{lmr}{bx}{n} + {<-5.5> "lmroman5-bold:+tlig;+tsub;+liga" + <5.5-6.5> "lmroman6-bold:+tlig;+tsub;+liga" + <6.5-7.5> "lmroman7-bold:+tlig;+tsub;+liga" + <7.5-8.5> "lmroman8-bold:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-bold:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-bold:+tlig;+tsub;+liga" + <11-> "lmroman12-bold:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{bx}{it} + {<-> "lmroman10-bolditalic:+tlig;+tsub;+liga"}{} +\DeclareFontShape{EU2}{lmr}{bx}{sl} + {<-> "lmroman10-boldoblique:+tlig;+tsub;+liga"}{} + +% \end{macrocode} +% +% \iffalse +%</lmr> +% \fi +% +% \subsection{\texttt{luainputenc.lua}} +% +% First the \texttt{inputenc} module is registered as a Lua\TeX\ module, with some informations. +% +% \iffalse +%<*lua> +% \fi +% +% \begin{macrocode} + +luainputenc = { } + +luainputenc.module = { + name = "luainputenc", + version = 0.93, + date = "2009/04/15", + description = "Lua simple inputenc package.", + author = "Elie Roux", + copyright = "Elie Roux", + license = "CC0", +} + +luatextra.provides_module(luainputenc.module) + +local format = string.format + +luainputenc.log = luainputenc.log or function(...) + luatextra.module_log('luainputenc', format(...)) +end + +local char, utfchar, byte, format, gsub = +string.char, unicode.utf8.char, string.byte, string.format, string.gsub + +local started, stopped = 1, 0 + +luainputenc.state = stopped + +function luainputenc.setstate(state) + if state == luainputenc.state then + return + elseif state == started then + luainputenc.start() + else + luainputenc.stop() + end +end + +function luainputenc.setstarted() + luainputenc.setstate(started) +end + +function luainputenc.setstopped() + luainputenc.setstate(stopped) +end + +% \end{macrocode} +% +% The function to transform a 8-bit character in the corresponding fake UTF-8 character. +% +% \begin{macrocode} + +function luainputenc.byte_to_utf(c) + return utfchar(byte(c)) +end + +% \end{macrocode} +% +% The function that will be registered in the \texttt{process\_input\_buffer} callback when needed. +% +% \begin{macrocode} + +function luainputenc.fake_utf(buf) + return gsub(buf,"(.)", luainputenc.byte_to_utf) +end + +% \end{macrocode} +% +% \texttt{start()} and \texttt{stop()} are the functions that register or unregister the function in the callback. When the function is registered, Lua\TeX\ reads the input in fake UTF-8. +% +% \begin{macrocode} + +function luainputenc.start() + callback.add('process_input_buffer', luainputenc.fake_utf, + 'luainputenc.fake_utf') + luainputenc.state = started + if luainputenc.callback_registered == 0 then + luainputenc.register_callback() + end +end + +function luainputenc.stop() + callback.remove('process_input_buffer', 'luainputenc.fake_utf') + luainputenc.state = stopped + return +end + +% \end{macrocode} +% +% Here is a list of all file extentions for which we consider that the files have been written by Lua\TeX , and thus must be read in fake UTF-8. I may have forgotten things in the list. If you find a new extention, please report the maintainer. +% +% \begin{macrocode} + +luainputenc.unicode_extentions = { + ['.aux'] = 1, -- basic files + ['.toc'] = 1, + ['.gls'] = 1, + ['.ind'] = 1, + ['.idx'] = 1, + ['.vrb'] = 1, -- beamer and powerdot + ['.nav'] = 1, -- other beamer extentions + ['.sol'] = 1, + ['.qsl'] = 1, + ['.snm'] = 1, + ['.pgn'] = 1, -- pagereference + ['.cpg'] = 1, -- AlProTeX + ['.pst'] = 1, -- pst-tree + ['.tmp'] = 1, -- sauerj/collect + ['.sym'] = 1, -- listofsymbols + ['.sub'] = 1, -- listofsymbols + ['.lof'] = 1, -- preprint + ['.lot'] = 1, -- preprint + ['mtc1'] = 1, -- minitoc + ['.ovr'] = 1, -- thumbss + ['.fff'] = 1, -- endplate + ['.sbb'] = 1, -- splitbib + ['.bbl'] = 1, -- latex + ['.ain'] = 1, -- authorindex + ['.abb'] = 1, -- juraabbrev + ['.ent'] = 1, -- endnotes + ['.end'] = 1, -- fn2end + ['.thm'] = 1, -- ntheorem + ['.xtr'] = 1, -- extract + ['.han'] = 1, -- linguho + ['.bnd'] = 1, -- bibref + ['.bbl'] = 1, -- bibref + ['.col'] = 1, -- mwrite + ['.ttt'] = 1, -- endfloat + ['.fax'] = 1, -- lettre + ['.tns'] = 1, -- lettre + ['.odt'] = 1, -- lettre + ['.etq'] = 1, -- lettre + ['.emd'] = 1, -- poemscol + ['.emx'] = 1, -- poemscol + ['.ctn'] = 1, -- poemscol + ['.hst'] = 1, -- vhistory + ['.acr'] = 1, -- crosswrd + ['.dwn'] = 1, -- crosswrd + ['.ttc'] = 1, -- talk + -- ['.txt'] = 1, -- coverpage, but not sure it's safe to include it... + ['.eve'] = 1, -- calend0 + ['.scn'] = 1, -- cwebmac + } + +% \end{macrocode} +% +% The code to define a specific behaviour for certain files. +% +% \begin{macrocode} + +luainputenc.unicode_files = {} + +luainputenc.non_unicode_files = {} + +function luainputenc.set_unicode_file(filename) + if luainputenc.non_unicode_files[filename] == 1 then + luainputenc.non_unicode_files[filename] = nil + end + luainputenc.unicode_files[filename] = 1 +end + +function luainputenc.set_non_unicode_file(filename) + if luainputenc.unicode_files[filename] == 1 then + luainputenc.unicode_files[filename] = nil + end + luainputenc.non_unicode_files[filename] = 1 +end + +function luainputenc.set_unicode_extention(ext) + luainputenc.unicode_extention[ext] = 1 +end + +function luainputenc.set_non_unicode_extention(ext) + if luainputenc.unicode_extentions[ext] == 1 then + luainputenc.unicode_extentions[ext] = nil + end +end + +function luainputenc.unset_file(filename) + if luainputenc.unicode_files[filename] == 1 then + luainputenc.unicode_files[filename] = nil + elseif luainputenc.non_unicode_files[filename] == 1 then + luainputenc.non_unicode_files[filename] = nil + end +end + +local unicode, non_unicode = stopped, started + +function luainputenc.find_state(filename) + if luainputenc.unicode_files[filename] == 1 then + return unicode + elseif luainputenc.non_unicode_files[filename] == 1 then + return non_unicode + else + local ext = filename:sub(-4) + if luainputenc.unicode_extentions[ext] == 1 then + return unicode + else + return non_unicode + end + end +end + +% \end{macrocode} +% +% We register the functions to stop or start the fake UTF-8 translation in the appropriate callbacks if necessary. +% +% \begin{macrocode} + +function luainputenc.pre_read_file(env) + local currentstate = luainputenc.state + luainputenc.setstate(luainputenc.find_state(env.filename)) + env.previousstate = currentstate +end + +function luainputenc.close(env) + luainputenc.setstate(env.previousstate) +end + +luainputenc.callback_registered = 0 + +function luainputenc.register_callback() + if luainputenc.callback_registered == 0 then + callback.add('pre_read_file', luainputenc.pre_read_file, + 'luainputenc.pre_read_file') + callback.add('file_close', luainputenc.close, 'luainputenc.close') + luainputenc.callback_registered = 1 + end +end + +% \end{macrocode} +% +% Finally we provide some functions to activate or disactivate the catcodes of the non-ASCII characters. +% +% \begin{macrocode} + +luainputenc.activated_characters = {} +luainputenc.characters_are_activated = false + +function luainputenc.declare_character(c) + luainputenc.activated_characters[tonumber(c)] = true +end + +function luainputenc.force_characters_activated () + luainputenc.characters_are_activated = true +end + +function luainputenc.activate_characters() + if not luainputenc.characters_are_activated then + for n, _ in pairs(luainputenc.activated_characters) do + tex.sprint(string.format('\\catcode %d\\active',n)) + end + luainputenc.characters_are_activated = true + end +end + +function luainputenc.desactivate_characters() + if luainputenc.characters_are_activated then + for n, _ in pairs(luainputenc.activated_characters) do + tex.sprint(string.format('\\catcode %d=11',n)) + end + luainputenc.characters_are_activated = false + end +end + +% \end{macrocode} +% +% \iffalse +%</lua> +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/tex/lualatex/luainputenc/eu2enc.def b/Master/texmf-dist/tex/lualatex/luainputenc/eu2enc.def new file mode 100644 index 00000000000..9699ee905d1 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luainputenc/eu2enc.def @@ -0,0 +1,37 @@ +%% +%% This is file `eu2enc.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% luainputenc.dtx (with options: `eu2') +%% This is a generated file. +%% +%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +%% +%% This work is under the CC0 license. As an exception, the files +%% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +%% See these file for more details. +%% +%% People who helped on this package: +%% Javier Bezos +%% Will Robertson +%% Hans Hagen +%% Heiko Oberdiek +%% Javier Mugica +%% +%% This work consists of the main source file luainputenc.dtx +%% and the derived files +%% luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +%% eu2enc.def, eu2lmr.fd and luainputenc.pdf +%% + +\ProvidesFile{eu2enc.def}[2009/04/15 v0.1 + a unicode font encoding for LuaTeX.] +\DeclareFontEncoding{EU2}{}{} +\DeclareErrorFont{EU2}{lmr}{m}{n}{10} +\DeclareFontSubstitution{EU2}{lmr}{m}{n} + +\endinput +%% +%% End of file `eu2enc.def'. diff --git a/Master/texmf-dist/tex/lualatex/luainputenc/eu2lmr.fd b/Master/texmf-dist/tex/lualatex/luainputenc/eu2lmr.fd new file mode 100644 index 00000000000..141dbf55342 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luainputenc/eu2lmr.fd @@ -0,0 +1,82 @@ +%% +%% This is file `eu2lmr.fd', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% luainputenc.dtx (with options: `lmr') +%% This is a generated file. +%% +%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +%% +%% This work is under the CC0 license. As an exception, the files +%% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +%% See these file for more details. +%% +%% People who helped on this package: +%% Javier Bezos +%% Will Robertson +%% Hans Hagen +%% Heiko Oberdiek +%% Javier Mugica +%% +%% This work consists of the main source file luainputenc.dtx +%% and the derived files +%% luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +%% eu2enc.def, eu2lmr.fd and luainputenc.pdf +%% + +\ProvidesFile{eu2lmr.fd} + [2009/04/15 v0.1 Font defs for Latin Modern for LuaTeX's EU2 encoding] +\DeclareFontFamily{EU2}{lmr}{} +\DeclareFontShape{EU2}{lmr}{m}{n}% + {<-5.5> "lmroman5-regular:+tlig;+tsub;+liga" + <5.5-6.5> "lmroman6-regular:+tlig;+tsub;+liga" + <6.5-7.5> "lmroman7-regular:+tlig;+tsub;+liga" + <7.5-8.5> "lmroman8-regular:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-regular:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-regular:+tlig;+tsub;+liga" + <11-15> "lmroman12-regular:+tlig;+tsub;+liga" + <15-> "lmroman17-regular:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{m}{sl}% + {<-8.5> "lmroman8-oblique:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-oblique:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-oblique:+tlig;+tsub;+liga" + <11-15> "lmroman12-oblique:+tlig;+tsub;+liga" + <15-> "lmroman17-oblique:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{m}{it}% + {<-7.5> "lmroman7-italic:+tlig;+tsub;+liga" + <7.5-8.5> "lmroman8-italic:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-italic:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-italic:+tlig;+tsub;+liga" + <11-> "lmroman12-italic:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{m}{sc}% + {<-> "lmroman10-capsregular:+tlig;+tsub;+liga"}{} +\DeclareFontShape{EU2}{lmr}{m}{scsl}% + {<-> "lmroman10-capsoblique:+tlig;+tsub;+liga"}{} +%%%%%%% bold series +\DeclareFontShape{EU2}{lmr}{b}{n} + {<-> "lmroman10-demi:+tlig;+tsub;+liga"}{} +\DeclareFontShape{EU2}{lmr}{b}{sl} + {<-> "lmroman10-demioblique:+tlig;+tsub;+liga"}{} +%%%%%%%% bold extended series +\DeclareFontShape{EU2}{lmr}{bx}{n} + {<-5.5> "lmroman5-bold:+tlig;+tsub;+liga" + <5.5-6.5> "lmroman6-bold:+tlig;+tsub;+liga" + <6.5-7.5> "lmroman7-bold:+tlig;+tsub;+liga" + <7.5-8.5> "lmroman8-bold:+tlig;+tsub;+liga" + <8.5-9.5> "lmroman9-bold:+tlig;+tsub;+liga" + <9.5-11> "lmroman10-bold:+tlig;+tsub;+liga" + <11-> "lmroman12-bold:+tlig;+tsub;+liga" + }{} +\DeclareFontShape{EU2}{lmr}{bx}{it} + {<-> "lmroman10-bolditalic:+tlig;+tsub;+liga"}{} +\DeclareFontShape{EU2}{lmr}{bx}{sl} + {<-> "lmroman10-boldoblique:+tlig;+tsub;+liga"}{} + +\endinput +%% +%% End of file `eu2lmr.fd'. diff --git a/Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.lua b/Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.lua new file mode 100644 index 00000000000..eb324f3459a --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.lua @@ -0,0 +1,259 @@ +-- +-- This is file `luainputenc.lua', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- luainputenc.dtx (with options: `lua') +-- This is a generated file. +-- +-- Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +-- +-- This work is under the CC0 license. As an exception, the files +-- luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +-- See these file for more details. +-- +-- People who helped on this package: +-- Javier Bezos +-- Will Robertson +-- Hans Hagen +-- Heiko Oberdiek +-- Javier Mugica +-- +-- This work consists of the main source file luainputenc.dtx +-- and the derived files +-- luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +-- eu2enc.def, eu2lmr.fd and luainputenc.pdf +-- + +luainputenc = { } + +luainputenc.module = { + name = "luainputenc", + version = 0.93, + date = "2009/04/15", + description = "Lua simple inputenc package.", + author = "Elie Roux", + copyright = "Elie Roux", + license = "CC0", +} + +luatextra.provides_module(luainputenc.module) + +local format = string.format + +luainputenc.log = luainputenc.log or function(...) + luatextra.module_log('luainputenc', format(...)) +end + +local char, utfchar, byte, format, gsub = +string.char, unicode.utf8.char, string.byte, string.format, string.gsub + +local started, stopped = 1, 0 + +luainputenc.state = stopped + +function luainputenc.setstate(state) + if state == luainputenc.state then + return + elseif state == started then + luainputenc.start() + else + luainputenc.stop() + end +end + +function luainputenc.setstarted() + luainputenc.setstate(started) +end + +function luainputenc.setstopped() + luainputenc.setstate(stopped) +end + + +function luainputenc.byte_to_utf(c) + return utfchar(byte(c)) +end + + +function luainputenc.fake_utf(buf) + return gsub(buf,"(.)", luainputenc.byte_to_utf) +end + + +function luainputenc.start() + callback.add('process_input_buffer', luainputenc.fake_utf, +'luainputenc.fake_utf') + luainputenc.state = started + if luainputenc.callback_registered == 0 then + luainputenc.register_callback() + end +end + +function luainputenc.stop() + callback.remove('process_input_buffer', 'luainputenc.fake_utf') + luainputenc.state = stopped + return +end + + +luainputenc.unicode_extentions = { + ['.aux'] = 1, -- basic files + ['.toc'] = 1, + ['.gls'] = 1, + ['.ind'] = 1, + ['.idx'] = 1, + ['.vrb'] = 1, -- beamer and powerdot + ['.nav'] = 1, -- other beamer extentions + ['.sol'] = 1, + ['.qsl'] = 1, + ['.snm'] = 1, + ['.pgn'] = 1, -- pagereference + ['.cpg'] = 1, -- AlProTeX + ['.pst'] = 1, -- pst-tree + ['.tmp'] = 1, -- sauerj/collect + ['.sym'] = 1, -- listofsymbols + ['.sub'] = 1, -- listofsymbols + ['.lof'] = 1, -- preprint + ['.lot'] = 1, -- preprint + ['mtc1'] = 1, -- minitoc + ['.ovr'] = 1, -- thumbss + ['.fff'] = 1, -- endplate + ['.sbb'] = 1, -- splitbib + ['.bbl'] = 1, -- latex + ['.ain'] = 1, -- authorindex + ['.abb'] = 1, -- juraabbrev + ['.ent'] = 1, -- endnotes + ['.end'] = 1, -- fn2end + ['.thm'] = 1, -- ntheorem + ['.xtr'] = 1, -- extract + ['.han'] = 1, -- linguho + ['.bnd'] = 1, -- bibref + ['.bbl'] = 1, -- bibref + ['.col'] = 1, -- mwrite + ['.ttt'] = 1, -- endfloat + ['.fax'] = 1, -- lettre + ['.tns'] = 1, -- lettre + ['.odt'] = 1, -- lettre + ['.etq'] = 1, -- lettre + ['.emd'] = 1, -- poemscol + ['.emx'] = 1, -- poemscol + ['.ctn'] = 1, -- poemscol + ['.hst'] = 1, -- vhistory + ['.acr'] = 1, -- crosswrd + ['.dwn'] = 1, -- crosswrd + ['.ttc'] = 1, -- talk + -- ['.txt'] = 1, -- coverpage, but not sure it's safe to include it... + ['.eve'] = 1, -- calend0 + ['.scn'] = 1, -- cwebmac + } + + +luainputenc.unicode_files = {} + +luainputenc.non_unicode_files = {} + +function luainputenc.set_unicode_file(filename) + if luainputenc.non_unicode_files[filename] == 1 then + luainputenc.non_unicode_files[filename] = nil + end + luainputenc.unicode_files[filename] = 1 +end + +function luainputenc.set_non_unicode_file(filename) + if luainputenc.unicode_files[filename] == 1 then + luainputenc.unicode_files[filename] = nil + end + luainputenc.non_unicode_files[filename] = 1 +end + +function luainputenc.set_unicode_extention(ext) + luainputenc.unicode_extention[ext] = 1 +end + +function luainputenc.set_non_unicode_extention(ext) + if luainputenc.unicode_extentions[ext] == 1 then + luainputenc.unicode_extentions[ext] = nil + end +end + +function luainputenc.unset_file(filename) + if luainputenc.unicode_files[filename] == 1 then + luainputenc.unicode_files[filename] = nil + elseif luainputenc.non_unicode_files[filename] == 1 then + luainputenc.non_unicode_files[filename] = nil + end +end + +local unicode, non_unicode = stopped, started + +function luainputenc.find_state(filename) + if luainputenc.unicode_files[filename] == 1 then + return unicode + elseif luainputenc.non_unicode_files[filename] == 1 then + return non_unicode + else + local ext = filename:sub(-4) + if luainputenc.unicode_extentions[ext] == 1 then + return unicode + else + return non_unicode + end + end +end + + +function luainputenc.pre_read_file(env) + local currentstate = luainputenc.state + luainputenc.setstate(luainputenc.find_state(env.filename)) + env.previousstate = currentstate +end + +function luainputenc.close(env) + luainputenc.setstate(env.previousstate) +end + +luainputenc.callback_registered = 0 + +function luainputenc.register_callback() + if luainputenc.callback_registered == 0 then + callback.add('pre_read_file', luainputenc.pre_read_file, +'luainputenc.pre_read_file') + callback.add('file_close', luainputenc.close, 'luainputenc.close') + luainputenc.callback_registered = 1 + end +end + + +luainputenc.activated_characters = {} +luainputenc.characters_are_activated = false + +function luainputenc.declare_character(c) + luainputenc.activated_characters[tonumber(c)] = true +end + +function luainputenc.force_characters_activated () + luainputenc.characters_are_activated = true +end + +function luainputenc.activate_characters() + if not luainputenc.characters_are_activated then + for n, _ in pairs(luainputenc.activated_characters) do + tex.sprint(string.format('\\catcode %d\\active',n)) + end + luainputenc.characters_are_activated = true + end +end + +function luainputenc.desactivate_characters() + if luainputenc.characters_are_activated then + for n, _ in pairs(luainputenc.activated_characters) do + tex.sprint(string.format('\\catcode %d=11',n)) + end + luainputenc.characters_are_activated = false + end +end + +-- +-- End of File `luainputenc.lua'. diff --git a/Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.sty b/Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.sty new file mode 100644 index 00000000000..9275c6b9746 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luainputenc/luainputenc.sty @@ -0,0 +1,255 @@ +%% +%% This is file `luainputenc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% luainputenc.dtx (with options: `package') +%% This is a generated file. +%% +%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +%% +%% This work is under the CC0 license. As an exception, the files +%% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +%% See these file for more details. +%% +%% People who helped on this package: +%% Javier Bezos +%% Will Robertson +%% Hans Hagen +%% Heiko Oberdiek +%% Javier Mugica +%% +%% This work consists of the main source file luainputenc.dtx +%% and the derived files +%% luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +%% eu2enc.def, eu2lmr.fd and luainputenc.pdf +%% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{luainputenc} + [2009/04/15 v0.93 inputenc package for LuaTeX] + +%% This file was adapted from inputenc.sty, which copyright is: +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 +%% 2005 2006 The LaTeX3 Project. +%% +%% inputenc.sty is under the lppl version 1.3c or later, and can be +%% found in the base LaTeX system. +%% +%% The lppl can be found at http://www.latex-project.org/lppl.txt +%% +%% The changes to inputenc.sty are Copyright 2009 Elie Roux, and are +%% under the CC0 license. +%% +%% The changes are LuaTeX support. +%% +%% This file is distributed under the CC0 license, with clause 6 of the +%% lppl as additional restrictions. + + +\RequirePackage{ifluatex} +\RequirePackage{ifxetex} + +\ifxetex + \RequirePackage{xetex-inputenc} + \DeclareOption{unactivate}{\PassOptionsToPackage{utf8}{xetex-inputenc}} + \DeclareOption{lutf8}{\PassOptionsToPackage{utf8}{xetex-inputenc}} + \DeclareOption{lutf8x}{\PassOptionsToPackage{utf8}{xetex-inputenc}} + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xetex-inputenc}} + \ProcessOptions* + \expandafter\endinput +\fi + +\ifluatex\else + \RequirePackage{inputenc} + \DeclareOption{unactivate}{\PassOptionsToPackage{utf8}{inputenc}} + \DeclareOption{lutf8}{\PassOptionsToPackage{utf8}{inputenc}} + \DeclareOption{lutf8x}{\PassOptionsToPackage{utf8}{inputenc}} + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{inputenc}} + \ProcessOptions* + \expandafter\endinput +\fi + + +\RequirePackage{luatextra} + +\luaUseModule{luainputenc} + + +\def\DeclareInputMath#1{% + \@inpenc@test + \bgroup + \uccode`\~#1% + \uppercase{% + \egroup + \def~% + }% +} +\def\DeclareInputText#1#2{% + \def\reserved@a##1 ${}% + \def\reserved@b{#2}% + \ifcat_\expandafter\reserved@a\meaning\reserved@b$ $_% + \DeclareInputMath{#1}{#2}% + \else + \DeclareInputMath{#1}{\IeC{#2}}% + \fi +} +\def\IeC{% + \ifx\protect\@typeset@protect + \expandafter\@firstofone + \else + \noexpand\IeC + \fi +} +\def\inputencoding#1{% + \the\inpenc@prehook + \gdef\@inpenc@test{\global\let\@inpenc@test\relax}% + \edef\@inpenc@undefined{\noexpand\@inpenc@undefined@{#1}}% + \edef\inputencodingname{#1}% + \@inpenc@loop\^^A\^^H% + \@inpenc@loop\^^K\^^K% + \@inpenc@loop\^^N\^^_% + \advance\endlinechar\@M + \xdef\saved@space@catcode{\the\catcode`\ }% + \catcode`\ 9\relax + \input{#1.def}% + \advance\endlinechar-\@M + \catcode`\ \saved@space@catcode\relax + \ifx\@inpenc@test\relax\else + \PackageWarning{inputenc}% + {No characters defined\MessageBreak + by input encoding change to `#1'\MessageBreak}% + \fi + \the\inpenc@posthook +} +\newtoks\inpenc@prehook +\newtoks\inpenc@posthook +\def\@inpenc@undefined@#1{\PackageError{inputenc}% + {Keyboard character used is undefined\MessageBreak + in inputencoding `#1'}% + {You need to provide a definition with + \noexpand\DeclareInputText\MessageBreak or + \noexpand\DeclareInputMath before using this key.}}% +\def\@inpenc@loop#1#2{% + \@tempcnta`#1\relax + \loop + \catcode\@tempcnta\active + \bgroup + \uccode`\~\@tempcnta + \uppercase{% + \egroup + \let~\inpenc@undefined + }% + \ifnum\@tempcnta<`#2\relax + \advance\@tempcnta\@ne + \repeat} + + +\DeclareOption{utf8}{% + \inputencoding{lutf8}% +} + +\DeclareOption{lutf8}{% + \inputencoding{lutf8}% +} + +\DeclareOption{utf8x}{% + \inputencoding{lutf8}% +} + +\DeclareOption{lutf8x}{% + \inputencoding{lutf8x}% +} + + +\DeclareOption{unactivate}{% + \edef\inputencodingname{unactivate}% +} + + +\DeclareOption*{% + \lIE@activate % + \@inpenc@loop\^^?\^^ff% + \inputencoding{\CurrentOption}% +} + + +\newcommand*\lIE@setstarted[0]{% + \ifnum\lIE@activated=1 % + \luadirect{luainputenc.setstarted()}% + \fi % +} + +\newcommand*\lIE@setstopped[0]{% + \ifnum\lIE@activated=1 % + \luadirect{luainputenc.setstopped()}% + \fi % +} + + +\newcommand*\lIE@SetUtfFile[1]{% + \luadirect{luainputenc.set_unicode_file([[#1]])}% +} + + +\newcommand*\lIE@SetNonUtfFile[1]{% + \luadirect{luainputenc.set_non_unicode_file([[#1]])}% +} + + +\newcommand*\lIE@UnsetFile[1]{% + \luadirect{luainputenc.unset_file([[#1]])}% +} + + +\newcommand*\lIE@SetUtfExt[1]{% + \luadirect{luainputenc.set_unicode_extention([[#1]])}% +} + + +\newcommand*\lIE@SetNonUtfExt[1]{ + \luadirect{luainputenc.set_non_unicode_extention([[#1]])} +} + + +\newcommand*\lIE@InputUtfFile[1]{% + \lIE@SetUtfFile{#1}% + \input #1% + \lIE@UnsetFile{#1}% +} + + +\newcommand*\lIE@InputNonUtfFile[1]{% + \lIE@SetNonUtfFile{#1}% + \input #1% + \lIE@UnsetFile{#1}% +} + + +\newcommand*\InputUtfFile[1]{% + \lIE@InputUtfFile{#1}% +} + +\newcommand*\InputNonUtfFile[1]{% + \lIE@InputNonUtfFile{#1}% +} + +\newcount\lIE@activated + +\newcommand*{\lIE@activate}[0]{% + \lIE@activated=1 % + \lIE@setstarted % +} + +\newcommand*{\lIE@FromInputenc}[1]{% + \ifnum\lIE@activated=0 % + \lIE@activate % + \fi% +} + +\ProcessOptions* + +\endinput +%% +%% End of file `luainputenc.sty'. diff --git a/Master/texmf-dist/tex/lualatex/luainputenc/lutf8.def b/Master/texmf-dist/tex/lualatex/luainputenc/lutf8.def new file mode 100644 index 00000000000..a8883724276 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luainputenc/lutf8.def @@ -0,0 +1,114 @@ +%% +%% This is file `lutf8.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% luainputenc.dtx (with options: `def') +%% This is a generated file. +%% +%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +%% +%% This work is under the CC0 license. As an exception, the files +%% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +%% See these file for more details. +%% +%% People who helped on this package: +%% Javier Bezos +%% Will Robertson +%% Hans Hagen +%% Heiko Oberdiek +%% Javier Mugica +%% +%% This work consists of the main source file luainputenc.dtx +%% and the derived files +%% luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +%% eu2enc.def, eu2lmr.fd and luainputenc.pdf +%% +%% This file was adapted from utf8.def, which copyright is: +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +%% 2004 2005 2006 The LaTeX3 Project. +%% +%% utf8.def is under the lppl version 1.3c or later, and can be found +%% in the base LaTeX system. +%% +%% The lppl can be found at http://www.latex-project.org/lppl.txt +%% +%% The changes to utf8.def are Copyright 2009 Elie Roux, and are under +%% the CC0 license. +%% +%% The changes are LuaTeX support. +%% +%% This file is distributed under the CC0 license, with clause 6 of the +%% lppl as additional restrictions. + + +\ProvidesFile{lutf8.def} + [2009/04/15 v0.93 UTF-8 support for luainputenc] + +\makeatletter +\catcode`\ \saved@space@catcode + +\@inpenc@test + +\ifx\@begindocumenthook\@undefined + \makeatother + \endinput \fi + + +\gdef\DeclareUnicodeCharacter#1#2{% + \@tempcnta"#1% + \catcode\@tempcnta\active % + \DeclareInputText{\the\@tempcnta}{#2}% +} + +\@onlypreamble\DeclareUnicodeCharacter + +\def\cdp@elt#1#2#3#4{% + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding + #1}% + \catcode`\ 9\relax}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% +} +\cdp@list + +\def\DeclareFontEncoding@#1#2#3{% + \expandafter % + \ifx\csname T@#1\endcsname\relax % + \def\cdp@elt{\noexpand\cdp@elt}% + \xdef\cdp@list{\cdp@list\cdp@elt{#1}% + {\default@family}{\default@series}% + {\default@shape}}% + \expandafter\let\csname#1-cmd\endcsname\@changed@cmd % + \begingroup % + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding #1}}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% + \endgroup + \else + \@font@info{Redeclaring font encoding #1}% + \fi + \global\@namedef{T@#1}{#2}% + \global\@namedef{M@#1}{\default@M#3}% + \xdef\LastDeclaredEncoding{#1}% +} + +\DeclareUnicodeCharacter{00A9}{\textcopyright} +\DeclareUnicodeCharacter{00AA}{\textordfeminine} +\DeclareUnicodeCharacter{00AE}{\textregistered} +\DeclareUnicodeCharacter{00BA}{\textordmasculine} +\DeclareUnicodeCharacter{02C6}{\textasciicircum} +\DeclareUnicodeCharacter{02DC}{\textasciitilde} +\DeclareUnicodeCharacter{200C}{\textcompwordmark} +\DeclareUnicodeCharacter{2026}{\textellipsis} +\DeclareUnicodeCharacter{2122}{\texttrademark} +\DeclareUnicodeCharacter{2423}{\textvisiblespace} + +\endinput +%% +%% End of file `lutf8.def'. diff --git a/Master/texmf-dist/tex/lualatex/luainputenc/lutf8x.def b/Master/texmf-dist/tex/lualatex/luainputenc/lutf8x.def new file mode 100644 index 00000000000..8b910c74a15 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luainputenc/lutf8x.def @@ -0,0 +1,154 @@ +%% +%% This is file `lutf8x.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% luainputenc.dtx (with options: `defx') +%% This is a generated file. +%% +%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu> +%% +%% This work is under the CC0 license. As an exception, the files +%% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions. +%% See these file for more details. +%% +%% People who helped on this package: +%% Javier Bezos +%% Will Robertson +%% Hans Hagen +%% Heiko Oberdiek +%% Javier Mugica +%% +%% This work consists of the main source file luainputenc.dtx +%% and the derived files +%% luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def, +%% eu2enc.def, eu2lmr.fd and luainputenc.pdf +%% +%% This file was adapted from utf8.def, which copyright is: +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +%% 2004 2005 2006 The LaTeX3 Project. +%% +%% utf8.def is under the lppl version 1.3c or later, and can be found +%% in the base LaTeX system. +%% +%% The lppl can be found at http://www.latex-project.org/lppl.txt +%% +%% The changes to utf8.def are Copyright 2009 Elie Roux, and are under +%% the CC0 license. +%% +%% The changes are LuaTeX support. +%% +%% This file is distributed under the CC0 license, with clause 6 of the +%% lppl as additional restrictions. + + +\ProvidesFile{lutf8x.def} + [2009/04/15 v0.93 UTF-8 support for luainputenc] + +\makeatletter +\catcode`\ \saved@space@catcode + +\@inpenc@test + +\ifx\@begindocumenthook\@undefined + \makeatother + \endinput \fi + + +\gdef\DeclareUnicodeCharacter#1#2{% + \@tempcnta"#1% + \luadirect{luainputenc.declare_character('\the\@tempcnta')}% + \catcode\@tempcnta\active % + \DeclareInputText{\the\@tempcnta}{#2}% +} + +\@onlypreamble\DeclareUnicodeCharacter + +\def\cdp@elt#1#2#3#4{% + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding + #1}% + \catcode`\ 9\relax}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% +} +\cdp@list + + +\def\lIE@ActivateUnicodeCatcodes{% +\luadirect{luainputenc.activate_characters()}% +} + +\def\lIE@DesactivateUnicodeCatcodes{% +\luadirect{luainputenc.desactivate_characters()}% +} + +\def\lIE@CharactersActivated{% +\luadirect{luainputenc.force_characters_activated()} +} + +\edef\lIE@EU{EU2} + + +\def\DeclareFontEncoding@#1#2#3{% + \edef\lIE@test{#1}% + \ifx\lIE@test\lIE@EU % + \ifx\LastDeclaredEncoding\lIE@EU\else % + \lIE@CharactersActivated % + \lIE@DesactivateUnicodeCatcodes % + \fi + \gdef\@@enc@update{% + \edef\lIE@test{#1}% + \ifx\f@encoding\lIE@EU % + \lIE@DesactivateUnicodeCatcodes % + \else % + \lIE@ActivateUnicodeCatcodes % + \fi + \expandafter\let\csname\cf@encoding-cmd\endcsname\@changed@cmd + \expandafter\let\csname\f@encoding-cmd\endcsname\@current@cmd + \default@T + \csname T@\f@encoding\endcsname + \csname D@\f@encoding\endcsname + \let\enc@update\relax + \let\cf@encoding\f@encoding + } + \else % + \expandafter % + \ifx\csname T@#1\endcsname\relax % + \def\cdp@elt{\noexpand\cdp@elt}% + \xdef\cdp@list{\cdp@list\cdp@elt{#1}% + {\default@family}{\default@series}% + {\default@shape}}% + \expandafter\let\csname#1-cmd\endcsname\@changed@cmd % + \begingroup % + \wlog{Now handling font encoding #1 ...}% + \lowercase{% + \InputIfFileExists{#1enc.dfu}}% + {\wlog{... processing UTF-8 mapping file for font encoding #1}}% + {\wlog{... no UTF-8 mapping file for font encoding #1}}% + \endgroup + \else + \@font@info{Redeclaring font encoding #1}% + \fi + \fi % + \global\@namedef{T@#1}{#2}% + \global\@namedef{M@#1}{\default@M#3}% + \xdef\LastDeclaredEncoding{#1}% +} + +\DeclareUnicodeCharacter{00A9}{\textcopyright} +\DeclareUnicodeCharacter{00AA}{\textordfeminine} +\DeclareUnicodeCharacter{00AE}{\textregistered} +\DeclareUnicodeCharacter{00BA}{\textordmasculine} +\DeclareUnicodeCharacter{02C6}{\textasciicircum} +\DeclareUnicodeCharacter{02DC}{\textasciitilde} +\DeclareUnicodeCharacter{200C}{\textcompwordmark} +\DeclareUnicodeCharacter{2026}{\textellipsis} +\DeclareUnicodeCharacter{2122}{\texttrademark} +\DeclareUnicodeCharacter{2423}{\textvisiblespace} + +\endinput +%% +%% End of file `lutf8x.def'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 0470ae59bef..b942bb1d021 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -147,7 +147,7 @@ my @WorkingTLP = qw( lshort-polish lshort-portuguese lshort-slovak lshort-slovenian lshort-spanish lshort-thai lshort-turkish lshort-ukr lshort-vietnamese ltablex ltabptch ltxdockit - ltxindex ltxmisc luamplib luatextra lxfonts + ltxindex ltxmisc luainputenc luamplib luatextra lxfonts macqassign mafr magyar mailing makebarcode makebox makecell makecirc makecmds makeglos makeplot maple margbib diff --git a/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc b/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc index e0d3d580331..48b3ebf21e7 100644 --- a/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc @@ -5,5 +5,6 @@ longdesc as an embedded scripting and extension language. http://luatex.org/ # depend collection-basic # +depend luainputenc depend luamplib depend luatextra diff --git a/Master/tlpkg/tlpsrc/luainputenc.tlpsrc b/Master/tlpkg/tlpsrc/luainputenc.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/luainputenc.tlpsrc |