diff options
Diffstat (limited to 'macros')
34 files changed, 1320 insertions, 510 deletions
diff --git a/macros/generic/expkv-def/README.md b/macros/generic/expkv-def/README.md index 34a6e05db4..da6fb32a6c 100644 --- a/macros/generic/expkv-def/README.md +++ b/macros/generic/expkv-def/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv-def -- a key-defining frontend for expkv -Version 2021-05-24 v0.8a +Version 2021-09-18 v0.8b Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/macros/generic/expkv-def/expkv-def.dtx b/macros/generic/expkv-def/expkv-def.dtx index b69c591a00..8aa537402e 100644 --- a/macros/generic/expkv-def/expkv-def.dtx +++ b/macros/generic/expkv-def/expkv-def.dtx @@ -492,6 +492,7 @@ and the derived files expkv-def.pdf % \begin{function}{initial,oinitial,finitial,einitial} % \begin{syntax} % initial \key\ = \{\val\} \prefixes3333 +% initial \key % \end{syntax} % With |initial| you can set an initial \val\ for an already defined argument % taking \key. It'll just call the key-macro of \key\ and pass it \val. The @@ -500,6 +501,10 @@ and the derived files expkv-def.pdf % token in \val\ once. |finitial| will expand \val\ until a non-expandable % token or a space is found, a space would be % gobbled.\footnotemark +% +% If you don't provide a value (and no equals sign) a |noval| \key\ of the +% same name is called once (or, if you specified a |default| for a value +% taking key that would be used). % \end{function} % \footnotetext{Again using \cs[no-index]{romannumeral}.} % @@ -931,8 +936,8 @@ and the derived files expkv-def.pdf % \begin{macro}{\ekvdVersion,\ekvdDate} % We're on our first input, so lets store the version and date in a macro. % \begin{macrocode} -\def\ekvdVersion{0.8a} -\def\ekvdDate{2021-05-24} +\def\ekvdVersion{0.8b} +\def\ekvdDate{2021-09-18} % \end{macrocode} % \end{macro} % @@ -1213,14 +1218,19 @@ and the derived files expkv-def.pdf % \begin{macrocode} \long\def\ekvd@type@initial#1#2#3#4% {% - \ekvd@assert@arg + \ekvd@assert@not@new + \ekvd@assert@not@also + \ekvd@assert@not@long + \ekvd@assert@not@protected + \ekvd@ifnoarg + {% + \ekvifdefinedNoVal\ekvd@set{#3}% + {\csname\ekv@name\ekvd@set{#3}N\endcsname}% + {\ekvd@err@undefined@noval{#3}}% + }% {% \ekvifdefined\ekvd@set{#3}% {% - \ekvd@assert@not@new - \ekvd@assert@not@also - \ekvd@assert@not@long - \ekvd@assert@not@protected #1{#2#4}% \csname\ekv@name\ekvd@set{#3}\expandafter\endcsname\expandafter {\ekvd@tmp}% @@ -2162,6 +2172,14 @@ and the derived files expkv-def.pdf \ekvd@errm {Undefined key `\unexpanded{#1}' found while processing `\ekvd@cur'}% } +\protected\def\ekvd@err@undefined@noval#1% + {% + \ekvd@errm + {% + Undefined noval key `\unexpanded{#1}' found while processing + `\ekvd@cur'% + }% + } \protected\def\ekvd@err@no@prefix#1% {\ekvd@errm{prefix `#1' not accepted in `\ekvd@cur'}} \protected\def\ekvd@err@no@prefix@msg#1#2% diff --git a/macros/generic/expkv-def/expkv-def.pdf b/macros/generic/expkv-def/expkv-def.pdf Binary files differindex 8acb39cdb7..59c3673f09 100644 --- a/macros/generic/expkv-def/expkv-def.pdf +++ b/macros/generic/expkv-def/expkv-def.pdf diff --git a/macros/latex/contrib/clicks/clicks.pdf b/macros/latex/contrib/clicks/clicks.pdf Binary files differindex 531234bef1..39146542d2 100644 --- a/macros/latex/contrib/clicks/clicks.pdf +++ b/macros/latex/contrib/clicks/clicks.pdf diff --git a/macros/latex/contrib/clicks/clicks.sty b/macros/latex/contrib/clicks/clicks.sty index e5fac0ebbc..68bf2b77ed 100644 --- a/macros/latex/contrib/clicks/clicks.sty +++ b/macros/latex/contrib/clicks/clicks.sty @@ -21,7 +21,7 @@ % SOFTWARE. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{clicks}[2021/09/13 0.1.1 Clicks] +\ProvidesPackage{clicks}[2021/09/18 0.2.0 Clicks] \RequirePackage{xkeyval} \RequirePackage{etoolbox} @@ -50,7 +50,10 @@ \fi% } -\makeatletter\newcommand\click{% +\makeatletter\newcommand\click[1][1]{% + \ifclicks@static\else% + \addtocounter{minutes}{#1}% + \fi% \ifclicks@static\else% \clicks@flush% \fi% @@ -65,10 +68,11 @@ } % Print and click +% [1]: How many minutes to stay here % {1}: The content to print -\newcommand\plick[1]{% - \print{#1}% - \click% +\newcommand\plick[2][1]{% + \print{#2}% + \click[#1]% } \endinput diff --git a/macros/latex/contrib/clicks/clicks.tex b/macros/latex/contrib/clicks/clicks.tex index 578a8e8bee..7a64b63990 100644 --- a/macros/latex/contrib/clicks/clicks.tex +++ b/macros/latex/contrib/clicks/clicks.tex @@ -28,7 +28,7 @@ \title{\ff{clicks}: \LaTeX{} Package \\ for Slide Deck Animation} \author{Yegor Bugayenko} -\date{0.1.1 2021/09/13} +\date{0.2.0 2021/09/18} \begin{document} \pagenumbering{gobble} @@ -65,16 +65,24 @@ You can make it shorter, with the help of \documentclass{article} \usepackage{clicks} \begin{document} -\plick{Here is your wedding plan:} -\plick{1. Buy a ring} -\plick{2. Propose} -\plush{3. Get married} +\plick[2]{Here is your wedding plan:} +\plick[3]{1. Buy a ring} +\plick[5]{2. Propose} +\plush[1]{3. Get married} \end{document} \end{ffcode} If you need to render the document without animation, just use the \ff{static} package option. +The optional parameters at \ff{\char`\\plick\{\}} and \ff{\char`\\plush\{\}} +are the minutes: how much you are planning to stay at this animation. +The minutes are accumulated in the \ff{minutes} counter, which +you can show, for example, at your header. This will help you track +time during the presentation. The commands +\ff{\char`\\click\{\}} and \ff{\char`\\flush\{\}} also have the +same optional arguments. + More details about this package you can find in the \ff{yegor256/clicks} GitHub repository. diff --git a/macros/latex/contrib/exesheet/exesheet.cls b/macros/latex/contrib/exesheet/exesheet.cls deleted file mode 100644 index 5cea657f2e..0000000000 --- a/macros/latex/contrib/exesheet/exesheet.cls +++ /dev/null @@ -1,36 +0,0 @@ -%% -%% This is file `exesheet.cls', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% exesheet.dtx (with options: `class') -%% -%% This is a generated file. -%% -%% Copyright (C) 2020-2021 by Antoine Missier <antoine.missier@ac-toulouse.fr> -%% -%% This file may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License, either version 1.3 of this license -%% or (at your option) any later version. The latest version of this -%% license is in: -%% -%% http://www.latex-project.org/lppl.txt -%% -%% and version 1.3 or later is part of all distributions of LaTeX version -%% 2005/12/01 or later. -%% -\NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesClass{exesheet} - [2020/08/30 v1.1 .dtx exesheet file] - -\DeclareOption{notoc}{\PassOptionsToPackage{notoc}{exesheet}} -\DeclareOption{nosetlist}{\PassOptionsToPackage{nosetlist}{exesheet}} -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} -\ProcessOptions \relax -\LoadClass{article} -\RequirePackage{exesheet} -\RequirePackage{schooldocs} -\endinput -%% -%% End of file `exesheet.cls'. diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx index 26ce619f4a..94b786c75e 100644 --- a/macros/latex/contrib/exesheet/exesheet.dtx +++ b/macros/latex/contrib/exesheet/exesheet.dtx @@ -23,7 +23,7 @@ %<class>\ProvidesClass{exesheet} %<package>\ProvidesPackage{exesheet} %<*class|package> - [2020/08/30 v1.1 .dtx exesheet file] +[2021/09/18 v1.2 .dtx exesheet file] %</class|package> % %<*driver> @@ -49,7 +49,6 @@ \newcommand{\ds}{\displaystyle} \newcommand{\bs}{\textbackslash} -\newcommand{\TODO}{\textcolor{green}{TODO}} \definecolor{darkbrown}{rgb}{0.5,0.1,0.1} \allsectionsfont{\sffamily\color{darkbrown}} @@ -68,7 +67,7 @@ \setboolean{marginpoints}{true} \setboolean{marginfullnotes}{true} -\DisableCrossrefs +\DisableCrossrefs %\CodelineIndex %\RecordChanges @@ -77,21 +76,21 @@ %\author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}} \subject{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}} -\date{August 30, 2021, \fileversion} +\date{\filedate, \fileversion} \hypersetup{% - colorlinks, + colorlinks, linkcolor=blue, - pdftitle={exesheet}, - pdfsubject={LaTeX class and package}, + pdftitle={exesheet}, + pdfsubject={LaTeX class and package}, pdfauthor={Antoine Missier} - } +} \begin{document} - \DocInput{exesheet.dtx} +\DocInput{exesheet.dtx} \end{document} %</driver> % \fi % -% \CheckSum{638} +% \CheckSum{609} % % \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 @@ -113,8 +112,9 @@ % \changes{v0.0}{2010/09/01}{Initial personal version} % \changes{v0.9}{2020/01/02}{Initial documentation in french} % \changes{v1.0}{2020/07/22}{Initial public version with documentation in english} -% \changes{v1.1}{2021/08/30}{macro tablenum replaced by tablenum1, small modifications due +% \changes{v1.1}{2021/08/30}{Macro tablenum replaced by tablenum1, small modifications due % to changes in tasks package} +% \changes{v1.2}{2021/09/18}{Bug correction in macros tablenum1 and tablenuma, using the translations package for internationalization} % % \GetFileInfo{exesheet.dtx} % @@ -141,18 +141,18 @@ % % Another specificity of the \textsf{exesheet} package is specific settings % for enumeration lists, different from \LaTeX\ standard settings, -% usefull for the numbering of questions or answers inside an exercise. +% useful for the numbering of questions or answers inside an exercise. % % Other packages provide often more or less elaborate mechanisms % to manage the placement of answers. % \textsf{exesheet} has no such ambitions: % for all exercises of the sheet, we can display subject only, -% answer anly or both, but always at the place they are inserted +% answer only or both, but always at the place they are inserted % in the source file. On the other hand this choice may be very flexible: % we can do a correct version for all exercises together, or a correct version per exercise, % per part (subpart of exercise), per question, per sub-question. % -% Finally the original fonctionality of this package is the display +% Finally the original functionality of this package is the display % of a detailed marking scheme, % with optional explanations, in the margin of exercise answers. % @@ -196,11 +196,11 @@ % in a few languages\footnote{Translation % is currently integrated into the package for the following languages: French, % German, Spanish, Italian, Portuguese.} -% when the \textsf{babel} package is loaded. -% It can be redefined, with |\renewcommand|, which should be placed -% after |\begin{document}|, or else we can use macros from the \textsf{babel} -% package (allowing dynamic language change), e.g.\\ -% |\addto\captionssweedish{\def\exercisename{\"Ovning}}| (in the preamble). +% according to the loaded language (by \textsf{babel} or \textsf{polyglossia}). +% It can be redefined, with |\renewcommand|, +% or else we can use macros from the \textsf{translations} +% package (allowing dynamic language change), e.g. (in the preamble)\\ +% |\DeclareTranslation{Swedish}{exesheet-exercise}{\"Ovning}}|. % % \DescribeMacro{\labelexercise} % This command calls |\exercisename| following by the exercise number. @@ -228,14 +228,14 @@ % % \exercise*[(Fermat theorem)]{Problem} % \psframe(-0.25,1.3)(12.75,-0.7) -% Proove that there are no positive integers $x, y, z$ such that $x^n+y^n=z^n$ +% Prove that there are no positive integers $x, y, z$ such that $x^n+y^n=z^n$ % for any integer $n$ greater than 2. % % \subsection{The \texttt{\bs subpart} command} % % \DescribeMacro{\subpart} % An exercise may contain several parts that we obtain -% with the |\subpart|\oarg{opt} command, typeset like a subsubsection. +% with the |\subpart|\oarg{opt} command, typeset like a sub-subsection. % \exercise % \subpart[(preliminary)] % \psframe(-0.25,1.95)(12.75,-1.9) @@ -249,11 +249,12 @@ % This numbering type can be redefined with the |\thesubpart| command based on % the |subpart| counter, for instance |\renewcommand\thesubpart{\arabic{subpart}}|. % +% \pagebreak % \DescribeMacro{\subpartname} \DescribeMacro{\labelsubpart} % \DescribeMacro{\labelsubpartstyle} % As for |\exercise|, the |\subpart| command -% uses |\subpartname| (with automatic translation in a few languages -% if \textsf{babel} is loaded), +% uses |\subpartname| (with automatic translation in a few languages +% according to the selected language), % |\labelsubpart| and |\labelsubpartstyle|, which are editable. % % \DescribeMacro{\subpart*} @@ -264,7 +265,7 @@ % \subsection{The \texttt{\bs annex} command} % \DescribeMacro{\annex} % The |\annex|\oarg{opt} command typesets the title \textbf{ANNEX}, -% in uppercase letters, centred +% in uppercase letters, centered % and in the subsection style, % with an optional parameter, added on the same line. % @@ -273,9 +274,9 @@ % \annex[(to return)] % % \DescribeMacro{\annexname} -% The word \emph{\annexname} has automatic translation in a few languages -% if \textsf{babel} package is loaded. -% It can be extended to other languages or modified by redifining |\annexname|. +% The word \emph{\annexname} has automatic translation in a few languages. +% It can be extended to other languages or modified by redefining |\annexname| +% or with macros from the \textsf{translations} package. % % \DescribeMacro{\annexstyle} % The annex title style is set by the |\annexstyle| macro, @@ -309,7 +310,7 @@ % \bigskip % \DescribeMacro{\exname} \DescribeMacro{\exlabel} \DescribeMacro{\exsepmark} % The abbreviation \emph{\exname} may be changed by -% redefining |\exname|. +% redefining |\exname| or with macros from the \textsf{translations} package. % The |\exlabel| macro calls |\exname| following by a period then the exercise number, % and |\exsepmark| typesets a long dash. % We may change these features by redefining these commands. @@ -337,10 +338,10 @@ % % \bigskip % \DescribeMacro{\pointsname} \DescribeMacro{\pointname} -% Like before, the words \emph{points} and in the singular \emph{point} +% Like before, the word \emph{points} and in the singular \emph{point} % (if \meta{pts} is inferior to 2) -% get automatic translation (with \textsf{babel}) in a few languages -% and are modifiables. +% get automatic translation in a few languages +% and are modifiable. % % \DescribeMacro{\pointsstyle} \DescribeMacro{pointscolor} % The style used by the |\points| command may be redefined with |\pointsstyle|. @@ -362,11 +363,11 @@ % may also be changed by the \texttt{\bs labelenumi} and \texttt{\bs labelenumii} commands.} % from the \textsf{enumitem} package by Javier Bezos. % Lists with \texttt{itemize} environment are kept in their default configuration\footnote{The -% \texttt{french} otion of the \textsf{babel} package +% \texttt{french} option of the \textsf{babel} package % alters \texttt{itemize} lists behavior and uses long dash % as labels for each list level. % This behavior is problematic when mathematics follows the dash -% symbol because the latter may be confused wih the minus sign. +% symbol because the latter may be confused with the minus sign. % Modifications of the \texttt{french} option (which supersedes \texttt{frenchb} % of \textsf{babel}) are canceled to restore \LaTeX\ default settings.}. % @@ -389,14 +390,14 @@ % % \subsection{List of exercises : the \texttt{exenumerate} environment} % \DescribeEnv{exenumerate} -% When an exercise sheet is made of short independant exercises, +% When an exercise sheet is made of short independent exercises, % it would be ill-advised to display the complete title \emph{\exercisename} for each. % In addition to the |\exe| command, previously presented, % we provide an even lighter solution with the |exenumerate| environment, % which is only an enumeration list in which % spaces between items are further increased compared with those of \texttt{enumerate}. % Here is an example (the main list is an \texttt{exenumerate} environment but -% sublists are produced with regular \texttt{enumerate} environments): +% sub-lists are produced with regular \texttt{enumerate} environments): % % \vspace{-\baselineskip} % \noindent\psframe(-0.25,-0.3)(12.75,-6.75) @@ -438,9 +439,8 @@ % |\NewTasksEnvironment| macro, from the \textsf{tasks} package by Clemens Niederberger. % They take an optional argument \meta{opt} % explained in the documentation of this package, -% e.g.\ |label=1)| gives a roman numbering -% following by a closing parenthesis (like in \texttt{enumitem} -% or \texttt{enumerate} packages. +% e.g.\ |label=\arabic*)| produces an Arabic numbering +% following by a closing parenthesis (like in \texttt{enumitem} package). % There are also many possibilities to place items in an original way, % for instance, the |\item*| command allows to % specify the number of columns the item is supposed to span. @@ -466,8 +466,7 @@ % (except by redefining the environment with |\RenewTasksEnvironment|). % If the \textsf{exesheet} package is called with option \texttt{nosetlist}, % labels of \texttt{tablenum1} and \texttt{tablenuma} environments -% are displayed in normal font with indentation, as for -% \texttt{enumerate}. +% are displayed in normal font instead of boldface, with indentation. % % \subsection{Items aligned by columns: \texttt{colsenum}} % \DescribeEnv{colsenum} @@ -549,7 +548,7 @@ % In the case (by default) where questions and answers are displayed both, % answers are then typeset in the style % |\correctionstyle|, which uses the color \texttt{correctioncolor}. -% This color may be choosen with the |\definecolor| macro +% This color may be chosen with the |\definecolor| macro % (by default |\definecolor{correctioncolor}{rgb}{0,0.2,0.6}| = kind of dark blue). % Moreover, in that case, % the title \textbf{\correctionname} is displayed at the beginning @@ -570,14 +569,14 @@ % \begin{questions} % \begin{enumerate} % \item Is the \textsf{exesheet} package useful ? -% \item Ins't there any other packages that deal with exercises ? +% \item Isn't there any other packages that deal with exercises ? % \end{enumerate} % \end{questions} % \begin{answers} % \begin{enumerate} % \item Yes, the \textsf{exesheet} package is very useful. -% \item There are many other packages that deal with exercices, and -% give the ability to produce separatly questions and solutions, for example +% \item There are many other packages that deal with exercises, and +% give the ability to produce separately questions and solutions, for example % \textsf{exercise} by Paul Pichaureau, \textsf{exercises} by Roger Jud, % \textsf{exsheets} (superseded by \textsf{xsim}) by Clemens Niederberger, % \textsf{exframe} by Niklas Beisert, @@ -591,7 +590,7 @@ % When only answers are displayed, the text color remains black, % the word \emph{\correctionname} is not displayed and the % |\points| macro is patched to suppress the display of points. -% An extended solution for a variable display of points will be disussed +% An extended solution for a variable display of points will be discussed % in section \ref{totalpoints} with the |\totalpoints| macro. % % \subsection{More about \texttt{answers} environment} @@ -632,7 +631,7 @@ % The optional \meta{level} parameter is defined as follows: % 1 for section level titles, % 2 for subsections (like \emph{\exercisename}), -% 3 for subsubsections (like \emph{\partname}), +% 3 for sub-subsections (like \emph{\partname}), % another number for lower levels % (then they will not appear in the table of contents). % @@ -650,7 +649,7 @@ % It can be more readable (in the source code) when questions and answers are short. % In the case of displaying both questions and answers, % the \emph{\correctionname} title will appear on a new line, in bold, -% as for levels lower than subsubsection in the \texttt{answers} environment +% as for levels lower than sub-subsection in the \texttt{answers} environment % (and without entries in the table of contents). % But this command doesn't work with \texttt{verbatim} inside. % @@ -670,7 +669,7 @@ % % \vspace{-\baselineskip} % \noindent\psframe(-3.5,-0.25)(12.75,-2) -% \exe \pts{3} The first exercise with marking sheme. +% \exe \pts{3} The first exercise with marking scheme. % \exe \pts{1.5} The second one. % % \bigskip @@ -703,7 +702,7 @@ % \label{totalpoints} % \DescribeMacro{\totalexe} % \DescribeMacro{\note} -% To give a more detailed marking sheme, the \textsf{exesheet} package +% To give a more detailed marking scheme, the \textsf{exesheet} package % provides some extended commands: % |\totalexe|\marg{num} to display the total number of points of an exercise % and especially |\note|\oarg{pts}\marg{comment}, @@ -711,7 +710,7 @@ % The optional parameter \meta{pts} is the number of points of the question % and the mandatory parameter \meta{comment} is used to give details about the marking scheme. % Below the title has been obtained with |\exercise[\totalexe{4}]| -% and the first comment with \\ +% and the first comment (on next page) with \\ % |\note[1]{0,5 for the anti-derivative\\0,5 for simplification of $\ln$}|. % % \exercise[\totalexe{4}] \label{totalexe} @@ -779,13 +778,13 @@ % % \DescribeMacro{\note*} % If we don't want to add comment, we have the -% |\note*|\marg{pts} command (better thant |\note|\oarg{pts}|{}|), +% |\note*|\marg{pts} command (better than |\note|\oarg{pts}|{}|), % used here in answer 3: |\note*{1.5}|. % % \DescribeMacro{markingcolor} \DescribeMacro{\markingstyle} \DescribeMacro{\ptsboxlength} % The display color of the points, in |\totalexe| and |\note|, % is defined by \texttt{markingcolor} -% and the style by |\markingstyle|, which are modifiables. +% and the style by |\markingstyle|, which are modifiable. % The oval box produced by |\totalexe| is obtained with the |\ovalbox| command % of the \textsf{fancybox} package by Timothy Van Zandt, % with corner arcs set by |\cornersize{1}|. @@ -881,108 +880,106 @@ \DeclareOption{nosetlist}{\setboolean{nosetlist}{true}} \ProcessOptions \relax \RequirePackage{xcolor} -\RequirePackage[shortlabels]{enumitem} +\RequirePackage[shortlabels]{enumitem} \RequirePackage{tasks} \RequirePackage{versions} %\@ifpackageloaded{doc}{}{\RequirePackage{verbatim}} \RequirePackage{geometry} \RequirePackage{fancybox} +\RequirePackage{translations} % \end{macrocode} % % \subsection{Internationalization} % Here we define the keywords and their translation in French, German, Spanish -% Italian, Portuguese, thanks to the |\addto\captions|\meta{language} macro -% of the \textsf{babel} package. -% -% Translations are placed in a macro |\exetranslate| because, if -% \textsf{exesheet} is called before \textsf{babel} (this is necessarily the case for the -% \textsf{exesheet} class), then these translations should only happen -% after having loaded the \textsf{babel} package, therefore the |\AtBeginDocument|. -% On the other hand, if the package is loaded \emph{after} \textsf{babel}, -% |AtBeginDocument{\exetranslate}| doesn't work, curiously. -% But calling immediately |\exetranslate| works in that case. +% Italian, Portuguese, thanks to macros of the \textsf{translations} package +% by Clemens Niederberger. It detects the used language +% loaded by \textsf{babel} or \textsf{polyglossia}. % % Accented characters cannot be used here because they are not recognized -% if \textsf{inputenc} is loaded after \textsf{exesheet}, -% despite the |\AtBeginDocument|. So we have used the basic \LaTeX\ commands to produce them. -% -% \TODO: give the choice to use \textsf{polyglossia} instead of \textsf{babel}; -% see the \textsf{translations} or \textsf{multilang} packages. +% if \textsf{inputenc} is loaded after \textsf{exesheet}. +% So we have used the basic \LaTeX\ commands to produce them. % % \begin{macrocode} -\def\exercisename{Exercise} -\def\subpartname{Part} -\def\annexname{Annex} -\def\exname{Ex} -\def\pointsname{points} -\def\pointname{point} -\def\correctionname{Correction} -\def\ptsname{pts} -\def\ptname{pt} +\DeclareTranslationFallback{exesheet-exercise}{Exercise} +\DeclareTranslationFallback{exesheet-subpart}{Part} +\DeclareTranslationFallback{exesheet-annex}{Annex} +\DeclareTranslationFallback{exesheet-ex}{Ex} +\DeclareTranslationFallback{exesheet-points}{points} +\DeclareTranslationFallback{exesheet-point}{point} +\DeclareTranslationFallback{exesheet-correction}{Correction} +\DeclareTranslationFallback{exesheet-pts}{pts} +\DeclareTranslationFallback{exesheet-pt}{pt} -\newcommand\exetranslate{% - \@ifpackageloaded{babel}{% - \addto\captionsfrench{% - \def\exercisename{Exercice} - \def\subpartname{Partie} - \def\annexname{Annexe} - \def\exname{Ex} - \def\pointsname{points} - \def\pointname{point} - \def\correctionname{Correction} - \def\ptsname{pts} - \def\ptname{pt} - } - \addto\captionsgerman{% - \def\exercisename{\"Ubung} - \def\subpartname{Teil} - \def\annexname{Anhang} - \def\exname{\"Ub} - \def\pointsname{Punkte} - \def\pointname{Punkt} - \def\correctionname{Verbesserung} - \def\ptsname{Pkte} - \def\ptname{Pkt} - } - \addto\captionsspanish{% - \def\exercisename{Ejercicio} - \def\subpartname{Parte} - \def\annexname{Anexo} - \def\exname{Ej} - \def\pointsname{puntos} - \def\pointname{punto} - \def\correctionname{Correcci\'on} - \def\ptsname{ptos} - \def\ptname{pot} - } - \addto\captionsitalian{% - \def\exercisename{Esercizio} - \def\subpartname{Parte} - \def\annexname{Ansesso} - \def\exname{Es} - \def\pointsname{punti} - \def\pointname{punto} - \def\correctionname{Correzione} - \def\ptsname{pti} - \def\ptname{pt} - } - \addto\captionsportuges{% - \def\exercisename{Exerc\'icio} - \def\subpartname{Parte} - \def\annexname{Anexo} - \def\exname{Ex} - \def\pointsname{pontos} - \def\pointname{ponto} - \def\correctionname{Corre\c c\~ao} - \def\ptsname{pts} - \def\ptname{pt} - } - }{} - } +\DeclareTranslation{English}{exesheet-exercise}{Exercise} +\DeclareTranslation{English}{exesheet-subpart}{Part} +\DeclareTranslation{English}{exesheet-annex}{Annex} +\DeclareTranslation{English}{exesheet-ex}{Ex} +\DeclareTranslation{English}{exesheet-points}{points} +\DeclareTranslation{English}{exesheet-point}{point} +\DeclareTranslation{English}{exesheet-correction}{Correction} +\DeclareTranslation{English}{exesheet-pts}{pts} +\DeclareTranslation{English}{exesheet-pt}{pt} -\AtBeginDocument{\exetranslate} % if loaded before babel -\exetranslate % necessary when loaded after babel +\DeclareTranslation{French}{exesheet-exercise}{Exercice} +\DeclareTranslation{French}{exesheet-subpart}{Partie} +\DeclareTranslation{French}{exesheet-annex}{Annexe} +\DeclareTranslation{French}{exesheet-ex}{Ex} +\DeclareTranslation{French}{exesheet-points}{points} +\DeclareTranslation{French}{exesheet-point}{point} +\DeclareTranslation{French}{exesheet-correction}{Correction} +\DeclareTranslation{French}{exesheet-pts}{pts} +\DeclareTranslation{French}{exesheet-pt}{pt} + +\DeclareTranslation{German}{exesheet-exercise}{\"Ubung} +\DeclareTranslation{German}{exesheet-subpart}{Teil} +\DeclareTranslation{German}{exesheet-annex}{Anhang} +\DeclareTranslation{German}{exesheet-ex}{\"Ub} +\DeclareTranslation{German}{exesheet-points}{Punkte} +\DeclareTranslation{German}{exesheet-point}{Punkt} +\DeclareTranslation{German}{exesheet-correction}{Verbesserung} +\DeclareTranslation{German}{exesheet-pts}{Pkte} +\DeclareTranslation{German}{exesheet-pt}{Pkt} + +\DeclareTranslation{Spanish}{exesheet-exercise}{Ejercicio} +\DeclareTranslation{Spanish}{exesheet-subpart}{Parte} +\DeclareTranslation{Spanish}{exesheet-annex}{Anexo} +\DeclareTranslation{Spanish}{exesheet-ex}{Ej} +\DeclareTranslation{Spanish}{exesheet-points}{puntos} +\DeclareTranslation{Spanish}{exesheet-point}{punto} +\DeclareTranslation{Spanish}{exesheet-correction}{Correcci\'on} +\DeclareTranslation{Spanish}{exesheet-pts}{ptos} +\DeclareTranslation{Spanish}{exesheet-pt}{pto} + +\DeclareTranslation{Italian}{exesheet-exercise}{Esercizio} +\DeclareTranslation{Italian}{exesheet-subpart}{Parte} +\DeclareTranslation{Italian}{exesheet-annex}{Annesso} +\DeclareTranslation{Italian}{exesheet-ex}{Es} +\DeclareTranslation{Italian}{exesheet-points}{punti} +\DeclareTranslation{Italian}{exesheet-point}{punto} +\DeclareTranslation{Italian}{exesheet-correction}{correzione} +\DeclareTranslation{Italian}{exesheet-pts}{pti} +\DeclareTranslation{Italian}{exesheet-pt}{pt} + +\DeclareTranslation{Portuges}{exesheet-exercise}{Exerc\'icio} +\DeclareTranslation{Portuges}{exesheet-subpart}{Parte} +\DeclareTranslation{Portuges}{exesheet-annex}{Anexo} +\DeclareTranslation{Portuges}{exesheet-ex}{Ex} +\DeclareTranslation{Portuges}{exesheet-points}{pontos} +\DeclareTranslation{Portuges}{exesheet-point}{ponto} +\DeclareTranslation{Portuges}{exesheet-correction}{Corre\c c\~ao} +\DeclareTranslation{Portuges}{exesheet-pts}{pts} +\DeclareTranslation{Portuges}{exesheet-pt}{pt} + +\newcommand*\exercisename{\GetTranslation{exesheet-exercise}} +\newcommand*\subpartname{\GetTranslation{exesheet-subpart}} +\newcommand*\annexname{\GetTranslation{exesheet-annex}} +\newcommand*\exname{\GetTranslation{exesheet-ex}} +\newcommand*\pointsname{\GetTranslation{exesheet-points}} +\newcommand*\pointname{\GetTranslation{exesheet-point}} +\newcommand*\correctionname{\GetTranslation{exesheet-correction}} +\newcommand*\ptsname{\GetTranslation{exesheet-pts}} +\newcommand*\ptname{\GetTranslation{exesheet-pt}} % \end{macrocode} % @@ -1033,16 +1030,16 @@ \subsection*{\labelexercisestyle\labelexercise\ #1} \ifthenelse{\boolean{notoc}}{}{ \addcontentsline{toc}{subsection}{\labelexercise} - } } +} \newcommand*{\@@exercise}[2][]{% - \subsection*{\labelexercisestyle #2 #1} + \subsection*{\labelexercisestyle #2 #1} \setcounter{subpart}{0} % resets the parts counter \ifthenelse{\boolean{notoc}}{}{ \addcontentsline{toc}{subsection}{#2} - } } -\newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}} +} +\newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}} % \end{macrocode} % \end{macro} @@ -1058,14 +1055,14 @@ \subsubsection*{\labelsubpartstyle\labelsubpart\ #1} \ifthenelse{\boolean{notoc}}{}{ \addcontentsline{toc}{subsubsection}{\labelsubpart} - } } +} \newcommand*{\@@subpart}[2][]{% \subsubsection*{\labelsubpartstyle #2 #1} \ifthenelse{\boolean{notoc}}{}{ \addcontentsline{toc}{subsubsection}{#2} - } } +} \newcommand{\subpart}{\@ifstar{\@@subpart}{\@subpart}} % \end{macrocode} @@ -1077,8 +1074,8 @@ \subsection*{\mbox{}\hfill\annexstyle{\annexname} #1\hfill\mbox{}} \ifthenelse{\boolean{notoc}}{}{ \addcontentsline{toc}{subsection}{\annexname} - } - } + } +} % \end{macrocode} % \end{macro} @@ -1090,7 +1087,7 @@ \newcommand{\@@exe}{\textbf{\exlabel}~} \newcommand{\exe}{\bigskip\par\noindent\refstepcounter{exercise} \@ifstar{\@@exe}{\@exe} - } +} % \end{macrocode} % \end{macro} @@ -1098,12 +1095,12 @@ % \begin{macrocode} \newcommand{\pointsstyle}{% \small\mdseries\sffamily\color{pointscolor}\fbox} -\newcommand*{\points}[1]{\hfill +\newcommand*{\points}[1]{\hfill \pointsstyle{#1~% \ifthenelse{\lengthtest{#1 cm < 2cm}}{\pointname}{\pointsname}% - } } - +} + % \end{macrocode} % Percent symbols are necessary to avoid spaces between the % |\fbox| and its inner text. @@ -1113,9 +1110,9 @@ % \subsection{Enumerations and lists} % % When using \textsf{babel} with the \texttt{french} option\footnote{The \texttt{french} option -% of \textsf{babel} superseeds the \texttt{frenchb} option.}, +% of \textsf{babel} supersedes the \texttt{frenchb} option.}, % \texttt{itemize} lists are modified with the same dash label for each list level. -% These modifications are cancelled here to restore default +% These modifications are canceled here to restore default % \LaTeX\ \texttt{itemize} lists (labels and spaces). % As for |\exetranslate|, % we have create the |\standardfrenchlists| command who must be called into @@ -1134,15 +1131,15 @@ \@ifundefined{frenchsetup}{ \frenchbsetup{StandardLists=true}}{ \frenchsetup{StandardLists=True}} - }{} - } + }{} +} \ifthenelse{\boolean{nosetlist}}{}{ \AtBeginDocument{% if loaded before babel package \standardfrenchlists} \standardfrenchlists % necessary when loaded after babel \setlist[enumerate]{font=\bfseries} \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em} - } +} % \end{macrocode} % \begin{macro}{\exenumerate} @@ -1154,7 +1151,7 @@ \setlist[enumerate,3]{noitemsep,nolistsep} \setlist[itemize]{noitemsep,nolistsep} \begin{enumerate}[#1] - }{\end{enumerate}} + }{\end{enumerate}} % \end{macrocode} % \end{macro} @@ -1167,23 +1164,23 @@ % % \begin{macrocode} \ifthenelse{\boolean{nosetlist}}{ - \NewTasksEnvironment[label=1., + \NewTasksEnvironment[label=\arabic*., column-sep=1em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2) - \NewTasksEnvironment[label=(a), + \NewTasksEnvironment[label=(\alph*), column-sep=1em,label-align=right, item-indent=2.15em,label-width=1.6em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) - }{% by default - \NewTasksEnvironment[label=1.,label-format=\bfseries, +}{% by default + \NewTasksEnvironment[label=\arabic*.,label-format=\bfseries, column-sep=1em,label-align=right, item-indent=1.5em,label-width=1em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2) - \NewTasksEnvironment[label=(a),label-format=\bfseries, + \NewTasksEnvironment[label=(\alph*),label-format=\bfseries, column-sep=1em,label-align=right, item-indent=2.15em,label-width=1.6em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) - } +} \PackageWarning{exesheet}{Environment tablenum is deprecated and replaced by tablenum1} % \end{macrocode} @@ -1201,18 +1198,18 @@ \setlength{\multicolsep}{2ex} \raggedcolumns % default is \flushcolumns \begin{multicols}{#2} % #2 = number of columns - \begin{enumerate}[#1] % #1 = options of enumerate - }{ - \end{enumerate} + \begin{enumerate}[#1] % #1 = options of enumerate + }{ + \end{enumerate} \end{multicols} } \newenvironment{colsenum*}[2][]{% \setlength{\multicolsep}{2ex} \begin{multicols}{#2} % #2 = number of columns - \begin{enumerate}[#1] % #1 = options of enumerate - }{ - \end{enumerate} + \begin{enumerate}[#1] % #1 = options of enumerate + }{ + \end{enumerate} \end{multicols} } @@ -1223,18 +1220,18 @@ \setlength{\multicolsep}{2ex} \raggedcolumns \begin{multicols}{#2} - \begin{itemize}[#1] - }{ - \end{itemize} + \begin{itemize}[#1] + }{ + \end{itemize} \end{multicols} } \newenvironment{colsitem*}[2][]{% \setlength{\multicolsep}{2ex} \begin{multicols}{#2} - \begin{itemize}[#1] - }{ - \end{itemize} + \begin{itemize}[#1] + }{ + \end{itemize} \end{multicols} } @@ -1279,8 +1276,8 @@ \ifthenelse{\boolean{questions}}{ \setcounter{exe@ini}{\value{exercise}} \setcounter{subpart@ini}{\value{subpart}} - }{\comment}}% - {\ifthenelse{\boolean{questions}}{}{\endcomment}} + }{\comment}}% +{\ifthenelse{\boolean{questions}}{}{\endcomment}} % \end{macrocode} % \end{environment} @@ -1300,12 +1297,12 @@ \ifthenelse{\value{exercise} > \value{exe@ini}}{ \setcounter{@toclevel}{1} }{\ifthenelse{\equal{\the\@enumdepth}{0}}{ - % we're not in an enumerate environment - \ifthenelse{\(\value{subpart} > \value{subpart@ini}\) - \or \(\value{subpart} = 0\)}{ - \setcounter{@toclevel}{2} - }{\setcounter{@toclevel}{3}} - }{\setcounter{@toclevel}{4}}} + % we're not in an enumerate environment + \ifthenelse{\(\value{subpart} > \value{subpart@ini}\) + \or \(\value{subpart} = 0\)}{ + \setcounter{@toclevel}{2} + }{\setcounter{@toclevel}{3}} + }{\setcounter{@toclevel}{4}}} }{\setcounter{@toclevel}{#1}}} \newcommand{\correctionstyle}{\color{correctioncolor}} @@ -1320,26 +1317,26 @@ \addcontentsline{toc}{section}{\correctionname}} \setcounter{exercise}{0} }{\ifthenelse{\value{@toclevel} = 2}{% - \subsection*{\correctionstyle\correctionname} - \ifthenelse{\boolean{notoc}}{}{ - \addcontentsline{toc}{subsection}{\correctionname}} - \setcounter{subpart}{0} - }{\ifthenelse{\value{@toclevel} = 3}{% - \subsubsection*{\correctionstyle\correctionname} + \subsection*{\correctionstyle\correctionname} \ifthenelse{\boolean{notoc}}{}{ - \addcontentsline{toc}{subsubsection}{ - \correctionname}} + \addcontentsline{toc}{subsection}{\correctionname}} + \setcounter{subpart}{0} + }{\ifthenelse{\value{@toclevel} = 3}{% + \subsubsection*{\correctionstyle\correctionname} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsubsection}{ + \correctionname}} }{\par\textbf{\correctionstyle\correctionname}\par }% - }% + }% }% - \correctionstyle% + \correctionstyle% }{}% }{\comment} }{\ifthenelse{\boolean{answers}}{}{\endcomment}} - + \newenvironment{answers*}{\ifthenelse{\boolean{answers}}{}{\comment}}% - {\ifthenelse{\boolean{answers}}{}{\endcomment}} +{\ifthenelse{\boolean{answers}}{}{\endcomment}} % \end{macrocode} % In the \texttt{answers} environment, if we place |\correctionstyle| @@ -1356,10 +1353,10 @@ \ifx#2\empty\else \par\correctionstyle\textbf{\correctionname}\par \fi - }{} + }{} #2}{} \egroup - } +} % \end{macrocode} % \end{macro} @@ -1392,15 +1389,15 @@ \mbox{}% \marginpar{\hspace{0pt}% \ptsstyle{\pointmark{#1}}}% - }{}% + }{}% \ignorespaces - } +} \newcommand{\displaypts}{% \reversemarginpar \geometry{hmarginratio=3:2} \setboolean{marginpts}{true} - } - +} + % \end{macrocode} % % \begin{macro}{\totalexe} @@ -1409,18 +1406,18 @@ % to avoid too much space in the text (or the margin) % where these macros are inserted. % \begin{macrocode} -\newlength{\ptsboxlength} +\newlength{\ptsboxlength} \setlength{\ptsboxlength}{3.1em} \cornersize{1} \newcommand*{\totalexe}[1]{% \ifthenelse{\boolean{marginpoints}}{% \mbox{}% \marginpar{\markingstyle{\ovalbox{% - \makebox[\ptsboxlength]{\pointmark{#1}}}% + \makebox[\ptsboxlength]{\pointmark{#1}}}% }}% - }{}% + }{}% \ignorespaces - } +} % \end{macrocode} % \end{macro} @@ -1446,17 +1443,17 @@ \marginpar{% \ifthenelse{\equal{#1}{}}{}{\markingstyle{#1}\\}% \ifthenelse{\boolean{marginfullnotes}}{\notestyle #2}{}% - }% - }{}% + }% + }{}% \ignorespaces - } +} \newcommand{\@@note}[1]{% \ifthenelse{\boolean{marginpoints}}{% \mbox{}% \marginpar{\markingstyle{#1}}% - }{}% + }{}% \ignorespaces - } +} \newcommand{\note}{\@ifstar{\@@note}{\@note}} % \end{macrocode} @@ -1472,7 +1469,7 @@ \reversemarginpar \geometry{hmarginratio=3:2} \setboolean{marginpoints}{true} - } +} \newcommand*{\displaynotes}[1][\raggedleft]{% \reversemarginpar @@ -1484,8 +1481,8 @@ \setlength{\marginparwidth}{0.8\marginparwidth} \setboolean{marginpoints}{true} \setboolean{marginfullnotes}{true} - } - +} + \newcommand*{\displaynotesright}[1][\raggedright]{% \normalmarginpar \renewcommand{\noteragged}{#1} @@ -1498,7 +1495,7 @@ \setlength{\marginparwidth}{0.8\marginparwidth} \setboolean{marginpoints}{true} \setboolean{marginfullnotes}{true} - } +} % \end{macrocode} % The formatting of marginal notes can possibly be made more regular % with the \textsf{ragged2e} package, not loaded by \textsf{exesheet}. diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf Binary files differindex f7efae7b5a..19dce9c5ec 100644 --- a/macros/latex/contrib/exesheet/exesheet.pdf +++ b/macros/latex/contrib/exesheet/exesheet.pdf diff --git a/macros/latex/contrib/readarray/readarray.pdf b/macros/latex/contrib/readarray/readarray.pdf Binary files differindex 5b8f2b4dbd..7bbc00acaa 100644 --- a/macros/latex/contrib/readarray/readarray.pdf +++ b/macros/latex/contrib/readarray/readarray.pdf diff --git a/macros/latex/contrib/readarray/readarray.sty b/macros/latex/contrib/readarray/readarray.sty index fb6c2ba90d..912d43c48b 100644 --- a/macros/latex/contrib/readarray/readarray.sty +++ b/macros/latex/contrib/readarray/readarray.sty @@ -1,5 +1,5 @@ -\def\readarrayPackageVersion{3.0} -\def\readarrayPackageDate{2021/08/08} +\def\readarrayPackageVersion{3.1} +\def\readarrayPackageDate{2021/09/17} \ProvidesPackage{readarray} [\readarrayPackageDate\ \readarrayPackageVersion\ % Routines for inputting 2D and 3D array data and recalling it on an @@ -17,25 +17,6 @@ element-by-element basis.] % % The Current Maintainer of this work is Steven B. Segletes. % -% Revisions: -% v1.01 -Documentation revision -% v1.1 -Added \csname record\roman{@row}\endcsname to \readdef -% v1.2 -Corrected the [truncated] LPPL license info -% -Added \arrayij and \arrayijk, which can be put into \edef -% -Used \romannumeral in preference to \roman{}, when possible, -% to avoid unnecessary use of counters. -% v1.3 -Moved \newread outside of \readdef, so as not to exhaust the -% 16 allotted file streams (Thanks to Ken Kubota for the tip). -% v2.0 -Converted parsing to listofitems package. This allows for -% ANY parsing character or combination of characters (via logical OR). -% -Replaced all \protected@edef's with appropriately expanded \def's. -% -Use listofitems package in preference to \getargsC. -% -Deprecated \Arrayijk, \arrayijk, \Arrayij, & \arrayij. Direct -% access now preferred, e.g., \xyz[2,3,1]. -% -Deprecated most other commands in favor of a more natural syntax. -% v3.0 (2021-08-05) -% -Added features: \setvalue, \initarray, \mergearray, \typesetarray -% -Allowed for \readarrayendlinechar to be set other than 9 \RequirePackage{forloop} \RequirePackage{listofitems}[2016-10-22] % @@ -50,6 +31,8 @@ element-by-element basis.] \newtoks\@arrayident@toks \newread\rdar@file \newcount\readarrayendlinechar +\newif\ifignoreblankreadarrayrecords +\ignoreblankreadarrayrecordsfalse \edef\readarraybackslash{\expandafter\@firstoftwo\string\\} % \newcommand\readdef[2]{\@readdef{#1}{#2}{ArrayRecord}} @@ -123,39 +106,51 @@ element-by-element basis.] \def\@readdef#1#2#3{% \clear@array{#3}% \edef\former@recordcount{\csname #3CELLS\endcsname}% + \def\nrows{0}% \def\first@row{T}% - \def\first@plane{T}% + \def\first@plane{F}% \catcode\endlinechar=\readarrayendlinechar\relax % \def#2{}% \setcounter{@record}{0}% \openin\rdar@file=#1% + \ifignoreblankreadarrayrecords + \def\rdar@iftest{\rdar@record\empty}\else\def\rdar@iftest{01}\fi \loop\unless\ifeof\rdar@file% - \read\rdar@file to\rdar@fileline % Reads file line into \rdar@fileline% - \addtocounter{@record}{1}% - \expandafter\g@addto@macro\expandafter#2\expandafter{\rdar@fileline}% - \ifx\rdar@fileline\empty\else\expandafter\g@addto@macro% - \expandafter#2\expandafter{\read@array@sepchar}\fi% - \if T\first@row\read@array{#2}\setcounter{@col}{\numexpr(\Arg@listlen-1)}% - \edef\ncols{\arabic{@col}}\def\first@row{F}\setcounter{@row}{1}% - \else% - \if T\first@plane% - \ifx\rdar@fileline\empty - \edef\nrows{\arabic{@row}}\def\first@plane{F}% + \read\rdar@file to\rdar@record % Reads record into \rdar@record% + \expandafter\ifx\rdar@iftest\else + \stepcounter{@record}% + \expandafter\g@addto@macro\expandafter#2\expandafter{\rdar@record}% + \ifx\rdar@record\empty\else\expandafter + \g@addto@macro\expandafter#2\expandafter{\read@array@sepchar}% + \if T\first@row + \read@array{#2}% + \setcounter{@col}{\numexpr(\Arg@listlen-1)}% + \edef\ncols{\arabic{@col}}% + \def\first@row{F}% + \setcounter{@row}{0}% + \def\first@plane{T}% + \fi + \fi + \if T\first@plane + \ifx\rdar@record\empty + \edef\nrows{\arabic{@row}}% + \def\first@plane{F}% \else - \addtocounter{@row}{1}% + \stepcounter{@row}% \fi - \fi% - \fi% - \def\record@name{\csname #3[\the@record]\endcsname}% - \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter% - \expandafter\def\expandafter\record@name\expandafter{\rdar@fileline}% - \repeat% + \fi + \def\record@name{\csname #3[\the@record]\endcsname}% + \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter + \expandafter\def\expandafter\record@name\expandafter{\rdar@record}% + \fi + \repeat + \ifnum\nrows=0 \edef\nrows{\arabic{@row}}\fi \edef\nrecords{\arabic{@record}}% \expandafter\edef\csname #3PLANES\endcsname{0}% \expandafter\edef\csname #3ROWS\endcsname{\nrecords}% \expandafter\edef\csname #3COLS\endcsname{0}% \expandafter\edef\csname #3CELLS\endcsname{\nrecords}% - \closein\rdar@file% + \closein\rdar@file \catcode\endlinechar=5 % \define@rootmacro{#3}% } @@ -252,7 +247,7 @@ element-by-element basis.] } % \def\clear@array#1{% - \ifcsname #1\endcsname% + \ifcsname #1ROWS\endcsname% \forloop{@row}{1}{\value{@row}<\numexpr\csname #1ROWS\endcsname+1}{% \ifnum\csname #1COLS\endcsname=0\relax% \expandafter\let\csname #1[\the@row]\endcsname\undefined% @@ -494,16 +489,32 @@ element-by-element basis.] \endinput - - - - - - - - - - +% Revisions: +% v1.0 -Initial release. +% v1.01 -Documentation revision. +% v1.1 -Added \csname record\roman{@row}\endcsname to \readdef. +% v1.2 -Corrected the [truncated] LPPL license info. +% -Added \arrayij and \arrayijk, which can be put into \edef. +% -Used \romannumeral in preference to \roman{}, when possible, +% to avoid unnecessary use of counters. +% v1.3 -Moved \newread outside of \readdef, so as not to exhaust the +% 16 allotted file streams (Thanks to Ken Kubota for the tip). +% v2.0 -Converted parsing to listofitems package. This allows for +% ANY parsing character or combination of characters (via logical OR). +% -Replaced all \protected@edef's with appropriately expanded \def's. +% -Use listofitems package in preference to \getargsC. +% -Deprecated \Arrayijk, \arrayijk, \Arrayij, & \arrayij. Direct +% access now preferred, e.g., \xyz[2,3,1]. +% -Deprecated most other commands in favor of a more natural syntax. +% v3.0 (2021-08-05) +% -Added features: \setvalue, \initarray, \mergearray, \typesetarray. +% -Allowed for \readarrayendlinechar to be set other than 9. +% v3.1 (2021-09-17) +% -Bug fix to not break if first line of file subject to \readdef +% is blank/comment line. +% -Introduce \ifignoreblankreadarrayrecords +% -Bug fix in \clear@array, if selected array name is defined, +% but not defined as an array. diff --git a/macros/latex/contrib/readarray/readarray.tex b/macros/latex/contrib/readarray/readarray.tex index bd9a4aa114..bdbb3bef70 100644 --- a/macros/latex/contrib/readarray/readarray.tex +++ b/macros/latex/contrib/readarray/readarray.tex @@ -9,8 +9,22 @@ \def\rdar{\textsf{readarray}} \def\loi{\textsf{listofitems}} \def\cmd#1{\texttt{\string\ \unskip#1}} -\usepackage{readarray} +\usepackage{readarray,tokcycle} \usepackage{verbatimbox} +\newcommand\bverb[1][]{\begingroup\ifx\relax#1\relax + \def\tmpA{\allowbreak}\def\tmpB{0}\else + \def\tmpA{}\def\tmpB{#1}\fi + \catcode`\%=12 \bverbaux} +\newcommand\bverbaux[2][\allowbreak\textvisiblespace\allowbreak]{% + \ttfamily\tokencycle + {\expandafter\tctestifx\expandafter{\tmpB##1}{\allowbreak} + {\string##1\tmpA}} + {\{\processtoks{##1}\}} + {\tctestifx{\isiteleven##1}{##1} + {\expandafter\tctestifx\expandafter{\tmpB##1}{\allowbreak} + {\tcpush{\string##1\isiteleven}}}} + {#1}#2\endtokencycle\endgroup} +\def\isiteleven{\tcpeek\zzz\ifcat\noexpand\zzz A\tcpush{\space}\fi} \begin{filecontents*}[overwrite]{file1data.txt} A111 A112 A113 A114 A121 A122 A123 A124 @@ -179,7 +193,11 @@ commands are: \textup{To select the level of bounds checking on array cell recall:}\\ \rl\vb|\nocheckbounds|\hfill OR\hfill% \vb|\checkbounds|\hfill OR\hfill% -\vb|\hypercheckbounds| +\vb|\hypercheckbounds|\\ +\textup{To ignore blank (or fully commented) records during the + course of a record-array read (this can be undone with a false + setting):}\\ +\rl\vb|\ignoreblankreadarrayrecordstrue| \upshape In these commands, \cmd{}\textit{data-macro} is a control sequence into @@ -454,6 +472,27 @@ If an array name is reutilized, its prior definitions are cleared, so that ``old'' data is not inadvertantly retrieved following the reutilization. +One option (introduced in v3.1) in this regard is the if-condition% + \margcmd{ifignoreblank readarrayrecords} + \bverb[.]{\ifignore.blankreadarrayrecords}, which can take on + values of either \bverb[\-]{\ignoreblank\-readarrayrecordstrue} or + \bverb{\ignoreblankreadarrayrecordsfalse}. +When set to the true condition, ``blank'' records in the input file + (defined either when the record is actually blank or if the first + non-blank token in the record is a catcode-14 \verb|%|) will + be ignored. +This setting will only affect the record array itself---the result + of any \cmd{readdef} will be unaffected by this setting, except + as detailed in the next paragraph. + +The only warning to heed when setting + \bverb[\-]{\ignoreblankreadarrayrecords\-true} is that the first + blank line in a \bverb{\readdef}'ed file is used to set the value + of \cmd{nrows}, which can be used to set the row-depth of a 3-D + array plane within subsequent invocations of \cmd{readarray}. +Of course, the array plane's row-depth may always be set + manually, in lieu of using \bverb{\nrows}. + \subsection{Creating 2-D and 3-D Arrays from Data} @@ -948,7 +987,7 @@ I am likewise grateful to Ken Kubota, who suggested moving the \vb|\newread| outside of \vb|\readdef|, so as not to prematurely exhaust the 16 available file streams. -\clearpage +%\clearpage \section{Code Listing} \verbfilenobox[\footnotesize]{readarray.sty} diff --git a/macros/luatex/generic/luatexja/README b/macros/luatex/generic/luatexja/README index 9e51dd5766..f708f32afa 100644 --- a/macros/luatex/generic/luatexja/README +++ b/macros/luatex/generic/luatexja/README @@ -1,4 +1,4 @@ -The LuaTeX-ja Package 20210607.0 +The LuaTeX-ja Package 20210918.0 -------------------------------- Copyright (c) 2011--2021 The LuaTeX-ja project License: modified BSD (see COPYING) @@ -42,9 +42,9 @@ Installation 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20210607.0 in the Git repository by + or tagged as 20210918.0 in the Git repository by <http://git.osdn.jp/view?p=luatex-ja/luatexja.git - ;a=snapshot;h=refs/tags/20210607.0;sf=tgz> + ;a=snapshot;h=refs/tags/20210918.0;sf=tgz> b. Extract the archive and process following three files by LuaLaTeX to generate classes for Japanese typesetting: @@ -93,4 +93,4 @@ Notes This file and ltj-kinsoku.lua are not used anymore. (Do not remove ltj-kinsoku.tex.) -Last commit date: Mon Jun 7 20:50:27 2021 +0900 +Last commit date: Sat Sep 18 21:01:24 2021 +0900 diff --git a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf Binary files differindex 6d9f8a3cd5..146c837511 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf Binary files differindex 4ca3182ca0..299097de2d 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf Binary files differindex 2ca312ab06..e3cea8d738 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex index a01994faa7..3148d1df9e 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex +++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex @@ -45,6 +45,31 @@ \DeclareFontShape{JY3}{mc}{mc}{n}{<-> [0.92487] HaranoAjiMincho-Regular:extend=0.67;jfm=ujisc33}{} +%%%% \ltjruby 内に \texorpdfstring + | 除去を仕込む +\RequirePackage{xparse} +\makeatletter +\def\removevert#1{\if\noexpand#1|% + \expandafter\expandafter\expandafter\@firstofone\expandafter{% + \else\ifnum0=1}\fi#1% + \ifx#1\relax\expandafter\@gobble% + \else\expandafter\@firstofone + \fi{\expandafter\@firstofone + \fi + \removevert}} +\makeatother +\ExplSyntaxOn +\cs_set_eq:NN \myorigltjruby \ltjruby +\DeclareExpandableDocumentCommand {\ltjruby} { O{} m m } {% + \texorpdfstring { + \exp_not:n { \myorigltjruby[#1]{#2}{#3} } + } { + \removevert #2 \relax + } +} +\cs_set_eq:NN \ruby \ltjruby +\ExplSyntaxOff +%%%% + \title{\textsf{luatexja-ruby}パッケージ} \author{\LuaTeX-jaプロジェクトチーム} \date{\texttt{\csname ver@luatexja-ruby.sty\endcsname}(\today)} diff --git a/macros/luatex/generic/luatexja/src/ltj-ivd_aj1.lua b/macros/luatex/generic/luatexja/src/ltj-ivd_aj1.lua index 4ed4e5a512..de18150d79 100644 --- a/macros/luatex/generic/luatexja/src/ltj-ivd_aj1.lua +++ b/macros/luatex/generic/luatexja/src/ltj-ivd_aj1.lua @@ -6,6 +6,9 @@ table_ivd_aj1 = { -- # -- # History: -- # +-- # 2020-11-06 Registration of additional sequences in the MSARG +-- # collection. +-- # -- # 2017-12-12 Registration of additional sequences in the Adobe-Japan1 -- # collection. Combined registration of the KRName collection -- # and of sequences in that collection. Registration of @@ -31,10 +34,10 @@ table_ivd_aj1 = { -- # -- # This file is part of the Unicode Ideographic Variation Database (IVD). -- # For more details on the IVD, see UTS #37: --- # http://www.unicode.org/reports/tr37/ +-- # https://www.unicode.org/reports/tr37/ -- # --- # Copyright 2006-2017 Unicode, Inc. --- # For terms of use, see: http://www.unicode.org/terms_of_use.html +-- # Copyright 2006-2020 Unicode, Inc. +-- # For terms of use, see: https://www.unicode.org/copyright.html#8 -- # -- # EOF f,f,f,f,f,f,f,f,f,f, diff --git a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua index 7437492772..9ce7816070 100644 --- a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua +++ b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2021-02-11', + date = '2021-09-18', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -45,11 +45,12 @@ local node_next = node.direct.getnext local ltjd_make_dir_whatsit = ltjd.make_dir_whatsit local ltjf_font_metric_table = ltjf.font_metric_table local ltjf_find_char_class = ltjf.find_char_class -local node_new = node.direct.new +local node_new = luatexja.dnode_new local node_copy = node.direct.copy local node_tail = node.direct.tail local node_free = node.direct.free local node_remove = node.direct.remove +local node_inherit_attr = luatexja.node_inherit_attr local id_glyph = node.id 'glyph' local id_hlist = node.id 'hlist' @@ -383,7 +384,7 @@ function calc_np_aux_glyph_common(lp, acc_flag) lp=lx local r if adj_depth>node_depth then - r = node_new(id_rule,3) + r = node_new(id_rule,3,first_glyph) setfield(r, 'width', 0); setfield(r, 'height', 0) setfield(r, 'depth',adj_depth); setfield(r, 'dir', tex_dir) set_attr(r, attr_icflag, PROCESSED) @@ -689,7 +690,7 @@ local function handle_penalty_normal(post, pre, g) local a = (pre or 0) + (post or 0) if #Bp == 0 then if (a~=0 and not(g and getid(g)==id_kern)) then - local p = node_new(id_penalty) + local p = node_new(id_penalty, nil, Nq.nuc, Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end setfield(p, 'penalty', a); head = insert_before(head, Np.first, p) Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) @@ -703,7 +704,7 @@ local function handle_penalty_always(post, pre, g) local a = (pre or 0) + (post or 0) if #Bp == 0 then if not (g and getid(g)==id_glue) or a~=0 then - local p = node_new(id_penalty) + local p = node_new(id_penalty, nil, Nq.nuc, Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end setfield(p, 'penalty', a); head = insert_before(head, Np.first, p) Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) @@ -716,7 +717,7 @@ local function handle_penalty_suppress(post, pre, g) luatexbase.call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) if #Bp == 0 then if g and getid(g)==id_glue then - local p = node_new(id_penalty) + local p = node_new(id_penalty, nil, Nq.nuc, Np.nuc) setfield(p, 'penalty', 10000); head = insert_before(head, Np.first, p) Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) end @@ -730,7 +731,7 @@ local function handle_penalty_jwp() local a = table_current_stack[luatexja.stack_table_index.JWP] if #widow_Bp == 0 then if a~=0 then - local p = node_new(id_penalty) + local p = node_new(id_penalty, widow_Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end setfield(p, 'penalty', a); head = insert_before(head, widow_Np.first, p) widow_Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) @@ -759,8 +760,7 @@ end -- Nq.last (kern w) .... (glue/kern g) Np.first local function real_insert(g) if g then - head = insert_before(head, Np.first, g) - Np.first = g + head, Np.first = insert_before(head, Np.first, node_inherit_attr(g, Nq.nuc, Np.nuc)) local ngk = Np.gk if not ngk then Np.gk = g elseif type(ngk)=="table" then ngk[#ngk+1]=g @@ -1151,7 +1151,7 @@ local function handle_list_head(par_indented) if g then set_attr(g, attr_icflag, BOXBDD) if getid(g)==id_glue and #Bp==0 then - local h = node_new(id_penalty) + local h = node_new(id_penalty, nil, Np.nuc) setfield(h, 'penalty', 10000); set_attr(h, attr_icflag, BOXBDD) end head = insert_before(head, Np.first, g) @@ -1424,31 +1424,27 @@ do return lx end end + local function special_jaglue_after_inner(lx, lxi, lxi_jfm, kn, bk) + local w, st, sh, sto, sho = getglue(kn) + if w~=1073741823 then + setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, lxi) + else + local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)] + setglue(lx, bk[1], bk[2], bk[3], 0, 0) + set_attr(lx, attr_icflag, lxi_jfm) + end + end local function special_jaglue_after(lx) if get_attr_icflag(lx)==SPECIAL_JAGLUE then lxi=has_attr(lx, attr_yablshift) if lxi>=PROCESSED_BEGIN_FLAG then lxi = lxi%PROCESSED_BEGIN_FLAG if lxi == KANJI_SKIP then - local w, st, sh, sto, sho = getglue(kanji_skip) - if w~=1073741823 then - setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, KANJI_SKIP) - else - local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)] - local bk = m.kanjiskip or null_skip_table - setglue(lx, bk[1], bk[2], bk[3], 0, 0) - set_attr(lx, attr_icflag, KANJI_SKIP_JFM) - end - elseif lxi == XKANJI_SKIP then - local w, st, sh, sto, sho = getglue(xkanji_skip) - if w~=1073741823 then - setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, XKANJI_SKIP) - else - local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)] - local bk = m.xkanjiskip or null_skip_table - setglue(lx, bk[1], bk[2], bk[3], 0, 0) - set_attr(lx, attr_icflag, XKANJI_SKIP_JFM) - end + special_jaglue_after_inner(lx, lxi, KANJI_SKIP_JFM, kanji_skip, + ltjf_font_metric_table[has_attr(lx, attr_tablshift)].kanjiskip or null_skip_table) + else -- lxi == XKANJI_SKIP + special_jaglue_after_inner(lx, lxi, XKANJI_SKIP_JFM, xkanji_skip, + ltjf_font_metric_table[has_attr(lx, attr_tablshift)].xkanjiskip or null_skip_table) end else set_attr(lx, attr_icflag, lxi) diff --git a/macros/luatex/generic/luatexja/src/ltj-jfont.lua b/macros/luatex/generic/luatexja/src/ltj-jfont.lua index ac8ce5c2fb..b097809883 100644 --- a/macros/luatex/generic/luatexja/src/ltj-jfont.lua +++ b/macros/luatex/generic/luatexja/src/ltj-jfont.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfont', - date = '2020-10-05', + date = '2021-09-18', description = 'Loader for Japanese fonts', }) @@ -793,9 +793,9 @@ local list_rotate_glyphs do local ceil = math.ceil -- output of function_uax50.lua - -- UAX#50 for Unicode 13.0.0 + -- UAX#50 for Unicode 14.0.0 -- t[0] = true - local t={ 0, 167, 168, 169, 170, 174, 175, 177, 178, 188, 191, 215, 216, 247, 248, 746, 748, 888, 890, 896, 900, 907, 908, 909, 910, 930, 931, 1328, 1329, 1367, 1369, 1419, 1421, 1424, 1425, 1480, 1488, 1515, 1519, 1525, 1536, 1565, 1566, 1806, 1807, 1867, 1869, 1970, 1984, 2043, 2045, 2094, 2096, 2111, 2112, 2140, 2142, 2143, 2144, 2155, 2208, 2229, 2230, 2248, 2259, 2436, 2437, 2445, 2447, 2449, 2451, 2473, 2474, 2481, 2482, 2483, 2486, 2490, 2492, 2501, 2503, 2505, 2507, 2511, 2519, 2520, 2524, 2526, 2527, 2532, 2534, 2559, 2561, 2564, 2565, 2571, 2575, 2577, 2579, 2601, 2602, 2609, 2610, 2612, 2613, 2615, 2616, 2618, 2620, 2621, 2622, 2627, 2631, 2633, 2635, 2638, 2641, 2642, 2649, 2653, 2654, 2655, 2662, 2679, 2689, 2692, 2693, 2702, 2703, 2706, 2707, 2729, 2730, 2737, 2738, 2740, 2741, 2746, 2748, 2758, 2759, 2762, 2763, 2766, 2768, 2769, 2784, 2788, 2790, 2802, 2809, 2816, 2817, 2820, 2821, 2829, 2831, 2833, 2835, 2857, 2858, 2865, 2866, 2868, 2869, 2874, 2876, 2885, 2887, 2889, 2891, 2894, 2901, 2904, 2908, 2910, 2911, 2916, 2918, 2936, 2946, 2948, 2949, 2955, 2958, 2961, 2962, 2966, 2969, 2971, 2972, 2973, 2974, 2976, 2979, 2981, 2984, 2987, 2990, 3002, 3006, 3011, 3014, 3017, 3018, 3022, 3024, 3025, 3031, 3032, 3046, 3067, 3072, 3085, 3086, 3089, 3090, 3113, 3114, 3130, 3133, 3141, 3142, 3145, 3146, 3150, 3157, 3159, 3160, 3163, 3168, 3172, 3174, 3184, 3191, 3213, 3214, 3217, 3218, 3241, 3242, 3252, 3253, 3258, 3260, 3269, 3270, 3273, 3274, 3278, 3285, 3287, 3294, 3295, 3296, 3300, 3302, 3312, 3313, 3315, 3328, 3341, 3342, 3345, 3346, 3397, 3398, 3401, 3402, 3408, 3412, 3428, 3430, 3456, 3457, 3460, 3461, 3479, 3482, 3506, 3507, 3516, 3517, 3518, 3520, 3527, 3530, 3531, 3535, 3541, 3542, 3543, 3544, 3552, 3558, 3568, 3570, 3573, 3585, 3643, 3647, 3676, 3713, 3715, 3716, 3717, 3718, 3723, 3724, 3748, 3749, 3750, 3751, 3774, 3776, 3781, 3782, 3783, 3784, 3790, 3792, 3802, 3804, 3808, 3840, 3912, 3913, 3949, 3953, 3992, 3993, 4029, 4030, 4045, 4046, 4059, 4096, 4294, 4295, 4296, 4301, 4302, 4304, 4352, 4608, 4681, 4682, 4686, 4688, 4695, 4696, 4697, 4698, 4702, 4704, 4745, 4746, 4750, 4752, 4785, 4786, 4790, 4792, 4799, 4800, 4801, 4802, 4806, 4808, 4823, 4824, 4881, 4882, 4886, 4888, 4955, 4957, 4989, 4992, 5018, 5024, 5110, 5112, 5118, 5120, 5121, 5760, 5789, 5792, 5881, 5888, 5901, 5902, 5909, 5920, 5943, 5952, 5972, 5984, 5997, 5998, 6001, 6002, 6004, 6016, 6110, 6112, 6122, 6128, 6138, 6144, 6159, 6160, 6170, 6176, 6265, 6272, 6315, 6400, 6431, 6432, 6444, 6448, 6460, 6464, 6465, 6468, 6510, 6512, 6517, 6528, 6572, 6576, 6602, 6608, 6619, 6622, 6684, 6686, 6751, 6752, 6781, 6783, 6794, 6800, 6810, 6816, 6830, 6832, 6849, 6912, 6988, 6992, 7037, 7040, 7156, 7164, 7224, 7227, 7242, 7245, 7305, 7312, 7355, 7357, 7368, 7376, 7419, 7424, 7674, 7675, 7958, 7960, 7966, 7968, 8006, 8008, 8014, 8016, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8062, 8064, 8117, 8118, 8133, 8134, 8148, 8150, 8156, 8157, 8176, 8178, 8181, 8182, 8191, 8192, 8214, 8215, 8224, 8226, 8240, 8242, 8251, 8253, 8258, 8259, 8263, 8266, 8273, 8274, 8293, 8294, 8306, 8308, 8335, 8336, 8349, 8352, 8384, 8400, 8413, 8417, 8418, 8421, 8433, 8450, 8451, 8458, 8463, 8464, 8467, 8469, 8470, 8472, 8478, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8494, 8495, 8501, 8512, 8517, 8523, 8524, 8526, 8527, 8586, 8588, 8592, 8734, 8735, 8756, 8758, 8960, 8968, 8972, 8992, 8996, 9001, 9003, 9004, 9085, 9115, 9150, 9166, 9167, 9168, 9169, 9180, 9186, 9251, 9252, 9472, 9632, 9754, 9760, 10088, 10102, 10132, 11026, 11056, 11088, 11098, 11124, 11126, 11158, 11160, 11192, 11218, 11219, 11244, 11248, 11264, 11311, 11312, 11359, 11360, 11508, 11513, 11558, 11559, 11560, 11565, 11566, 11568, 11624, 11631, 11633, 11647, 11671, 11680, 11687, 11688, 11695, 11696, 11703, 11704, 11711, 11712, 11719, 11720, 11727, 11728, 11735, 11736, 11743, 11744, 11856, 11858, 11859, 12296, 12306, 12308, 12320, 12336, 12337, 12448, 12449, 12540, 12541, 42192, 42540, 42560, 42744, 42752, 42944, 42946, 42955, 42997, 43053, 43056, 43066, 43072, 43128, 43136, 43206, 43214, 43226, 43232, 43348, 43359, 43360, 43392, 43470, 43471, 43482, 43486, 43519, 43520, 43575, 43584, 43598, 43600, 43610, 43612, 43715, 43739, 43767, 43777, 43783, 43785, 43791, 43793, 43799, 43808, 43815, 43816, 43823, 43824, 43884, 43888, 44014, 44016, 44026, 55296, 57344, 64256, 64263, 64275, 64280, 64285, 64311, 64312, 64317, 64318, 64319, 64320, 64322, 64323, 64325, 64326, 64450, 64467, 64832, 64848, 64912, 64914, 64968, 65008, 65022, 65024, 65040, 65056, 65072, 65097, 65104, 65112, 65119, 65123, 65127, 65136, 65141, 65142, 65277, 65279, 65280, 65288, 65290, 65293, 65294, 65306, 65311, 65339, 65340, 65341, 65342, 65343, 65344, 65371, 65471, 65474, 65480, 65482, 65488, 65490, 65496, 65498, 65501, 65507, 65508, 65512, 65519, 65529, 65532, 65536, 65548, 65549, 65575, 65576, 65595, 65596, 65598, 65599, 65614, 65616, 65630, 65664, 65787, 65792, 65795, 65799, 65844, 65847, 65935, 65936, 65949, 65952, 65953, 66000, 66046, 66176, 66205, 66208, 66257, 66272, 66300, 66304, 66340, 66349, 66379, 66384, 66427, 66432, 66462, 66463, 66500, 66504, 66518, 66560, 66718, 66720, 66730, 66736, 66772, 66776, 66812, 66816, 66856, 66864, 66916, 66927, 66928, 67072, 67383, 67392, 67414, 67424, 67432, 67584, 67590, 67592, 67593, 67594, 67638, 67639, 67641, 67644, 67645, 67647, 67670, 67671, 67743, 67751, 67760, 67808, 67827, 67828, 67830, 67835, 67868, 67871, 67898, 67903, 67904, 68000, 68024, 68028, 68048, 68050, 68100, 68101, 68103, 68108, 68116, 68117, 68120, 68121, 68150, 68152, 68155, 68159, 68169, 68176, 68185, 68192, 68256, 68288, 68327, 68331, 68343, 68352, 68406, 68409, 68438, 68440, 68467, 68472, 68498, 68505, 68509, 68521, 68528, 68608, 68681, 68736, 68787, 68800, 68851, 68858, 68904, 68912, 68922, 69216, 69247, 69248, 69290, 69291, 69294, 69296, 69298, 69376, 69416, 69424, 69466, 69552, 69580, 69600, 69623, 69632, 69710, 69714, 69744, 69759, 69826, 69837, 69838, 69840, 69865, 69872, 69882, 69888, 69941, 69942, 69960, 69968, 70007, 70016, 70112, 70113, 70133, 70144, 70162, 70163, 70207, 70272, 70279, 70280, 70281, 70282, 70286, 70287, 70302, 70303, 70314, 70320, 70379, 70384, 70394, 70400, 70404, 70405, 70413, 70415, 70417, 70419, 70441, 70442, 70449, 70450, 70452, 70453, 70458, 70459, 70469, 70471, 70473, 70475, 70478, 70480, 70481, 70487, 70488, 70493, 70500, 70502, 70509, 70512, 70517, 70656, 70748, 70749, 70754, 70784, 70856, 70864, 70874, 71168, 71237, 71248, 71258, 71264, 71277, 71296, 71353, 71360, 71370, 71424, 71451, 71453, 71468, 71472, 71488, 71680, 71740, 71840, 71923, 71935, 71943, 71945, 71946, 71948, 71956, 71957, 71959, 71960, 71990, 71991, 71993, 71995, 72007, 72016, 72026, 72096, 72104, 72106, 72152, 72154, 72165, 72384, 72441, 72704, 72713, 72714, 72759, 72760, 72774, 72784, 72813, 72816, 72848, 72850, 72872, 72873, 72887, 72960, 72967, 72968, 72970, 72971, 73015, 73018, 73019, 73020, 73022, 73023, 73032, 73040, 73050, 73056, 73062, 73063, 73065, 73066, 73103, 73104, 73106, 73107, 73113, 73120, 73130, 73440, 73465, 73648, 73649, 73664, 73714, 73727, 74650, 74752, 74863, 74864, 74869, 74880, 75076, 92160, 92729, 92736, 92767, 92768, 92778, 92782, 92784, 92880, 92910, 92912, 92918, 92928, 92998, 93008, 93018, 93019, 93026, 93027, 93048, 93053, 93072, 93760, 93851, 93952, 94027, 94031, 94088, 94095, 94112, 113664, 113771, 113776, 113789, 113792, 113801, 113808, 113818, 113820, 113828, 119296, 119366, 119808, 119893, 119894, 119965, 119966, 119968, 119970, 119971, 119973, 119975, 119977, 119981, 119982, 119994, 119995, 119996, 119997, 120004, 120005, 120070, 120071, 120075, 120077, 120085, 120086, 120093, 120094, 120122, 120123, 120127, 120128, 120133, 120134, 120135, 120138, 120145, 120146, 120486, 120488, 120780, 120782, 120832, 122880, 122887, 122888, 122905, 122907, 122914, 122915, 122917, 122918, 122923, 123136, 123181, 123184, 123198, 123200, 123210, 123214, 123216, 123584, 123642, 123647, 123648, 124928, 125125, 125127, 125143, 125184, 125260, 125264, 125274, 125278, 125280, 126065, 126133, 126209, 126270, 126464, 126468, 126469, 126496, 126497, 126499, 126500, 126501, 126503, 126504, 126505, 126515, 126516, 126520, 126521, 126522, 126523, 126524, 126530, 126531, 126535, 126536, 126537, 126538, 126539, 126540, 126541, 126544, 126545, 126547, 126548, 126549, 126551, 126552, 126553, 126554, 126555, 126556, 126557, 126558, 126559, 126560, 126561, 126563, 126564, 126565, 126567, 126571, 126572, 126579, 126580, 126584, 126585, 126589, 126590, 126591, 126592, 126602, 126603, 126620, 126625, 126628, 126629, 126634, 126635, 126652, 126704, 126706, 129024, 129036, 129040, 129096, 129104, 129114, 129120, 129160, 129168, 129198, 129200, 129202, 129792, 129939, 129940, 129995, 130032, 130042, 917505, 917506, 917536, 917632, 917760, 918000 } + local t={ 0, 167, 168, 169, 170, 174, 175, 177, 178, 188, 191, 215, 216, 247, 248, 746, 748, 888, 890, 896, 900, 907, 908, 909, 910, 930, 931, 1328, 1329, 1367, 1369, 1419, 1421, 1424, 1425, 1480, 1488, 1515, 1519, 1525, 1536, 1806, 1807, 1867, 1869, 1970, 1984, 2043, 2045, 2094, 2096, 2111, 2112, 2140, 2142, 2143, 2144, 2155, 2160, 2191, 2192, 2194, 2200, 2436, 2437, 2445, 2447, 2449, 2451, 2473, 2474, 2481, 2482, 2483, 2486, 2490, 2492, 2501, 2503, 2505, 2507, 2511, 2519, 2520, 2524, 2526, 2527, 2532, 2534, 2559, 2561, 2564, 2565, 2571, 2575, 2577, 2579, 2601, 2602, 2609, 2610, 2612, 2613, 2615, 2616, 2618, 2620, 2621, 2622, 2627, 2631, 2633, 2635, 2638, 2641, 2642, 2649, 2653, 2654, 2655, 2662, 2679, 2689, 2692, 2693, 2702, 2703, 2706, 2707, 2729, 2730, 2737, 2738, 2740, 2741, 2746, 2748, 2758, 2759, 2762, 2763, 2766, 2768, 2769, 2784, 2788, 2790, 2802, 2809, 2816, 2817, 2820, 2821, 2829, 2831, 2833, 2835, 2857, 2858, 2865, 2866, 2868, 2869, 2874, 2876, 2885, 2887, 2889, 2891, 2894, 2901, 2904, 2908, 2910, 2911, 2916, 2918, 2936, 2946, 2948, 2949, 2955, 2958, 2961, 2962, 2966, 2969, 2971, 2972, 2973, 2974, 2976, 2979, 2981, 2984, 2987, 2990, 3002, 3006, 3011, 3014, 3017, 3018, 3022, 3024, 3025, 3031, 3032, 3046, 3067, 3072, 3085, 3086, 3089, 3090, 3113, 3114, 3130, 3132, 3141, 3142, 3145, 3146, 3150, 3157, 3159, 3160, 3163, 3165, 3166, 3168, 3172, 3174, 3184, 3191, 3213, 3214, 3217, 3218, 3241, 3242, 3252, 3253, 3258, 3260, 3269, 3270, 3273, 3274, 3278, 3285, 3287, 3293, 3295, 3296, 3300, 3302, 3312, 3313, 3315, 3328, 3341, 3342, 3345, 3346, 3397, 3398, 3401, 3402, 3408, 3412, 3428, 3430, 3456, 3457, 3460, 3461, 3479, 3482, 3506, 3507, 3516, 3517, 3518, 3520, 3527, 3530, 3531, 3535, 3541, 3542, 3543, 3544, 3552, 3558, 3568, 3570, 3573, 3585, 3643, 3647, 3676, 3713, 3715, 3716, 3717, 3718, 3723, 3724, 3748, 3749, 3750, 3751, 3774, 3776, 3781, 3782, 3783, 3784, 3790, 3792, 3802, 3804, 3808, 3840, 3912, 3913, 3949, 3953, 3992, 3993, 4029, 4030, 4045, 4046, 4059, 4096, 4294, 4295, 4296, 4301, 4302, 4304, 4352, 4608, 4681, 4682, 4686, 4688, 4695, 4696, 4697, 4698, 4702, 4704, 4745, 4746, 4750, 4752, 4785, 4786, 4790, 4792, 4799, 4800, 4801, 4802, 4806, 4808, 4823, 4824, 4881, 4882, 4886, 4888, 4955, 4957, 4989, 4992, 5018, 5024, 5110, 5112, 5118, 5120, 5121, 5760, 5789, 5792, 5881, 5888, 5910, 5919, 5943, 5952, 5972, 5984, 5997, 5998, 6001, 6002, 6004, 6016, 6110, 6112, 6122, 6128, 6138, 6144, 6170, 6176, 6265, 6272, 6315, 6400, 6431, 6432, 6444, 6448, 6460, 6464, 6465, 6468, 6510, 6512, 6517, 6528, 6572, 6576, 6602, 6608, 6619, 6622, 6684, 6686, 6751, 6752, 6781, 6783, 6794, 6800, 6810, 6816, 6830, 6832, 6863, 6912, 6989, 6992, 7039, 7040, 7156, 7164, 7224, 7227, 7242, 7245, 7305, 7312, 7355, 7357, 7368, 7376, 7419, 7424, 7958, 7960, 7966, 7968, 8006, 8008, 8014, 8016, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8062, 8064, 8117, 8118, 8133, 8134, 8148, 8150, 8156, 8157, 8176, 8178, 8181, 8182, 8191, 8192, 8214, 8215, 8224, 8226, 8240, 8242, 8251, 8253, 8258, 8259, 8263, 8266, 8273, 8274, 8293, 8294, 8306, 8308, 8335, 8336, 8349, 8352, 8385, 8400, 8413, 8417, 8418, 8421, 8433, 8450, 8451, 8458, 8463, 8464, 8467, 8469, 8470, 8472, 8478, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8494, 8495, 8501, 8512, 8517, 8523, 8524, 8526, 8527, 8586, 8588, 8592, 8734, 8735, 8756, 8758, 8960, 8968, 8972, 8992, 8996, 9001, 9003, 9004, 9085, 9115, 9150, 9166, 9167, 9168, 9169, 9180, 9186, 9251, 9252, 9472, 9632, 9754, 9760, 10088, 10102, 10132, 11026, 11056, 11088, 11098, 11124, 11126, 11158, 11160, 11192, 11218, 11219, 11244, 11248, 11264, 11508, 11513, 11558, 11559, 11560, 11565, 11566, 11568, 11624, 11631, 11633, 11647, 11671, 11680, 11687, 11688, 11695, 11696, 11703, 11704, 11711, 11712, 11719, 11720, 11727, 11728, 11735, 11736, 11743, 11744, 11856, 11858, 11870, 12296, 12306, 12308, 12320, 12336, 12337, 12448, 12449, 12540, 12541, 42192, 42540, 42560, 42744, 42752, 42955, 42960, 42962, 42963, 42964, 42965, 42970, 42994, 43053, 43056, 43066, 43072, 43128, 43136, 43206, 43214, 43226, 43232, 43348, 43359, 43360, 43392, 43470, 43471, 43482, 43486, 43519, 43520, 43575, 43584, 43598, 43600, 43610, 43612, 43715, 43739, 43767, 43777, 43783, 43785, 43791, 43793, 43799, 43808, 43815, 43816, 43823, 43824, 43884, 43888, 44014, 44016, 44026, 55296, 57344, 64256, 64263, 64275, 64280, 64285, 64311, 64312, 64317, 64318, 64319, 64320, 64322, 64323, 64325, 64326, 64451, 64467, 64912, 64914, 64968, 64975, 64976, 65008, 65040, 65056, 65072, 65097, 65104, 65112, 65119, 65123, 65127, 65136, 65141, 65142, 65277, 65279, 65280, 65288, 65290, 65293, 65294, 65306, 65311, 65339, 65340, 65341, 65342, 65343, 65344, 65371, 65471, 65474, 65480, 65482, 65488, 65490, 65496, 65498, 65501, 65507, 65508, 65512, 65519, 65529, 65532, 65536, 65548, 65549, 65575, 65576, 65595, 65596, 65598, 65599, 65614, 65616, 65630, 65664, 65787, 65792, 65795, 65799, 65844, 65847, 65935, 65936, 65949, 65952, 65953, 66000, 66046, 66176, 66205, 66208, 66257, 66272, 66300, 66304, 66340, 66349, 66379, 66384, 66427, 66432, 66462, 66463, 66500, 66504, 66518, 66560, 66718, 66720, 66730, 66736, 66772, 66776, 66812, 66816, 66856, 66864, 66916, 66927, 66939, 66940, 66955, 66956, 66963, 66964, 66966, 66967, 66978, 66979, 66994, 66995, 67002, 67003, 67005, 67072, 67383, 67392, 67414, 67424, 67432, 67456, 67462, 67463, 67505, 67506, 67515, 67584, 67590, 67592, 67593, 67594, 67638, 67639, 67641, 67644, 67645, 67647, 67670, 67671, 67743, 67751, 67760, 67808, 67827, 67828, 67830, 67835, 67868, 67871, 67898, 67903, 67904, 68000, 68024, 68028, 68048, 68050, 68100, 68101, 68103, 68108, 68116, 68117, 68120, 68121, 68150, 68152, 68155, 68159, 68169, 68176, 68185, 68192, 68256, 68288, 68327, 68331, 68343, 68352, 68406, 68409, 68438, 68440, 68467, 68472, 68498, 68505, 68509, 68521, 68528, 68608, 68681, 68736, 68787, 68800, 68851, 68858, 68904, 68912, 68922, 69216, 69247, 69248, 69290, 69291, 69294, 69296, 69298, 69376, 69416, 69424, 69466, 69488, 69514, 69552, 69580, 69600, 69623, 69632, 69710, 69714, 69750, 69759, 69827, 69837, 69838, 69840, 69865, 69872, 69882, 69888, 69941, 69942, 69960, 69968, 70007, 70016, 70112, 70113, 70133, 70144, 70162, 70163, 70207, 70272, 70279, 70280, 70281, 70282, 70286, 70287, 70302, 70303, 70314, 70320, 70379, 70384, 70394, 70400, 70404, 70405, 70413, 70415, 70417, 70419, 70441, 70442, 70449, 70450, 70452, 70453, 70458, 70459, 70469, 70471, 70473, 70475, 70478, 70480, 70481, 70487, 70488, 70493, 70500, 70502, 70509, 70512, 70517, 70656, 70748, 70749, 70754, 70784, 70856, 70864, 70874, 71168, 71237, 71248, 71258, 71264, 71277, 71296, 71354, 71360, 71370, 71424, 71451, 71453, 71468, 71472, 71495, 71680, 71740, 71840, 71923, 71935, 71943, 71945, 71946, 71948, 71956, 71957, 71959, 71960, 71990, 71991, 71993, 71995, 72007, 72016, 72026, 72096, 72104, 72106, 72152, 72154, 72165, 72384, 72441, 72704, 72713, 72714, 72759, 72760, 72774, 72784, 72813, 72816, 72848, 72850, 72872, 72873, 72887, 72960, 72967, 72968, 72970, 72971, 73015, 73018, 73019, 73020, 73022, 73023, 73032, 73040, 73050, 73056, 73062, 73063, 73065, 73066, 73103, 73104, 73106, 73107, 73113, 73120, 73130, 73440, 73465, 73648, 73649, 73664, 73714, 73727, 74650, 74752, 74863, 74864, 74869, 74880, 75076, 77712, 77811, 92160, 92729, 92736, 92767, 92768, 92778, 92782, 92863, 92864, 92874, 92880, 92910, 92912, 92918, 92928, 92998, 93008, 93018, 93019, 93026, 93027, 93048, 93053, 93072, 93760, 93851, 93952, 94027, 94031, 94088, 94095, 94112, 113664, 113771, 113776, 113789, 113792, 113801, 113808, 113818, 113820, 113828, 119296, 119366, 119808, 119893, 119894, 119965, 119966, 119968, 119970, 119971, 119973, 119975, 119977, 119981, 119982, 119994, 119995, 119996, 119997, 120004, 120005, 120070, 120071, 120075, 120077, 120085, 120086, 120093, 120094, 120122, 120123, 120127, 120128, 120133, 120134, 120135, 120138, 120145, 120146, 120486, 120488, 120780, 120782, 120832, 122624, 122655, 122880, 122887, 122888, 122905, 122907, 122914, 122915, 122917, 122918, 122923, 123136, 123181, 123184, 123198, 123200, 123210, 123214, 123216, 123536, 123567, 123584, 123642, 123647, 123648, 124896, 124903, 124904, 124908, 124909, 124911, 124912, 124927, 124928, 125125, 125127, 125143, 125184, 125260, 125264, 125274, 125278, 125280, 126065, 126133, 126209, 126270, 126464, 126468, 126469, 126496, 126497, 126499, 126500, 126501, 126503, 126504, 126505, 126515, 126516, 126520, 126521, 126522, 126523, 126524, 126530, 126531, 126535, 126536, 126537, 126538, 126539, 126540, 126541, 126544, 126545, 126547, 126548, 126549, 126551, 126552, 126553, 126554, 126555, 126556, 126557, 126558, 126559, 126560, 126561, 126563, 126564, 126565, 126567, 126571, 126572, 126579, 126580, 126584, 126585, 126589, 126590, 126591, 126592, 126602, 126603, 126620, 126625, 126628, 126629, 126634, 126635, 126652, 126704, 126706, 129024, 129036, 129040, 129096, 129104, 129114, 129120, 129160, 129168, 129198, 129200, 129202, 129792, 129939, 129940, 129995, 130032, 130042, 917505, 917506, 917536, 917632, 917760, 918000 } local function rotate_in_uax50(i) local lo, hi = 1, #t while lo < hi do diff --git a/macros/luatex/generic/luatexja/src/ltj-setwidth.lua b/macros/luatex/generic/luatexja/src/ltj-setwidth.lua index 03ec44fe13..a4073936f0 100644 --- a/macros/luatex/generic/luatexja/src/ltj-setwidth.lua +++ b/macros/luatex/generic/luatexja/src/ltj-setwidth.lua @@ -33,7 +33,6 @@ local getoffsets = node.direct.getoffsets or function(n) local node_traverse_id = node.direct.traverse_id local node_traverse = node.direct.traverse -local node_new = node.direct.new local node_copy = node.direct.copy local node_remove = node.direct.remove local node_tail = node.direct.tail @@ -43,6 +42,7 @@ local set_attr = node.direct.set_attribute local node_insert_before = node.direct.insert_before local node_insert_after = node.direct.insert_after local round = tex.round +local node_new = luatexja.dnode_new local id_glyph = node.id 'glyph' local id_kern = node.id 'kern' @@ -76,6 +76,7 @@ do end end + local ltjw = {} --export luatexja.setwidth = ltjw @@ -114,7 +115,7 @@ local function capsule_glyph_yoko(p, met, char_data, head, dir) setoffsets(p, xo - fshift.left, yo - kbl - fshift.down) return node_next(p), head, p elseif ht_diff >= 0 and dp_diff >=0 then -- rule - local box = node_new(id_rule,rule_subtype) + local box = node_new(id_rule, rule_subtype, p) local xo, yo = getoffsets(p) setoffsets(p, xo, yo - kbl - fshift.down) setwhd(box, 0, fheight - kbl, fdepth + kbl) @@ -140,7 +141,7 @@ local function capsule_glyph_yoko(p, met, char_data, head, dir) setoffsets(p, xo + char_data.align*(fwidth-pwidth) - fshift.left, yo - fshift.down); setnext(p, nil) - local box = node_new(id_hlist) + local box = node_new(id_hlist, nil, p) setwhd(box, fwidth, fheight, fdepth) setfield(box, 'head', p) setfield(box, 'shift', kbl) @@ -170,7 +171,7 @@ local function capsule_glyph_tate_rot(p, met, char_data, head, dir, asc) setoffsets(p, xo + char_data.align*(fwidth-pwidth) - fshift.left, yo - fshift.down - asc); setnext(p, nil) - local box = node_new(id_hlist) + local box = node_new(id_hlist, nil, p) setwhd(box, fwidth, fheight, fdepth) setfield(box, 'head', p) setfield(box, 'shift', kbl) @@ -216,7 +217,7 @@ local function capsule_glyph_tate(p, met, char_data, head, dir) local y_shift = xo + (has_attr(p,attr_tkblshift) or 0) local q head, q = node_remove(head, p) - local box = node_new(id_hlist) + local box = node_new(id_hlist, nil, p) setwhd(box, fwidth, fheight, fdepth) setfield(box, 'shift', y_shift) setdir(box, dir) @@ -254,7 +255,7 @@ local function capsule_glyph_math(p, met, char_data) = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0) setfield(p, 'yoffset', -fshift.down) setfield(p, 'xoffset', getfield(p, 'xoffset') + char_data.align*(fwidth-pwidth) - fshift.left) - local box = node_new(id_hlist); + local box = node_new(id_hlist, nil, p); setwhd(box, fwidth, fheight, fdepth) setfield(box, 'head', p) setfield(box, 'shift', y_shift) @@ -307,7 +308,7 @@ do setfield(lp, 'yoffset', getfield(lp, 'yoffset') - y_adjust) end if adj_depth>node_depth then - local r = node_new(id_rule,rule_subtype) + local r = node_new(id_rule,rule_subtype, head) setwhd(r, 0, 0, adj_depth); setdir(r, tex_dir) set_attr(r, attr_icflag, PROCESSED) if field=='post' then diff --git a/macros/luatex/generic/luatexja/src/ltj-unicode-ccfix.lua b/macros/luatex/generic/luatexja/src/ltj-unicode-ccfix.lua index 1e2234a8e6..86db7e9aa4 100644 --- a/macros/luatex/generic/luatexja/src/ltj-unicode-ccfix.lua +++ b/macros/luatex/generic/luatexja/src/ltj-unicode-ccfix.lua @@ -1,5 +1,5 @@ -- Do not edit this file! --- Created from LineBreak.txt by ltj-unicode-ccfix_make.pl on 2020年 7月 4日 土曜日 11:27:40 JST. +-- Created from LineBreak.txt by ltj-unicode-ccfix_make.pl on 2021年 9月 18日 土曜日 16:02:07 JST. -- In case of errors, fix the Perl script instead. local tex_catcode = tex.setcatcode local tex_getcc = tex.getcatcode @@ -92,8 +92,7 @@ set_letter(0x32B1,0x32BF) set_letter(0x32C0,0x32FF) set_letter(0x3300,0x33FF) set_letter(0x3400,0x4DBF) -set_letter(0x4E00,0x9FFC) -set_letter(0x9FFD,0x9FFF) +set_letter(0x4E00,0x9FFF) set_letter(0xA000,0xA014) set_letter(0xA016,0xA48C) set_letter(0xA490,0xA4C6) @@ -146,7 +145,7 @@ set_letter(0x17000,0x187F7) set_letter(0x18800,0x18AFF) set_letter(0x18D00,0x18D08) set_letter(0x1B000,0x1B0FF) -set_letter(0x1B100,0x1B11E) +set_letter(0x1B100,0x1B122) set_letter(0x1B170,0x1B2FB) set_letter(0x1F000,0x1F02B) set_letter(0x1F02C,0x1F02F) @@ -213,8 +212,8 @@ set_letter(0x1F6A4,0x1F6B3) set_letter(0x1F6B7,0x1F6BF) set_letter(0x1F6C1,0x1F6CB) set_letter(0x1F6CD,0x1F6D7) -set_letter(0x1F6D8,0x1F6DF) -set_letter(0x1F6E0,0x1F6EC) +set_letter(0x1F6D8,0x1F6DC) +set_letter(0x1F6DD,0x1F6EC) set_letter(0x1F6ED,0x1F6EF) set_letter(0x1F6F0,0x1F6FC) set_letter(0x1F6FD,0x1F6FF) @@ -222,7 +221,9 @@ set_letter(0x1F774,0x1F77F) set_letter(0x1F7D5,0x1F7D8) set_letter(0x1F7D9,0x1F7DF) set_letter(0x1F7E0,0x1F7EB) -set_letter(0x1F7EC,0x1F7FF) +set_letter(0x1F7EC,0x1F7EF) +set_letter(0x1F7F0,0x1F7F0) +set_letter(0x1F7F1,0x1F7FF) set_letter(0x1F80C,0x1F80F) set_letter(0x1F848,0x1F84F) set_letter(0x1F85A,0x1F85F) @@ -236,13 +237,10 @@ set_letter(0x1F920,0x1F925) set_letter(0x1F927,0x1F92F) set_letter(0x1F93A,0x1F93B) set_letter(0x1F93F,0x1F976) -set_letter(0x1F978,0x1F978) -set_letter(0x1F979,0x1F979) -set_letter(0x1F97A,0x1F9B4) +set_letter(0x1F978,0x1F9B4) set_letter(0x1F9B7,0x1F9B7) set_letter(0x1F9BA,0x1F9BA) -set_letter(0x1F9BC,0x1F9CB) -set_letter(0x1F9CC,0x1F9CC) +set_letter(0x1F9BC,0x1F9CC) set_letter(0x1F9D0,0x1F9D0) set_letter(0x1F9DE,0x1F9FF) set_letter(0x1FA54,0x1FA5F) @@ -250,23 +248,26 @@ set_letter(0x1FA60,0x1FA6D) set_letter(0x1FA6E,0x1FA6F) set_letter(0x1FA70,0x1FA74) set_letter(0x1FA75,0x1FA77) -set_letter(0x1FA78,0x1FA7A) -set_letter(0x1FA7B,0x1FA7F) +set_letter(0x1FA78,0x1FA7C) +set_letter(0x1FA7D,0x1FA7F) set_letter(0x1FA80,0x1FA86) set_letter(0x1FA87,0x1FA8F) -set_letter(0x1FA90,0x1FAA8) -set_letter(0x1FAA9,0x1FAAF) -set_letter(0x1FAB0,0x1FAB6) -set_letter(0x1FAB7,0x1FABF) +set_letter(0x1FA90,0x1FAAC) +set_letter(0x1FAAD,0x1FAAF) +set_letter(0x1FAB0,0x1FABA) +set_letter(0x1FABB,0x1FABF) set_letter(0x1FAC0,0x1FAC2) -set_letter(0x1FAC3,0x1FACF) -set_letter(0x1FAD0,0x1FAD6) -set_letter(0x1FAD7,0x1FAFF) +set_letter(0x1FAC6,0x1FACF) +set_letter(0x1FAD0,0x1FAD9) +set_letter(0x1FADA,0x1FADF) +set_letter(0x1FAE0,0x1FAE7) +set_letter(0x1FAE8,0x1FAEF) +set_letter(0x1FAF7,0x1FAFF) set_letter(0x1FC00,0x1FFFD) -set_letter(0x20000,0x2A6DD) -set_letter(0x2A6DE,0x2A6FF) -set_letter(0x2A700,0x2B734) -set_letter(0x2B735,0x2B73F) +set_letter(0x20000,0x2A6DF) +set_letter(0x2A6E0,0x2A6FF) +set_letter(0x2A700,0x2B738) +set_letter(0x2B739,0x2B73F) set_letter(0x2B740,0x2B81D) set_letter(0x2B81E,0x2B81F) set_letter(0x2B820,0x2CEA1) diff --git a/macros/luatex/generic/luatexja/src/luatexja.lua b/macros/luatex/generic/luatexja/src/luatexja.lua index 878f791181..f375d727df 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.lua +++ b/macros/luatex/generic/luatexja/src/luatexja.lua @@ -12,6 +12,34 @@ luatexja.load_lua = load_lua function luatexja.load_module(name) require('ltj-' .. name.. '.lua') end do + local dnode = node.direct + local getfield, traverse = dnode.getfield, dnode.traverse + local node_new, set_attr, get_attr = dnode.new, dnode.set_attribute, dnode.get_attribute + local set_attrlist, get_attrlist = dnode.setattributelist, dnode.getattributelist + local unset_attr = dnode.unset_attribute + local attr_icflag = luatexbase.attributes['ltj@icflag'] + local function node_inherit_attr(n, b, a) + if b or a then + local attrlist = get_attrlist(b or a) + local nic = get_attr(n, attr_icflag) + set_attrlist(n, attrlist); set_attr(n, attr_icflag, nic) + if b and a then + for na in traverse(attrlist) do + local id = getfield(na, 'number') + if id and id~=attr_icflag and getfield(na, 'value')~=get_attr(a, id) then + unset_attr(n, id) + end + end + end + end + return n + end + luatexja.node_inherit_attr = node_inherit_attr + luatexja.dnode_new = function (id, subtype, b, a) + return node_inherit_attr(node_new(id, subtype), b, a) + end +end +do local setfield = node.direct.setfield luatexja.setglue = node.direct.setglue or function(g,w,st,sh,sto,sho) diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty index d2646d5785..77a955741a 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.sty +++ b/macros/luatex/generic/luatexja/src/luatexja.sty @@ -41,7 +41,7 @@ \ProcessOptions\relax \fi %</LaTeX> %%%% VERSION -\def\LuaTeXjaversion{20210607.0} +\def\LuaTeXjaversion{20210918.0} \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/macros/luatex/generic/luatexja/tool/function_uax50.lua b/macros/luatex/generic/luatexja/tool/function_uax50.lua index ea7871a6a8..1eaf2605f2 100644 --- a/macros/luatex/generic/luatexja/tool/function_uax50.lua +++ b/macros/luatex/generic/luatexja/tool/function_uax50.lua @@ -3,7 +3,7 @@ dofile(kpse.find_file('lualibs.lua')) local function toX(a) return string.format('0x%X',a) end -local uax_revision = '13.0.0' +local uax_revision = '14.0.0' print(' -- UAX#50 for Unicode ' .. uax_revision) local fh = io.open('VerticalOrientation-' .. uax_revision .. '.txt') local t = {} diff --git a/macros/luatex/optex/pdfextra/README.md b/macros/luatex/optex/pdfextra/README.md index c47262b1f5..70ef8febf7 100644 --- a/macros/luatex/optex/pdfextra/README.md +++ b/macros/luatex/optex/pdfextra/README.md @@ -1,6 +1,7 @@ # PDF Extra -PDF Extra provides extra PDF features for OpTeX. +PDF Extra provides extra PDF features for OpTeX (or in limited form for plain +LuaTeX and LuaLaTeX). As a minimalistic package OpTeX doesn't support "advanced" features of PDF file format in the base. This third party package aims to provide them. Summary of @@ -21,13 +22,18 @@ well as technical documentation interleaved with source code. # Installation instructions -Put `pdfextra.opm` where `optex` can find it. +Put `pdfextra.opm` where your TeX can find it. Additionaly, for plain/LaTeX you +need `pdfextra.tex`, and on top of that `pdfextra.sty` for LaTeX. Or just copy paste anything you want. # Usage -In OpTex do: `\load [pdfextra]`. +In OpTeX do: `\load [pdfextra]`. + +In plain LuaTeX do: `\input pdfextra`. + +In LuaLaTeX do: `\usepackage{pdfextra}`. # License diff --git a/macros/luatex/optex/pdfextra/examples/pdfextra-example-latex.tex b/macros/luatex/optex/pdfextra/examples/pdfextra-example-latex.tex new file mode 100644 index 0000000000..dc5a31f9f1 --- /dev/null +++ b/macros/luatex/optex/pdfextra/examples/pdfextra-example-latex.tex @@ -0,0 +1,223 @@ +% Compiled with: +% env TEXMFDOTDIR='..//:~/src/texlive/texmf-dist/source/latex/media9/files/' lualatex pdfextra-example-latex.tex +\documentclass{article} + +\usepackage{hyperref} +\usepackage{xcolor} +\usepackage{graphicx} +\usepackage{pdfextra} +\sdef{_linkcolor}{\color{blue}} + +\begin{document} + +% Using document level JavaScript we can run initialization code right at the +% start (this is more flexible than \openaction). +\dljavascript[random]{ + function getRandomNumber() { + return 4; % chosen by fair dice roll, ![https://xkcd.com/221/] + } + console.println("initialized with seed " + getRandomNumber()); +} + + + +% For external references we need to `\filedef` "external" and "url" files +% beforehand: +\filedef/u[doc-internet]{http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf} +\filedef/x[doc-local]{optex-doc.pdf} + +% We then try to reference them using external references: +\hlink[extref:doc-internet:ref:langphrases]{OpTeX documentation, section ``Multilingual phrases and quotation marks''.} +\hlink[extpgref:doc-internet:12]{OpTeX documentation, page 12.} + + + +% Insert a video twice with different settings: +\filedef/e[video]{example-movie.mp4} +% Insert video into page using Renditions mechanism with controls and autoplay. +\render[video][ + controls=true, + aactions=\renditionautoplay, +]{\includegraphics[width=\textwidth]{example-image.pdf}} + +% We set red text color, blue border (RGB triplet) for "rendition" links. +\sdef{_renditionlinkcolor}{\color{red}} +\sdef{_renditionborder}{0 1 0} +% Then we add some buttons. +\hlink[rendition::play]{play} \hlink[rendition::pause]{pause} +\hlink[rendition::stop]{stop} \hlink[rendition::resume]{resume} + +% Render the same file again, but with different dimensions, no controls +% and explicit activation. +\render[video]{\includegraphics{example-image.pdf}} +% This one can't have buttons, because it doesn't have its own name -- "video" +% is used by the previous one. + + + +% Add already embedded video to the list of attachments shown in user +% interface. +\attach[video] + + +% We are done for this page, who not go to the next one? +% +% \hlink typesets in group, so we locally disable lining links (our button is +% bigger than normal line) +\hlink[named:NextPage]{\nolininglinks\scalebox{2}[2]{NEXT PAGE}} + + + +\clearpage + + + +% Deliver fresh random number to everyone who sees this page using "page open" +% ("O") trigger event of page's actions. +\pageactions[ + {O} {js:{app.alert("Random number for you is " + getRandomNumber());}} +] + + +% Link to previous page (predefined PDF action) with "Split" transition: +\hlink[named:PrevPage, transition:Split]{Go to previous page (with transition).} + + + +\clearpage + +% A 3D Rich Media annotation with a custom view and script follows: + +% First we define the 3D file, so we can use same name for the view and have it +% auto included. +\filedef/e[example]{pdfextra-example-part.prc} + +% Then a simplistic "front" view. +\DDDview[example][ + projection=ortho, + roo=400, +] + +% A 3D JavaScript script that will define function to use with action button. +% (we write the script only now, so we don't have to carry around an extra file +% in the package, you would normally have the contents in the file -- "turn.js" +% in this case). +\newwrite\js +\immediate\openout\js=turn.js +% rotate every node by angle degrees along $x$ axis +\immediate\write\js{\detokenize{ +function turn(angle) { + angle = angle * Math.PI / 180; + for (var i = 0; i < scene.nodes.count; i++) { + var node = scene.nodes.getByIndex(i); + node.transform.rotateAboutXInPlace(angle); + } +} +}} +\closeout\js + +% The annotation itself, with our script above. +\RM[example][ + activation=auto, + scripts=turn.js, +]{\textcolor{white}{\vrule width\textwidth height\textwidth}} + +\hlink[js:\DDDcontext{example}.turn(10);]{Turn by 10 degrees along $x$ axis.}\par +\hlink[js:\DDDcontext{example}.turn(30);]{Turn by 30 degrees along $x$ axis.}\par +\hlink[js:\DDDcontext{example}.turn(90);]{Turn by 90 degrees along $x$ axis.} + + + +\clearpage + + +% Here is the "epix" 3D model example from media9 documentation ported to +% pdfextra. +% +% First we define a view with the same name as the future Rich Media +% annotation. This view will then automatically be used if no `views` key is +% specified. No need to be excessive with decimal numbers. +\DDDview[epix][ + FOV=30, + c2c=4 2 3, + coo=4.41 2.19 0, + roo=430, +] + +% 3Dmenu is used often, lets use shortcut instead. +\filedef/e[3dmenu]{3Dmenu.js} +% We want to use the nice "epix" name for the view and annotation. +\filedef/e[epix]{epix.prc} + +% Just to spice things up, we diverge a bit from media9 and define custom +% background color. We can't use LaTeX's colors, so we use RGB triplet. +\newcommand{\GreyBG}{0.9 0.9 0.9} + +% Define the 3D Rich Media annotation. One view is automatically detected from +% name ("epix"). Scripts will run in specified order at initialization time +% (when the annotation is activated). +\RM[epix][ + scripts={ + asylabels.js, + 3Dspintool.js, + 3dmenu, + }, + background=\GreyBG, +]{\includegraphics[width=0.8\textwidth, height=0.8\textwidth]{epixposter.pdf}} + + + +\clearpage + + + +% Second media9 example is "dice" it has a lot of views, but they are simple. +% This time we can't use the view name deduction from `\RM` name -- there is +% more than one view. +\DDDview[Front][roo=27] +\DDDview[Back][roo=27, c2c=0 1 0] +\DDDview[Left][roo=27, c2c=-1 0 0] +\DDDview[Right][roo=27, c2c=1 0 0] +\DDDview[Top][roo=27, c2c=0 0 1] +\DDDview[Bottom][roo=27, c2c=0 0 -1] +\DDDview[Fish Eye at Centre][fov=120] + +% We want to use all the defined views, as well as autoactivate the annotation. +% This means that the preview mostly sets dimensions, because it will not be +% shown much. (Only in viewers that don't support 3D Rich Media -- that is, all +% except Acrobat). +\RM[dice.u3d][ + views={Front, Back, Left, Right, Top, Bottom, Fish Eye at Centre}, + activation=auto, + scripts=3dmenu, +]{\textcolor{red}{\vrule height.5\textwidth width.5\textwidth}} + +% A few buttons for switching views. +\hlink[goto3dview::/N]{\frame{Next view}} +\hlink[goto3dview::(Back)]{\frame{View ``Back''}} +\hlink[goto3dview::5]{\frame{6th view in the list}} + +\clearpage + + +% Last media9 example ported. It has its own JavaScript file for animation, +% which can be customized at runtime using JavaScript actions that access 3D +% context of the annotation. +\filedef/e[malte]{malte.u3d} +\DDDview[malte][c2c=1 1 1, roo=0.25] +\RM[malte][ + activation=auto, + scripts={3dmenu, malte.js}, +]{\textcolor{blue}{\vrule height 0.5\textwidth width 0.5\textwidth}} + +% Normal JavaScript actions, but we access functions defined globaly in the 3D +% JavaScript context of "malte" Rich Media annotation. +\hlink[js:\DDDcontext{malte}.cntrClockWise();] {\includegraphics[height=1.44em]{boutona.pdf}} +\hlink[js:\DDDcontext{malte}.pause();] {\includegraphics[height=1.44em]{boutonb.pdf}} +\hlink[js:\DDDcontext{malte}.clockWise();] {\includegraphics[height=1.44em]{boutonc.pdf}} +\hlink[js:\DDDcontext{malte}.scaleSpeed(1/1.1);]{\includegraphics[height=1.44em]{boutond.pdf}} +\hlink[js:\DDDcontext{malte}.origSpeed();] {\includegraphics[height=1.44em]{boutone.pdf}} +\hlink[js:\DDDcontext{malte}.scaleSpeed(1.1);] {\includegraphics[height=1.44em]{boutonf.pdf}} + + +\end{document} diff --git a/macros/luatex/optex/pdfextra/examples/pdfextra-example.pdf b/macros/luatex/optex/pdfextra/examples/pdfextra-example.pdf Binary files differindex abb2e9c4c5..24ca714a75 100644 --- a/macros/luatex/optex/pdfextra/examples/pdfextra-example.pdf +++ b/macros/luatex/optex/pdfextra/examples/pdfextra-example.pdf diff --git a/macros/luatex/optex/pdfextra/examples/pdfextra-example.tex b/macros/luatex/optex/pdfextra/examples/pdfextra-example.tex index 6093bf7def..6704ac4b98 100644 --- a/macros/luatex/optex/pdfextra/examples/pdfextra-example.tex +++ b/macros/luatex/optex/pdfextra/examples/pdfextra-example.tex @@ -7,17 +7,14 @@ % env TEXMFDOTDIR=.:~/src/texlive/texmf-dist/source/latex/media9/files/ optex pdfextra-example.tex % \endtt -% basic \OpTeX/ settings +% Basic \OpTeX/ settings: \enlang\enquotes \fontfam[lm] -%\pdfobjcompresslevel=0 -%\pdfcompresslevel=0 - -% load the package from standard search path +% Load the package from standard search path: \load[pdfextra] -% Before using \hlink we must activate hyperlinks +% Before using \hlink we must activate hyperlinks: \hyperlinks\Blue\Green % Maybe we want to greet the user and jump to page 2 right at the start? @@ -41,7 +38,8 @@ -% For external references we need to `\filedef` "external" and "url" files beforehand: +% For external references we need to `\filedef` "external" and "url" files +% beforehand: \filedef/u[doc-internet]{http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf} \filedef/x[doc-local]{optex-doc.pdf} @@ -53,20 +51,24 @@ % Insert a video twice with different settings: \filedef/e[video]{example-movie.mp4} -% insert video into page using Renditions mechanism with controls and autoplay +% Insert video into page using Renditions mechanism with controls and autoplay. \render[video][ controls=true, aactions=\renditionautoplay, ]{\picwidth=\hsize \inspic{example-image.pdf}} -% Maybe add action buttons? +% We set red text color, blue border (RGB triplet) for "rendition" links. +\let\_renditionlinkcolor\Red +\def\_renditionborder{0 1 0} +% Then we add some buttons. \hlink[rendition::play]{play} \hlink[rendition::pause]{pause} \hlink[rendition::stop]{stop} \hlink[rendition::resume]{resume} % Render the same file again, but with different dimensions, no controls % and explicit activation. \render[video]{\inspic{example-image.pdf}} -% This one can't have buttons, because it doesn't have its own name ("video") is used by the previous one. +% This one can't have buttons, because it doesn't have its own name -- "video" +% is used by the previous one. @@ -87,13 +89,13 @@ -% deliver fresh random number to everyone who sees this page using "page open" -% trigger event of page's actions +% Deliver fresh random number to everyone who sees this page using "page open" +% ("O") trigger event of page's actions. \pageactions[ {O} {js:{app.alert("Random number for you is " + getRandomNumber());}} ] -% "previous page" link with "Split" transition +% Link to OpTeX's page reference ("pg:1") with "Split" transition: \hlink[pg:1, transition:Split]{Go to previous page (with transition).} @@ -102,7 +104,8 @@ % A 3D Rich Media annotation with a custom view and script follows: -% First we define the 3D file, so we can use same name for the view and have it auto included. +% First we define the 3D file, so we can use same name for the view and have it +% auto included. \filedef/e[example]{pdfextra-example-part.prc} % Then a simplistic "front" view. @@ -112,7 +115,9 @@ ] % A 3D JavaScript script that will define function to use with action button. -% (we write the script only now, so we don't have to carry around an extra file in the package) +% (we write the script only now, so we don't have to carry around an extra file +% in the package, you would normally have the contents in the file -- "turn.js" +% in this case). \newwrite\js \immediate\openout\js=turn.js % rotate every node by angle degrees along $x$ axis @@ -131,7 +136,7 @@ function turn(angle) { \RM[example][ activation=auto, scripts=turn.js, -]{{\White\vrule width\hsize height\hsize}} +]{\White\vrule width\hsize height\hsize} \hlink[js:\DDDcontext{example}.turn(10);]{Turn by 10 degrees along $x$ axis.}\par \hlink[js:\DDDcontext{example}.turn(30);]{Turn by 30 degrees along $x$ axis.}\par @@ -142,10 +147,11 @@ function turn(angle) { \vfil\break -% Here is the "epix" 3D model example from media9 documentation ported to pdfextra +% Here is the "epix" 3D model example from media9 documentation ported to +% pdfextra. % % First we define a view with the same name as the future Rich Media -% annotation. This view will then automatically be used if no `views` is +% annotation. This view will then automatically be used if no `views` key is % specified. No need to be excessive with decimal numbers. \DDDview[epix][ FOV=30, @@ -159,11 +165,13 @@ function turn(angle) { % We want to use the nice "epix" name for the view and annotation. \filedef/e[epix]{epix.prc} -% Just to spice things up, we diverge a bit from media9 and define custom background color. +% Just to spice things up, we diverge a bit from media9 and define custom +% background color. \colordef\GreyBG{0.1\Black} % Define the 3D Rich Media annotation. One view is automatically detected from -% name ("epix"). Scripts will run in turn at initialization time. +% name ("epix"). Scripts will run in specified order at initialization time +% (when the annotation is activated). \RM[epix][ scripts={ asylabels.js, @@ -180,7 +188,8 @@ function turn(angle) { % Second media9 example is "dice" it has a lot of views, but they are simple. -% This time we can't use the deduction with same name. +% This time we can't use the view name deduction from `\RM` name -- there is +% more than one view. \DDDview[Front][roo=27] \DDDview[Back][roo=27, c2c=0 1 0] \DDDview[Left][roo=27, c2c=-1 0 0] @@ -190,38 +199,32 @@ function turn(angle) { \DDDview[Fish Eye at Centre][fov=120] % We want to use all the defined views, as well as autoactivate the annotation. -% This means that the previews mostly sets dimensions, because it will not be -% shown much. (Except in viewers that don't support 3D Rich Media -- all except -% Acrobat). +% This means that the preview mostly sets dimensions, because it will not be +% shown much. (Only in viewers that don't support 3D Rich Media -- that is, all +% except Acrobat). \RM[dice.u3d][ views={Front, Back, Left, Right, Top, Bottom, Fish Eye at Centre}, activation=auto, scripts=3dmenu, -]{{\Red \vrule height.5\hsize width.5\hsize}} +]{\Red \vrule height.5\hsize width.5\hsize} % A few buttons for switching views. \hlink[goto3dview::/N]{\frame{Next view}} \hlink[goto3dview::(Back)]{\frame{View \"Back"}} \hlink[goto3dview::5]{\frame{6th view in the list}} -% And define the action buttons using this new custom action. -\hlink[diceview:/N]{Next view} -\hlink[diceview:(Back)]{View \"Back"} -\hlink[diceview:5]{6th view in the list} - - \vfil\break % Last media9 example ported. It has its own JavaScript file for animation, % which can be customized at runtime using JavaScript actions that access 3D -% conotext. +% context of the annotation. \filedef/e[malte]{malte.u3d} \DDDview[malte][c2c=1 1 1, roo=0.25] \RM[malte][ activation=auto, scripts={3dmenu, malte.js}, -]{{\Blue \vrule height.5\hsize width0.5\hsize}} +]{\Blue \vrule height.5\hsize width0.5\hsize} {\picheight=1.44em % Normal JavaScript actions, but we access functions defined globaly in the 3D @@ -240,7 +243,7 @@ function turn(angle) { % Lastly a showcase of transitions / page durations in \OpTeX/ slideshow. % Because transitions are displayed only in fullscreen mode, we could request -% it by using "\fullscreen". But we have more pages before this, so we didn't. +% it by using `\fullscreen`. But we have more pages before this, so we didn't. % We just turn the rest of the document into slideshow. \slides @@ -253,7 +256,8 @@ function turn(angle) { % "Wipe" and be 1 second long. \transitions[Wipe:1] -% The slides will by default be shown for 3 seconds before advancing to the next one. +% The slides will by default be shown for 3 seconds before advancing to the +% next one. \defaultpageduration[3] % But the first slide has override to only be shown for 1 second. \pageduration[1] @@ -268,7 +272,7 @@ function turn(angle) { % to that page. That means that we probably didn't see the "Wipe:1" animation % of the first slide, because we already were there. However, this second slide % with "Fade" is now shown correctly. (The first one also will, when we go -% back.) +% back to it.) \transition[Fade] \sec First slide diff --git a/macros/luatex/optex/pdfextra/pdfextra-doc.pdf b/macros/luatex/optex/pdfextra/pdfextra-doc.pdf Binary files differindex e5a6b8e30d..9534e46bfa 100644 --- a/macros/luatex/optex/pdfextra/pdfextra-doc.pdf +++ b/macros/luatex/optex/pdfextra/pdfextra-doc.pdf diff --git a/macros/luatex/optex/pdfextra/pdfextra-doc.tex b/macros/luatex/optex/pdfextra/pdfextra-doc.tex index 38f6cd9795..292bb34ab2 100644 --- a/macros/luatex/optex/pdfextra/pdfextra-doc.tex +++ b/macros/luatex/optex/pdfextra/pdfextra-doc.tex @@ -2,8 +2,6 @@ \load [doc, pdfextra] \catcode`\.=11 -\hyperlinks\Green\Green - % table notes (http://petr.olsak.net/optex/optex-tricks.html#tnote) \newcount\tnotenum \def\tnotelist{} @@ -14,22 +12,23 @@ \global\tnotenum=0 \gdef\tnotelist{}% } -% use `\hlink` instead of OpTeX `\*link` s -\protected\def\_link[#1]#2#3{\hlink[#1]{#3}} -\protected\def\_ilink[#1]#2{\hlink[#1]{#2}} -\protected\def\_ulink[#1]#2{\hlink[url:#1]{#2}} -\public \link \ilink \ulink ; - \let\_cslinkcolor\Blue % allow hyperlinking of \OpTeX's control sequences (see doc.opm) -\let\_pdfextra_opdocaction\_pdfextra_urlaction -\let\_pdfextra_opdoclinkcolor\Blue +\let\_pdfextra_extdocaction\_pdfextra_urlaction +\let\_extdoclinkcolor\Blue \def\_Xindex#1#2{\sdef{,#1}{}\slet{el:#1}{optexdoclink}} -\def\optexdoclink{\hlink[opdoc:\optexdocurl\#cs:\_tmpa]{\csstring\\\_tmpb}} +\def\optexdoclink{\hlink[extdoc:\optexdocurl\#cs:\_tmpa]{\csstring\\\_tmpb}} \def\optexdocurl{http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf} \isfile{optex-doc.eref}\iftrue \input{optex-doc.eref}\fi +% allow hyperlinks to TeX's control sequences (TeX in a Nutshell) +\def\Xeref#1{\sdef{,#1}{}\slet{el:#1}{texdoclink}} +\def\texdoclink{\hlink[extdoc:\texdocurl\#cs:\_tmpa]{\csstring\\\_tmpb}} +\def\texdocurl{http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf} +\isfile{tex-nutshell.eref}\iftrue \input{tex-nutshell.eref}\fi + + \insertoutline{PDF extra} \tit PDF extra -- extra PDF features for \OpTeX/ @@ -50,7 +49,8 @@ copying some useful parts of this package into your documents / packages. \OpTeX/ namespacing is used, but it can be easily stripped, if you wish to incorporate these macros into other macro packages. The code currently depends on \LuaTeX/, but mostly uses only pdf\TeX/ primitives and a few simple macros -from \OpTeX/. +from \OpTeX/. Additionally, the package can be used in plain LuaTeX and +LuaLaTeX (in a limited form), see section~\ref[user:plain+latex]. User documentation (`pdfextra-doc.tex`) and technical documentation interleaved with source code (`pdfextra.opm`) are all typeset in this PDF file. Some @@ -367,7 +367,7 @@ macros like `\ref` or `\url` might be beneficial. <text> will be typeset directly and the area it occupies will be clickable. Clicking it executes action defined by <action spec>. Line breaks inside <text> will be possible, in that case several clickable rectangles will be created, one for each line. -Normally in text you want the ares to be of the same height and depth +Normally in text you want the areas to be of the same height and depth (calculated from `\baselineskip`), to achieve sort of a lining, uniform effect. If you want to define big clickable buttons, you may need to turn off the lining effect using \^`\nolininglinks`. It respects groups, but a counterpart @@ -482,7 +482,7 @@ must be unique) and are executed in order of definition. Use \begtt \adef![#1]{\url{#1}} \filedef/e[preamble]{preamble.js} -\djavascript[preamble]{preamble} +\dljavascript[preamble]{preamble} \dljavascript[initialization]{% var data = 42; @@ -554,7 +554,7 @@ Examples: \render[video]{\inspic{example-image.pdf}} % we want the rendition action to have yellow border and red content -\let\_renditionborder\Yellow +\def\_renditionborder{1 1 0} \let\_renditionlinkcolor\Red To start playing the video, click \hlink[rendition::play]{\"Play"}. @@ -671,14 +671,102 @@ You can choose what is shown when document is opened with commands: The commands are mutually exclusive and only the first appearing one will be respected. -You can set request two page view (odd pages on the right) using +You can request two page view (odd pages on the right) using \^`\duplexdisplay`. It is useful for more natural display of double sided documents. Because it may not be desirable to automatically apply this, it is independent of `\margins`. +\label[user:plain+latex] +\sec Usage in plain \LuaTeX/ or LuaLa\TeX/ + +You can use this package also from plain LuaTeX by adding to your document: + +\begtt +\input pdfextra +\endtt + +\noindent or for LuaLa\TeX/: + +\begtt +\usepackage{pdfextra} +\endtt + +See the file `pdfextra-example-latex.tex` for the adaptation of the \OpTeX/ +examples to \LaTeX/. + +The usage of the macros described in this document is the same, but there are +limitations: + +\begitems +* {\em Color}. Where this package expects \"\OpTeX/ color" key value argument +(e.g. `\Blue`), you have to use an RGB triplet instead (e.g. `0.0 0.0 0.0` or +the shorter `0 0 0`). + +But for text color setting, you can get away with wrapping commands from +La\TeX/'s `color` package, e.g. to customize link border/color: + + \begtt + \sdef{_renditionlinkcolor}{\color[red]} + \endtt + +* {\em Initialization}. In \OpTeX/ you normally have to initialize hyperlinks +with the command\nl +`\hyperlinks<color for internal links><color for external links>`.\nl +This is not required by this package. You can instead set the color by setting +`\_linkcolor` (fallback for all link types), `\_ilinkcolor` / `\_elinkcolor` +(internal / external links). E.g. if you have the \LaTeX/ `color` package +loaded, you can get blue links like this: + + \begtt + \sdef{_linkcolor}{\color[blue]} + \endtt + +In addition to the above this means all links will be blue except \"rendition" +links. + +* {\em Openaction}. If the package `hyperref` is used, then `\openaction` will +not work. + +* {\em Labels / hyperlink destinations}. \OpTeX/ uses very simple and consistent +scheme for labels / hyperlink destinations: + + \begitems + * `ref:<label>` -- result of `\label[<label>]` + * `toc:<tocrefnum>` -- result of `\chap`/`\sec`/`\secc` titles + * `pg:<gpageno>` -- created on each page with global numbering from 1 + * `cite:<bibpart>/<bibnum>` -- bibliography references, + * `fnt:<gfnotenum>` -- link form text to footnote + * `fnf:<gfnotenum>` -- link from footnote to text + * `url:<url>` -- used by `\url` or `\ulink`, + \enditems + + Hence these labels / destinations can be used with `\hlink`, e.g. to make text + `page 5` a link to page 5, one can use: + + \begtt + \hlink[pg:5]{page 5} + \endtt + + This is not possible in plain \LuaTeX/ (no destinations are created) or + LuaLa\TeX/ (different and incompatible destination names). You would have to + create your own destinations adhering to the naming convention + `<type>:<arguments>` to be able to use `\hlink` as intended for some links. + +\enditems + \chap Technical documentation -\printdoctail pdfextra.opm +This is the technical documentation. It is intended for those who want to know +how this package works internally. Casual users shouldn't need to read this. But +if you would like to customize anything or perhaps just use some part of this +package, feel free to copy paste and use anything you want in \OpTeX/'s spirit. + +This documentation is interleaved within the source itself, both are contained +in a single file, `pdfextra.opm` (according to \OpTeX/ conventions). The user +documentation is instead contained in `pdfextra-doc.tex`, which itself +`\input`'s the documented source file `pdfextra.opm` so that the user and +technical documentation is available in a single PDF file, `pdfextra-doc.pdf`. + \printdoc pdfextra.opm \bye diff --git a/macros/luatex/optex/pdfextra/pdfextra.opm b/macros/luatex/optex/pdfextra/pdfextra.opm index b7cf70a981..bccf096484 100644 --- a/macros/luatex/optex/pdfextra/pdfextra.opm +++ b/macros/luatex/optex/pdfextra/pdfextra.opm @@ -1,17 +1,35 @@ % vim: tw=80 -\_def\_pdfextra_version{0.1} +\_def\_pdfextra_version{0.2} \_codedecl \RM {Extra PDF features (v\_pdfextra_version)} +\_namespace{pdfextra} + \_doc \sec Package initialization + We ensure that hyperlinking is active. Our fallback \`\_linkcolor` must + exist. We also use it for `\hyperlinks` if the user didn't enable + `\hyperlinks` yet (we don't want to override user setting). + \_cod + +\_ifdefined\_ilinkcolor\_else + \_ifdefined\_linkcolor + \_ea\_let\_ea\_linkcolor \_ifdefined\Blue\Blue\_else\_empty\_fi + \_else + \_let\_linkcolor\linkcolor + \_fi +\_fi + +\_ifx\_dest\_destactive\_else + \_hyperlinks\_linkcolor\_linkcolor +\_fi + + \_doc We are in the \OpTeX/ package namespace. A couple of shortcuts are defined here: \`\.isdefined`, \`\.trycs`, \`\.cs` \`\.slet`, \`\.slet`, \`\.sdef` and - \`\.xdef`. They all hard code the package name, because we already have too + \`\.sxdef`. They all hard code the package name, because we already have too many levels of indirection. \_cod -\_namespace{pdfextra} - \_def\.isdefined#1{\_isdefined{_pdfextra_#1}} \_def\.trycs#1{\_trycs{_pdfextra_#1}} \_def\.cs#1{\_cs{_pdfextra_#1}} @@ -67,7 +85,8 @@ \_doc \`\.xaddto``\macro`{<text>} is a natural extension of \OpTeX's `\addto` that - expands <text> and is global. + expands <text> and is global.\nl + \`\.tmp` is used throught the package for temporary values. \_cod \_def\.xaddto#1#2{\_edef\.tmp{#2}% @@ -115,10 +134,6 @@ rough estimate we take the current page~-- this actually works well for slides where page breaks are manual. - `\.pageof` is expandable, but we want to let the user know, that the document - needs to be processed twice. Therefore we use \LuaTeX's - `\immediateassignment` to increment the counter of unresolved references. - When `.ref` file is read along with the defintion of `\.Xpageof` this package has not been loaded yet. Hence we can't use namespaced variants of `\.isdefined`, etc. @@ -134,7 +149,6 @@ \_def\.pageof#1{% \.trycs{pageof:#1}{% - \_immediateassignment\_incr\_unresolvedrefs \_the\_numexpr\_gpageno+1\_relax % best effort = current page num }% } @@ -368,14 +382,12 @@ \_doc \label[actions-link] \secc Link annotations - The main use of actions~-- annotations of `/Subtype /Link`. - Annotation of this type creates an active rectangular area on the page that - executes a PDF action (or chain of them in the general case). - \`\hlinkactive``[<action spec>]<text>` is a natural extension of \OpTeX/'s - `\linkactive`, that supports the classic \"jump" actions of types `ref`, - `bib`, etc. But also other types of actions. No distinction between - \"internal" (`\ilink`) and external (`\ulink`) links is made. The mechanism is - completely generic. + The main use of actions~-- annotations of `/Subtype /Link`. Annotation of + this type creates an active rectangular area on the page that executes a PDF + action (or chain of them in the general case). + \`\hlink``[<action spec>]<text>` is macro that typesets <text> and makes area + occupied by it active according to <action spec>. All action types are + supported, the mechanism is completely generic. The `\pdfstartlink`/`\pdfendlink` primitives are used to denote the part of the page where <text> appears as active. \LuaTeX/ will then handle even the @@ -383,7 +395,7 @@ multiple rectangular annotations to cover all `\hbox`es). \_cod -\_def\.hlinkactive[#1]#2{\_bgroup\_def\#{\_csstring\#}% +\_def\.hlink[#1]#2{\_bgroup\_def\#{\_csstring\#}% \_edef\.type{\.pdfactiontype[#1]}% \_quitvmode\_pdfstartlink \.linkdimens attr{\_pdfborder{\.type}}% @@ -391,25 +403,25 @@ \_localcolor\.linkcolor{\.type}#2\_pdfendlink\_egroup } +\_nspublic \hlink ; + \_doc - `\hlinkactive` itself is dormant before `\hyperlinks` occurs. Until then, a - dummy \`\hlink` is used. \OpTeX/'s `\hyperlinks` is extended to hook `\hlink` - activation. The colors of internal/external links are remembered for - compatibility with \OpTeX/. + Use `\hlink` as the backing command for OpTeX's \"higher level" linking + commands (`\ilink` and `\ulink`). + + The lower level ones (`\xlink` and its predecessor `\link` actually have + completely different semantics with regards to color, so we keep them as they + are. \_cod -\_def\.hlink[#1]#2{\_quitvmode{#2}} -\_nspublic \hlink ; +\_protected\_def\_ilink[#1]#2{\.hlink[#1]{#2}} +\_protected\_def\_ulink[#1]#2{{\_escapechar=-1 \_ea}\_expanded + {\_noexpand\.hlink[url:\_detokenize{#1}]}{#2}} -\_let\.oldhyperlinks\_hyperlinks -\_def\_hyperlinks#1#2{% - \.oldhyperlinks#1#2 - \_let\.ilinkcolor=#1% - \_let\.elinkcolor=#2% - \_let\.hlink=\.hlinkactive - \_let\hlink=\.hlink -} -\_public \hyperlinks ; +\_public \link \ilink \ulink ; + +%\_protected\_def\_link[#1]#2#3{\_hlink[#1]{#3}} +%\_protected\_def\_xlink#1#2#3#4{\_hlink[#1:#2]{#4}} \_doc Two customizations of `\hlinks` are possible: @@ -421,10 +433,12 @@ running text~-- it covers all space of a line using `\baselineskip`. \`\nolininglinks` sets no dimensions, this is useful for buttons, that may have larger height/depth than a line. - * The color is determined from the type of link (that is the first action in - <action spec>) by checking `\_<type>linkcolor` (compatible with \OpTeX/) or - `\_pdfextra_<type>linkcolor`. - As a fallback \`\.ilinkcolor` is used (set by `\hyperlinks`). + * The color is determined from the type of link (that is, the first action in + <action spec>) by checking `\_<type>linkcolor` (compatible with \OpTeX/). + As a fallback `\_ilinkcolor` is used (set by \OpTeX's `\hyperlinks`) for all links + except for URLs, where `\_elinkcolor` is used instead. If even these + fallback colors are not defined (`\hyperlinks` isn't used), then the most + generic `\_linkcolor` will be taken or no color will be set. \enditems \_cod @@ -436,8 +450,10 @@ \_nspublic \lininglinks \nolininglinks ; -\_def\.linkcolor#1{\_trycs{_#1linkcolor}{\.trycs{#1linkcolor}{\.ilinkcolor}}} -\_def\.ilinkcolor{} +\_def\.linkcolor#1{\_trycs{_#1linkcolor}{\_trycs{_ilinkcolor}{\_trycs{_linkcolor}{}}}} + + % \_urllinkcolor = \_elinkcolor with fallbacks +\_def\_urllinkcolor{\.linkcolor{e}} \_doc \secc Open action @@ -683,7 +699,8 @@ \.pdfpageattributesetters Dur \defaultpageduration \pageduration {#1} \_doc - \sec Attachments and document level JavaScript + \label[nametrees] + \sec Name trees -- attachments and document level JavaScript These don't have any last place to be in, so they are documented separately, here. Attaching files using `/FileAttachment` annotations: @@ -711,7 +728,7 @@ \`\dljavascript``[<name>]{<script>}` (adds action that executes <script> after document is opened, <name> is more or less meaningless). - Internally both commands construct lists of what ends up in the resulting name + Internally the commands construct lists of what ends up in the resulting name array, i.e. pairs {\visiblesp `(<name>) <object number> 0 R `}. Intermediate macros \`\.embeddedfiles` and \`\.dljavascripts` are used for this. @@ -735,7 +752,23 @@ \_nspublic \dljavascript ; \_doc - Object creation, which is common to both, is handled by\nl\indent + Renditions (see \ref[mm-renditions]) also need their name tree. This package + mostly doesn't play well with Unicode filenames, that is why they are + forbidden. However, Renditions that are accessed from JavaScript have to be + named/present in a `/Renditions` name tree, with the names encoded in the PDF + encoding (UTF-16BE).\nl + The names and object references are collected in \`\.renditions`. Unicode + encoding is hacked with \`\.pdfstringtounicode`. + \_cod + +\_def\.pdfstringstrip(#1){#1}% +\_def\.pdfstringtounicode#1#2{% + \_ea\_pdfunidef\_ea#1\_ea{\_ea\.pdfstringstrip\_expanded{\.cs{filename:#2}}}% +} +\_def\.renditions{} + + \_doc + Object creation, which is common to all name trees, is handled by\nl\indent \`\.makenamearray``<name tree name><name tree content>`.\nl It doesn't do anything for empty lists, to not bloat PDF files when this mechanism isn't used. @@ -750,12 +783,13 @@ The lists themselves can only be written out to the PDF file at the very end of the run. We use \OpTeX/'s `\_byehook`, which is run in `\_bye`. But `\bye` itself may be predefined by the user, for example when using some of the - \OpTeX/ tricks. We just hope that user keeps `\_byehook`. + \OpTeX/ tricks. We just hope that the user keeps `\_byehook`. \_cod \_addto\_byehook{% \.makenamearray{EmbeddedFiles}\.embeddedfiles \.makenamearray{JavaScript}\.dljavascripts + \.makenamearray{Renditions}\.renditions } \_doc @@ -889,6 +923,7 @@ \_def\.boxedannot[#1:#2]#3#4#5{% \_setbox0=\_hbox{#3}\_setbox2=\_null \_ht2=\_ht0 \_wd2=\_wd0 \_dp2=\_dp0 + \_preshipout0 \box0 \_immediate\_pdfxform0 % box with annotation both stretching to dimensions of appearance \_hbox{\.setpageof{#1:#2}% @@ -995,9 +1030,10 @@ \_ea\_readkv\_ea{\_ea\.renderdefaults\_ea,\_the\_opt}% \.colortorgbdef\.bgcolor{\_kv{background}}% % rendition object ("media specifaction") + \.pdfstringtounicode\.uiname\.name \_pdfobj {<</Type /Rendition /S /MR - /N \.cs{filename:\.name} + /N \.uiname /C <<%/Type /MediaClip /S /MCD % subtype MediaClipData /D \.cs{filespec:\.name} @@ -1011,6 +1047,7 @@ /BE << /O \_kv{opacity} /B [\.bgcolor] >> >> >>}\_pdfrefobj\_pdflastobj + \.xaddto\.renditions{\.uiname \_the\_pdflastobj \_space 0 R }% \.redefinename{rendition}% \.sxdef{rendition:\.name}{\_the\_pdflastobj}% % screen annotation ("screen space allocation") @@ -1284,7 +1321,7 @@ \_doc For scripting using JavaScript actions one needs to access the 3D context of the 3D / Rich Media annotation. This requires the page number. We can't use - `this.pageNum` from [TODO], because the script strictly doesn't have to be on + `this.pageNum`, because the script strictly doesn't have to be on the same page. We use `\.pageof` (`\.setpageof` was done in `\.boxedannot`) to retrieve the page number in next run. Also PDF indexes page numbers from 0. \`\DDDannot``{<name>}`. and \`\DDDcontext``{<name>}` allow this. @@ -1593,12 +1630,12 @@ coo=0 0 0, c2c=0 -1 0, } -\.sdef{3dview:media9}{\_edef\.coo{\_kv{coo}}\_edef\.c2c{\_kv{c2c}}\_edef\.viewparams{ +\.sdef{3dview:media9}{\_edef\.viewparams{ /MS /M /C2W [\_directlua{ local function normalize(x, y, z) local len = math.sqrt(x*x + y*y + z*z) - if len ~= 0 then return x/len, y/len, z/len else return 0, 0, 0 end + if len \csstring\~= 0 then return x/len, y/len, z/len else return 0, 0, 0 end end local function cross(ux, uy, uz, vx, vy, vz) return uy*vz - uz*vy, uz*vx - ux*vz, ux*vy - uy*vx @@ -1689,14 +1726,3 @@ \_endnamespace \_endcode - -This is the technical documentation. It is intended for those who want to know -how this package works internally. Casual users shouldn't need to read this. But -if you would like to customize anything or perhaps just use some part of this -package, feel free to copy paste and use anything you want in \OpTeX/'s spirit. - -This documentation is interleaved within the source itself, both are contained -in a single file, `pdfextra.opm` (according to \OpTeX/ conventions). The user -documentation is instead contained in `pdfextra-doc.tex`, which itself -`\input`'s the documented source file `pdfextra.opm` so that the user and -technical documentation is available in a single PDF file, `pdfextra-doc.pdf`. diff --git a/macros/luatex/optex/pdfextra/pdfextra.sty b/macros/luatex/optex/pdfextra/pdfextra.sty new file mode 100644 index 0000000000..2ebe8354c5 --- /dev/null +++ b/macros/luatex/optex/pdfextra/pdfextra.sty @@ -0,0 +1,4 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pdfextra} + +\input pdfextra diff --git a/macros/luatex/optex/pdfextra/pdfextra.tex b/macros/luatex/optex/pdfextra/pdfextra.tex new file mode 100644 index 0000000000..cbbeca0c17 --- /dev/null +++ b/macros/luatex/optex/pdfextra/pdfextra.tex @@ -0,0 +1,364 @@ +\ifdefined \pdfextraloaded \expandafter \endinput \fi +\chardef\pdfextraloaded=\catcode`\_ +\catcode`\_=11 + +\long\def \_xargs #1#2{\ifx #2;\else + \expandafter#1\expandafter#2\expandafter\_xargs \expandafter #1\fi} + +\def \_private {\_xargs \_privateA} +\def \_privateA #1{\expandafter\let\csname _\csstring #1\endcsname#1} + +% primitives +\_private \detokenize \expanded \hbox \ht \wd \dp \copy \immediateassignment ; +\_private \escapechar \baselineskip \quitvmode \lastnamedcs ; + +% +% prefixed.opm +% + +\_private \expandafter \def \let \ifx \else \fi \undefined \wlog \endinput ; + +\_let\_ea=\_expandafter + +\_def \_codedecl #1#2{% + \_ifx #1\_undefined \_wlog{#2}% + \_else \_ea \_endinput \_fi +} + +\_let \_endcode = \_endinput + +\_def \_wterm {\_immediate \_write16 } + +\_private \ifcsname \csname \endcsname \errmessage \gdef \csstring \directlua ; +\_let \_ea = \_expandafter + +% modified +\_def \_pkglabel{} +\_def\_namespace #1{% + \_ifcsname namesp:#1\_endcsname \_errmessage + {The name space "#1" is used already, it cannot be used twice}% + \_endinput + \_else \_resetnamespace{#1}\_fi +} +\_def\_resetnamespace #1{% + \_ea \_gdef \_csname namesp:#1\_endcsname {}% + \_gdef \_pkglabel{_#1}% + \_directlua{ + luatexbase.add_to_callback("process_input_buffer", + function (str) + return string.gsub(str, "\_nbb[.]([a-zA-Z])", "\_nbb _#1_\_pcent 1") + end, "_namespace") + }% +} +% modified +\_def\_endnamespace {% + \_directlua{ luatexbase.remove_from_callback("process_input_buffer", "_namespace") }% + \_gdef \_pkglabel{}% +} + +\_def \_nspublic {\_xargs \_nspublicA} +\_def \_nspublicA #1{% + \_unless\_ifx #1\_undefined + \_opwarning{\_ea\_ignoreit\_pkglabel\_space redefines the meaning of \_string#1}\_fi + \_ea\_let \_ea#1\_csname \_pkglabel _\_csstring #1\_endcsname +} + +% modified +\_def \_public {\_xargs \_publicA} +\_def \_publicA #1{\_ea\_let \_ea#1\_csname _\_csstring #1\_endcsname} + +% +% basic-macros.opm +% + +\_private \bgroup \egroup \empty \space \null \long ; + +\_long\_def \_ignoreit #1{} +\_long\_def \_useit #1{#1} +\_long\_def \_ignoresecond #1#2{#1} +\_long\_def \_usesecond #1#2{#2} + +\_private \the \inputlineno \edef ; + +\_def \_opwarning #1{\_wterm{WARNING l.\_the\_inputlineno: pdfextra: #1.}} + +\_edef \_bslash {\_csstring\\} +\_edef \_pcent {\_csstring\%} +\_edef \_nbb {\_bslash\_bslash} + +\_private \xdef \begincsname ; + +\_def \_sdef #1{\_ea\_def \_csname#1\_endcsname} +\_def \_sxdef #1{\_ea\_xdef \_csname#1\_endcsname} +\_def \_slet #1#2{\_ea\_let \_csname#1\_ea\_endcsname + \_ifcsname#2\_ea\_endcsname \_begincsname#2\_endcsname \_else \_undefined \_fi +} + +% Make \sdef public, so users can customize without messing with catcodes. +\_public \sdef ; + +\_def \_cs #1{\_csname#1\_endcsname} +\_def \_trycs#1#2{\_ifcsname #1\_endcsname \_csname #1\_ea\_endcsname \_else #2\_fi} + +\_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}} + +\_private \global \advance ; + +\_def\_incr #1{\_global\_advance#1by1 } +\_def\_decr #1{\_global\_advance#1by-1 } + +\_private \immediate \closeout \jobname ; + +% modified +\_def\_byehook{% + \_immediate\_closeout\_reffile + \_edef\_tmp{\_mdfive{\_jobname.ref}}% + \_ifx\_tmp\_prevrefhash\_else \_opwarning{Try to rerun, + \_jobname.ref file was \_ifx\_prevrefhash\_empty created\_else changed\_fi}\_fi +} + +% +% alloc.opm +% + +\_private \newcount ; + +% +% if-macros.opm +% + +\_def\_afterfi#1#2\_fi{\_fi#1} + +\_private \unless ; + +\_def\_isdefined #1#2{\_ifcsname #1\_endcsname \_else \_ea\_unless \_fi #2} + +\_private \newread \openin \relax \ifeof \closein ; + +\_newread \_testin +\_def\_isfile #1{% + \_immediate\_openin\_testin ={#1}\_relax + \_ifeof\_testin \_ea\_unless + \_else \_immediate\_closein\_testin + \_fi +} + +\_private \begingroup \toks \endgroup \futurelet ; + +\_long\_def\_isnextchar#1#2#3{\_begingroup\_toks0={\_endgroup#2}\_toks1={\_endgroup#3}% + \_let\_tmp= #1\_futurelet\_next\_isnextcharA +} +\_def\_isnextcharA{\_the\_toks\_ifx\_tmp\_next0\_else1\_fi\_space} + +% +% more-macros.opm +% + +\_private \string \newtoks \romannumeral ; + +\_def\_optdef#1[#2]{% + \_def#1{\_opt={#2}\_isnextchar[{\_cs{_oA:\_string#1}}{\_cs{_oB:\_string#1}}}% + \_sdef{_oA:\_string#1}[##1]{\_opt={##1}\_cs{_oB:\_string#1\_nospaceafter}}% + \_sdef{_oB:\_string#1\_nospaceafter}% +} +\_def\_nospaceafter#1{\_ea#1\_romannumeral-`\.} +\_newtoks\_opt + +\_private \noexpand \catcode \toksapp ; + +\_newtoks\_tmptoks +% modified +\_edef\_tmp{\_noexpand\_catcode`!=\_the\_catcode`! \_noexpand\_catcode`?=\_the\_catcode`?} +\_catcode`!=3 \_catcode`?=3 +\_def\_replstring #1#2#3{% \replstring #1{stringA}{stringB} + \_long\_def\_replacestringsA##1#2{\_tmptoks{##1}\_replacestringsB}% + \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_toksapp\_tmptoks{#3##1}% + \_ea\_replacestringsB\_fi}% + \_ea\_replacestringsA #1?#2!#2% + \_long\_def\_replacestringsA##1?{\_tmptoks{##1}\_edef#1{\_the\_tmptoks}}% + \_ea\_replacestringsA \_the\_tmptoks} +\_tmp % modified + +% modified (no \_skiptoeol) +\_long\_def\_doc #1\_cod{} + +% +% keyval.opm +% + +\_def\_readkv#1{\_ea\_def\_ea\_tmpb\_ea{#1}% + \_replstring\_tmpb{= }{=}\_replstring\_tmpb{ =}{=}% + \_replstring\_tmpb{, }{,}\_replstring\_tmpb{,,}{,}% + \_ea \_kvscan \_tmpb,,=,} +\_def\_kvscan #1#2=#3,{\_ifx#1,\_else \_sdef{_kv:#1#2}{#3}\_ea\_kvscan\_fi} +\_def\_kv#1{\_trycs{_kv:#1}{\_kvunknown}} +\_def\_kvunknown{???} + +% +% ref-file.opm +% + +\_private \newwrite \write \iftrue \iffalse \input ; + +% modified +\_newwrite\_reffile +\_def\_inputref {% + \_isfile{\_jobname.ref}\_iftrue + \_edef\_prevrefhash{\_mdfive{\_jobname.ref}}% + \_input {\_jobname.ref}% + \_openref + \_fi +} + +\_private \luaescapestring ; + +% modified +\_def\_mdfive#1{\_directlua{ + local fh = io.open("\_luaescapestring{#1}", "rb") + if fh then + local data = fh:read("*a") + fh:close() + tex.print(md5.sumhexa(data)) + end +}} +\_def\_prevrefhash{} + +\_def\_wrefrelax#1#2{} +\_let\_wref=\_wrefrelax + +\_private \openout ; + +% modified +\_def\_openref {% + \_immediate\_openout\_reffile={\_jobname.ref}\_relax + \_gdef\_wref ##1##2{\_write\_reffile{\_bslash\_csstring##1##2}}% + \_immediate\_write\_reffile {\_pcent\_pcent\_space pdfextra - REF file}% + \_gdef\_openref{}% +} +\_def\_ewref #1#2{\_edef\_ewrefA{#2}\_ea\_wref\_ea#1\_ea{\_ewrefA}} + +\_private \ifnum ; + +\_def\_refdecl{\_bgroup \_catcode`\#=12 \_refdeclA} +\_def\_refdeclA #1{\_egroup\_openref + \_immediate\_write\_reffile {\_pcent\_space \_string \refdecl:}% + \_immediate\_write\_reffile {\_detokenize{#1}}% +} + +% +% hyperlinks.opm +% + +\_def\_pdfborder#1{\_ifcsname _#1border\_endcsname + /C [\_csname _#1border\_endcsname] /Border [0 0 .6]\_else /Border [0 0 0]\_fi +} + +% modified +\_def\_hyperlinks#1#2{% + \_let\_ilinkcolor=#1\_empty + \_let\_elinkcolor=#2\_empty +} +\_public \hyperlinks ; + +% +% pdfuni-string.opm +% + +% modified +\_def\_pdfunidef#1#2{% + \_edef\_tmp{#2}% + \_def#1{\_directlua{ + local str = token.scan_string() + local out = { "<FEFF" } + for _, c in utf8.codes(str) do + if c < 0x10000 then + out[\_csstring\#out+1] = string.format("\_pcent04X", c) + else + c = c - 0x10000 + local high = c >> 10 + 0xD800 + local low = c \_csstring\& 0x3FF + 0xDC00 + out[\_csstring\#out+1] = string.format("\_pcent04X\_pcent04X", high, low) + end + end + out[\_csstring\#out+1] = ">" + tex.print(table.concat(out, ""))}\_ea{\_tmp}% +}} + +% +% optex.lua +% + +\_private \setbox ; + +% modified +\_def\_preshipout#1#2{\_setbox#1#2} + +% +% luatex-ini.opm +% + +\_private \protected \pdfextension \pdffeedback \pdfvariable ; +\_private \numexpr \saveboxresource \lastsavedboxresourceindex ; + +\_protected\_def \_pdfobj {\_pdfextension obj } +\_protected\_def \_pdfrefobj {\_pdfextension refobj } +\_protected\_def \_pdflastobj {\_numexpr\_pdffeedback lastobj\_relax} +\_protected\_def \_pdfstartlink {\_pdfextension startlink } +\_protected\_def \_pdfendlink {\_pdfextension endlink\_relax} +\_protected\_def \_pdfcatalog {\_pdfextension catalog } +\_protected\_edef\_pdfpageattr {\_pdfvariable pageattr} +\_protected\_def \_pdfnames {\_pdfextension names } +\_protected\_def \_pdfannot {\_pdfextension annot } +\_protected\_def \_pdflastannot {\_numexpr\_pdffeedback lastannot\_relax} + \_def \_pdfpageref {\_pdffeedback pageref} + \_let \_pdfxform \_saveboxresource + \_let \_pdflastxform \_lastsavedboxresourceindex + +% +% output.opm +% + +\_let\_oldshipout=\shipout +\_def\shipout{\_begoutput\_oldshipout} + +% modified +\_newcount\_gpageno +\_def \_begoutput{\_incr\_gpageno + % we try \folio, or nothing ({}), pdfextra only uses \gpageno + \_immediate\_wref\_Xpage{{\_the\_gpageno}{\_trycs{folio}{}}}% +} + +% +% references.opm +% + +% modified +\_def\_Xpage#1#2{\_def\_currpage{{#1}{#2}}} + +% +% colors.opm +% + +% modified +\_let\_localcolor\_relax + +% +% \_byehook and \_inputref +% + +\_private \ifdefined ; + +\_ifdefined\AtEndDocument + % make sure all pages (and write whatsits) are flushed before we close files + \AtEndDocument{\clearpage\_byehook}% +\_else + % hope that usual \bye (\outer\def\bye{\par\vfill\supereject\end}) is used + \_let\_end\end + \_def\end{\_byehook \_end}% +\_fi + +\_inputref + +% continue with the real macros +\_input pdfextra.opm +\_catcode`\_=\pdfextraloaded |