diff options
Diffstat (limited to 'macros/luatex/generic')
62 files changed, 5917 insertions, 4109 deletions
diff --git a/macros/luatex/generic/luaaddplot/README.md b/macros/luatex/generic/luaaddplot/README.md index ce4f4448e3..f89acae2ae 100644 --- a/macros/luatex/generic/luaaddplot/README.md +++ b/macros/luatex/generic/luaaddplot/README.md @@ -3,7 +3,7 @@ luaaddeplot Version ------- -1.0 +1.0a Author ------ diff --git a/macros/luatex/generic/luaaddplot/luaaddplot.dtx b/macros/luatex/generic/luaaddplot/luaaddplot.dtx index 7d3e4bf8c2..d6387dfbef 100644 --- a/macros/luatex/generic/luaaddplot/luaaddplot.dtx +++ b/macros/luatex/generic/luaaddplot/luaaddplot.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% $Id: luaaddplot.dtx 3 2022-03-19 23:12:51Z reinhard $ +% $Id: luaaddplot.dtx 6 2024-09-22 00:02:45Z reinhard $ % %<*driver> \documentclass[a4paper,11pt]{ltxdoc} @@ -17,6 +17,7 @@ \author{Reinhard Kotucha} \title{\textsf{luaaddplot}} +\date{Version 1.0a\\[.5ex]\today} \begin{document} \maketitle \vspace*{1cm} @@ -70,8 +71,8 @@ ignored. Different devices use different column delimiters. Therefore tabs, colons, semicolons, and commas are replaced by a space. With other -words, various datafile formats are converted to a format specified by -\textsc{Matlab}. +words, various datafile formats are converted to a to a \textsc{Matlab} +compatible format. \subsection{\texorpdfstring{$\lambda$}{lambda}-Expressions} @@ -118,7 +119,7 @@ Frequencies are in \si{\hertz} but for the plot we prefer \si{\mega\hertz}. The solution is \begin{verbatim} \luaaddplot[blue] file "spectrum.data", function (col) - return col[1]/1e6, col2 + return col[1]/1e6, col[2] end; \end{verbatim} @@ -203,7 +204,7 @@ The solution is % \end{macrocode} % \subsection{luaaddplot.sty} % \begin{macrocode} -%<*sty> \ProvidesPackage{luaaddplot}[2022/03/18/ v1.0] +%<*sty> \ProvidesPackage{luaaddplot}[2024/09/22 v1.0a] \input luaaddplot.tex %</sty> % \end{macrocode} diff --git a/macros/luatex/generic/luaaddplot/luaaddplot.pdf b/macros/luatex/generic/luaaddplot/luaaddplot.pdf Binary files differindex 875fac1157..732135e6d8 100644 --- a/macros/luatex/generic/luaaddplot/luaaddplot.pdf +++ b/macros/luatex/generic/luaaddplot/luaaddplot.pdf diff --git a/macros/luatex/generic/luamplib/Makefile b/macros/luatex/generic/luamplib/Makefile index f41c9a6339..a0a2282675 100644 --- a/macros/luatex/generic/luamplib/Makefile +++ b/macros/luatex/generic/luamplib/Makefile @@ -26,6 +26,8 @@ CTAN_ZIP = $(NAME).zip TDS_ZIP = $(NAME).tds.zip ZIPS = $(CTAN_ZIP) $(TDS_ZIP) +DOLATEX = texfot --quiet --tee=/dev/null --ignore "hypdoc" --ignore "^Overfull" --ignore "^Underfull" lualatex -recorder $(DTX) + all: $(GENERATED) doc: $(DOC) unpack: $(UNPACKED) @@ -36,7 +38,9 @@ world: all ctan .PHONY: all doc unpack ctan tds check world %.pdf: %.dtx - @texfot --quiet --tee=/dev/null --ignore "^Overfull" --ignore "^Underfull" lualatex -recorder $< + @$(DOLATEX) + @if( grep rerunfilecheck $(NAME).log |grep 'has changed' > /dev/null ); then $(DOLATEX); fi + @if( grep 'Rerun to get' $(NAME).log > /dev/null ); then $(DOLATEX); fi $(UNPACKED): $(DTX) luatex -interaction=batchmode $< >/dev/null diff --git a/macros/luatex/generic/luamplib/NEWS b/macros/luatex/generic/luamplib/NEWS index 347f560046..82e82632f6 100644 --- a/macros/luatex/generic/luamplib/NEWS +++ b/macros/luatex/generic/luamplib/NEWS @@ -1,8 +1,109 @@ History of the luamplib package +2024/08/03 2.34.5 + * provide 'withgroupbbox' macro for transparency group to enable users to + control the bounding box + + * write down the width/height/depth values of mplibgroup to the log file + +2024/07/31 2.34.4 + * 'withpattern' operator accepts a <textual picture> as well as a <path> + for its operand. Thus users can give pattern effect to the result of btex + command or infont operator. + + * fix regarding line width in mplibgraphictext + +2024/07/27 2.34.3 + * in DVI mode, use LaTeX's shipout hooks to generate new XObjects + or to put resources to pageresources. (in plain, load atbegshi.sty) + + * fix shading to allow the even-odd rule + +2024/07/24 2.34.2 + * With the newly introduced macros, \mplibgroup ... \endmplibgroup, users + can define a transparency group or a normal form XObject from TeX side. + The LaTeX environment 'mplibgroup' is identical to this pair of macros. + See the document for details. + + * document: be more precise about the color effect of a transparency group + + * remove trailing zeros from numeric objects to get smaller PDF + +2024/07/19 2.34.1 + * transparency group is available with plain format as well. + * transparency group once used is reusable in the TeX code or + in other MetaPost code chunks. see the document for details. + +2024/07/17 2.34.0 + * support transparency group with metafun format + * fix regarding default value in circular fading mode + * fix regarging the scope of graphics state + +2024/07/14 2.33.1 + * refactor the manual, including some minor items undocumented so far + * improve fading routine to get possibly smaller pdf file + +2024/07/08 2.33.0 + * provide a new metapost operator 'withfademethod' and related macros, + which make the color of an object gradiently transparent. see luamplib + document for details. + + * fix spot-color shading routine to support user-defined colorspace + +2024/07/03 2.32.4 + * make the variable 'patterns' local + * 'math.randomseed' on plain TeX + * remove redundant code 'fullcircle scaled 0' + +2024/06/21 2.32.3 + * 'coloured' is a synonym of the option 'colored' in pattern definition. + + * fix a bug related to pdf page resources in dvi mode + + * users can access the lua table containing mplib instances 'luamplib.instances', + through which metapost variables are also easily accessible as documented in + LuaTeX manual 11.2.8.4. + +2024/06/14 2.32.2 + * fix matrix conversion between MP and PDF + +2024/06/13 2.32.1 + * for the sake of convenience, width and height values of tiling patterns + will be written down into the log file. + + * table type is allowed as well as string type for 'matrix' and 'bbox' + options in pattern definition. + + * metapost code such as 'rotated 30 slanted .2' is allowed as well as the + string or table of numbers for the 'matrix' option in pattern definition. + + * as for the 'resources' option in pattern definition, luamplib + automatically includes the resources of the current page. + + * luamplib does not log info even if there's no beginfig ... endfig. + +2024/06/10 2.32.0 + * \mppattern{<name>} ... \endmppattern defines a tiling pattern which can be + used with 'withpattern' operator to fill a closed path by replicating the tile + horizontally and vertically. \begin{mppattern} ... \end{mppattern} is exactly + the same as \mppattern ... \endmppattern. See luamplib manual for details. + +2024/05/30 2.31.2 + * support vertical writing mode in mpliboutlinetext (presently luatexko + package only, and except horizontal mode inside vertical mode) + + * after the process of mpliboutlinetext, mpliboutlinepic[1] ... + mpliboutlinepic[mpliboutlinenum] will be preserved as an array of images + each of which containing a glyph or a rule. N.B. Unicode grapheme cluster + is not considered here. + +2024/05/24 2.31.1 + * fix bugs in outlinetext routine + * improve rule treatment in graphictext + 2024/05/21 2.31.0 * provide a new metapost operator 'mpliboutlinetext', which mimicks - metafun's 'outlinetext'. The syntax is the same as metafun's. + metafun's 'outlinetext'. The syntax is the same as metafun's. (#133) 2024/05/10 2.30.0 * provide a new metapost operator 'mplibglyph', which returns a metapost diff --git a/macros/luatex/generic/luamplib/luamplib.dtx b/macros/luatex/generic/luamplib/luamplib.dtx index 506b5c019a..625a35848c 100644 --- a/macros/luatex/generic/luamplib/luamplib.dtx +++ b/macros/luatex/generic/luamplib/luamplib.dtx @@ -2,8 +2,8 @@ % % Copyright (C) 2008-2024 by Hans Hagen, Taco Hoekwater, Elie Roux, % Manuel Pégourié-Gonnard, Philipp Gesang and Kim Dohyun. -% Currently maintained by the LuaLaTeX development team. -% Support: <lualatex-dev@tug.org> +% Currently maintained by Kim Dohyun. +% Support: <https://github.com/lualatex/luamplib> % % This work is under the GPL v2.0 license. % @@ -85,9 +85,9 @@ See source file '\inFileName' for licencing and contact information. %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{luamplib.drv}% - [2024/05/21 v2.31.0 Interface for using the mplib library]% + [2024/08/03 v2.34.5 Interface for using the mplib library]% \documentclass{ltxdoc} -\usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace} +\usepackage{metalogo,multicol,xspace} \usepackage[x11names]{xcolor} % \def\primarycolor{DodgerBlue4} %%-> rgb 16 78 139 | #104e8b @@ -112,7 +112,7 @@ See source file '\inFileName' for licencing and contact information. ItalicFont = {Linux Libertine O Italic}, SlantedFont = {Linux Libertine O Italic}, ]{Linux Libertine O} -\setmonofont[Ligatures=TeX,Scale=MatchLowercase]{InconsolataN} +\setmonofont[Scale=MatchLowercase]{InconsolataN} %setsansfont[Ligatures=TeX]{Linux Biolinum O} \setsansfont[Ligatures=TeX,Scale=MatchLowercase]{Iwona Medium} %setmathfont{XITS Math} @@ -123,7 +123,9 @@ See source file '\inFileName' for licencing and contact information. \newcommand*\email [1] {<\href{mailto:#1}{#1}>} \newcommand \file {\nolinkurl} -\newcommand \pk {\textsf} + +\newcommand*\metapost {\textsc{metapost}\xspace} +\newcommand*\mplib {\pkg{mplib}\xspace} \begin{document} \DocInput{luamplib.dtx}% @@ -149,125 +151,164 @@ See source file '\inFileName' for licencing and contact information. % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % -% \title{The \textsf{luamplib} package} +% \title{The \pkg{luamplib} package} % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\ -% Maintainer: LuaLaTeX Maintainers --- -% Support: \email{lualatex-dev@tug.org}} -% \date{2024/05/21 v2.31.0} +% Current Maintainer: Kim Dohyun\\ +% Support: \url{https://github.com/lualatex/luamplib}} +% \date{2024/08/03 v2.34.5} % % \maketitle % % \begin{abstract} -% Package to have metapost code typeset directly in a document with \LuaTeX. +% Package to have \metapost code typeset directly in a document with \LuaTeX. % \end{abstract} % % \section{Documentation} % -% This packages aims at providing a simple way to typeset directly metapost -% code in a document with \LuaTeX. \LuaTeX\ is built with the lua -% \texttt{mplib} library, that runs metapost code. This package is basically a -% wrapper (in Lua) for the Lua \texttt{mplib} functions and some \TeX\ -% functions to have the output of the \texttt{mplib} functions in the pdf. -% -% In the past, -% the package required PDF mode in order to output something. -% Starting with version 2.7 it works in DVI mode as well, though -% DVIPDFMx is the only DVI tool currently supported. -% -% The metapost figures are put in a \TeX\ \texttt{hbox} with dimensions -% adjusted to the metapost code. +% This package aims at providing a simple way to typeset directly \metapost +% code in a document with \LuaTeX. \LuaTeX\ is built with the Lua +% \mplib library, that runs \metapost code. This package is basically a +% wrapper for the Lua \mplib functions and some \TeX\ +% functions to have the output of the \mplib functions in the pdf. % -% Using this package is easy: in Plain, type your metapost code between the +% Using this package is easy: in Plain, type your \metapost code between the % macros \cs{mplibcode} and \cs{endmplibcode}, and in \LaTeX\ in the -% \texttt{mplibcode} environment. +% |mplibcode| environment. % -% The code is from the \texttt{luatex-mplib.lua} and \texttt{luatex-mplib.tex} files -% from \ConTeXt, they have been adapted to \LaTeX\ and Plain by Elie Roux and -% Philipp Gesang, new functionalities have been added by Kim Dohyun. -% The changes are: +% The resulting \metapost figures are put in a \TeX\ |hbox| with dimensions +% adjusted to the \metapost code. +% +% The code of luamplib is basically from the |luatex-mplib.lua| and |luatex-mplib.tex| files +% from \ConTeXt. They have been adapted to \LaTeX\ and Plain by Elie Roux and +% Philipp Gesang and new functionalities have been added by Kim Dohyun. +% The most notable changes are: % % \begin{itemize} -% \item a \LaTeX\ environment -% \item all \TeX\ macros start by |mplib| -% \item use of our own function for errors, warnings and informations % \item possibility to use |btex ... etex| to typeset \TeX\ code. -% |textext()| is a more versatile macro equivalent to |TEX()| from TEX.mp. -% |TEX()| is also allowed and is a synomym of |textext()|.\par\smallskip -% \textsc{n.b.} Since v2.5, |btex ... etex| input from external |mp| files -% will also be processed by \textsf{luamplib}.\par\smallskip -% \textsc{n.b.} Since v2.20, |verbatimtex ... etex| from external |mp| files -% will be also processed by \textsf{luamplib}. Warning: This is a change -% from previous version. +% |textext()| is a more versatile macro equivalent to |TEX()| from \pkg{TEX.mp}. +% |TEX()| is also allowed and is a synonym of |textext()|. +% The argument of +% \mplib's primitive |maketext| will also be processed by the same routine. +% +% \item possibility to use |verbatimtex ... etex|, though it's behavior cannot +% be the same as the stand-alone \pkg{mpost}. +% Of course you cannot include \cs{documentclass}, \cs{usepackage} etc. +% When these \TeX\ commands are found in |verbatimtex ... etex|, the entire code will be +% ignored. +% The treatment of |verbatimtex| command has changed a lot since v2.20: +% see \hyperlink{mpliblegacybehavior}{below \S\,1.1}. +% +% \item in the past, +% the package required PDF mode in order to have some output. +% Starting with version 2.7 it works in DVI mode as well, though +% DVIPDFMx is the only DVI tool currently supported. % \end{itemize} % -% Some more changes and cautions are: +% It seems to be convenient to divide the explanations of some more changes and cautions +% into three parts: \TeX, \textsc{MetaPost}, and Lua interfaces. +% +% \subsection{\TeX} % % \paragraph{\cs{mplibforcehmode}} -% When this macro is declared, every mplibcode figure box will be +% When this macro is declared, every \metapost figure box will be % typeset in horizontal mode, so \cs{centering}, \cs{raggedleft} etc -% will have effects. |\mplibnoforcehmode|, being default, reverts this -% setting. (Actually these commands redefine |\prependtomplibbox|. You -% can define this command with anything suitable before a box.) +% will have effects. \cs{mplibnoforcehmode}, being default, reverts this +% setting. (Actually these commands redefine \cs{prependtomplibbox}; you +% can redefine this command with anything suitable before a box.) % -% \paragraph{\cs{mpfig} \ldots\ \cs{endmpfig}} -% Since v2.29 we provide unexpandable \TeX\ macros |\mpfig ... \endmpfig| and its starred version -% |\mpfig* ... \endmpfig| to save typing toil. -% The first is roughly the same as follows: -% \begin{verbatim} -% \begin{mplibcode}[@mpfig] -% beginfig(0) -% token list declared by \everymplib[@mpfig] -% ... -% token list declared by \everyendmplib[@mpfig] -% endfig; -% \end{mplibcode} -% \end{verbatim} -% and the starred version is roughly the same as follows: -% \begin{verbatim} -% \begin{mplibcode}[@mpfig] -% ... +% \paragraph{\cs{everymplib\{...\}}, \cs{everyendmplib\{...\}}} +% \cs{everymplib} and \cs{everyendmplib} redefine +% the lua table containing \metapost code +% which will +% be automatically inserted at the beginning and ending of each \metapost code chunk. +%\begin{verbatim} +% \everymplib{ beginfig(0); } +% \everyendmplib{ endfig; } +% \begin{mplibcode} +% % beginfig/endfig not needed +% draw fullcircle scaled 1cm; % \end{mplibcode} -% \end{verbatim} -% In these macros |\mpliblegacybehavior{disable}| (see below) -% is forcibly declared. -% And as both share the same instance name, metapost codes are inherited among them. -% A simple example: -% \begin{verbatim} -% \mpfig* input boxes \endmpfig -% \everymplib[@mpfig]{ drawoptions(withcolor .5[red,white]); } -% \mpfig circleit.a(btex Box 1 etex); drawboxed(a); \endmpfig -% \end{verbatim} -% The instance name (default: |@mpfig|) can be changed by redefining -% \cs{mpfiginstancename}, after which a new MPlib instance will start and -% code inheritance too will begin anew. |\let\mpfiginstancename\empty| will -% prevent code inheritance if |\mplibcodeinherit{true}| (see below) is not declared.\footnote{% -% As for user setting values, |enable|, |true|, |yes| are identical, and -% |disable|, |false|, |no| are identical.} -% -% \paragraph{\cs{mpliblegacybehavior\{enable\}}} -% By default, |\mpliblegacybehavior{enable}| is already declared, -% in which case -% a |verbatimtex ... etex| that comes just before |beginfig()| -% is not ignored, but the \TeX\ code will be inserted before the -% following mplib hbox. Using this command, -% each mplib box can be freely moved horizontally and/or vertically. -% Also, a box number might be assigned to mplib box, allowing it to be -% reused later (see test files). -% \begin{verbatim} +%\end{verbatim} +% +% \paragraph{\cs{mplibsetformat\{plain\textbar metafun\}}} +% There are (basically) two formats for \metapost: \emph{plain} and +% \emph{metafun}. By default, the \emph{plain} format is used, but you can set +% the format to be used by future figures at any time using +% \cs{mplibsetformat\{<format name>\}}. +% +% \textsc{n.b.} As \emph{metafun} is such a complicated format, +% we cannot support all the functionalities producing special effects provided by \emph{metafun}. +% At least, however, transparency (actually opacity), transparency group, and shading (gradient colors) +% are fully supported, +% and outlinetext is supported by our own alternative |mpliboutlinetext| +% (see \hyperlink{mpliboutlinetext}{below \S\,1.2}). +% +% \leavevmode\llap{\textcolor{red}{☞}\kern1.2\parindent}\relax +% Among these, transparency is so simple that you can apply it to an object, +% even with the \emph{plain} format, +% just by appending |withprescript| |"tr_transparency=<number>"| to the sentence. +% ($0 \le \hbox{\emph{<number>}} \le 1$) +% +% \hypertarget{metafunformat}{}\relax +% As for transparency group, the current \emph{metafun} document \S\,8.8 is not correct. +% The true syntax is: +%\begin{verbatim} +% draw <picture>|<path> asgroup <string> +%\end{verbatim} +% where \emph{<string>} should be |""| (empty), |"isolated"|, |"knockout"|, or |"isolated,knockout"|. +% Beware that currently many of the PDF rendering applications, except Adobe Acrobat Reader, +% cannot properly render the isolated or knockout effect. +% Transparency group is available with \emph{plain} format as well, with extended functionality. +% See \hyperlink{transparencygroup}{below \S\,1.2}. +% +% One thing worth mentioning about shading is: +% when a color expression is given in string type, +% it is regarded by luamplib as +% a color expression of \TeX\ side. +% For instance, when |withshadecolors("orange", 2/3red)| is given, the first color |"orange"| will be +% interpreted as a \pkg{color}, \pkg{xcolor} or \pkg{l3color}'s expression. +% +% \paragraph{\cs{mplibnumbersystem\{scaled\textbar double\textbar decimal\}}} +% Users can choose |numbersystem| option. +% The default value is |scaled|, which can be changed +% by declaring \cs{mplibnumbersystem\{double\}} or +% \cs{mplibnumbersystem\{decimal\}}. +% +% \paragraph{\cs{mplibshowlog\{enable\textbar disable\}}} +% Default: |disable|. +% When \cs{mplibshowlog\{enable\}}\footnote{As for user's setting, +% |enable|, |true| and |yes| are identical; +% |disable|, |false| and |no| are identical.} is declared, log messages returned by +% the \metapost process will be printed to the |.log| file. +% This is the \TeX{} side interface for |luamplib.showlog|. +% +% \paragraph{\cs{mpliblegacybehavior\{enable\textbar disable\}}} +% \hypertarget{mpliblegacybehavior}{}\relax +% By default, \cs{mpliblegacybehavior\{enable\}} +% is already declared for backward compatibility, +% in which case \TeX\ code in +% |verbatimtex| |...| |etex| that comes just before |beginfig()| +% will be inserted before the +% following \metapost figure box. In this way, +% each figure box can be freely moved horizontally or vertically. +% Also, a box number can be assigned to a figure box, allowing it to be +% reused later. +%\begin{verbatim} % \mplibcode % verbatimtex \moveright 3cm etex; beginfig(0); ... endfig; % verbatimtex \leavevmode etex; beginfig(1); ... endfig; % verbatimtex \leavevmode\lower 1ex etex; beginfig(2); ... endfig; % verbatimtex \endgraf\moveright 1cm etex; beginfig(3); ... endfig; % \endmplibcode -% \end{verbatim} +%\end{verbatim} % \textsc{n.b.} \cs{endgraf} should be used instead of \cs{par} inside % |verbatimtex ... etex|. % -% By contrast, \TeX\ code in |VerbatimTeX(...)| or |verbatimtex ... etex| +% On the other hand, \TeX\ code in |verbatimtex ... etex| % between |beginfig()| and |endfig| will be inserted -% after flushing out the mplib figure. -% \begin{verbatim} +% after flushing out the \metapost figure. +% As shown in the example below, |VerbatimTeX()| is a synonym of |verbatimtex| |...| |etex|. +%\begin{verbatim} % \mplibcode % D := sqrt(2)**7; % beginfig(0); @@ -276,15 +317,15 @@ See source file '\inFileName' for licencing and contact information. % endfig; % \endmplibcode % diameter: \Dia bp. -% \end{verbatim} +%\end{verbatim} % -% \paragraph{\cs{mpliblegacybehavior\{disable\}}} -% If |\mpliblegacybehavior{disabled}| is declared by user, any -% |verbatimtex ... etex| will be executed, along with |btex ... etex|, +% By contrast, +% when \cs{mpliblegacybehavior\{disable\}} is declared, any +% |verbatimtex| |...| |etex| will be executed, along with |btex| |...| |etex|, % sequentially one by one. % So, some \TeX\ code in |verbatimtex ... etex| will have effects on -% |btex ... etex| codes that follows. -% \begin{verbatim} +% following |btex| |...| |etex| codes. +%\begin{verbatim} % \begin{mplibcode} % beginfig(0); % draw btex ABC etex; @@ -293,114 +334,72 @@ See source file '\inFileName' for licencing and contact information. % draw btex GHI etex shifted (2cm,0); % bold face % endfig; % \end{mplibcode} -% \end{verbatim} -% -% \paragraph{\cs{everymplib}, \cs{everyendmplib}} -% Since v2.3, new macros \cs{everymplib} and \cs{everyendmplib} redefine -% the lua table containing MetaPost code -% which will -% be automatically inserted at the beginning and ending of each |mplibcode|. -% \begin{verbatim} -% \everymplib{ beginfig(0); } -% \everyendmplib{ endfig; } -% \mplibcode % beginfig/endfig not needed -% draw fullcircle scaled 1cm; -% \endmplibcode -% \end{verbatim} -% -% \paragraph{\cs{mpdim}} -% Since v2.3, \cs{mpdim} and other raw \TeX\ commands are allowed -% inside mplib code. This feature is inpired by gmp.sty authored by -% Enrico Gregorio. Please refer the manual of gmp package for details. -% \begin{verbatim} -% \begin{mplibcode} -% draw origin--(.6\mpdim{\linewidth},0) withpen pencircle scaled 4 -% dashed evenly scaled 4 withcolor \mpcolor{orange}; -% \end{mplibcode} -% \end{verbatim} -% \textsc{n.b.} Users should not use the protected variant of -% |btex ... etex| as provided by gmp package. As \textsf{luamplib} -% automatically protects \TeX\ code inbetween, \cs{btex} is not supported -% here. -% -% \paragraph{\cs{mpcolor}} -% With \cs{mpcolor} command, color names or expressions of -% \textsf{color}/\textsf{xcolor} packages can be used inside mplibcode -% enviroment (after |withcolor| operator), -% though \textsf{luamplib} does not automatically load these -% packages. See the example code above. For spot colors, -% \textsf{colorspace}, \textsf{spotcolor} -% (in PDF mode) and \textsf{xespotcolor} (in DVI mode) packages are supported -% as well. -% -% From v2.26.1, \textsf{l3color} is also supported by the command -% \cs{mpcolor\{color expression\}}, including spot colors. -% -% \paragraph{\cs{mplibnumbersystem}} -% Users can choose |numbersystem| option since v2.4. -% The default value |scaled| can be changed to |double| or |decimal| -% by declaring |\mplibnumbersystem{double}| or |\mplibnumbersystem{decimal}|. -% For details see -% \url{http://github.com/lualatex/luamplib/issues/21}. +%\end{verbatim} % -% \paragraph{\cs{mplibtextextlabel}} -% Starting with v2.6, |\mplibtextextlabel{enable}| enables -% string labels typeset via |textext()| instead of |infont| operator. +% \paragraph{\cs{mplibtextextlabel\{enable\textbar disable\}}} +% Default: |disable|. +% \cs{mplibtextextlabel\{enable\}} enables +% the labels typeset via |textext| instead of |infont| operator. % So, |label("my text",origin)| thereafter is exactly the same as -% |label(textext("my text"),origin)|. \textsc{n.b.} In the background, -% \textsf{luamplib} redefines |infont| operator so that the right side -% argument (the font part) is totally ignored. Every string label -% therefore will be typeset with current \TeX\ font. +% |label(textext("my text"),origin)|. +% +% \textsc{n.b.} In the background, +% luamplib redefines |infont| operator so that the right side +% argument (the font part) is totally ignored. Therefore the left side arguemnt +% will be typeset with the current \TeX\ font. % Also take care of |char| operator in the left side argument, % as this might bring unpermitted characters into \TeX. % -% \paragraph{\cs{mplibcodeinherit}} -% Starting with v2.9, |\mplibcodeinherit{enable}| enables the inheritance -% of variables, constants, and macros defined by previous |mplibcode| chunks. -% On the contrary, the default value |\mplibcodeinherit{disable}| will make -% each code chunks being treated as an independent instance, and never +% \paragraph{\cs{mplibcodeinherit\{enable\textbar disable\}}} +% Default: |disable|. +% \cs{mplibcodeinherit\{enable\}} enables the inheritance +% of variables, constants, and macros defined by previous \metapost code chunks. +% On the contrary, \cs{mplibcodeinherit\{disable\}} will make +% each code chunk being treated as an independent instance, never % affected by previous code chunks. % -% \paragraph{Separate instances for \LaTeX{} and plain \TeX} -% v2.22 has added the support for several named MetaPost instances +% \paragraph{Separate \metapost instances} +% luamplib v2.22 has added the support for several named \metapost instances % in \LaTeX{} |mplibcode| environment. -% (And since v2.29 plain \TeX\ users can use this functionality as well.) -% Syntax is like so: -% \begin{verbatim} +% Plain \TeX\ users also can use this functionality. +% The syntax for \LaTeX\ is: +%\begin{verbatim} % \begin{mplibcode}[instanceName] % % some mp code % \end{mplibcode} -% \end{verbatim} -% Behaviour is as follows. +%\end{verbatim} +% The behavior is as follows. % \begin{itemize} % \item All the variables and functions are shared % only among all the environments belonging to the same instance. -% \item |\mplibcodeinherit| only affects environments +% \item \cs{mplibcodeinherit} only affects environments % with no instance name set (since if a name is set, % the code is intended to be reused at some point). -% \item From v2.27, |btex ... etex| boxes are also shared and do not -% require |\mplibglobaltextext|. +% \item |btex ... etex| boxes are also shared and do not +% require \cs{mplibglobaltextext}. % \item When an instance names is set, -% respective |\currentmpinstancename| is set. +% respective \cs{currentmpinstancename} is set as well. % \end{itemize} -% In parellel with this functionality, v2.23 and after supports +% In parellel with this functionality, we support % optional argument of instance name for \cs{everymplib} and % \cs{everyendmplib}, affecting only those |mplibcode| environments % of the same name. % Unnamed \cs{everymplib} affects not only those instances with no name, % but also those with name but with no corresponding \cs{everymplib}. -% Syntax is: -% \begin{verbatim} +% The syntax is: +%\begin{verbatim} % \everymplib[instanceName]{...} % \everyendmplib[instanceName]{...} -% \end{verbatim} +%\end{verbatim} % -% \paragraph{\cs{mplibglobaltextext}} -% Formerly, to inherit |btex ... etex| boxes as well as metapost variables, +% \paragraph{\cs{mplibglobaltextext\{enable\textbar disable\}}} +% Default: |disable|. +% Formerly, to inherit |btex| |...| |etex| boxes as well as other \metapost macros, variables and constants, % it was necessary to declare \cs{mplibglobaltextext\{enable\}} in advance. % But from v2.27, this is implicitly enabled when \cs{mplibcodeinherit} -% is |true|. -% \begin{verbatim} +% is enabled. +% This optional command still remains mostly for backward compatibility. +%\begin{verbatim} % \mplibcodeinherit{enable} % %\mplibglobaltextext{enable} % \everymplib{ beginfig(0);} \everyendmplib{ endfig;} @@ -412,38 +411,92 @@ See source file '\inFileName' for licencing and contact information. % \mplibcode % currentpicture := pic scaled 2; % \endmplibcode -% \end{verbatim} -% Generally speaking, it is recommended to turn |mplibglobaltextext| -% always on, because it has the advantage of reusing metapost pictures -% among code chunks. -% But everything has its downside: it will waste more memory resources. -% -% \paragraph{\cs{mplibverbatim}} -% Starting with v2.11, users can issue |\mplibverbatim{enable}|, after which +%\end{verbatim} +% +% \paragraph{\cs{mplibverbatim\{enable\textbar disable\}}} +% Default: |disable|. +% Users can issue \cs{mplibverbatim\{enable\}}, after which % the contents of mplibcode environment will be read verbatim. As a result, -% except for |\mpdim| and |\mpcolor|, all other \TeX\ commands outside -% |btex ... etex| or |verbatimtex ... etex| are not expanded and will be fed -% literally into the mplib process. -% -% \paragraph{\cs{mplibshowlog}} -% When |\mplibshowlog{enable}| is declared, log messages returned by -% |mplib| instance will be printed into the |.log| file. -% |\mplibshowlog{disable}| will revert this functionality. -% This is a \TeX{} side interface for |luamplib.showlog|. (v2.20.8) -% -% \paragraph{Settings regarding cache files} -% To support |btex ... etex| in external |.mp| files, \textsf{luamplib} -% inspects the content of each and every |.mp| input files and makes caches -% if nececcsary, before returning their paths to \LuaTeX's mplib library. -% This would make the compilation time longer wastefully, as most |.mp| files -% do not contain |btex ... etex| command. So \textsf{luamplib} provides -% macros as follows, so that users can give instruction about files +% except for \cs{mpdim} and \cs{mpcolor} (see \hyperlink{mpdim}{below}), +% all other \TeX\ commands outside of the +% |btex| or |verbatimtex| |...| |etex| are not expanded and will be fed +% literally to the \mplib library. +% +% \paragraph{\cs{mpdim\{...\}}} +% \hypertarget{mpdim}{}\relax +% Besides other \TeX\ commands, \cs{mpdim} is specially allowed +% in the mplibcode environment. This feature is inpired by \pkg{gmp} package authored by +% Enrico Gregorio. Please refer to the manual of \pkg{gmp} package for details. +%\begin{verbatim} +% \begin{mplibcode} +% beginfig(1) +% draw origin--(.6\mpdim{\linewidth},0) withpen pencircle scaled 4 +% dashed evenly scaled 4 withcolor \mpcolor{orange}; +% endfig; +% \end{mplibcode} +%\end{verbatim} +% +% \paragraph{\cs{mpcolor[...]\{...\}}} +% With \cs{mpcolor} command, color names or expressions of +% \pkg{color}, \pkg{xcolor} and \pkg{l3color} module/packages can be used in the mplibcode +% environment (after |withcolor| operator). +% See the example \hyperlink{mpdim}{above}. +% The optional |[...]| denotes the option of \pkg{xcolor}'s \cs{color} command. +% For spot colors, \pkg{l3color} (in PDF/DVI mode), +% \pkg{colorspace}, \pkg{spotcolor} +% (in PDF mode) and \pkg{xespotcolor} (in DVI mode) packages are supported +% as well. +% +% \paragraph{\cs{mpfig} \ldots\ \cs{endmpfig}} +% Besides the |mplibcode| environment (for \LaTeX) and +% \cs{mplibcode ...} \cs{endmplibcode} (for Plain), +% we also provide unexpandable \TeX\ macros \cs{mpfig} |...| \cs{endmpfig} and its starred version +% \cs{mpfig*} |...| \cs{endmpfig} to save typing toil. +% The former is roughly the same as follows: +%\begin{verbatim} +% \begin{mplibcode}[@mpfig] +% beginfig(0) +% token list declared by \everymplib[@mpfig] +% ... +% token list declared by \everyendmplib[@mpfig] +% endfig; +% \end{mplibcode} +%\end{verbatim} +% and the starred version is roughly the same as follows: +%\begin{verbatim} +% \begin{mplibcode}[@mpfig] +% ... +% \end{mplibcode} +%\end{verbatim} +% In these macros \cs{mpliblegacybehavior\{disable\}} +% is forcibly declared. +% Again, as both share the same instance name, \metapost codes are inherited among them. +% A simple example: +%\begin{verbatim} +% \everymplib[@mpfig]{ drawoptions(withcolor .5[red,white]); } +% \mpfig* input boxes \endmpfig +% \mpfig +% circleit.a(btex Box 1 etex); drawboxed(a); +% \endmpfig +%\end{verbatim} +% The instance name (default: |@mpfig|) can be changed by redefining +% \cs{mpfiginstancename}, after which a new \mplib instance will start and +% code inheritance too will begin anew. \cs{let}\cs{mpfiginstancename}\cs{empty} will +% prevent code inheritance if \cs{mplibcodeinherit\{true\}} is not declared. +% +% \paragraph{About cache files} +% To support |btex ... etex| in external |.mp| files, luamplib +% inspects the content of each and every |.mp| file and makes caches +% if nececcsary, before returning their paths to \LuaTeX's \mplib library. +% This could waste the compilation time, as most |.mp| files +% do not contain |btex ... etex| commands. So luamplib provides +% macros as follows, so that users can give instructions about files % that do not require this functionality. % \begin{itemize} -% \item |\mplibmakenocache{<filename>[,<filename>,...]}| -% \item |\mplibcancelnocache{<filename>[,<filename>,...]}| +% \item \cs{mplibmakenocache\{<filename>[,<filename>,...]\}} +% \item \cs{mplibcancelnocache\{<filename>[,<filename>,...]\}} % \end{itemize} -% where |<filename>| is a file name excluding |.mp| extension. +% where |<filename>| is a filename excluding |.mp| extension. % Note that |.mp| files under |$TEXMFMAIN/metapost/base| and % |$TEXMFMAIN/metapost/context/base| are already registered by default. % @@ -451,64 +504,96 @@ See source file '\inFileName' for licencing and contact information. % if it's not available (mostly not writable), % in the directory where output files are saved: % to be specific, |$TEXMF_OUTPUT_DIRECTORY/luamplib_cache|, -% |./luamplib_cache|, |$TEXMFOUTPUT/luamplib_cache|, and |.| in this order. -% (|$TEXMF_OUTPUT_DIRECTORY| is normally the value of |--output-directory| -% command-line option.) -% This behavior however can be changed by the command -% |\mplibcachedir{<directory path>}|, where tilde (|~|) is interpreted +% |./luamplib_cache|, |$TEXMFOUTPUT/luamplib_cache|, and |.|, in this order. +% |$TEXMF_OUTPUT_DIRECTORY| is normally the value of |--output-directory| +% command-line option. +% +% Users can change this behavior by the command +% \cs{mplibcachedir\{<directory path>\}}, where tilde (|~|) is interpreted % as the user's home directory (on a windows machine as well). -% As backslashes (|\|) should be escaped by users, it would be easier to use +% As backslashes (\cs{}) should be escaped by users, it would be easier to use % slashes (|/|) instead. % -% \paragraph{\texttt{mplibtexcolor}, \texttt{mplibrgbtexcolor}} -% |mplibtexcolor| is a metapost operator that converts a \TeX\ color expression -% to a MetaPost color expression. For instance: -% \begin{verbatim} +% \paragraph{About figure box metric} +% Notice that, after each figure is processed, the macro \cs{MPwidth} stores +% the width value of the latest figure; \cs{MPheight}, the height value. +% Incidentally, also note that \cs{MPllx}, \cs{MPlly}, \cs{MPurx}, and +% \cs{MPury} store the bounding box information of the latest figure +% without the unit |bp|. +% +% \paragraph{luamplib.cfg} +% At the end of package loading, luamplib searches +% |luamplib.cfg| and, if found, reads the file in automatically. +% Frequently used settings such as \cs{everymplib}, \cs{mplibforcehmode} +% or \cs{mplibcodeinherit} are suitable for going into this file. +% +% \subsection{\textsc{MetaPost}} +% +% \paragraph{\texttt{mplibdimen(...)}, \texttt{mplibcolor(...)}} +% These are \metapost interfaces for the \TeX\ commands +% \cs{mpdim} and \cs{mpcolor} (see \hyperlink{mpdim}{above}). For example, +% |mplibdimen("\linewidth")| is basically the same as \cs{mpdim\{\cs{linewidth}\}}, and +% |mplibcolor("red!50")| is basically the same as \cs{mpcolor\{red!50\}}. +% The difference is that these \metapost operators can also be used in external |.mp| files, +% which cannot have \TeX\ commands outside of the |btex| or |verbatimtex| |...| |etex|. +% +% \paragraph{\texttt{mplibtexcolor ...}, \texttt{mplibrgbtexcolor ...}} +% |mplibtexcolor|, which accepts a string argument, is a \metapost operator that converts a \TeX\ color expression +% to a \metapost color expression, that can be used anywhere color expression is expected +% as well as after the |withcolor| operator. +% For instance: +%\begin{verbatim} % color col; % col := mplibtexcolor "olive!50"; -% \end{verbatim} -% The result may vary in its color model (gray/rgb/cmyk) +%\end{verbatim} +% But the result may vary in its color model (gray/rgb/cmyk) % according to the given \TeX\ color. (Spot colors are forced to % cmyk model, so this operator is not recommended for spot colors.) -% Therefore the example shown above would raise a metapost error: +% Therefore the example shown above would raise a \metapost error: % |cmykcolor col;| should have been declared. -% By contrast, |mplibrgbtexcolor| always returns rgb model expressions. -% -% \paragraph{\texttt{mplibgraphictext}} -% For some amusement, luamplib provides its own metapost operator -% |mplibgraphictext|, the effect of which is similar to that of -% \ConTeXt's |graphictext|. However syntax is somewhat different. -% \begin{verbatim} +% By contrast, |mplibrgbtexcolor| \emph{<string>} always returns rgb model expressions. +% +% \paragraph{\texttt{mplibgraphictext ...}} +% |mplibgraphictext| is a \metapost operator, the effect of which is similar to that of +% \ConTeXt's |graphictext| or our own |mpliboutlinetext| +% (see \hyperlink{mpliboutlinetext}{below}). +% However the syntax is somewhat different. +%\begin{verbatim} % mplibgraphictext "Funny" % fakebold 2.3 % fontspec option % drawcolor .7blue fillcolor "red!50" % color expressions -% \end{verbatim} +%\end{verbatim} % |fakebold|, |drawcolor| and |fillcolor| are optional; % default values are |2|, |"black"| and |"white"| respectively. -% When color expressions are given as string, they are regarded as -% xcolor's or l3color's expressions (this is the same with shading colors). -% From v2.30, |scale| option is deprecated and is now a synonym of |scaled|. +% When the color expressions are given in string type, they are regarded as +% \pkg{color}, \pkg{xcolor} or \pkg{l3color}'s expressions. % All from |mplibgraphictext| to the end of sentence will compose an % anonymous |picture|, which can be drawn or assigned to a variable. % Incidentally, |withdrawcolor| and |withfillcolor| are synonyms of % |drawcolor| and |fillcolor|, hopefully to be compatible with |graphictext|. -% \textsc{n.b.} Because luamplib's current implementation is quite different -% from the \ConTeXt's, there are some limitations such that you can't -% apply shading (gradient colors) to the text (But see below). -% In DVI mode, |unicode-math| package is needed for math formula graphictext, +% +% \textsc{n.b.} +% In some cases, |mplibgraphictext| will produce better results than \ConTeXt\ +% or even than our own |mpliboutlinetext|, +% especially when processing complicated \TeX\ code +% such as the vertical writing in Chinese or Japanese. +% However, because the implementation is quite different from others, +% there are some limitations such that you can't +% apply shading (gradient colors) to the text. Again, +% in DVI mode, \pkg{unicode-math} package is needed for math formula, % as we cannot embolden type1 fonts in DVI mode. % -% \paragraph{\texttt{mplibglyph}, \texttt{mplibdrawglyph}} -% From v2.30, we provide a new metapost operator |mplibglyph|, which returns a metapost picture +% \paragraph{\texttt{mplibglyph ... of ...}} +% From v2.30, we provide a new \metapost operator |mplibglyph|, which returns a \metapost picture % containing outline paths of a glyph in opentype, truetype or type1 fonts. -% When a type1 font is specified, metapost primitive |glyph| will be called. -% \begin{verbatim} +% When a type1 font is specified, \metapost primitive |glyph| will be called. +%\begin{verbatim} % mplibglyph 50 of \fontid\font % slot 50 of current font % mplibglyph "Q" of "TU/TeXGyrePagella(0)/m/n/10" % font csname % mplibglyph "Q" of "texgyrepagella-regular.otf" % raw filename % mplibglyph "Q" of "Times.ttc(2)" % subfont number % mplibglyph "Q" of "SourceHanSansK-VF.otf[Regular]" % instance name -% \end{verbatim} +%\end{verbatim} % Both arguments before and after of ``|of|'' can be either a number or a string. % Number arguments are regarded as a glyph slot (GID) and a font id number, repectively. % String argument at the left side is regarded as a glyph name in the font or a unicode character. @@ -518,67 +603,418 @@ See source file '\inFileName' for licencing and contact information. % subfont number (starting from zero) of a TTC font; a string within brackets denotes % an instance name of a variable font. % -% The returned picture will be quite similar to the result of |glyph| primitive in its structure. -% So, metapost's |draw| command will fill the inner path of the picture with background color. -% In contrast, |mplibdrawglyph| command fills the paths according to the Nonzero Winding -% Number Rule. As a result, for instance, the area surrounded by inner path of ``O'' +% \paragraph{\texttt{mplibdrawglyph ...}} +% The picture returned by |mplibglyph| will be quite similar to the result of |glyph| primitive in its structure. +% So, \metapost's |draw| command will fill the inner path of the picture with the background color. +% In contrast, |mplibdrawglyph| \emph{<picture>} command fills the paths according to the nonzero winding +% number rule. As a result, for instance, the area surrounded by inner path of ``O'' % will remain transparent. % -% We can adapt the method used in |mplibdrawglyph| to multiple pictures as if they were -% components of one and the same picture. An example: -% \begin{verbatim} -% \mplibsetformat{metafun} -% \mpfig -% picture Q, u, e; -% Q := mplibglyph "Q" of "Times.ttc(2)" scaled .15; -% u := mplibglyph "u" of "Times.ttc(2)" scaled .15 shifted lrcorner Q; -% e := mplibglyph "e" of "Times.ttc(2)" scaled .15 shifted lrcorner u; -% -% i:=0; -% totallen := length Q + length u + length e; -% for pic=Q, u, e: -% for item within pic: -% i:=i+1; -% fill pathpart item -% if i < totallen: withpostscript "collect"; fi -% endfor -% endfor -% withshademethod "linear" -% withshadedirection (0.5,2.5) -% withshadecolors (.7red,.7yellow); -% \endmpfig -% \end{verbatim} -% -% \paragraph{\texttt{mpliboutlinetext}} -% From v2.31, we provide a new metapost operator |mpliboutlinetext|, which mimicks -% metafun's |outlinetext|. So the syntax is the same as metafun's. See the metafun -% manual \textsection\,8.7 (|texdoc metafun|). A simple example: -% \begin{verbatim} +% \leavevmode\llap{\textcolor{red}{☞}\kern1.2\parindent}\relax +% To apply the nonzero winding number rule to a picture containing paths, +% luamplib appends |withpostscript| |"collect"| +% to the paths except the last one in the picture. +% If you want the even-odd rule instead, you can, with \emph{plain} format as well, +% additionally declare |withpostscript| |"evenodd"| to the last path in the picture. +% +% \paragraph{\texttt{mpliboutlinetext (...)}} +% \hypertarget{mpliboutlinetext}{}\relax +% From v2.31, a new \metapost operator |mpliboutlinetext| is available, which mimicks +% \emph{metafun}'s |outlinetext|. So the syntax is the same: see the \emph{metafun} +% manual \S\,8.7 (|texdoc metafun|). A simple example: +%\begin{verbatim} % draw mpliboutlinetext.b ("$\sqrt{2+\alpha}$") % (withcolor \mpcolor{red!50}) % (withpen pencircle scaled .2 withcolor red) % scaled 2 ; -% \end{verbatim} -% -% \paragraph{About figure box metrics} -% Notice that, after each figure is processed, macro \cs{MPwidth} stores -% the width value of latest figure; \cs{MPheight}, the height value. -% Incidentally, also note that \cs{MPllx}, \cs{MPlly}, \cs{MPurx}, and -% \cs{MPury} store the bounding box information of latest figure -% without the unit |bp|. -% -% \paragraph{luamplib.cfg} -% At the end of package loading, \textsf{luamplib} searches -% |luamplib.cfg| and, if found, reads the file in automatically. -% Frequently used settings such as \cs{everymplib}, \cs{mplibforcehmode} -% or \cs{mplibcodeinherit} are suitable for going into this file. +%\end{verbatim} +% After the process, |mpliboutlinepic[]| +% and |mpliboutlinenum| will be preserved as global variables; +% |mpliboutlinepic[1]| |...| |mpliboutlinepic[mpliboutlinenum]| +% will be an array of images each of which containing a glyph or a rule. +% +% \textsc{n.b.} As Unicode grapheme cluster is not considered in the array, a unit that must be +% a single cluster might be separated apart. +% +% \paragraph{\cs{mppattern\{...\} ...} \cs{endmppattern}, \texttt{... withpattern ...}} +% \hypertarget{mppattern}{}\relax +% \TeX\ macros +% \cs{mppattern\{<name>\}} |...| \cs{endmppattern} define a tiling pattern +% associated with the |<name>|. +% \metapost operator |withpattern|, the syntax being +% \emph{<path>}\,\textbar\,\emph{<textual picture>} |withpattern| \emph{<string>}, +% will return a \metapost picture which fills +% the given path or text with a tiling pattern of the |<name>| +% by replicating it horizontally and vertically. +% The \emph{textual picture} here means any text typeset by \TeX, mostly the result +% of the |btex| command (though technically this is not a true textual picture) +% or the |infont| operator. +% +% An example: +%\begin{verbatim} +% \mppattern{mypatt} % or \begin{mppattern}{mypatt} +% [ % options: see below +% xstep = 10, +% ystep = 12, +% matrix = {0, 1, -1, 0}, % or "0 1 -1 0" +% ] +% \mpfig % or any other TeX code, +% draw (origin--(1,1)) +% scaled 10 +% withcolor 1/3[blue,white] +% ; +% draw (up--right) +% scaled 10 +% withcolor 1/3[red,white] +% ; +% \endmpfig +% \endmppattern % or \end{mppattern} +% +% \mpfig +% draw fullcircle scaled 90 +% withpostscript "collect" +% ; +% draw fullcircle scaled 200 +% withpattern "mypatt" +% withpen pencircle scaled 1 +% withcolor \mpcolor{red!50!blue!50} +% withpostscript "evenodd" +% ; +% \endmpfig +%\end{verbatim} +% +% The available options are listed in Table~\ref{tab:mppatternoptions}. +% \begin{table} +% \centering +% \caption{options for \cs{mppattern}}\label{tab:mppatternoptions} +% \begin{tabular}{lll}\hline +% Key & Value Type & Explanation\\\hline +% |xstep| &\emph{number} & horizontal spacing between pattern cells\\ +% |ystep| &\emph{number} & vertical spacing between pattern cells\\ +% |xshift| &\emph{number} & horizontal shifting of pattern cells\\ +% |yshift| &\emph{number} & vertical shifting of pattern cells\\ +% |bbox| &\emph{table} or \emph{string} & |llx|, |lly|, |urx|, |ury| values\kern1pt*\\ +% |matrix| &\emph{table} or \emph{string} & |xx|, |yx|, |xy|, |yy| values\kern1pt* or MP transform code\\ +% |resources|&\emph{string} & PDF resources if needed\\ +% |colored| or |coloured| &\emph{boolean}& |false| for uncolored pattern. default: |true|\\\hline +% & & \small *\,in string type, numbers are separated by spaces\\ +% \end{tabular} +% \end{table} +% +% For the sake of convenience, the width and height values of tiling patterns will be written down +% into the log file. (depth is always zero.) Users can refer to them for option setting. +% +% As for |matrix| option, \metapost code such as `|rotated 30 slanted .2|' is allowed as well +% as string or table of four numbers. You can also set |xshift| and |yshift| +% values by using `|shifted|' operator. But when |xshift| or |yshift| option is explicitly +% given, they have precedence over the effect of `|shifted|' operator. +% +% When you use special effects such as transparency in a pattern, +% |resources| option is needed: for instance, |resources="/ExtGState 1 0 R"|. +% However, as luamplib automatically includes the resources of the current page, this option +% is not needed in most cases. +% +% Option |colored=false| (|coloured| is a synonym of |colored|) will generate an uncolored pattern which shall have no color at all. +% Uncolored pattern will be painted later by the color of a \metapost object. +% An example: +%\begin{verbatim} +% \begin{mppattern}{pattnocolor} +% [ +% colored = false, +% matrix = "slanted .3 rotated 30", +% ] +% \tiny\TeX +% \end{mppattern} +% +% \begin{mplibcode} +% beginfig(1) +% picture tex; +% tex = mpliboutlinetext.p ("\bfseries \TeX"); +% for i=1 upto mpliboutlinenum: +% j:=0; +% for item within mpliboutlinepic[i]: +% j:=j+1; +% draw pathpart item scaled 10 +% if j < length mpliboutlinepic[i]: +% withpostscript "collect" +% else: +% withpattern "pattnocolor" +% withpen pencircle scaled 1/2 +% withcolor (i/4)[red,blue] % paints the pattern +% fi; +% endfor +% endfor +% endfig; +% \end{mplibcode} +%\end{verbatim} +% A much simpler and efficient way to obtain a similar result +% (without colorful characters in this example) +% is to give a \emph{textual picture} as the operand of |withpattern|: +%\begin{verbatim} +% \begin{mplibcode} +% beginfig(2) +% picture pic; +% pic = mplibgraphictext "\bfseries\TeX" +% fakebold 1/2 +% fillcolor 1/3[red,blue] % paints the pattern +% drawcolor 2/3[red,blue] +% scaled 10 ; +% draw pic withpattern "pattnocolor" ; +% endfig; +% \end{mplibcode} +%\end{verbatim} +% +% \paragraph{\texttt{... withfademethod ...}} +% This is a \metapost operator which makes the color of an object gradiently transparent. +% The syntax is \emph{<path>}\texttt{\textbar}\emph{<picture>} |withfademethod| \emph{<string>}, +% the latter being either |"linear"| or |"circular"|. +% Though it is similar to the |withshademethod| from \emph{metafun}, +% the differences are: (1) the operand of |withfademethod| can be a picture as well as a path; +% (2) you cannot make gradient colors, but can only make gradient opacity. +% +% Related macros to control optional values are: +% \begin{description} +% \let\bfseries\relax +% \item [|withfadeopacity (|\emph{number, number}|)|] +% sets the starting opacity and the ending opacity, default value being |(1,0)|. +% `|1|' denotes full color; `|0|' full transparency. +% \item [|withfadevector (|\emph{pair, pair}|)|] +% sets the starting and ending points. Default value in the linear mode is +% |(llcorner p, lrcorner p)|, where |p| is the operand, +% meaning that fading starts from the left edge and ends at the right edge. +% Default value in the circular mode is |(center p, center p)|, which means +% centers of both starting and ending circles are the center of the bounding box. +% \item [|withfadecenter|] is a synonym of |withfadevector|. +% \item [|withfaderadius (|\emph{number, number}|)|] +% sets the radii of starting and ending circles. This is no-op in the linear mode. +% Default value is |(0, abs(center p - urcorner p))|, meaning that fading starts from the +% center and ends at the four corners of the bounding box. +% \item [|withfadebbox (|\emph{pair, pair}|)|] +% sets the bounding box of the fading area, default value being |(llcorner p, urcorner p)|. +% Though this option is not needed in most cases, there could be cases when users want to +% explicitly control the bounding box. +% Particularly, see the description \hyperlink{withgroupbbox}{below} +% on the analogous macro |withgroupbbox|. +% \end{description} +% An example: +%\begin{verbatim} +% \mpfig +% picture mill; +% mill = btex \includegraphics[width=100bp]{mill} etex; +% draw mill +% withfademethod "circular" +% withfadecenter (center mill, center mill) +% withfaderadius (20, 50) +% withfadeopacity (1, 0) +% ; +% \endmpfig +%\end{verbatim} +% +% \paragraph{\texttt{... asgroup ...}} +% \hypertarget{transparencygroup}{}\relax +% As said \hyperlink{metafunformat}{before}, +% transparency group is available with \emph{plain} as well as \emph{metafun} format. +% The syntax is exactly the same: +% \emph{<picture>} \textbar\ \emph{<path>} |asgroup| +% |""| \textbar\ |"isolated"| \textbar\ |"knockout"| \textbar\ |"isolated,knockout"|, +% which will return a \metapost picture. +% It is called \emph{Transparency Group} because the objects contained in the group are composited +% to produce a single object, so that outer transparency effect, if any, +% will be applied to the group as a whole, not to the individual objects cumulatively. +% +% The additional feature provided by luamplib is that +% you can reuse the group as many times as you want +% in the \TeX{} code or in other \metapost code chunks, +% with infinitesimal increase in the size of PDF file. +% For this functionality we provide \TeX{} and \metapost macros as follows: +% \begin{description} +% \let\bfseries\relax +% \item[|withgroupname| \emph{<string>}] associates a transparency group with the given name. +% When this is not appended to the sentense with |asgroup| operator, +% the default group name `|lastmplibgroup|' will be used. +% +% \item[\cs{usemplibgroup\{...\}}] +% \hypertarget{usemplibgroup}{}\relax +% is a \TeX\ command to reuse a transparency group of the name +% once used. +% Note that the position of the group will be origin-based: +% in other words, lower-left corner of the group will be shifted to the origin. +% +% \item[|usemplibgroup| \emph{<string>}] is a \metapost command which will add +% a transparency group of the name to the |currentpicture|. +% Contrary to the \TeX\ command just mentioned, +% the position of the group is the same as the original transparency group. +% +% \item[|withgroupbbox (|\emph{pair}|,|\emph{pair}|)|] +% \hypertarget{withgroupbbox}{}\relax +% sets the bounding box of the transparency group, +% default value being |(llcorner p, urcorner p)|. +% This option might be needed especially when you draw with a thick pen +% a path that touches the boundary; +% you would probably want to append to the sentense +% `|withgroupbbox| |(bot| |lft| |llcorner| |p,| |top| |rt| |urcorner| |p)|', +% supposing that the pen was selected by the |pickup| command. +% +% \end{description} +% An example showing the difference between the \TeX\ and \metapost commands: +%\begin{verbatim} +% \mpfig +% draw image( +% fill fullcircle scaled 100 shifted 25right withcolor .5[blue,white]; +% fill fullcircle scaled 100 withcolor .5[red,white] ; +% ) asgroup "" +% withgroupname "mygroup"; +% draw (left--right) scaled 10; +% draw (up--down) scaled 10; +% \endmpfig +% +% \noindent +% \clap{\vrule width 20pt height .25pt depth .25pt}% +% \clap{\vrule width .5pt height 10pt depth 10pt}% +% \usemplibgroup{mygroup} +% +% \mpfig +% usemplibgroup "mygroup" rotated 15; +% draw (left--right) scaled 10; +% draw (up--down) scaled 10; +% \endmpfig +%\end{verbatim} +% +% Also note that normally the reused transparency groups are not affected by outer color commands. +% However, if you have made the original transparency group using |withoutcolor| command, +% colors will have effects on the uncolored objects in the group. +% +% \paragraph{\cs{mplibgroup\{...\} ...} \cs{endmplibgroup}} +% These \TeX\ macros are described here in this subsection, as they are +% deeply related to the |asgroup| operator. +% Users can define a transparency group or a normal \emph{form XObject} +% with these macros from \TeX\ side. +% The syntax is similar to the \cs{mppattern} command (see \hyperlink{mppattern}{above}). +% An example: +%\begin{verbatim} +% \mplibgroup{mygrx} % or \begin{mplibgroup}{mygrx} +% [ % options: see below +% asgroup="", +% ] +% \mpfig % or any other TeX code +% pickup pencircle scaled 10; +% draw (left--right) scaled 30 rotated 45 ; +% draw (left--right) scaled 30 rotated -45 ; +% \endmpfig +% \endmplibgroup % or \end{mplibgroup} +% +% \usemplibgroup{mygrx} +% +% \mpfig +% usemplibgroup "mygrx" +% scaled 1.5 +% withprescript "tr_transparency=0.5" ; +% \endmpfig +%\end{verbatim} +% +% Availabe options, much fewer than those for \cs{mppattern}, +% are listed in Table~\ref{tab:mplibgroupoptions}. +% Again, the width/height/depth values of the mplibgroup will be written down into the log file. +% \begin{table} +% \centering +% \caption{options for \cs{mplibgroup}}\label{tab:mplibgroupoptions} +% \begin{tabular}{lll} +% \hline +% Key & Value Type & Explanation\\ +% \hline +% |asgroup| &\emph{string} & |""|, |"isolated"|, |"knockout"|, or |"isolated,knockout"|\\ +% |bbox| &\emph{table} or \emph{string} & |llx|, |lly|, |urx|, |ury| values\kern1pt*\\ +% |matrix| &\emph{table} or \emph{string} & |xx|, |yx|, |xy|, |yy| values\kern1pt* +% or MP transform code\\ +% |resources| &\emph{string} & PDF resources if needed\\ +% \hline +% & & \small *\,in string type, numbers are separated by spaces\\ +% \end{tabular} +% \end{table} +% +% When |asgroup| option, including empty string, is not given, +% a normal form XObject will be generated rather than a transparency group. +% Thus the individual objects, not the XObject as a whole, will be affected +% by outer transparency command. +% +% As shown in the example, you can reuse the mplibgroup once defined +% using the \TeX\ command \cs{usemplibgroup} or +% the \metapost command |usemplibgroup|. +% The behavior of these commands is the same as that described \hyperlink{usemplibgroup}{above}. +% +% +% \subsection{Lua} +% +% \paragraph{\texttt{runscript ...}} +% Using the primitive |runscript| \emph{<string>}, you can run a Lua code chunk from \metapost side +% and get some \metapost code returned by Lua if you want. +% As the functionality is provided by the \mplib library itself, +% luamplib does not have much to say about it. +% +% One thing is worth mentioning, however: +% if you return a Lua \emph{table} to the \metapost process, +% it is automatically converted to a relevant \metapost value type +% such as pair, color, cmykcolor or transform. +% So users can save some extra toil of converting a table to a string, though it's not a big deal. +% For instance, |runscript "return {1,0,0}"| will give you the \metapost color expression |(1,0,0)| +% automatically. +% +% \paragraph{Lua table \texttt{luamplib.instances}} +% Users can access the Lua table containing \mplib instances, |luamplib.instances|, +% through which \metapost variables are also easily accessible from Lua side, +% as documented in Lua\TeX{} manual \S\,11.2.8.4 (|texdoc luatex|). +% The following will print |false|, |3.0|, |MetaPost| and +% the knots and the cyclicity of the path |unitsquare|, consecutively. +%\begin{verbatim} +% \begin{mplibcode}[instance1] +% boolean b; b = 1 > 2; +% numeric n; n = 3; +% string s; s = "MetaPost"; +% path p; p = unitsquare; +% \end{mplibcode} % -% \bigskip +% \directlua{ +% local instance1 = luamplib.instances.instance1 +% print( instance1:get_boolean "b" ) +% print( instance1:get_number "n" ) +% print( instance1:get_string "s" ) +% local t = instance1:get_path "p" +% for k,v in pairs(t) do +% print(k, type(v)=='table' and table.concat(v,' ') or v) +% end +% } +%\end{verbatim} +% +% \paragraph{Lua function \texttt{luamplib.process\_mplibcode}} +% Users can execute a \metapost code chunk from Lua side by using this function: +%\begin{verbatim} +% luamplib.process_mplibcode (<string> metapost code, <string> instance name) +%\end{verbatim} +% The second argument cannot be absent, but can be an empty string (|""|) which +% means that it has no instance name. +% +% Some other elements in the |luamplib| namespace, listed in Table~\ref{tab:elementsinluamplib}, +% can have effects on the process of |process_mplibcode|. +% \begin{table} +% \centering +% \caption{elements in \texttt{luamplib} table (partial)}\label{tab:elementsinluamplib} +% \begin{tabular}{lll}\hline +% Key & Type & Related \TeX\ macro \\\hline +% |codeinherit| & \emph{boolean} & \cs{mplibcodeinherit}\\ +% |everyendmplib| & \emph{table} & \cs{everyendmplib}\\ +% |everymplib| & \emph{table} & \cs{everymplib}\\ +% |getcachedir| & \emph{function} (\emph{<string>}) & \cs{mplibcachedir}\\ +% |globaltextext| & \emph{boolean} & \cs{mplibglobaltextext}\\ +% |legacyverbatimtex| & \emph{boolean} & \cs{mpliblegacybehavior}\\ +% |noneedtoreplace| & \emph{table} & \cs{mplibmakenocache}\\ +% |numbersystem| & \emph{string} & \cs{mplibnumbersystem}\\ +% |setformat| & \emph{function} (\emph{<string>}) & \cs{mplibsetformat}\\ +% |showlog| & \emph{boolean} & \cs{mplibshowlog}\\ +% |textextlabel| & \emph{boolean} & \cs{mplibtextextlabel}\\ +% |verbatiminput| & \emph{boolean} & \cs{mplibverbatim}\\\hline +% \end{tabular} +% \end{table} % -% There are (basically) two formats for metapost: \emph{plain} and -% \emph{metafun}. By default, the \emph{plain} format is used, but you can set -% the format to be used by future figures at any time using -% \cs{mplibsetformat}\marg{format name}. % % \section{Implementation} % @@ -592,14 +1028,14 @@ See source file '\inFileName' for licencing and contact information. luatexbase.provides_module { name = "luamplib", - version = "2.31.0", - date = "2024/05/21", + version = "2.34.5", + date = "2024/08/03", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } % \end{macrocode} % -% Use the |luamplib| namespace, since |mplib| is for the metapost library +% Use the |luamplib| namespace, since |mplib| is for the \metapost library % itself. \ConTeXt{} uses |metapost|. % \begin{macrocode} luamplib = luamplib or { } @@ -635,7 +1071,6 @@ local function termorlog (target, text, kind) if kind == "Error" then error() end end end - local function warn (...) -- beware '%' symbol termorlog("term and log", select("#",...) > 1 and format(...) or ...) end @@ -651,33 +1086,23 @@ luamplib.showlog = luamplib.showlog or false % \end{macrocode} % % This module is a stripped down version of libraries that are used by -% \ConTeXt. Provide a few ``shortcuts'' expected by the imported code. +% \ConTeXt. Provide a few ``shortcuts'' expected by the code. % \begin{macrocode} local tableconcat = table.concat local tableinsert = table.insert +local tableunpack = table.unpack local texsprint = tex.sprint local texgettoks = tex.gettoks local texgetbox = tex.getbox local texruntoks = tex.runtoks -% \end{macrocode} -% -% We don't use |tex.scantoks| anymore. See below reagrding |tex.runtoks|. -% \begin{verbatim} -% local texscantoks = tex.scantoks -% \end{verbatim} -% \begin{macrocode} - if not texruntoks then err("Your LuaTeX version is too old. Please upgrade it to the latest") end - local is_defined = token.is_defined local get_macro = token.get_macro - local mplib = require ('mplib') local kpse = require ('kpse') local lfs = require ('lfs') - local lfsattributes = lfs.attributes local lfsisdir = lfs.isdir local lfsmkdir = lfs.mkdir @@ -693,7 +1118,6 @@ local file = file or { } local replacesuffix = file.replacesuffix or function(filename, suffix) return (filename:gsub("%.[%a%d]+$","")) .. "." .. suffix end - local is_writable = file.is_writable or function(name) if lfsisdir(name) then name = name .. "/_luam_plib_temp_file_" @@ -715,14 +1139,11 @@ end % \end{macrocode} % % |btex ... etex| in input |.mp| files will be replaced in finder. -% Because of the limitation of MPLib regarding |make_text|, +% Because of the limitation of \mplib regarding |make_text|, % we might have to make cache files modified from input files. % \begin{macrocode} -local luamplibtime = kpse.find_file("luamplib.lua") -luamplibtime = luamplibtime and lfsattributes(luamplibtime,"modification") - +local luamplibtime = lfsattributes(kpse.find_file"luamplib.lua", "modification") local currenttime = os.time() - local outputdir, cachedir if lfstouch then for i,v in ipairs{'TEXMFVAR','TEXMF_OUTPUT_DIRECTORY','.','TEXMFOUTPUT'} do @@ -759,10 +1180,9 @@ function luamplib.getcachedir(dir) end end end - % \end{macrocode} % -% Some basic MetaPost files not necessary to make cache files. +% Some basic \metapost files not necessary to make cache files. % \begin{macrocode} local noneedtoreplace = { ["boxes.mp"] = true, -- ["format.mp"] = true, @@ -781,7 +1201,6 @@ local noneedtoreplace = { ["mp-tool.mpiv"] = true, ["mp-cont.mpiv"] = true, } luamplib.noneedtoreplace = noneedtoreplace - % \end{macrocode} % % |format.mp| is much complicated, so specially treated. @@ -803,7 +1222,6 @@ local function replaceformatmp(file,newfile,ofmodify) lfstouch(newfile,currenttime,ofmodify) return newfile end - % \end{macrocode} % % Replace |btex ... etex| and |verbatimtex ... etex| in input files, @@ -813,7 +1231,6 @@ local name_b = "%f[%a_]" local name_e = "%f[^%a_]" local btex_etex = name_b.."btex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e local verbatimtex_etex = name_b.."verbatimtex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e - local function replaceinputmpfile (name,file) local ofmodify = lfsattributes(file,"modification") if not ofmodify then return file end @@ -826,24 +1243,19 @@ local function replaceinputmpfile (name,file) return nf.size == 0 and file or newfile end end - if name == "format.mp" then return replaceformatmp(file,newfile,ofmodify) end - local fh = ioopen(file,"r") if not fh then return file end local data = fh:read("*all"); fh:close() - % \end{macrocode} -% -% ``|etex|'' must be followed by a space or semicolon as specified in -% \LuaTeX\ manual, which is not the case of standalone MetaPost though. +% ``|etex|'' must be preceded by a space and followed by a space or semicolon as specified in +% \LuaTeX\ manual, which is not the case of standalone \metapost though. % \begin{macrocode} local count,cnt = 0,0 data, cnt = data:gsub(btex_etex, "btex %1 etex ") -- space count = count + cnt data, cnt = data:gsub(verbatimtex_etex, "verbatimtex %1 etex;") -- semicolon count = count + cnt - if count == 0 then noneedtoreplace[name] = true fh = ioopen(newfile,"w"); @@ -853,7 +1265,6 @@ local function replaceinputmpfile (name,file) end return file end - fh = ioopen(newfile,"w") if not fh then return file end fh:write(data); fh:close() @@ -863,8 +1274,8 @@ end % \end{macrocode} % -% As the finder function for MPLib, use the |kpse| library and -% make it behave like as if MetaPost was used. And replace it with +% As the finder function for \mplib, use the |kpse| library and +% make it behave like as if \metapost was used. And replace |.mp| files with % cache files if needed. % See also \#74, \#97. % \begin{macrocode} @@ -876,12 +1287,10 @@ do end mpkpse = kpse.new(arg[exe], "mpost") end - local special_ftype = { pfb = "type1 fonts", enc = "enc files", } - function luamplib.finder (name, mode, ftype) if mode == "w" then if name and name ~= "mpout.log" then @@ -907,9 +1316,9 @@ end % \end{macrocode} % -% Create and load MPLib instances. -% We do not support ancient version of MPLib any more. -% (Don't know which version of MPLib started to support +% Create and load \mplib instances. +% We do not support ancient version of \mplib any more. +% (Don't know which version of \mplib started to support % |make_text| and |run_script|; let the users find it.) % \begin{macrocode} local preamble = [[ @@ -918,32 +1327,29 @@ local preamble = [[ let normalfontsize = fontsize; input %s ; ]] - % \end{macrocode} % -% |plain| or |metafun|, -% though we cannot support |metafun| format fully. +% \emph{plain} or \emph{metafun}, +% though we cannot support \emph{metafun} format fully. % \begin{macrocode} local currentformat = "plain" function luamplib.setformat (name) currentformat = name end - % \end{macrocode} % % v2.9 has introduced the concept of ``code inherit'' % \begin{macrocode} luamplib.codeinherit = false local mplibinstances = {} +luamplib.instances = mplibinstances local has_instancename = false - local function reporterror (result, prevlog) if not result then err("no result object returned") else local t, e, l = result.term, result.error, result.log % \end{macrocode} -% % log has more information than term, so log first (2021/08/02) % \begin{macrocode} local log = l or t or "no-term" @@ -962,10 +1368,9 @@ local function reporterror (result, prevlog) elseif prevlog then log = prevlog..log % \end{macrocode} -% % v2.6.1: now luamplib does not disregard |show| command, % even when |luamplib.showlog| is false. Incidentally, -% it does not raise error but just prints an info, +% it does not raise error nor prints an info, % even if output has no figure. % \begin{macrocode} local show = log:match"\n>>? .+" @@ -979,18 +1384,20 @@ local function reporterror (result, prevlog) return log end end - +% \end{macrocode} +% +% |lualibs-os.lua| installs a randomseed. When this file is not loaded, +% we should explicitly seed a unique integer to get random randomseed for each run. +% \begin{macrocode} +if not math.initialseed then math.randomseed(currenttime) end local function luamplibload (name) local mpx = mplib.new { ini_version = true, find_file = luamplib.finder, % \end{macrocode} -% % Make use of |make_text| and |run_script|, which will co-operate -% with \LuaTeX's |tex.runtoks|. And we -% provide |numbersystem| option since v2.4. Default value ``|scaled|'' -% can be changed by declaring |\mplibnumbersystem{double}| -% or |\mplibnumbersystem{decimal}|. +% with \LuaTeX's |tex.runtoks| or other Lua functions. And we +% provide |numbersystem| option since v2.4. % See \url{https://github.com/lualatex/luamplib/issues/21}. % \begin{macrocode} make_text = luamplib.maketext, @@ -1001,13 +1408,12 @@ local function luamplibload (name) extensions = 1, } % \end{macrocode} -% -% Append our own MetaPost preamble to the preamble above. +% Append our own \metapost preamble to the preamble above. % \begin{macrocode} local preamble = tableconcat{ format(preamble, replacesuffix(name,"mp")), luamplib.preambles.mplibcode, - luamplib.legacy_verbatimtex and luamplib.preambles.legacyverbatimtex or "", + luamplib.legacyverbatimtex and luamplib.preambles.legacyverbatimtex or "", luamplib.textextlabel and luamplib.preambles.textextlabel or "", } local result, log @@ -1019,23 +1425,12 @@ local function luamplibload (name) log = reporterror(result) return mpx, result, log end - % \end{macrocode} % % Here, excute each |mplibcode| data, % ie |\begin{mplibcode} ... \end{mplibcode}|. % \begin{macrocode} local function process (data, instancename) -% \end{macrocode} -% -% The workaround of issue \#70 seems to be unnecessary, as we use -% |make_text| now. -% \begin{verbatim} -% if not data:find(name_b.."beginfig%s*%([%+%-%s]*%d[%.%d%s]*%)") then -% data = data .. "beginfig(-1);endfig;" -% end -% \end{verbatim} -% \begin{macrocode} local currfmt if instancename and instancename ~= "" then currfmt = instancename @@ -1045,7 +1440,7 @@ local function process (data, instancename) currentformat, luamplib.numbersystem or "scaled", tostring(luamplib.textextlabel), - tostring(luamplib.legacy_verbatimtex), + tostring(luamplib.legacyverbatimtex), } has_instancename = false end @@ -1066,8 +1461,6 @@ local function process (data, instancename) if log then if result.fig then converted = luamplib.convert(result) - else - info"No figure output. Maybe no beginfig/endfig" end end else @@ -1081,40 +1474,30 @@ end % |dvipdfmx| is supported, though nobody seems to use it. % \begin{macrocode} local pdfmode = tex.outputmode > 0 + % \end{macrocode} % -% |make_text| and some |run_script| uses \LuaTeX's |tex.runtoks|, -% which made possible running \TeX\ code snippets inside |\directlua|. +% |make_text| and some |run_script| uses \LuaTeX's |tex.runtoks|. % \begin{macrocode} local catlatex = luatexbase.registernumber("catcodetable@latex") local catat11 = luatexbase.registernumber("catcodetable@atletter") - % \end{macrocode} % % |tex.scantoks| sometimes fail to read catcode properly, especially % |\#|, |\&|, or |\%|. After some experiment, we dropped using it. -% Instead, a function containing |tex.script| seems to work nicely. -% \begin{verbatim} -% local function run_tex_code_no_use (str, cat) -% cat = cat or catlatex -% texscantoks("mplibtmptoks", cat, str) -% texruntoks("mplibtmptoks") -% end -% \end{verbatim} +% Instead, a function containing |tex.sprint| seems to work nicely. % \begin{macrocode} local function run_tex_code (str, cat) texruntoks(function() texsprint(cat or catlatex, str) end) end - % \end{macrocode} % -% Prepare textext box number containers, -% locals, globals and possibly instances. +% Prepare textext box number containers, locals and globals. % |localid| can be any number. They are local anyway. % The number will be reset at the start of a new code chunk. % Global boxes will use |\newbox| command in |tex.runtoks| process. -% This is the same when |codeinherit| is declared as true. -% Boxes of an instance will also be global, so that +% This is the same when |codeinherit| is true. +% Boxes in instances with name will also be global, so that % their tex boxes can be shared among instances of the same name. % \begin{macrocode} local texboxes = { globalid = 0, localid = 4096 } @@ -1122,11 +1505,9 @@ local texboxes = { globalid = 0, localid = 4096 } % For conversion of |sp| to |bp|. % \begin{macrocode} local factor = 65536*(7227/7200) - local textext_fmt = 'image(addto currentpicture doublepath unitsquare \z -xscaled %f yscaled %f shifted (0,-%f) \z -withprescript "mplibtexboxid=%i:%f:%f")' - + xscaled %f yscaled %f shifted (0,-%f) \z + withprescript "mplibtexboxid=%i:%f:%f")' local function process_tex_text (str) if str then local global = (has_instancename or luamplib.globaltextext or luamplib.codeinherit) @@ -1138,8 +1519,7 @@ local function process_tex_text (str) else local boxid = texboxes.globalid + 1 texboxes.globalid = boxid - run_tex_code(format( - [[\expandafter\newbox\csname luamplib.box.%s\endcsname]], boxid)) + run_tex_code(format([[\expandafter\newbox\csname luamplib.box.%s\endcsname]], boxid)) tex_box_id = tex.getcount'allocationnumber' end run_tex_code(format("%s\\setbox%i\\hbox{%s}", global, tex_box_id, str)) @@ -1157,7 +1537,6 @@ end % Make |color| or |xcolor|'s color expressions usable, % with \cs{mpcolor} or |mplibcolor|. These commands should be used % with graphical objects. -% % Attempt to support l3color as well. % \begin{macrocode} local mplibcolorfmt = { @@ -1173,7 +1552,6 @@ local mplibcolorfmt = { [[\color_select:n%s\endgroup]], }, } - local colfmt = is_defined'color_select:n' and "l3color" or "xcolor" if colfmt == "l3color" then run_tex_code{ @@ -1187,7 +1565,6 @@ if colfmt == "l3color" then } end local ccexplat = luatexbase.registernumber"luamplibcctabexplat" - local function process_color (str) if str then if not str:find("%b{}") then @@ -1248,20 +1625,18 @@ end % % For legacy verbatimtex process. % |verbatimtex ... etex| before |beginfig()| is not ignored, -% but the \TeX\ code is inserted just before the mplib box. And -% \TeX\ code inside |beginfig() ... endfig| is inserted after the mplib box. +% but the \TeX\ code is inserted just before the \mplib box. And +% \TeX\ code inside |beginfig() ... endfig| is inserted after the \mplib box. % \begin{macrocode} local tex_code_pre_mplib = {} luamplib.figid = 1 luamplib.in_the_fig = false - local function process_verbatimtex_prefig (str) if str then tex_code_pre_mplib[luamplib.figid] = str end return "" end - local function process_verbatimtex_infig (str) if str then return format('special "postmplibverbtex=%s";', str) @@ -1280,17 +1655,16 @@ local runscript_funcs = { % \end{macrocode} % -% For |metafun| format. see issue \#79. +% For \emph{metafun} format. see issue \#79. % \begin{macrocode} mp = mp or {} local mp = mp mp.mf_path_reset = mp.mf_path_reset or function() end mp.mf_finish_saving_data = mp.mf_finish_saving_data or function() end mp.report = mp.report or info - % \end{macrocode} % -% metafun 2021-03-09 changes crashes luamplib. +% \emph{metafun} 2021-03-09 changes crashes luamplib. % \begin{macrocode} catcodes = catcodes or {} local catcodes = catcodes @@ -1324,7 +1698,6 @@ local function mpprint(buffer,...) end end end - function luamplib.runscript (code) local id, str = code:match("(.-){(.*)}") if id and str then @@ -1346,7 +1719,7 @@ function luamplib.runscript (code) return buffer end buffer = {} - mpprint(buffer, table.unpack(res)) + mpprint(buffer, tableunpack(res)) return tableconcat(buffer) end return "" @@ -1363,9 +1736,7 @@ local function protecttexcontents (str) :gsub("%zPerCent%z", "\\%%") :gsub("%s+", " ") end - -luamplib.legacy_verbatimtex = true - +luamplib.legacyverbatimtex = true function luamplib.maketext (str, what) if str and str ~= "" then str = protecttexcontents(str) @@ -1374,7 +1745,7 @@ function luamplib.maketext (str, what) not str:find("\\begin%s*{document}") and not str:find("\\documentstyle"..name_e) and not str:find("\\usepackage"..name_e) then - if luamplib.legacy_verbatimtex then + if luamplib.legacyverbatimtex then if luamplib.in_the_fig then return process_verbatimtex_infig(str) else @@ -1393,13 +1764,13 @@ end % \end{macrocode} % -% luamplib's metapost color operators +% luamplib's \metapost color operators % \begin{macrocode} local function colorsplit (res) - local t, tt = { }, res:gsub("[%[%]]",""):explode() + local t, tt = { }, res:gsub("[%[%]]","",2):explode() local be = tt[1]:find"^%d" and 1 or 2 for i=be, #tt do - if tt[i]:find"^%a" then break end + if not tonumber(tt[i]) then break end t[#t+1] = tt[i] end return t @@ -1433,7 +1804,7 @@ luamplib.shadecolor = function (str) if res:find" cs " or res:find"@pdf.obj" then -- spot color shade: l3 only % \end{macrocode} % An example of spot color shading: -% \begin{verbatim} +%\begin{verbatim} % \documentclass{article} % \usepackage{luamplib} % \mplibsetformat{metafun} @@ -1479,73 +1850,187 @@ luamplib.shadecolor = function (str) % endfig; % \end{mplibcode} % \end{document} -% \end{verbatim} +%\end{verbatim} +% another one: user-defined DeviceN colorspace +%\begin{verbatim} +% \DocumentMetadata{ } +% \documentclass{article} +% \usepackage{luamplib} +% \mplibsetformat{metafun} +% \ExplSyntaxOn +% \color_model_new:nnn { pantone1215 } +% { Separation } +% { name = PANTONE~1215~U , +% alternative-model = cmyk , +% alternative-values = {0, 0.15, 0.51, 0} +% } +% \color_model_new:nnn { pantone+black } +% { DeviceN } +% { +% names = {pantone1215,black} +% } +% \color_set:nnn{purepantone}{pantone+black}{1,0} +% \color_set:nnn{pureblack} {pantone+black}{0,1} +% \ExplSyntaxOff +% \begin{document} +% \mpfig +% fill unitsquare xscaled \mpdim{\textwidth} yscaled 30 +% withshademethod "linear" +% withshadecolors ("purepantone","pureblack") +% ; +% \endmpfig +% \end{document} +%\end{verbatim} % \begin{macrocode} run_tex_code({ [[\color_export:nnN{]], str, [[}{backend}\mplib_@tempa]], },ccexplat) - local name = get_macro'mplib_@tempa':match'{(.-)}{.+}' + local name, value = get_macro'mplib_@tempa':match'{(.-)}{(.-)}' local t, obj = res:explode() if pdfmode then - obj = t[1]:match"^/(.+)" - if ltx.pdf and ltx.pdf.object_id then - obj = format("%s 0 R", ltx.pdf.object_id(obj)) - else - run_tex_code({ - [[\edef\mplib_@tempa{\pdf_object_ref:n{]], obj, "}}", - },ccexplat) - obj = get_macro'mplib_@tempa' - end + obj = format("%s 0 R", ltx.pdf.object_id( t[1]:sub(2,-1) )) else obj = t[2] end - local value = t[3]:match"%[(.-)%]" or t[3] - return format('(%s) withprescript"mplib_spotcolor=%s:%s"', value,obj,name) + return format('(1) withprescript"mplib_spotcolor=%s:%s:%s"', value,obj,name) end return colorsplit(res) end % \end{macrocode} % +% Remove trailing zeros for smaller PDF +% \begin{macrocode} +local decimals = "%.%d+" +local function rmzeros(str) return str:gsub("%.?0+$","") end + +% \end{macrocode} +% % luamplib's mplibgraphictext operator % \begin{macrocode} local emboldenfonts = { } -local function embolden (head, fakebold) - local curr = head +local function getemboldenwidth (curr, fakebold) + local width = emboldenfonts.width + if not width then + local f + local function getglyph(n) + while n do + if n.head then + getglyph(n.head) + elseif n.font and n.font > 0 then + f = n.font; break + end + n = node.getnext(n) + end + end + getglyph(curr) + width = font.getcopy(f or font.current()).size * fakebold / factor * 10 + emboldenfonts.width = width + end + return width +end +local function getrulewhatsit (line, wd, ht, dp) + line, wd, ht, dp = line/1000, wd/factor, ht/factor, dp/factor + local pl + local fmt = "%f w %f %f %f %f re %s" + if pdfmode then + pl = node.new("whatsit","pdf_literal") + pl.mode = 0 + else + fmt = "pdf:content "..fmt + pl = node.new("whatsit","special") + end + pl.data = fmt:format(line, 0, -dp, wd, ht+dp, "B") :gsub(decimals,rmzeros) + local ss = node.new"glue" + node.setglue(ss, 0, 65536, 65536, 2, 2) + pl.next = ss + return pl +end +local function getrulemetric (box, curr, bp) + local running = -1073741824 + local wd,ht,dp = curr.width, curr.height, curr.depth + wd = wd == running and box.width or wd + ht = ht == running and box.height or ht + dp = dp == running and box.depth or dp + if bp then + return wd/factor, ht/factor, dp/factor + end + return wd, ht, dp +end +local function embolden (box, curr, fakebold) + local head = curr while curr do if curr.head then - embolden(curr.head, fakebold) - elseif curr.leader and curr.leader.head then - embolden(curr.leader.head, fakebold) + curr.head = embolden(curr, curr.head, fakebold) + elseif curr.replace then + curr.replace = embolden(box, curr.replace, fakebold) + elseif curr.leader then + if curr.leader.head then + curr.leader.head = embolden(curr.leader, curr.leader.head, fakebold) + elseif curr.leader.id == node.id"rule" then + local glue = node.effective_glue(curr, box) + local line = getemboldenwidth(curr, fakebold) + local wd,ht,dp = getrulemetric(box, curr.leader) + if box.id == node.id"hlist" then + wd = glue + else + ht, dp = 0, glue + end + local pl = getrulewhatsit(line, wd, ht, dp) + local pack = box.id == node.id"hlist" and node.hpack or node.vpack + local list = pack(pl, glue, "exactly") + head = node.insert_after(head, curr, list) + head, curr = node.remove(head, curr) + end + elseif curr.id == node.id"rule" and curr.subtype == 0 then + local line = getemboldenwidth(curr, fakebold) + local wd,ht,dp = getrulemetric(box, curr) + if box.id == node.id"vlist" then + ht, dp = 0, ht+dp + end + local pl = getrulewhatsit(line, wd, ht, dp) + local list + if box.id == node.id"hlist" then + list = node.hpack(pl, wd, "exactly") + else + list = node.vpack(pl, ht+dp, "exactly") + end + head = node.insert_after(head, curr, list) + head, curr = node.remove(head, curr) elseif curr.id == node.id"glyph" and curr.font > 0 then local f = curr.font - local i = emboldenfonts[f] + local key = format("%s:%s",f,fakebold) + local i = emboldenfonts[key] if not i then + local ft = font.getfont(f) or font.getcopy(f) if pdfmode then - local ft = font.getcopy(f) - ft.mode = 2 - ft.width = ft.size * fakebold / 6578.176 + width = ft.size * fakebold / factor * 10 + emboldenfonts.width = width + ft.mode, ft.width = 2, width i = font.define(ft) else - local ft = font.getfont(f) or font.getcopy(f) if ft.format ~= "opentype" and ft.format ~= "truetype" then goto skip_type1 end local name = ft.name:gsub('"',''):gsub(';$','') - name = format('%s;embolden=%s',name,fakebold) + name = format('%s;embolden=%s;',name,fakebold) _, i = fonts.constructors.readanddefine(name,ft.size) end - emboldenfonts[f] = i + emboldenfonts[key] = i end curr.font = i end ::skip_type1:: curr = node.getnext(curr) end + return head end local function graphictextcolor (col, filldraw) if col:find"^[%d%.:]+$" then col = col:explode":" + for i=1,#col do + col[i] = format("%.3f", col[i]) + end if pdfmode then local op = #col == 4 and "k" or #col == 3 and "rg" or "g" col[#col+1] = filldraw == "fill" and op or op:upper() @@ -1568,7 +2053,9 @@ end luamplib.graphictext = function (text, fakebold, fc, dc) local fmt = process_tex_text(text):sub(1,-2) local id = tonumber(fmt:match"mplibtexboxid=(%d+):") - embolden(texgetbox(id).head, fakebold) + emboldenfonts.width = nil + local box = texgetbox(id) + box.head = embolden(box, box.head, fakebold) local fill = graphictextcolor(fc,"fill") local draw = graphictextcolor(dc,"draw") local bc = pdfmode and "" or "pdf:bc " @@ -1667,7 +2154,7 @@ function luamplib.glyph (f, c) local fontdata = font.getfont(fid) or font.getcopy(fid) filename, subfont, kind = fontdata.filename, fontdata.subfont, fontdata.format instance = fontdata.specification and fontdata.specification.instance - filename = filename:gsub("^harfloaded:","") + filename = filename and filename:gsub("^harfloaded:","") else local name f = f:match"^%s*(.+)%s*$" @@ -1722,7 +2209,7 @@ function luamplib.glyph (f, c) if not gid then return mperr"cannot get GID (glyph id)" end local fac = 1000 / (shapedata.units or 1000) local t = shapedata.glyphs[gid].segments - if not t then return "image(fill fullcircle scaled 0;)" end + if not t then return "image()" end for i,v in ipairs(t) do if type(v) == "table" then for ii,vv in ipairs(v) do @@ -1740,20 +2227,18 @@ end % % mpliboutlinetext : based on mkiv's font-mps.lua % \begin{macrocode} -local rulefmt = "mplibpic[%i]:=image(addto currentpicture contour \z -unitsquare shifted - center unitsquare;) xscaled %f yscaled %f shifted (%f,%f);" +local rulefmt = "mpliboutlinepic[%i]:=image(addto currentpicture contour \z + unitsquare shifted - center unitsquare;) xscaled %f yscaled %f shifted (%f,%f);" local outline_horz, outline_vert function outline_vert (res, box, curr, xshift, yshift) local b2u = box.dir == "LTL" - local dy = (b2u and -(box.depth or 0) or (box.height or 0))/factor + local dy = (b2u and -box.depth or box.height)/factor local ody = dy while curr do if curr.id == node.id"rule" then - local ht, dp = curr.height/factor, curr.depth/factor + local wd, ht, dp = getrulemetric(box, curr, true) local hd = ht + dp if hd ~= 0 then - local wd = curr.width - wd = (wd == -1073741824 and box.width or wd)/factor dy = dy + (b2u and dp or -ht) if wd ~= 0 and curr.subtype == 0 then res[#res+1] = rulefmt:format(#res+1, wd, hd, xshift+wd/2, yshift+dy+(ht-dp)/2) @@ -1762,14 +2247,13 @@ function outline_vert (res, box, curr, xshift, yshift) end elseif curr.id == node.id"glue" then local vwidth = node.effective_glue(curr,box)/factor - dy = dy + (b2u and vwidth or 0) if curr.leader then local curr, kind = curr.leader, curr.subtype if curr.id == node.id"rule" then - local wd = curr.width/factor + local wd = getrulemetric(box, curr, true) if wd ~= 0 then local hd = vwidth - local dy = dy - hd + local dy = dy + (b2u and 0 or -hd) if hd ~= 0 and curr.subtype == 0 then res[#res+1] = rulefmt:format(#res+1, wd, hd, xshift+wd/2, yshift+dy+hd/2) end @@ -1777,8 +2261,7 @@ function outline_vert (res, box, curr, xshift, yshift) elseif curr.head then local hd = (curr.height + curr.depth)/factor if hd <= vwidth then - local dy = b2u and dy-vwidth or dy - local n, iy = 0, 0 + local dy, n, iy = dy, 0, 0 if kind == 100 or kind == 103 then -- todo: gleaders local ady = abs(ody - dy) local ndy = math.ceil(ady / hd) * hd @@ -1806,7 +2289,7 @@ function outline_vert (res, box, curr, xshift, yshift) end end end - dy = dy - (b2u and 0 or vwidth) + dy = dy + (b2u and vwidth or -vwidth) elseif curr.id == node.id"kern" then dy = dy + curr.kern/factor * (b2u and 1 or -1) elseif curr.id == node.id"vlist" then @@ -1822,24 +2305,23 @@ function outline_vert (res, box, curr, xshift, yshift) end return res end -function outline_horz (res, box, curr, xshift, yshift) +function outline_horz (res, box, curr, xshift, yshift, discwd) local r2l = box.dir == "TRT" - local dx = r2l and (box.width or 0)/factor or 0 + local dx = r2l and (discwd or box.width/factor) or 0 local dirs = { { dir = r2l, dx = dx } } - local odx = dx while curr do if curr.id == node.id"dir" then local sign, dir = curr.dir:match"(.)(...)" local level, newdir = curr.level, r2l if sign == "+" then - local n = node.getnext(curr) - while n do - if n.id == node.id"dir" and n.level+1 == level then break end - n = node.getnext(n) - end - n = n or node.tail(curr) newdir = dir == "TRT" if r2l ~= newdir then + local n = node.getnext(curr) + while n do + if n.id == node.id"dir" and n.level+1 == level then break end + n = node.getnext(n) + end + n = n or node.tail(curr) dx = dx + node.rangedimensions(box, curr, n)/factor * (newdir and 1 or -1) end dirs[level] = { dir = r2l, dx = dx } @@ -1864,6 +2346,18 @@ function outline_horz (res, box, curr, xshift, yshift) dx = dx - (r2l and curr.width/factor*expand or 0) local xpos = dx + xshift + (curr.xoffset or 0)/factor local ypos = yshift + (curr.yoffset or 0)/factor + local vertical = ft.shared and ft.shared.features.vertical and "rotated 90" or "" + if vertical ~= "" then -- luatexko + for _,v in ipairs(ft.characters[curr.char].commands or { }) do + if v[1] == "down" then + ypos = ypos - v[2] / factor + elseif v[1] == "right" then + xpos = xpos + v[2] / factor + else + break + end + end + end local image if ft.format == "opentype" or ft.format == "truetype" then image = luamplib.glyph(curr.font, gid) @@ -1883,20 +2377,17 @@ function outline_horz (res, box, curr, xshift, yshift) end image = format("glyph %s of %q scaled %f", gid, name, scale) end - res[#res+1] = format("mplibpic[%i]:=%s xscaled %f yscaled %f slanted %f shifted (%f,%f);", - #res+1, image, xscale, yscale, slant, xpos, ypos) + res[#res+1] = format("mpliboutlinepic[%i]:=%s xscaled %f yscaled %f slanted %f %s shifted (%f,%f);", + #res+1, image, xscale, yscale, slant, vertical, xpos, ypos) dx = dx + (r2l and 0 or curr.width/factor*expand) - elseif curr.id == node.id"disc" then + elseif curr.replace then local width = node.dimensions(curr.replace)/factor dx = dx - (r2l and width or 0) - res = outline_horz(res, curr, curr.replace, xshift+dx, yshift) + res = outline_horz(res, box, curr.replace, xshift+dx, yshift, width) dx = dx + (r2l and 0 or width) elseif curr.id == node.id"rule" then - local wd = curr.width/factor + local wd, ht, dp = getrulemetric(box, curr, true) if wd ~= 0 then - local ht, dp = curr.height, curr.depth - ht = (ht == -1073741824 and box.height or ht)/factor - dp = (dp == -1073741824 and box.depth or dp)/factor local hd = ht + dp dx = dx - (r2l and wd or 0) if hd ~= 0 and curr.subtype == 0 then @@ -1910,10 +2401,10 @@ function outline_horz (res, box, curr, xshift, yshift) if curr.leader then local curr, kind = curr.leader, curr.subtype if curr.id == node.id"rule" then - local ht, dp = curr.height/factor, curr.depth/factor + local wd, ht, dp = getrulemetric(box, curr, true) local hd = ht + dp if hd ~= 0 then - local wd = width + wd = width if wd ~= 0 and curr.subtype == 0 then res[#res+1] = rulefmt:format(#res+1, wd, hd, xshift+dx+wd/2, yshift+(ht-dp)/2) end @@ -1924,7 +2415,7 @@ function outline_horz (res, box, curr, xshift, yshift) local dx = r2l and dx+width or dx local n, ix = 0, 0 if kind == 100 or kind == 103 then -- todo: gleaders - local adx = abs(dx-odx) + local adx = abs(dx-dirs[1].dx) local ndx = math.ceil(adx / wd) * wd local diff = ndx - adx n = (width-diff) // wd @@ -1972,17 +2463,13 @@ function luamplib.outlinetext (text) local id = tonumber(fmt:match"mplibtexboxid=(%d+):") local box = texgetbox(id) local res = outline_horz({ }, box, box.head, 0, 0) - if #res == 0 then res = { "mplibpic[1]:=image(fill fullcircle scaled 0;);" } end - local t = { } - for i=1, #res do - t[#t+1] = format("addto currentpicture also mplibpic[%i];", i) - end - return tableconcat(res) .. format("mplibpic[0]:=image(%s);", tableconcat(t)) + if #res == 0 then res = { "mpliboutlinepic[1]:=image();" } end + return tableconcat(res) .. format("mpliboutlinenum:=%i;", #res) end % \end{macrocode} % -% Our MetaPost preambles +% Our \metapost preambles % \begin{macrocode} luamplib.preambles = { mplibcode = [[ @@ -2085,6 +2572,9 @@ def mplib_do_outline_text_set_f (text f) text r = def mplib_do_outline_options_f = f enddef; def mplib_do_outline_options_r = r enddef; enddef; +def mplib_do_outline_text_set_u (text f) text r = + def mplib_do_outline_options_f = f enddef; +enddef; def mplib_do_outline_text_set_d (text d) text r = def mplib_do_outline_options_d = d enddef; def mplib_do_outline_options_r = r enddef; @@ -2098,27 +2588,40 @@ def mplib_do_outline_text_set_n text r = def mplib_do_outline_options_r = r enddef; enddef; def mplib_do_outline_text_set_p = enddef; -def mplib_fill_outline_text (expr p) = - i:=0; - for item within p: - i:=i+1; - addto currentpicture contour pathpart item - if i < length p: withpostscript "collect"; fi +def mplib_fill_outline_text = + for n=1 upto mpliboutlinenum: + i:=0; + for item within mpliboutlinepic[n]: + i:=i+1; + fill pathpart item mplib_do_outline_options_f withpen pencircle scaled 0 + if (n<mpliboutlinenum) or (i<length mpliboutlinepic[n]): withpostscript "collect"; fi + endfor endfor - mplib_do_outline_options_f; enddef; -def mplib_draw_outline_text (expr p) = - i:=0; - for item within p: - i:=i+1; - addto currentpicture doublepath pathpart item - if i < length p: withpostscript "collect"; fi +def mplib_draw_outline_text = + for n=1 upto mpliboutlinenum: + for item within mpliboutlinepic[n]: + draw pathpart item mplib_do_outline_options_d; + endfor + endfor +enddef; +def mplib_filldraw_outline_text = + for n=1 upto mpliboutlinenum: + i:=0; + for item within mpliboutlinepic[n]: + i:=i+1; + if (n<mpliboutlinenum) or (i<length mpliboutlinepic[n]): + fill pathpart item mplib_do_outline_options_f withpostscript "collect"; + else: + draw pathpart item mplib_do_outline_options_f withpostscript "both"; + fi + endfor endfor - mplib_do_outline_options_d; enddef; vardef mpliboutlinetext@# (expr t) text rest = save kind; string kind; kind := str @#; - save mplibpic, i; picture mplibpic[]; numeric i; + save i; numeric i; + picture mpliboutlinepic[]; numeric mpliboutlinenum; def mplib_do_outline_options_d = enddef; def mplib_do_outline_options_f = enddef; def mplib_do_outline_options_r = enddef; @@ -2126,31 +2629,120 @@ vardef mpliboutlinetext@# (expr t) text rest = image ( addto currentpicture also image ( if kind = "f": mplib_do_outline_text_set_f rest; - def mplib_do_outline_options_d = withpen pencircle scaled 0 enddef; - mplib_fill_outline_text (mplibpic0); + mplib_fill_outline_text; elseif kind = "d": mplib_do_outline_text_set_d rest; - mplib_draw_outline_text (mplibpic0); + mplib_draw_outline_text; elseif kind = "b": mplib_do_outline_text_set_b rest; - mplib_fill_outline_text (mplibpic0); - mplib_draw_outline_text (mplibpic0); + mplib_fill_outline_text; + mplib_draw_outline_text; elseif kind = "u": - mplib_do_outline_text_set_f rest; - mplib_fill_outline_text (mplibpic0); + mplib_do_outline_text_set_u rest; + mplib_filldraw_outline_text; elseif kind = "r": mplib_do_outline_text_set_r rest; - mplib_draw_outline_text (mplibpic0); - mplib_fill_outline_text (mplibpic0); + mplib_draw_outline_text; + mplib_fill_outline_text; elseif kind = "p": mplib_do_outline_text_set_p; - mplib_draw_outline_text (mplibpic0); + mplib_draw_outline_text; else: mplib_do_outline_text_set_n rest; - mplib_fill_outline_text (mplibpic0); + mplib_fill_outline_text; fi; ) mplib_do_outline_options_r; ) enddef ; +primarydef t withpattern p = + image( + if cycle t: + fill + else: + draw + fi + t withprescript "mplibpattern=" & if numeric p: decimal fi p; ) +enddef; +vardef mplibtransformmatrix (text e) = + save t; transform t; + t = identity e; + runscript("luamplib.transformmatrix = {" + & decimal xxpart t & "," + & decimal yxpart t & "," + & decimal xypart t & "," + & decimal yypart t & "," + & decimal xpart t & "," + & decimal ypart t & "," + & "}"); +enddef; +primarydef p withfademethod s = + if picture p: + image( + draw p; + draw center p withprescript "mplibfadestate=stop"; + ) + else: + p withprescript "mplibfadestate=stop" + fi + withprescript "mplibfadetype=" & s + withprescript "mplibfadebbox=" & + decimal (xpart llcorner p -1/4) & ":" & + decimal (ypart llcorner p -1/4) & ":" & + decimal (xpart urcorner p +1/4) & ":" & + decimal (ypart urcorner p +1/4) +enddef; +def withfadeopacity (expr a,b) = + withprescript "mplibfadeopacity=" & + decimal a & ":" & + decimal b +enddef; +def withfadevector (expr a,b) = + withprescript "mplibfadevector=" & + decimal xpart a & ":" & + decimal ypart a & ":" & + decimal xpart b & ":" & + decimal ypart b +enddef; +let withfadecenter = withfadevector; +def withfaderadius (expr a,b) = + withprescript "mplibfaderadius=" & + decimal a & ":" & + decimal b +enddef; +def withfadebbox (expr a,b) = + withprescript "mplibfadebbox=" & + decimal xpart a & ":" & + decimal ypart a & ":" & + decimal xpart b & ":" & + decimal ypart b +enddef; +primarydef p asgroup s = + image( + draw center p + withprescript "mplibgroupbbox=" & + decimal (xpart llcorner p -1/4) & ":" & + decimal (ypart llcorner p -1/4) & ":" & + decimal (xpart urcorner p +1/4) & ":" & + decimal (ypart urcorner p +1/4) + withprescript "gr_state=start" + withprescript "gr_type=" & s; + draw p; + draw center p withprescript "gr_state=stop"; + ) +enddef; +def withgroupbbox (expr a,b) = + withprescript "mplibgroupbbox=" & + decimal xpart a & ":" & + decimal ypart a & ":" & + decimal xpart b & ":" & + decimal ypart b +enddef; +def withgroupname expr s = + withprescript "mplibgroupname=" & s +enddef; +def usemplibgroup primary s = + draw maketext("\usemplibgroup{" & s & "}") + shifted runscript("return luamplib.trgroupshifts['" & s & "']") +enddef; ]], legacyverbatimtex = [[ def specialVerbatimTeX (text t) = runscript("luamplibprefig{"&t&"}") enddef; @@ -2180,7 +2772,6 @@ enddef; % When \cs{mplibverbatim} is enabled, do not expand |mplibcode| data. % \begin{macrocode} luamplib.verbatiminput = false - % \end{macrocode} % % Do not expand |btex ... etex|, |verbatimtex ... etex|, and @@ -2196,7 +2787,6 @@ local function protect_expansion (str) return format("\\unexpanded{%s}",str) end end - local function unprotect_expansion (str) if str then return str:gsub("!!!Control!!!", "\\") @@ -2206,26 +2796,20 @@ local function unprotect_expansion (str) :gsub("!!!RBrace!!!", "}") end end - luamplib.everymplib = setmetatable({ [""] = "" },{ __index = function(t) return t[""] end }) luamplib.everyendmplib = setmetatable({ [""] = "" },{ __index = function(t) return t[""] end }) - function luamplib.process_mplibcode (data, instancename) texboxes.localid = 4096 - % \end{macrocode} -% % This is needed for legacy behavior % \begin{macrocode} - if luamplib.legacy_verbatimtex then + if luamplib.legacyverbatimtex then luamplib.figid, tex_code_pre_mplib = 1, {} end - local everymplib = luamplib.everymplib[instancename] local everyendmplib = luamplib.everyendmplib[instancename] data = format("\n%s\n%s\n%s\n",everymplib, data, everyendmplib) :gsub("\r","\n") - % \end{macrocode} % These five lines are needed for |mplibverbatim| mode. % \begin{macrocode} @@ -2236,7 +2820,6 @@ function luamplib.process_mplibcode (data, instancename) :gsub(btex_etex, "btex %1 etex ") :gsub(verbatimtex_etex, "verbatimtex %1 etex;") % \end{macrocode} -% % If not |mplibverbatim|, expand |mplibcode| data, % so that users can use \TeX\ codes in it. % It has turned out that no comment sign is allowed. @@ -2255,7 +2838,6 @@ function luamplib.process_mplibcode (data, instancename) run_tex_code(format("\\mplibtmptoks\\expandafter{\\expanded{%s}}",data)) data = texgettoks"mplibtmptoks" % \end{macrocode} -% % Next line to address issue \#55 % \begin{macrocode} :gsub("##", "#") @@ -2267,7 +2849,6 @@ function luamplib.process_mplibcode (data, instancename) return format("verbatimtex %s etex", unprotect_expansion(str)) end) end - process(data, instancename) end @@ -2275,21 +2856,12 @@ end % % For parsing |prescript| materials. % \begin{macrocode} -local further_split_keys = { - mplibtexboxid = true, - sh_color_a = true, - sh_color_b = true, -} local function script2table(s) local t = {} for _,i in ipairs(s:explode("\13+")) do local k,v = i:match("(.-)=(.*)") -- v may contain = or empty. if k and v and k ~= "" and not t[k] then - if further_split_keys[k] or further_split_keys[k:sub(1,10)] then - t[k] = v:explode(":") - else - t[k] = v - end + t[k] = v end end return t @@ -2297,144 +2869,34 @@ end % \end{macrocode} % -% Codes below for inserting PDF lieterals are mostly from ConTeXt general, -% with small changes when needed. +% pdfliterals will be stored in |figcontents| table, and written to pdf in one go +% at the end of the flushing figure. +% Subtable |post| is for the legacy behavior. % \begin{macrocode} -local function getobjects(result,figure,f) - return figure:objects() -end - -function luamplib.convert (result, flusher) - luamplib.flush(result, flusher) - return true -- done -end - local figcontents = { post = { } } local function put2output(a,...) figcontents[#figcontents+1] = type(a) == "string" and format(a,...) or a end - local function pdf_startfigure(n,llx,lly,urx,ury) put2output("\\mplibstarttoPDF{%f}{%f}{%f}{%f}",llx,lly,urx,ury) end - local function pdf_stopfigure() put2output("\\mplibstoptoPDF") end - % \end{macrocode} % % |tex.sprint| with catcode regime -2, as sometimes |#| gets doubled % in the argument of pdfliteral. % \begin{macrocode} -local function pdf_literalcode (fmt,...) - put2output{-2, format(fmt,...)} -end - -local function pdf_textfigure(font,size,text,width,height,depth) - text = text:gsub(".",function(c) - return format("\\hbox{\\char%i}",string.byte(c)) -- kerning happens in metapost : false - end) - put2output("\\mplibtextext{%s}{%f}{%s}{%s}{%s}",font,size,text,0,0) -end - -local bend_tolerance = 131/65536 - -local rx, sx, sy, ry, tx, ty, divider = 1, 0, 0, 1, 0, 0, 1 - -local function pen_characteristics(object) - local t = mplib.pen_info(object) - rx, ry, sx, sy, tx, ty = t.rx, t.ry, t.sx, t.sy, t.tx, t.ty - divider = sx*sy - rx*ry - return not (sx==1 and rx==0 and ry==0 and sy==1 and tx==0 and ty==0), t.width -end - -local function concat(px, py) -- no tx, ty here - return (sy*px-ry*py)/divider,(sx*py-rx*px)/divider -end - -local function curved(ith,pth) - local d = pth.left_x - ith.right_x - if abs(ith.right_x - ith.x_coord - d) <= bend_tolerance and abs(pth.x_coord - pth.left_x - d) <= bend_tolerance then - d = pth.left_y - ith.right_y - if abs(ith.right_y - ith.y_coord - d) <= bend_tolerance and abs(pth.y_coord - pth.left_y - d) <= bend_tolerance then - return false - end - end - return true -end - -local function flushnormalpath(path,open) - local pth, ith - for i=1,#path do - pth = path[i] - if not ith then - pdf_literalcode("%f %f m",pth.x_coord,pth.y_coord) - elseif curved(ith,pth) then - pdf_literalcode("%f %f %f %f %f %f c",ith.right_x,ith.right_y,pth.left_x,pth.left_y,pth.x_coord,pth.y_coord) - else - pdf_literalcode("%f %f l",pth.x_coord,pth.y_coord) - end - ith = pth - end - if not open then - local one = path[1] - if curved(pth,one) then - pdf_literalcode("%f %f %f %f %f %f c",pth.right_x,pth.right_y,one.left_x,one.left_y,one.x_coord,one.y_coord ) - else - pdf_literalcode("%f %f l",one.x_coord,one.y_coord) - end - elseif #path == 1 then -- special case .. draw point - local one = path[1] - pdf_literalcode("%f %f l",one.x_coord,one.y_coord) - end -end - -local function flushconcatpath(path,open) - pdf_literalcode("%f %f %f %f %f %f cm", sx, rx, ry, sy, tx ,ty) - local pth, ith - for i=1,#path do - pth = path[i] - if not ith then - pdf_literalcode("%f %f m",concat(pth.x_coord,pth.y_coord)) - elseif curved(ith,pth) then - local a, b = concat(ith.right_x,ith.right_y) - local c, d = concat(pth.left_x,pth.left_y) - pdf_literalcode("%f %f %f %f %f %f c",a,b,c,d,concat(pth.x_coord, pth.y_coord)) - else - pdf_literalcode("%f %f l",concat(pth.x_coord, pth.y_coord)) - end - ith = pth - end - if not open then - local one = path[1] - if curved(pth,one) then - local a, b = concat(pth.right_x,pth.right_y) - local c, d = concat(one.left_x,one.left_y) - pdf_literalcode("%f %f %f %f %f %f c",a,b,c,d,concat(one.x_coord, one.y_coord)) - else - pdf_literalcode("%f %f l",concat(one.x_coord,one.y_coord)) - end - elseif #path == 1 then -- special case .. draw point - local one = path[1] - pdf_literalcode("%f %f l",concat(one.x_coord,one.y_coord)) - end -end - -local function start_pdf_code() - if pdfmode then - pdf_literalcode("q") - else - put2output"\\special{pdf:bcontent}" - end -end -local function stop_pdf_code() - if pdfmode then - pdf_literalcode("Q") - else - put2output"\\special{pdf:econtent}" - end +local function pdf_literalcode (...) + put2output{ -2, format(...) :gsub(decimals,rmzeros) } end +local start_pdf_code = pdfmode + and function() pdf_literalcode"q" end + or function() put2output"\\special{pdf:bcontent}" end +local stop_pdf_code = pdfmode + and function() pdf_literalcode"Q" end + or function() put2output"\\special{pdf:econtent}" end % \end{macrocode} % @@ -2442,7 +2904,7 @@ end % |textext(...)| or |TEX(...)|, all being the same internally. % \begin{macrocode} local function put_tex_boxes (object,prescript) - local box = prescript.mplibtexboxid + local box = prescript.mplibtexboxid:explode":" local n,tw,th = box[1],tonumber(box[2]),tonumber(box[3]) if n and tw and th then local op = object.path @@ -2472,6 +2934,7 @@ end % \begin{macrocode} local prev_override_color local function do_preobj_CR(object,prescript) + if object.postscript == "collect" then return end local override = prescript and prescript.mpliboverridecolor if override then if pdfmode then @@ -2503,32 +2966,44 @@ end local pdfmanagement = is_defined'pdfmanagement_add:nnn' local pdfobjs, pdfetcs = {}, {} pdfetcs.pgfextgs = "pgf@sys@addpdfresource@extgs@plain" - -local function update_pdfobjs (os) - local on = pdfobjs[os] +pdfetcs.pgfpattern = "pgf@sys@addpdfresource@patterns@plain" +pdfetcs.pgfcolorspace = "pgf@sys@addpdfresource@colorspaces@plain" +local function update_pdfobjs (os, stream) + local key = os + if stream then key = key..stream end + local on = pdfobjs[key] if on then return on,false end if pdfmode then - on = pdf.immediateobj(os) + if stream then + on = pdf.immediateobj("stream",stream,os) + else + on = pdf.immediateobj(os) + end else on = pdfetcs.cnt or 1 - texsprint(format("\\special{pdf:obj @mplibpdfobj%s %s}",on,os)) + if stream then + texsprint(format("\\special{pdf:stream @mplibpdfobj%s (%s) <<%s>>}",on,stream,os)) + else + texsprint(format("\\special{pdf:obj @mplibpdfobj%s %s}",on,os)) + end pdfetcs.cnt = on + 1 end - pdfobjs[os] = on + pdfobjs[key] = on return on,true end - +pdfetcs.resfmt = pdfmode and "%s 0 R" or "@mplibpdfobj%s" if pdfmode then pdfetcs.getpageres = pdf.getpageresources or function() return pdf.pageresources end - pdfetcs.setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end - pdfetcs.initialize_resources = function (name) + local getpageres = pdfetcs.getpageres + local setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end + local initialize_resources = function (name) local tabname = format("%s_res",name) pdfetcs[tabname] = { } if luatexbase.callbacktypes.finish_pdffile then -- ltluatex local obj = pdf.reserveobj() - pdfetcs.setpageres(format("%s/%s %i 0 R", pdfetcs.getpageres() or "", name, obj)) + setpageres(format("%s/%s %i 0 R", getpageres() or "", name, obj)) luatexbase.add_to_callback("finish_pdffile", function() pdf.immediateobj(obj, format("<<%s>>", tableconcat(pdfetcs[tabname]))) end, @@ -2536,20 +3011,38 @@ if pdfmode then end end pdfetcs.fallback_update_resources = function (name, res) + local tabname = format("%s_res",name) + if not pdfetcs[tabname] then + initialize_resources(name) + end if luatexbase.callbacktypes.finish_pdffile then - local t = pdfetcs[format("%s_res",name)] + local t = pdfetcs[tabname] t[#t+1] = res else - local tpr, n = pdfetcs.getpageres() or "", 0 + local tpr, n = getpageres() or "", 0 tpr, n = tpr:gsub(format("/%s<<",name), "%1"..res) if n == 0 then tpr = format("%s/%s<<%s>>", tpr, name, res) end - pdfetcs.setpageres(tpr) + setpageres(tpr) end end else - texsprint("\\special{pdf:obj @MPlibTr<<>>}","\\special{pdf:obj @MPlibSh<<>>}") + texsprint { + "\\luamplibatfirstshipout{", + "\\special{pdf:obj @MPlibTr<<>>}", + "\\special{pdf:obj @MPlibSh<<>>}", + "\\special{pdf:obj @MPlibCS<<>>}", + "\\special{pdf:obj @MPlibPt<<>>}}", + } + pdfetcs.resadded = { } + pdfetcs.fallback_update_resources = function (name,res,obj) + texsprint{"\\special{pdf:put ", obj, " <<", res, ">>}"} + if not pdfetcs.resadded[name] then + texsprint{"\\luamplibateveryshipout{\\special{pdf:put @resources <</", name, " ", obj, ">>}}"} + pdfetcs.resadded[name] = obj + end + end end % \end{macrocode} @@ -2563,28 +3056,19 @@ local transparancy_modes = { [0] = "Normal", "Hue", "Saturation", "Color", "Luminosity", "Compatible", } - -local function update_tr_res(mode,opaq) - if pdfetcs.pgfloaded == nil then - pdfetcs.pgfloaded = is_defined(pdfetcs.pgfextgs) - if pdfmode and not pdfmanagement and not pdfetcs.pgfloaded and not is_defined"TRP@list" then - pdfetcs.initialize_resources"ExtGState" - end - end - local os = format("<</BM /%s/ca %.3f/CA %.3f/AIS false>>",mode,opaq,opaq) - local on, new = update_pdfobjs(os) - if not new then return on end +local function add_extgs_resources (on, new) local key = format("MPlibTr%s", on) - local val = format(pdfmode and "%s 0 R" or "@mplibpdfobj%s", on) - if pdfmanagement then - texsprint(ccexplat, - format("\\pdfmanagement_add:nnn{Page/Resources/ExtGState}{%s}{%s}", key, val)) - else - local tr = format("/%s %s", key, val) - if pdfetcs.pgfloaded then - texsprint(format("\\csname %s\\endcsname{%s}", pdfetcs.pgfextgs,tr)) - elseif pdfmode then - if is_defined"TRP@list" then + if new then + local val = format(pdfetcs.resfmt, on) + if pdfmanagement then + texsprint { + "\\csname pdfmanagement_add:nnn\\endcsname{Page/Resources/ExtGState}{", key, "}{", val, "}" + } + else + local tr = format("/%s %s", key, val) + if is_defined(pdfetcs.pgfextgs) then + texsprint { "\\csname ", pdfetcs.pgfextgs, "\\endcsname{", tr, "}" } + elseif is_defined"TRP@list" then texsprint(catat11,{ [[\if@filesw\immediate\write\@auxout{]], [[\string\g@addto@macro\string\TRP@list{]], @@ -2595,86 +3079,91 @@ local function update_tr_res(mode,opaq) texsprint(catat11,[[\global\TRP@reruntrue]]) end else - pdfetcs.fallback_update_resources("ExtGState", tr) + pdfetcs.fallback_update_resources("ExtGState",tr,"@MPlibTr") end - else - texsprint(format("\\special{pdf:put @MPlibTr<<%s>>}",tr)) - texsprint"\\special{pdf:put @resources<</ExtGState @MPlibTr>>}" end end - return on + return key end - -local function do_preobj_TR(prescript) +local function do_preobj_TR(object,prescript) + if object.postscript == "collect" then return end local opaq = prescript and prescript.tr_transparency - local tron_no if opaq then + local key, on, os, new local mode = prescript.tr_alternative or 1 - mode = transparancy_modes[tonumber(mode)] - tron_no = update_tr_res(mode, opaq) - start_pdf_code() - pdf_literalcode("/MPlibTr%i gs",tron_no) + mode = transparancy_modes[tonumber(mode)] or mode + opaq = format("%.3f", opaq) :gsub(decimals,rmzeros) + for i,v in ipairs{ {mode,opaq},{"Normal",1} } do + os = format("<</BM/%s/ca %s/CA %s/AIS false>>",v[1],v[2],v[2]) + on, new = update_pdfobjs(os) + key = add_extgs_resources(on,new) + if i == 1 then + pdf_literalcode("/%s gs",key) + else + return format("/%s gs",key) + end + end end - return tron_no end % \end{macrocode} % -% Shading with |metafun| format. +% Shading with \emph{metafun} format. % \begin{macrocode} local function sh_pdfpageresources(shtype,domain,colorspace,ca,cb,coordinates,steps,fractions) - if pdfmode and not pdfmanagement and not pdfetcs.Shading_res then - pdfetcs.initialize_resources"Shading" + for _,v in ipairs{ca,cb} do + for i,vv in ipairs(v) do + for ii,vvv in ipairs(vv) do + v[i][ii] = tonumber(vvv) and format("%.3f",vvv) or vvv + end + end end - local fun2fmt,os = "<</FunctionType 2/Domain [%s]/C0 [%s]/C1 [%s]/N 1>>" + local fun2fmt,os = "<</FunctionType 2/Domain[%s]/C0[%s]/C1[%s]/N 1>>" if steps > 1 then local list,bounds,encode = { },{ },{ } for i=1,steps do if i < steps then - bounds[i] = fractions[i] or 1 + bounds[i] = format("%.3f", fractions[i] or 1) end encode[2*i-1] = 0 encode[2*i] = 1 os = fun2fmt:format(domain,tableconcat(ca[i],' '),tableconcat(cb[i],' ')) - list[i] = format(pdfmode and "%s 0 R" or "@mplibpdfobj%s",update_pdfobjs(os)) + :gsub(decimals,rmzeros) + list[i] = format(pdfetcs.resfmt, update_pdfobjs(os)) end os = tableconcat { "<</FunctionType 3", - format("/Bounds [%s]", tableconcat(bounds,' ')), - format("/Encode [%s]", tableconcat(encode,' ')), - format("/Functions [%s]", tableconcat(list, ' ')), - format("/Domain [%s]>>", domain), - } + format("/Bounds[%s]", tableconcat(bounds,' ')), + format("/Encode[%s]", tableconcat(encode,' ')), + format("/Functions[%s]", tableconcat(list, ' ')), + format("/Domain[%s]>>", domain), + } :gsub(decimals,rmzeros) else os = fun2fmt:format(domain,tableconcat(ca[1],' '),tableconcat(cb[1],' ')) + :gsub(decimals,rmzeros) end - local objref = format(pdfmode and "%s 0 R" or "@mplibpdfobj%s",update_pdfobjs(os)) + local objref = format(pdfetcs.resfmt, update_pdfobjs(os)) os = tableconcat { format("<</ShadingType %i", shtype), format("/ColorSpace %s", colorspace), format("/Function %s", objref), - format("/Coords [%s]", coordinates), - "/Extend [true true]/AntiAlias true>>", - } + format("/Coords[%s]", coordinates), + "/Extend[true true]/AntiAlias true>>", + } :gsub(decimals,rmzeros) local on, new = update_pdfobjs(os) - if not new then return on end - local key = format("MPlibSh%s", on) - local val = format(pdfmode and "%s 0 R" or "@mplibpdfobj%s", on) - if pdfmanagement then - texsprint(ccexplat, - format("\\pdfmanagement_add:nnn{Page/Resources/Shading}{%s}{%s}", key, val)) - else - local res = format("/%s %s", key, val) - if pdfmode then - pdfetcs.fallback_update_resources("Shading", res) + if new then + local key, val = format("MPlibSh%s", on), format(pdfetcs.resfmt, on) + if pdfmanagement then + texsprint { + "\\csname pdfmanagement_add:nnn\\endcsname{Page/Resources/Shading}{", key, "}{", val, "}" + } else - texsprint(format("\\special{pdf:put @MPlibSh<<%s>>}", res)) - texsprint"\\special{pdf:put @resources<</Shading @MPlibSh>>}" + local res = format("/%s %s", key, val) + pdfetcs.fallback_update_resources("Shading",res,"@MPlibSh") end end return on end - local function color_normalize(ca,cb) if #cb == 1 then if #ca == 4 then @@ -2686,7 +3175,6 @@ local function color_normalize(ca,cb) cb[1], cb[2], cb[3], cb[4] = 1-cb[1], 1-cb[2], 1-cb[3], 0 end end - pdfetcs.clrspcs = setmetatable({ }, { __index = function(t,names) run_tex_code({ [[\color_model_new:nnn]], @@ -2698,20 +3186,21 @@ pdfetcs.clrspcs = setmetatable({ }, { __index = function(t,names) t[names] = colorspace return colorspace end }) - local function do_preobj_SH(object,prescript) local shade_no local sh_type = prescript and prescript.sh_type - if sh_type then + if not sh_type then + return + else local domain = prescript.sh_domain or "0 1" - local centera = prescript.sh_center_a or "0 0"; centera = centera:explode() - local centerb = prescript.sh_center_b or "0 0"; centerb = centerb:explode() + local centera = (prescript.sh_center_a or "0 0"):explode() + local centerb = (prescript.sh_center_b or "0 0"):explode() local transform = prescript.sh_transform == "yes" local sx,sy,sr,dx,dy = 1,1,1,0,0 if transform then - local first = prescript.sh_first or "0 0"; first = first:explode() - local setx = prescript.sh_set_x or "0 0"; setx = setx:explode() - local sety = prescript.sh_set_y or "0 0"; sety = sety:explode() + local first = (prescript.sh_first or "0 0"):explode() + local setx = (prescript.sh_set_x or "0 0"):explode() + local sety = (prescript.sh_set_y or "0 0"):explode() local x,y = tonumber(setx[1]) or 0, tonumber(sety[1]) or 0 if x ~= 0 and y ~= 0 then local path = object.path @@ -2733,15 +3222,15 @@ local function do_preobj_SH(object,prescript) end end local ca, cb, colorspace, steps, fractions - ca = { prescript.sh_color_a_1 or prescript.sh_color_a or {0} } - cb = { prescript.sh_color_b_1 or prescript.sh_color_b or {1} } + ca = { (prescript.sh_color_a_1 or prescript.sh_color_a or "0"):explode":" } + cb = { (prescript.sh_color_b_1 or prescript.sh_color_b or "1"):explode":" } steps = tonumber(prescript.sh_step) or 1 if steps > 1 then fractions = { prescript.sh_fraction_1 or 0 } for i=2,steps do fractions[i] = prescript[format("sh_fraction_%i",i)] or (i/steps) - ca[i] = prescript[format("sh_color_a_%i",i)] or {0} - cb[i] = prescript[format("sh_color_b_%i",i)] or {1} + ca[i] = (prescript[format("sh_color_a_%i",i)] or "0"):explode":" + cb[i] = (prescript[format("sh_color_b_%i",i)] or "1"):explode":" end end if prescript.mplib_spotcolor then @@ -2750,15 +3239,14 @@ local function do_preobj_SH(object,prescript) local script = object.prescript:explode"\13+" for i=#script,1,-1 do if script[i]:find"mplib_spotcolor" then - local name, value - objref, name = script[i]:match"=(.-):(.+)" - value = script[i+1]:match"=(.+)" + local t, name, value = script[i]:explode"="[2]:explode":" + value, objref, name = t[1], t[2], t[3] if not names[name] then pos = pos+1 names[name] = pos names[#names+1] = name end - local t = { } + t = { } for j=1,names[name] do t[#t+1] = 0 end t[#t+1] = value tableinsert(#ca == #cb and ca or cb, t) @@ -2809,13 +3297,508 @@ local function do_preobj_SH(object,prescript) else err"unknown shading type" end - pdf_literalcode("q /Pattern cs") end return shade_no end % \end{macrocode} % +% Patterns +% \begin{macrocode} +pdfetcs.patterns = { } +local function gather_resources (optres) + local t, do_pattern = { }, not optres + local names = {"ExtGState","ColorSpace","Shading"} + if do_pattern then + names[#names+1] = "Pattern" + end + if pdfmode then + if pdfmanagement then + for _,v in ipairs(names) do + local pp = get_macro(format("g__pdfdict_/g__pdf_Core/Page/Resources/%s_prop",v)) + if pp and pp:find"__prop_pair" then + t[#t+1] = format("/%s %s 0 R", v, ltx.pdf.object_id("__pdf/Page/Resources/"..v)) + end + end + else + local res = pdfetcs.getpageres() or "" + run_tex_code[[\mplibtmptoks\expandafter{\the\pdfvariable pageresources}]] + res = res .. texgettoks'mplibtmptoks' + if do_pattern then return res end + res = res:explode"/+" + for _,v in ipairs(res) do + v = v:match"^%s*(.-)%s*$" + if not v:find"Pattern" and not optres:find(v) then + t[#t+1] = "/" .. v + end + end + end + else + if pdfmanagement then + for _,v in ipairs(names) do + local pp = get_macro(format("g__pdfdict_/g__pdf_Core/Page/Resources/%s_prop",v)) + if pp and pp:find"__prop_pair" then + run_tex_code { + "\\mplibtmptoks\\expanded{{", + format("/%s \\csname pdf_object_ref:n\\endcsname{__pdf/Page/Resources/%s}",v,v), + "}}", + } + t[#t+1] = texgettoks'mplibtmptoks' + end + end + elseif is_defined(pdfetcs.pgfextgs) then + run_tex_code ({ + "\\mplibtmptoks\\expanded{{", + "\\ifpgf@sys@pdf@extgs@exists /ExtGState @pgfextgs\\fi", + "\\ifpgf@sys@pdf@colorspaces@exists /ColorSpace @pgfcolorspaces\\fi", + do_pattern and "\\ifpgf@sys@pdf@patterns@exists /Pattern @pgfpatterns \\fi" or "", + "}}", + }, catat11) + t[#t+1] = texgettoks'mplibtmptoks' + else + for _,v in ipairs(names) do + local vv = pdfetcs.resadded[v] + if vv then + t[#t+1] = format("/%s %s", v, vv) + end + end + end + end + return tableconcat(t) +end +function luamplib.registerpattern ( boxid, name, opts ) + local box = texgetbox(boxid) + local wd = format("%.3f",box.width/factor) + local hd = format("%.3f",(box.height+box.depth)/factor) + info("w/h/d of pattern '%s': %s 0", name, format("%s %s",wd, hd):gsub(decimals,rmzeros)) + if opts.xstep == 0 then opts.xstep = nil end + if opts.ystep == 0 then opts.ystep = nil end + if opts.colored == nil then + opts.colored = opts.coloured + if opts.colored == nil then + opts.colored = true + end + end + if type(opts.matrix) == "table" then opts.matrix = tableconcat(opts.matrix," ") end + if type(opts.bbox) == "table" then opts.bbox = tableconcat(opts.bbox," ") end + if opts.matrix and opts.matrix:find"%a" then + local data = format("mplibtransformmatrix(%s);",opts.matrix) + process(data,"@mplibtransformmatrix") + local t = luamplib.transformmatrix + opts.matrix = format("%f %f %f %f", t[1], t[2], t[3], t[4]) + opts.xshift = opts.xshift or format("%f",t[5]) + opts.yshift = opts.yshift or format("%f",t[6]) + end + local attr = { + "/Type/Pattern", + "/PatternType 1", + format("/PaintType %i", opts.colored and 1 or 2), + "/TilingType 2", + format("/XStep %s", opts.xstep or wd), + format("/YStep %s", opts.ystep or hd), + format("/Matrix[%s %s %s]", opts.matrix or "1 0 0 1", opts.xshift or 0, opts.yshift or 0), + } + local optres = opts.resources or "" + optres = optres .. gather_resources(optres) + local patterns = pdfetcs.patterns + if pdfmode then + if opts.bbox then + attr[#attr+1] = format("/BBox[%s]", opts.bbox) + end + attr = tableconcat(attr) :gsub(decimals,rmzeros) + local index = tex.saveboxresource(boxid, attr, optres, true, opts.bbox and 4 or 1) + patterns[name] = { id = index, colored = opts.colored } + else + local cnt = #patterns + 1 + local objname = "@mplibpattern" .. cnt + local metric = format("bbox %s", opts.bbox or format("0 0 %s %s",wd,hd)) + texsprint { + "\\expandafter\\newbox\\csname luamplib.patternbox.", cnt, "\\endcsname", + "\\global\\setbox\\csname luamplib.patternbox.", cnt, "\\endcsname", + "\\hbox{\\unhbox ", boxid, "}\\luamplibatnextshipout{", + "\\special{pdf:bcontent}", + "\\special{pdf:bxobj ", objname, " ", metric, "}", + "\\raise\\dp\\csname luamplib.patternbox.", cnt, "\\endcsname", + "\\box\\csname luamplib.patternbox.", cnt, "\\endcsname", + "\\special{pdf:put @resources <<", optres, ">>}", + "\\special{pdf:exobj <<", tableconcat(attr), ">>}", + "\\special{pdf:econtent}}", + } + patterns[cnt] = objname + patterns[name] = { id = cnt, colored = opts.colored } + end +end +local function pattern_colorspace (cs) + local on, new = update_pdfobjs(format("[/Pattern %s]", cs)) + if new then + local key, val = format("MPlibCS%i",on), format(pdfetcs.resfmt,on) + if pdfmanagement then + texsprint { + "\\csname pdfmanagement_add:nnn\\endcsname{Page/Resources/ColorSpace}{", key, "}{", val, "}" + } + else + local res = format("/%s %s", key, val) + if is_defined(pdfetcs.pgfcolorspace) then + texsprint { "\\csname ", pdfetcs.pgfcolorspace, "\\endcsname{", res, "}" } + else + pdfetcs.fallback_update_resources("ColorSpace",res,"@MPlibCS") + end + end + end + return on +end +local function do_preobj_PAT(object, prescript) + local name = prescript and prescript.mplibpattern + if not name then return end + local patterns = pdfetcs.patterns + local patt = patterns[name] + local index = patt and patt.id or err("cannot get pattern object '%s'", name) + local key = format("MPlibPt%s",index) + if patt.colored then + pdf_literalcode("/Pattern cs /%s scn", key) + else + local color = prescript.mpliboverridecolor + if not color then + local t = object.color + color = t and #t>0 and luamplib.colorconverter(t) + end + if not color then return end + local cs + if color:find" cs " or color:find"@pdf.obj" then + local t = color:explode() + if pdfmode then + cs = format("%s 0 R", ltx.pdf.object_id( t[1]:sub(2,-1) )) + color = t[3] + else + cs = t[2] + color = t[3]:match"%[(.+)%]" + end + else + local t = colorsplit(color) + cs = #t == 4 and "/DeviceCMYK" or #t == 3 and "/DeviceRGB" or "/DeviceGray" + color = tableconcat(t," ") + end + pdf_literalcode("/MPlibCS%i cs %s /%s scn", pattern_colorspace(cs), color, key) + end + if not patt.done then + local val = pdfmode and format("%s 0 R",index) or patterns[index] + if pdfmanagement then + texsprint { + "\\csname pdfmanagement_add:nnn\\endcsname{Page/Resources/Pattern}{", key, "}{", val, "}" + } + else + local res = format("/%s %s", key, val) + if is_defined(pdfetcs.pgfpattern) then + texsprint { "\\csname ", pdfetcs.pgfpattern, "\\endcsname{", res, "}" } + else + pdfetcs.fallback_update_resources("Pattern",res,"@MPlibPt") + end + end + end + patt.done = true +end + +% \end{macrocode} +% +% Fading +% \begin{macrocode} +pdfetcs.fading = { } +local function do_preobj_FADE (object, prescript) + local fd_type = prescript and prescript.mplibfadetype + local fd_stop = prescript and prescript.mplibfadestate + if not fd_type then + return fd_stop -- returns "stop" (if picture) or nil + end + local bbox = prescript.mplibfadebbox:explode":" + local dx, dy = -bbox[1], -bbox[2] + local vec = prescript.mplibfadevector; vec = vec and vec:explode":" + if not vec then + if fd_type == "linear" then + vec = {bbox[1], bbox[2], bbox[3], bbox[2]} -- left to right + else + local centerx, centery = (bbox[1]+bbox[3])/2, (bbox[2]+bbox[4])/2 + vec = {centerx, centery, centerx, centery} -- center for both circles + end + end + local coords = { vec[1]+dx, vec[2]+dy, vec[3]+dx, vec[4]+dy } + if fd_type == "linear" then + coords = format("%f %f %f %f", tableunpack(coords)) + elseif fd_type == "circular" then + local width, height = bbox[3]-bbox[1], bbox[4]-bbox[2] + local radius = (prescript.mplibfaderadius or "0:"..math.sqrt(width^2+height^2)/2):explode":" + tableinsert(coords, 3, radius[1]) + tableinsert(coords, radius[2]) + coords = format("%f %f %f %f %f %f", tableunpack(coords)) + else + err("unknown fading method '%s'", fd_type) + end + fd_type = fd_type == "linear" and 2 or 3 + local opaq = (prescript.mplibfadeopacity or "1:0"):explode":" + local on, os, new + on = sh_pdfpageresources(fd_type, "0 1", "/DeviceGray", {{opaq[1]}}, {{opaq[2]}}, coords, 1) + os = format("<</PatternType 2/Shading %s>>", format(pdfetcs.resfmt, on)) + on = update_pdfobjs(os) + bbox = format("0 0 %f %f", bbox[3]+dx, bbox[4]+dy) + local streamtext = format("q /Pattern cs/MPlibFd%s scn %s re f Q", on, bbox) + :gsub(decimals,rmzeros) + os = format("<</Pattern<</MPlibFd%s %s>>>>", on, format(pdfetcs.resfmt, on)) + on = update_pdfobjs(os) + local resources = format(pdfetcs.resfmt, on) + on = update_pdfobjs"<</S/Transparency/CS/DeviceGray>>" + local attr = tableconcat{ + "/Subtype/Form", + "/BBox[", bbox, "]", + "/Matrix[1 0 0 1 ", format("%f %f", -dx,-dy), "]", + "/Resources ", resources, + "/Group ", format(pdfetcs.resfmt, on), + } :gsub(decimals,rmzeros) + on = update_pdfobjs(attr, streamtext) + os = "<</SMask<</S/Luminosity/G " .. format(pdfetcs.resfmt, on) .. ">>>>" + on, new = update_pdfobjs(os) + local key = add_extgs_resources(on,new) + start_pdf_code() + pdf_literalcode("/%s gs", key) + if fd_stop then return "standalone" end + return "start" +end + +% \end{macrocode} +% +% Transparency Group +% \begin{macrocode} +pdfetcs.tr_group = { shifts = { } } +luamplib.trgroupshifts = pdfetcs.tr_group.shifts +local function do_preobj_GRP (object, prescript) + local grstate = prescript and prescript.gr_state + if not grstate then return end + local trgroup = pdfetcs.tr_group + if grstate == "start" then + trgroup.name = prescript.mplibgroupname or "lastmplibgroup" + trgroup.isolated, trgroup.knockout = false, false + for _,v in ipairs(prescript.gr_type:explode",+") do + trgroup[v] = true + end + trgroup.bbox = prescript.mplibgroupbbox:explode":" + put2output[[\begingroup\setbox\mplibscratchbox\hbox\bgroup]] + elseif grstate == "stop" then + local llx,lly,urx,ury = tableunpack(trgroup.bbox) + put2output(tableconcat{ + "\\egroup", + format("\\wd\\mplibscratchbox %fbp", urx-llx), + format("\\ht\\mplibscratchbox %fbp", ury-lly), + "\\dp\\mplibscratchbox 0pt", + }) + local grattr = format("/Group<</S/Transparency/I %s/K %s>>",trgroup.isolated,trgroup.knockout) + local res = gather_resources() + local bbox = format("%f %f %f %f", llx,lly,urx,ury) :gsub(decimals,rmzeros) + if pdfmode then + put2output(tableconcat{ + "\\saveboxresource type 2 attr{/Type/XObject/Subtype/Form/FormType 1", + "/BBox[", bbox, "]", grattr, "} resources{", res, "}\\mplibscratchbox", + [[\setbox\mplibscratchbox\hbox{\useboxresource\lastsavedboxresourceindex}]], + [[\wd\mplibscratchbox 0pt\ht\mplibscratchbox 0pt\dp\mplibscratchbox 0pt]], + [[\box\mplibscratchbox\endgroup]], + "\\expandafter\\xdef\\csname luamplib.group.", trgroup.name, "\\endcsname{", + "\\noexpand\\mplibstarttoPDF{",llx,"}{",lly,"}{",urx,"}{",ury,"}", + "\\useboxresource \\the\\lastsavedboxresourceindex\\noexpand\\mplibstoptoPDF}", + }) + else + trgroup.cnt = (trgroup.cnt or 0) + 1 + local objname = format("@mplibtrgr%s", trgroup.cnt) + put2output(tableconcat{ + "\\special{pdf:bxobj ", objname, " bbox ", bbox, "}", + "\\unhbox\\mplibscratchbox", + "\\special{pdf:put @resources <<", res, ">>}", + "\\special{pdf:exobj <<", grattr, ">>}", + "\\special{pdf:uxobj ", objname, "}\\endgroup", + }) + token.set_macro("luamplib.group."..trgroup.name, tableconcat{ + "\\mplibstarttoPDF{",llx,"}{",lly,"}{",urx,"}{",ury,"}", + "\\special{pdf:uxobj ", objname, "}\\mplibstoptoPDF", + }, "global") + end + trgroup.shifts[trgroup.name] = { llx, lly } + end + return grstate +end +function luamplib.registergroup (boxid, name, opts) + local box = texgetbox(boxid) + local wd, ht, dp = node.getwhd(box) + local res = (opts.resources or "") .. gather_resources() + local attr = { "/Type/XObject/Subtype/Form/FormType 1" } + if type(opts.matrix) == "table" then opts.matrix = tableconcat(opts.matrix," ") end + if type(opts.bbox) == "table" then opts.bbox = tableconcat(opts.bbox," ") end + if opts.matrix and opts.matrix:find"%a" then + local data = format("mplibtransformmatrix(%s);",opts.matrix) + process(data,"@mplibtransformmatrix") + opts.matrix = format("%f %f %f %f %f %f",tableunpack(luamplib.transformmatrix)) + end + local grtype = 3 + if opts.bbox then + attr[#attr+1] = format("/BBox[%s]", opts.bbox) + grtype = 2 + end + if opts.matrix then + attr[#attr+1] = format("/Matrix[%s]", opts.matrix) + grtype = opts.bbox and 4 or 1 + end + if opts.asgroup then + local t = { isolated = false, knockout = false } + for _,v in ipairs(opts.asgroup:explode",+") do t[v] = true end + attr[#attr+1] = format("/Group<</S/Transparency/I %s/K %s>>", t.isolated, t.knockout) + end + local trgroup = pdfetcs.tr_group + trgroup.shifts[name] = { get_macro'MPllx', get_macro'MPlly' } + local whd + if pdfmode then + attr = tableconcat(attr) :gsub(decimals,rmzeros) + local index = tex.saveboxresource(boxid, attr, res, true, grtype) + token.set_macro("luamplib.group."..name, "\\useboxresource "..index, "global") + whd = format("%.3f %.3f 0", wd/factor, (ht+dp)/factor) :gsub(decimals,rmzeros) + else + trgroup.cnt = (trgroup.cnt or 0) + 1 + local objname = format("@mplibtrgr%s", trgroup.cnt) + texsprint { + "\\expandafter\\newbox\\csname luamplib.groupbox.", trgroup.cnt, "\\endcsname", + "\\global\\setbox\\csname luamplib.groupbox.", trgroup.cnt, "\\endcsname", + "\\hbox{\\unhbox ", boxid, "}\\luamplibatnextshipout{", + "\\special{pdf:bcontent}", + "\\special{pdf:bxobj ", objname, " width ", wd, "sp height ", ht, "sp depth ", dp, "sp}", + "\\unhbox\\csname luamplib.groupbox.", trgroup.cnt, "\\endcsname", + "\\special{pdf:put @resources <<", res, ">>}", + "\\special{pdf:exobj <<", tableconcat(attr), ">>}", + "\\special{pdf:econtent}}", + } + token.set_macro("luamplib.group."..name, tableconcat{ + "\\begingroup\\setbox\\mplibscratchbox\\hbox{\\special{pdf:uxobj ", objname, "}}", + "\\wd\\mplibscratchbox ", wd, "sp", + "\\ht\\mplibscratchbox ", ht, "sp", + "\\dp\\mplibscratchbox ", dp, "sp", + "\\box\\mplibscratchbox\\endgroup", + }, "global") + whd = format("%.3f %.3f %.3f", wd/factor, ht/factor, dp/factor) :gsub(decimals,rmzeros) + end + info("w/h/d of group '%s': %s", name, whd) +end + +local function stop_special_effects(fade,opaq,over) + if fade then -- fading + stop_pdf_code() + end + if opaq then -- opacity + pdf_literalcode(opaq) + end + if over then -- color + put2output"\\special{pdf:ec}" + end +end + +% \end{macrocode} +% +% Codes below for inserting PDF lieterals are mostly from ConTeXt general, +% with small changes when needed. +% \begin{macrocode} +local function getobjects(result,figure,f) + return figure:objects() +end + +function luamplib.convert (result, flusher) + luamplib.flush(result, flusher) + return true -- done +end + +local function pdf_textfigure(font,size,text,width,height,depth) + text = text:gsub(".",function(c) + return format("\\hbox{\\char%i}",string.byte(c)) -- kerning happens in metapost : false + end) + put2output("\\mplibtextext{%s}{%f}{%s}{%s}{%s}",font,size,text,0,0) +end + +local bend_tolerance = 131/65536 + +local rx, sx, sy, ry, tx, ty, divider = 1, 0, 0, 1, 0, 0, 1 + +local function pen_characteristics(object) + local t = mplib.pen_info(object) + rx, ry, sx, sy, tx, ty = t.rx, t.ry, t.sx, t.sy, t.tx, t.ty + divider = sx*sy - rx*ry + return not (sx==1 and rx==0 and ry==0 and sy==1 and tx==0 and ty==0), t.width +end + +local function concat(px, py) -- no tx, ty here + return (sy*px-ry*py)/divider,(sx*py-rx*px)/divider +end + +local function curved(ith,pth) + local d = pth.left_x - ith.right_x + if abs(ith.right_x - ith.x_coord - d) <= bend_tolerance and abs(pth.x_coord - pth.left_x - d) <= bend_tolerance then + d = pth.left_y - ith.right_y + if abs(ith.right_y - ith.y_coord - d) <= bend_tolerance and abs(pth.y_coord - pth.left_y - d) <= bend_tolerance then + return false + end + end + return true +end + +local function flushnormalpath(path,open) + local pth, ith + for i=1,#path do + pth = path[i] + if not ith then + pdf_literalcode("%f %f m",pth.x_coord,pth.y_coord) + elseif curved(ith,pth) then + pdf_literalcode("%f %f %f %f %f %f c",ith.right_x,ith.right_y,pth.left_x,pth.left_y,pth.x_coord,pth.y_coord) + else + pdf_literalcode("%f %f l",pth.x_coord,pth.y_coord) + end + ith = pth + end + if not open then + local one = path[1] + if curved(pth,one) then + pdf_literalcode("%f %f %f %f %f %f c",pth.right_x,pth.right_y,one.left_x,one.left_y,one.x_coord,one.y_coord ) + else + pdf_literalcode("%f %f l",one.x_coord,one.y_coord) + end + elseif #path == 1 then -- special case .. draw point + local one = path[1] + pdf_literalcode("%f %f l",one.x_coord,one.y_coord) + end +end + +local function flushconcatpath(path,open) + pdf_literalcode("%f %f %f %f %f %f cm", sx, rx, ry, sy, tx ,ty) + local pth, ith + for i=1,#path do + pth = path[i] + if not ith then + pdf_literalcode("%f %f m",concat(pth.x_coord,pth.y_coord)) + elseif curved(ith,pth) then + local a, b = concat(ith.right_x,ith.right_y) + local c, d = concat(pth.left_x,pth.left_y) + pdf_literalcode("%f %f %f %f %f %f c",a,b,c,d,concat(pth.x_coord, pth.y_coord)) + else + pdf_literalcode("%f %f l",concat(pth.x_coord, pth.y_coord)) + end + ith = pth + end + if not open then + local one = path[1] + if curved(pth,one) then + local a, b = concat(pth.right_x,pth.right_y) + local c, d = concat(one.left_x,one.left_y) + pdf_literalcode("%f %f %f %f %f %f c",a,b,c,d,concat(one.x_coord, one.y_coord)) + else + pdf_literalcode("%f %f l",concat(one.x_coord,one.y_coord)) + end + elseif #path == 1 then -- special case .. draw point + local one = path[1] + pdf_literalcode("%f %f l",concat(one.x_coord,one.y_coord)) + end +end + +% \end{macrocode} +% % Finally, flush figures by inserting PDF literals. % \begin{macrocode} function luamplib.flush (result,flusher) @@ -2832,15 +3815,14 @@ function luamplib.flush (result,flusher) local llx, lly, urx, ury = bbox[1], bbox[2], bbox[3], bbox[4] -- faster than unpack if urx < llx then % \end{macrocode} -% % luamplib silently ignores this invalid figure for those % that do not contain |beginfig ... endfig|. (issue \#70) % Original code of ConTeXt general was: -% \begin{verbatim} +%\begin{verbatim} % -- invalid % pdf_startfigure(fignum,0,0,0,0) % pdf_stopfigure() -% \end{verbatim} +%\end{verbatim} % \begin{macrocode} else % \end{macrocode} @@ -2858,14 +3840,16 @@ function luamplib.flush (result,flusher) local object = objects[o] local objecttype = object.type % \end{macrocode} -% -% The following 6 lines are part of |btex...etex| patch. +% The following 9 lines are part of |btex...etex| patch. % Again, colors are processed at this stage. % \begin{macrocode} local prescript = object.prescript prescript = prescript and script2table(prescript) -- prescript is now a table local cr_over = do_preobj_CR(object,prescript) -- color - local tr_opaq = do_preobj_TR(prescript) -- opacity + local tr_opaq = do_preobj_TR(object,prescript) -- opacity + local fading_ = do_preobj_FADE(object,prescript) -- fading + local trgroup = do_preobj_GRP(object,prescript) -- transparency group + local pattern_ = do_preobj_PAT(object,prescript) -- pattern if prescript and prescript.mplibtexboxid then put_tex_boxes(object,prescript) elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then --skip @@ -2879,7 +3863,6 @@ function luamplib.flush (result,flusher) miterlimit, linecap, linejoin, dashed = -1, -1, -1, false elseif objecttype == "special" then % \end{macrocode} -% % Collect \TeX\ codes that will be executed after flushing. % Legacy behavior. % \begin{macrocode} @@ -2892,7 +3875,7 @@ function luamplib.flush (result,flusher) pdf_literalcode("%f %f %f %f %f %f cm",ot[3],ot[4],ot[5],ot[6],ot[1],ot[2]) pdf_textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth) stop_pdf_code() - else + elseif not trgroup and fading_ ~= "stop" then local evenodd, collect, both = false, false, false local postscript = object.postscript if not object.istext then @@ -2918,9 +3901,7 @@ function luamplib.flush (result,flusher) else % \end{macrocode} % Removed from ConTeXt general: color stuff. -% Added instead : shading stuff % \begin{macrocode} - local shade_no = do_preobj_SH(object,prescript) -- shading local ml = object.miterlimit if ml and ml ~= miterlimit then miterlimit = ml @@ -2962,6 +3943,14 @@ function luamplib.flush (result,flusher) objecttype = 'fill' end end +% \end{macrocode} +% Added : shading +% \begin{macrocode} + local shade_no = do_preobj_SH(object,prescript) -- shading + if shade_no then + pdf_literalcode"q /Pattern cs" + objecttype = false + end if transformed then start_pdf_code() end @@ -2982,27 +3971,25 @@ function luamplib.flush (result,flusher) else flushnormalpath(path,open) end -% \end{macrocode} -% Shading seems to conflict with these ops -% \begin{macrocode} - if not shade_no then -- conflict with shading - if objecttype == "fill" then - pdf_literalcode(evenodd and "h f*" or "h f") - elseif objecttype == "outline" then - if both then - pdf_literalcode(evenodd and "h B*" or "h B") - else - pdf_literalcode(open and "S" or "h S") - end - elseif objecttype == "both" then + if objecttype == "fill" then + pdf_literalcode(evenodd and "h f*" or "h f") + elseif objecttype == "outline" then + if both then pdf_literalcode(evenodd and "h B*" or "h B") + else + pdf_literalcode(open and "S" or "h S") end + elseif objecttype == "both" then + pdf_literalcode(evenodd and "h B*" or "h B") end end if transformed then stop_pdf_code() end local path = object.htap +% \end{macrocode} +% How can we generate an |htap| object? Please let us know if you have succeeded. +% \begin{macrocode} if path then if transformed then start_pdf_code() @@ -3036,19 +4023,29 @@ function luamplib.flush (result,flusher) end end % \end{macrocode} -% -% Added to ConTeXt general: post-object color and shading stuff. +% Added to ConTeXt general: post-object colors and shading stuff. +% We should beware the |q ... Q| scope. % \begin{macrocode} if shade_no then -- shading - pdf_literalcode("W n /MPlibSh%s sh Q",shade_no) + pdf_literalcode("W%s n /MPlibSh%s sh Q",evenodd and "*" or "",shade_no) end end end - if tr_opaq then -- opacity - stop_pdf_code() + if fading_ == "start" then + pdfetcs.fading.specialeffects = {fading_, tr_opaq, cr_over} + elseif trgroup == "start" then + pdfetcs.tr_group.specialeffects = {fading_, tr_opaq, cr_over} + elseif fading_ == "stop" then + local se = pdfetcs.fading.specialeffects + if se then stop_special_effects(se[1], se[2], se[3]) end + elseif trgroup == "stop" then + local se = pdfetcs.tr_group.specialeffects + if se then stop_special_effects(se[1], se[2], se[3]) end + else + stop_special_effects(fading_, tr_opaq, cr_over) end - if cr_over then -- color - put2output"\\special{pdf:ec}" + if fading_ or trgroup then -- extgs resetted + miterlimit, linecap, linejoin, dashed = -1, -1, -1, false end end end @@ -3101,15 +4098,34 @@ end % First we need to load some packages. % % \begin{macrocode} -\bgroup\expandafter\expandafter\expandafter\egroup -\expandafter\ifx\csname selectfont\endcsname\relax - \input ltluatex -\else +\ifcsname ProvidesPackage\endcsname +% \end{macrocode} +% We need \LaTeX\ 2024-06-01 as we use |ltx.pdf.object_id| when pdfmanagement is loaded. +% But as \pkg{fp} package does not accept an option, we do not append the date option. +% \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2024/05/21 v2.31.0 mplib package for LuaTeX] - \ifx\newluafunction\@undefined + [2024/08/03 v2.34.5 mplib package for LuaTeX] +\fi +\ifdefined\newluafunction\else \input ltluatex +\fi +% \end{macrocode} +% +% In DVI mode, a new XObject (mppattern, mplibgroup) must be encapsulated in an \cs{hbox}. +% But this should not affect typesetting. So we use Hook mechanism provided by \LaTeX\ kernel. +% In Plain, \pkg{atbegshi.sty} is loaded. +% \begin{macrocode} +\ifnum\outputmode=0 + \ifdefined\AddToHookNext + \def\luamplibatnextshipout{\AddToHookNext{shipout/background}} + \def\luamplibatfirstshipout{\AddToHook{shipout/firstpage}} + \def\luamplibateveryshipout{\AddToHook{shipout/background}} + \else + \input atbegshi.sty + \def\luamplibatnextshipout#1{\AtBeginShipoutNext{\AtBeginShipoutAddToBox{#1}}} + \let\luamplibatfirstshipout\AtBeginShipoutFirst + \def\luamplibateveryshipout#1{\AtBeginShipout{\AtBeginShipoutAddToBox{#1}}} \fi \fi % \end{macrocode} @@ -3129,7 +4145,7 @@ end \fi % \end{macrocode} % -% Set the format for metapost. +% Set the format for \metapost. % \begin{macrocode} \def\mplibsetformat#1{\directlua{luamplib.setformat("#1")}} % \end{macrocode} @@ -3171,7 +4187,78 @@ end \def\mplibputtextbox#1{\vbox to 0pt{\vss\hbox to 0pt{\raise\dp#1\copy#1\hss}}} % \end{macrocode} % -% simple way to use mplib: +% use Transparency Group +% \begin{macrocode} +\protected\def\usemplibgroup#1{\csname luamplib.group.#1\endcsname} +\protected\def\mplibgroup#1{% + \begingroup + \def\MPllx{0}\def\MPlly{0}% + \def\mplibgroupname{#1}% + \mplibgroupgetnexttok +} +\def\mplibgroupgetnexttok{\futurelet\nexttok\mplibgroupbranch} +\def\mplibgroupskipspace{\afterassignment\mplibgroupgetnexttok\let\nexttok= } +\def\mplibgroupbranch{% + \ifx [\nexttok + \expandafter\mplibgroupopts + \else + \ifx\mplibsptoken\nexttok + \expandafter\expandafter\expandafter\mplibgroupskipspace + \else + \let\mplibgroupoptions\empty + \expandafter\expandafter\expandafter\mplibgroupmain + \fi + \fi +} +\def\mplibgroupopts[#1]{\def\mplibgroupoptions{#1}\mplibgroupmain} +\def\mplibgroupmain{\setbox\mplibscratchbox\hbox\bgroup\ignorespaces} +\protected\def\endmplibgroup{\egroup + \directlua{ luamplib.registergroup( + \the\mplibscratchbox, '\mplibgroupname', {\mplibgroupoptions} + )}% + \endgroup +} +% \end{macrocode} +% +% Patterns +% \begin{macrocode} +{\def\:{\global\let\mplibsptoken= } \: } +\protected\def\mppattern#1{% + \begingroup + \def\mplibpatternname{#1}% + \mplibpatterngetnexttok +} +\def\mplibpatterngetnexttok{\futurelet\nexttok\mplibpatternbranch} +\def\mplibpatternskipspace{\afterassignment\mplibpatterngetnexttok\let\nexttok= } +\def\mplibpatternbranch{% + \ifx [\nexttok + \expandafter\mplibpatternopts + \else + \ifx\mplibsptoken\nexttok + \expandafter\expandafter\expandafter\mplibpatternskipspace + \else + \let\mplibpatternoptions\empty + \expandafter\expandafter\expandafter\mplibpatternmain + \fi + \fi +} +\def\mplibpatternopts[#1]{% + \def\mplibpatternoptions{#1}% + \mplibpatternmain +} +\def\mplibpatternmain{% + \setbox\mplibscratchbox\hbox\bgroup\ignorespaces +} +\protected\def\endmppattern{% + \egroup + \directlua{ luamplib.registerpattern( + \the\mplibscratchbox, '\mplibpatternname', {\mplibpatternoptions} + )}% + \endgroup +} +% \end{macrocode} +% +% simple way to use \mplib: % |\mpfig draw fullcircle scaled 10; \endmpfig| % \begin{macrocode} \def\mpfiginstancename{@mpfig} @@ -3194,16 +4281,16 @@ end \long\def\mplibdomainmpfig#1\endmpfig{% \endgroup \directlua{ - local legacy = luamplib.legacy_verbatimtex + local legacy = luamplib.legacyverbatimtex local everympfig = luamplib.everymplib["\mpfiginstancename"] or "" local everyendmpfig = luamplib.everyendmplib["\mpfiginstancename"] or "" - luamplib.legacy_verbatimtex = false + luamplib.legacyverbatimtex = false luamplib.everymplib["\mpfiginstancename"] = "" luamplib.everyendmplib["\mpfiginstancename"] = "" luamplib.process_mplibcode( "beginfig(0) "..everympfig.." "..[===[\unexpanded{#1}]===].." "..everyendmpfig.." endfig;", "\mpfiginstancename") - luamplib.legacy_verbatimtex = legacy + luamplib.legacyverbatimtex = legacy luamplib.everymplib["\mpfiginstancename"] = everympfig luamplib.everyendmplib["\mpfiginstancename"] = everyendmpfig }% @@ -3217,14 +4304,14 @@ end \long\def\mplibdoprempfig#1\endmpfig{% \endgroup \directlua{ - local legacy = luamplib.legacy_verbatimtex + local legacy = luamplib.legacyverbatimtex local everympfig = luamplib.everymplib["\mpfiginstancename"] local everyendmpfig = luamplib.everyendmplib["\mpfiginstancename"] - luamplib.legacy_verbatimtex = false + luamplib.legacyverbatimtex = false luamplib.everymplib["\mpfiginstancename"] = "" luamplib.everyendmplib["\mpfiginstancename"] = "" luamplib.process_mplibcode([===[\unexpanded{#1}]===],"\mpfiginstancename") - luamplib.legacy_verbatimtex = legacy + luamplib.legacyverbatimtex = legacy luamplib.everymplib["\mpfiginstancename"] = everympfig luamplib.everyendmplib["\mpfiginstancename"] = everyendmpfig }% @@ -3303,9 +4390,9 @@ end \def\mpliblegacybehavior#1{\directlua{ local s = string.lower("#1") if s == "enable" or s == "true" or s == "yes" then - luamplib.legacy_verbatimtex = true + luamplib.legacyverbatimtex = true else - luamplib.legacy_verbatimtex = false + luamplib.legacyverbatimtex = false end }} \def\mplibverbatim#1{\directlua{ @@ -3377,14 +4464,13 @@ end % % Allow \TeX\ dimen/color macros. Now |runscript| does the job, % so the following lines are not needed for most cases. -% But the macros will be expanded when they are used in another macro. % \begin{macrocode} \def\mpdim#1{ runscript("luamplibdimen{#1}") } \def\mpcolor#1#{\domplibcolor{#1}} \def\domplibcolor#1#2{ runscript("luamplibcolor{#1{#2}}") } % \end{macrocode} % -% MPLib's number system. Now |binary| has gone away. +% \mplib's number system. Now |binary| has gone away. % \begin{macrocode} \def\mplibnumbersystem#1{\directlua{ local t = "#1" @@ -3449,12 +4535,13 @@ end % \end{macrocode} % % The followings are from ConTeXt general, mostly. -% % We use a dedicated scratchbox. +% +% We use a dedicated scratchbox. % \begin{macrocode} \ifx\mplibscratchbox\undefined \newbox\mplibscratchbox \fi % \end{macrocode} % -% We encapsulate the litterals. +% We encapsulate the literals. % \begin{macrocode} \def\mplibstarttoPDF#1#2#3#4{% \prependtomplibbox diff --git a/macros/luatex/generic/luamplib/luamplib.pdf b/macros/luatex/generic/luamplib/luamplib.pdf Binary files differindex 5ffccd841a..7682155b3c 100644 --- a/macros/luatex/generic/luamplib/luamplib.pdf +++ b/macros/luatex/generic/luamplib/luamplib.pdf diff --git a/macros/luatex/generic/luamplib/test-luamplib-latex.tex b/macros/luatex/generic/luamplib/test-luamplib-latex.tex index 043c34adbb..8435ee070c 100644 --- a/macros/luatex/generic/luamplib/test-luamplib-latex.tex +++ b/macros/luatex/generic/luamplib/test-luamplib-latex.tex @@ -7,7 +7,7 @@ \usepackage{fontspec} \setmainfont{latin modern roman} \usepackage{luamplib} -\usepackage{xcolor} +\usepackage{graphicx,xcolor} \everymplib{ beginfig(0); } \everyendmplib{ endfig; } \mpliblegacybehavior{true}% @@ -175,7 +175,7 @@ diameter:\Dia bp.% \par \begin{mplibcode} beginfig(1) -draw mplibgraphictext "\bfseries Funny" + draw mplibgraphictext "\bfseries Funny$\sqrt{2}$" fakebold 2 % fontspec option drawcolor blue fillcolor "red!50" % l3color expression scaled 3 rotated 30 ; @@ -227,11 +227,122 @@ endfor \mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig \def\mpfiginstancename{mympfig}% \mpfig -draw mpliboutlinetext.b ("$\sqrt{2+\alpha}$") +draw mpliboutlinetext.b ("$\displaystyle\frac{1}{1-x^2}$") (withcolor .6[red,white]) (withpen pencircle scaled .2 withcolor red) scaled 4 ; \endmpfig +\par +\mpfig + draw mpliboutlinetext.r + ("Question") + ( withpen pencircle scaled .3 ) + ( + withshademethod "linear" + withshadedirection (2.5, 0.5) + withshadecolors(red, blue) + ) + scaled 4; +\endmpfig +\par\leavevmode +\mppattern{mypatt} +[ + xstep = 5, ystep = 6, + matrix = "rotated 90 scaled .75", +] +\mpfig +draw (origin--right+up) scaled 5 withcolor 1/3[blue,white] ; +draw (up--right) scaled 5 withcolor 1/3[red,white] ; +\endmpfig +\endmppattern +\mpfig +draw unitsquare shifted -center unitsquare scaled 45 withpostscript "collect" ; +draw fullcircle scaled 100 withpattern "mypatt" withpen pencircle scaled 1 + withcolor \mpcolor{red!50!blue!50} withpostscript "evenodd" ; +\endmpfig +\begin{mppattern}{pattuncolored} + [ + colored = false, + matrix = "slanted .3 rotated 30", + ] + \tiny\TeX +\end{mppattern}\relax +\mpfig + picture tex; + tex = mpliboutlinetext.p ("\bfseries \TeX"); + for i=1 upto mpliboutlinenum: + draw image( + j:=0; + for item within mpliboutlinepic[i]: + j:=j+1; + draw pathpart item scaled 10 + if j < length mpliboutlinepic[i]: + withpostscript "collect" + else: + withpattern "pattuncolored" + withpen pencircle scaled 1/2 + withcolor (i/4)[red,blue] + fi; + endfor + ) + withfademethod "linear" + ; + endfor +\endmpfig +\par\leavevmode +\mpfig + picture mill; mill = btex \includegraphics[width=100bp]{mill} etex; + draw mill; + mill := mill shifted 125right; + draw mill + withfademethod "circular" + withfadecenter (center mill, center mill) + withfaderadius (30, abs(lrcorner mill - llcorner mill)/2) + withfadeopacity (1, 0) + ; +\endmpfig +\par +\def\test#1{% + \mpfig + fill unitsquare shifted -center unitsquare scaled 200 + withshademethod "linear" + withshadecolors (.3[red,white], .3[blue,white]) + ; + label( btex MetaPost etex scaled 3, origin) ; + draw image( + fill fullcircle scaled 100 shifted 25left + withcolor .8white + withtransparency (2,1) + ; + fill fullcircle scaled 100 shifted 25right + withcolor .8white + withtransparency (2,1) + ; + ) + asgroup "#1" + withgroupname "test:#1" + withtransparency (1,.5) + ; + currentpicture := currentpicture scaled 2/3; + \endmpfig +}% +\hbox{\test{isolated,knockout}\,\test{isolated}\vbox to\MPheight{\vss\hbox{~isolated}\vss}}% +\hbox{\test{knockout}\,\test{}}% +\hbox to\MPwidth{\hss knockout\hss}% +\leavevmode +\mpfig usemplibgroup "test:isolated,knockout" scaled 2/3 rotated 15 ; \endmpfig +\usemplibgroup{test:isolated,knockout}% +\begin{mplibgroup}{mytex}[matrix="rotated 15"] \TeX \end{mplibgroup}% +\hbox to0pt{\hss\vrule width.5pt height5pt depth5pt\hss}% +\hbox to0pt{\hss\vrule width10pt height.25pt depth.25pt\hss}% +\usemplibgroup{mytex}% +\mpfig usemplibgroup "mytex"; draw (left--right) scaled 5; draw (up--down) scaled 5; \endmpfig +\par +\mpfig + picture test; test = mplibgraphictext "\textbf{MPLIB}" + fakebold 1 fillcolor "red!70" drawcolor .7red scaled 7; + draw test withpattern "mypatt" ; +\endmpfig \tracingcommands0 \vskip 2\baselineskip diff --git a/macros/luatex/generic/luamplib/test-luamplib-plain.tex b/macros/luatex/generic/luamplib/test-luamplib-plain.tex index 63bffc5ad5..05c2f8138d 100644 --- a/macros/luatex/generic/luamplib/test-luamplib-plain.tex +++ b/macros/luatex/generic/luamplib/test-luamplib-plain.tex @@ -1,4 +1,4 @@ -\input luaotfload.sty +%\input luaotfload.sty \input miniltx \input color \definecolor{orange}{cmyk}{0,.5,1,0} @@ -167,7 +167,7 @@ diameter:\Dia bp.% \par \mplibcode beginfig(1) % in dvi mode, not work for type1 font -draw mplibgraphictext "\bf Funny" +draw mplibgraphictext "\bf Funny$\sqrt{2}$" fakebold 2 % fontspec option drawcolor blue fillcolor .5[red,white] scaled 3 rotated 30 ; @@ -220,10 +220,103 @@ endfor \mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig \def\mpfiginstancename{mympfig}% \mpfig -draw mpliboutlinetext.b ("$\sqrt{2+\alpha}$") +draw mpliboutlinetext.b ("$\overbrace{x+\cdots+x}^k$") (withcolor .6[red,white]) (withpen pencircle scaled .2 withcolor red) - scaled 4 ; + scaled 3 ; +\endmpfig +\par +\mpfig + draw mpliboutlinetext.r + ("Question") + ( withpen pencircle scaled .3 ) + ( + withshademethod "linear" + withshadedirection (2.5, 0.5) + withshadecolors(red, blue) + ) + scaled 4; +\endmpfig +\par\leavevmode +\mppattern{mypatt} + \mpfig + picture q; + q := btex Q etex; + fill bbox q withcolor .8[red,white]; + draw q withcolor .8red; + \endmpfig +\endmppattern +\mpfig + fill fullcircle scaled 100 withpostscript "collect"; + draw unitsquare shifted - center unitsquare scaled 45 + withpattern "mypatt" + withpostscript "evenodd" + ; +\endmpfig +\mppattern{pattuncolored} + [ + colored = false, + matrix = "slanted .3 rotated 30", + ] + \fiverm\TeX +\endmppattern +\mpfig + picture tex; + tex = mpliboutlinetext.p ("\bf \TeX"); + draw image( + for i=1 upto mpliboutlinenum: + j:=0; + for item within mpliboutlinepic[i]: + j:=j+1; + draw pathpart item scaled 10 + if j < length mpliboutlinepic[i]: + withpostscript "collect" + else: + withpattern "pattuncolored" + withpen pencircle scaled 1/2 + withcolor (i/4)[red,blue] + fi; + endfor + endfor + ) + withfademethod "linear" + ; +\endmpfig +\par\leavevmode +\mpfig +fill fullcircle scaled 125 withcolor 2/3[blue,white]; +fill fullcircle scaled 80 withcolor 2/3[red,white]; +draw image( + draw (left--right) rotated 45 scaled 50 + withpen pencircle scaled 20 + ; + draw (left--right) rotated -45 scaled 50 + withpen pencircle scaled 20 + ; + ) + asgroup "" + withgroupname "testTRgroup" + withprescript "tr_transparency=.3" + ; +\endmpfig +\mpfig +fill fullcircle scaled 125 withcolor 2/3[red,white]; +fill fullcircle scaled 80 withcolor 2/3[blue,white]; +usemplibgroup "testTRgroup" + withfademethod "circular" + withfaderadius (0,60) + ; +\endmpfig +\mplibgroup{mytex}[matrix="rotated 15"] \TeX \endmplibgroup +\hbox to0pt{\hss\vrule width.5pt height5pt depth5pt\hss}% +\hbox to0pt{\hss\vrule width10pt height.25pt depth.25pt\hss}% +\usemplibgroup{mytex}% +\mpfig usemplibgroup "mytex"; draw (left--right) scaled 5; draw (up--down) scaled 5; \endmpfig +\par +\mpfig + picture test; test = mplibgraphictext "\bf MPLIB" + fakebold 1 fillcolor .7[white,blue] drawcolor .7blue scaled 7; + draw test withpattern "pattuncolored" ; \endmpfig \tracingcommands0 diff --git a/macros/luatex/generic/luatexja/README b/macros/luatex/generic/luatexja/README index 9224c83b0b..b1fc7c59aa 100644 --- a/macros/luatex/generic/luatexja/README +++ b/macros/luatex/generic/luatexja/README @@ -1,4 +1,4 @@ -The LuaTeX-ja Package 20240514.0 +The LuaTeX-ja Package 20240909.0 -------------------------------- Copyright (c) 2011--2024 The LuaTeX-ja project License: modified BSD (see COPYING) @@ -42,7 +42,7 @@ Installation 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20240514.0 in the Git repository by + or tagged as 20240909.0 in the Git repository by <https://github.com/luatexja/luatexja/archive/refs/tags/$VER.zip> b. Extract the archive and process following three files by LuaLaTeX @@ -92,4 +92,4 @@ Notes This file and ltj-kinsoku.lua are not used anymore. (Do not remove ltj-kinsoku.tex.) -Last commit date: Tue May 14 19:12:05 2024 +0900 +Last commit date: Mon Sep 9 05:16:53 2024 +0900 diff --git a/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf b/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf Binary files differindex 786e01afa5..1c20815985 100644 --- a/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf +++ b/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf Binary files differindex de28e1d279..2d627fded2 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 49a8a6feef..de1d8f172d 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 06cf336b44..0914351b11 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 c7e05e8c51..8a12307e70 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex +++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex @@ -1,7 +1,7 @@ %#! lualatex %%% a test of ruby. \documentclass[a4paper,10ptj]{ltjsarticle} -\usepackage[rgb]{xcolor} +\usepackage[cmyk]{xcolor} \usepackage{enumitem,mleftright,pict2e} \usepackage{luatexja-otf,amsmath,bxghost} \usepackage[no-math]{fontspec} @@ -17,15 +17,21 @@ \def\cs#1{\eghostguarded{\texttt{\textbackslash#1}}} \usepackage[textwidth=45\zw, lines=45, footskip=2\zh]{geometry} \advance\leftmargini-1\zw\advance\leftmarginii-1\zw -\protected\def\Param#1{\eghostguarded{\underline{\smash{\textsf{\mdseries #1}}}}} +\protected\def\Param#1{\texorpdfstring{\eghostguarded{\underline{\smash{\textsf{\mdseries #1}}}}}{#1}} +\def\Pkg#1{\texorpdfstring{\textsf{#1}}{#1}} % packages/classes \usepackage{luatexja-ruby,showexpl,booktabs} -\definecolor{mygreen}{rgb}{0,0.5,0} +\usepackage{luacolor,lua-ul} +\definecolor{green}{cmyk}{.75,0,.65,0} +\definecolor{blue}{cmyk}{1,.45,0,0} +\definecolor{b_blue}{cmyk}{.3,0,0,0} \lstset{ preset=\normalsize, basicstyle=\small\ttfamily, basewidth=0.5em, explpreset={numberstyle=\tiny, numbers=left, numbersep=1em, columns=fixed}, - morecomment=[l]{\%}, commentstyle=\color{mygreen} + morecomment=[l]{\%}, commentstyle=\color{green} } +\newunderlinetype\beginActIntr{\color{blue}\leaders\vrule height -.16\zh depth .24\zh} +\NewDocumentCommand\ActIntr{+m}{{\beginActIntr#1}} \makeatletter\let\SX@Info=\relax\makeatother \fboxsep=0mm @@ -37,41 +43,23 @@ allcolors=blue, pdftitle={luatexja-ruby.sty} } -\def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr - #1\mathstrut\cr\noalign{\smallskip\hrule height.4pt\smallskip}\strut\<#2\cr}}}}}\,} +\makeatletter +\def\Node{\@ifstar{\@Node[b_blue]}{\@Node[white]}} +\def\@Node[#1]#2#3{\,\vcenter{\hbox{\fboxsep=1pt\fcolorbox{black}{#1}{% + \vbox{\small\halign{\hfil##\hfil\cr + #2\mathstrut\cr\noalign{\smallskip\hrule height.4pt\smallskip}\strut\<#3\cr}}}}}\,} \def\LuaTeX{Lua\TeX} % 三分ルビ用 \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 -%%%% - \makeatletter +\let\origunderscore=\_ +\def\_{\ifx\f@family\ttdefault\origunderscore\else + \leavevmode \kern .06em\vbox {\hrule \@width .333em}\fi} \def\figureautorefname{図} +\def\tableautorefname{表} \def\HyRef@autoref#1#2{% \begingroup \Hy@safe@activestrue @@ -79,14 +67,29 @@ \endgroup\eghostguarded{}%" 欧文ゴースト } -\title{\textsf{luatexja-ruby}パッケージ} +\title{\Pkg{luatexja-ruby}パッケージ} \author{\LuaTeX-jaプロジェクトチーム} \date{\texttt{\csname ver@luatexja-ruby.sty\endcsname}(\today)} \makeatletter -\def\mybox#1{\unskip\ {\Large \fboxrule=0.1mm\fboxsep=0mm\fcolorbox{cyan}{white}{\hbox{\<\ltjjachar#1\<}}}\ } - +\def\mybox{\@ifnextchar({\mybox@@{2}{0}}{% + \@ifnextchar){\mybox@@{0}{2}}{\@ifnextchar={\mybox@@{1}{1}}{\mybox@@{0}{0}.}}}} +\def\mybox@@#1#2#3#4{\unskip\ {\Large \fboxrule=0.1mm\fboxsep=0mm% + \ifnum#1>0\fcolorbox{blue}{b_blue}{\vrule width 0pt height .88\zh depth .12\zh\kern#1\dimexpr.25\zw}\kern-\fboxrule\fi% + \fcolorbox{blue}{white}{\hbox{\<\ltjjachar#4\<}}% + \ifnum#2>0\kern-\fboxrule\fcolorbox{blue}{b_blue}{\vrule width 0pt height .88\zh depth .12\zh\kern#2\dimexpr.25\zw}\fi% +}\ } + +\def\RULER#1#2{% + \noindent + \rlap{\smash{\phantom{#1}\ \color{cyan}% + \@tempcnta=0 + \loop\ifnum\@tempcnta<20 + \kern-.05mm\vrule height \dimexpr-\baselineskip+0.88\zh depth \dimexpr #2\baselineskip+0.12\zh width0.1mm\kern-.05mm% + \kern\zw\advance\@tempcnta 1 + \repeat + }}\ignorespaces +} \begin{document} - \catcode`\<=13 \def<#1>{{\rmfamily\mdseries\itshape$\langle$#1\/$\rangle$}} %\fontsize{13.19873}{15}\selectfont% @@ -94,7 +97,7 @@ \maketitle \begin{abstract} -\textsf{luatexja-ruby}パッケージは,\LuaTeX-jaの機能を利用してルビの組版処理を行う追加パッケージである. +\Pkg{luatexja-ruby}パッケージは,\LuaTeX-jaの機能を利用してルビの組版処理を行う追加パッケージである. \LuaTeX, \LuaTeX-jaの内部処理に割り込むことにより,熟語ルビ中の行分割や, 行頭形・行中形・行末形の自動検出,また進入許容量の自動設定などを可能とした. @@ -105,15 +108,15 @@ v0.3より前とは親文字の高さの扱いが変わっている(\texttt{ba \tableofcontents \newpage -\section{\ltjruby{利|用|方|法}{り|よう|ほう|ほう}} +\section[利用方法]{\ltjruby{利|用|方|法}{り|よう|ほう|ほう}} パッケージ読み込みは,\verb+\usepackage{luatexja-ruby}+ で良く, 必要ならば自動的に\LuaTeX-ja本体を読み込む. plain \LuaTeX でのロードはまだサポートしておらず, \LaTeXe のみサポートしている. -\subsection{\ltjruby{用|語}{よう|ご}} +\subsection[用語]{\ltjruby{用|語}{よう|ご}} 「進入(intrusion)」「突出(protrusion)」という用語は, -\href{http://zrbabbler.sp.land.to/pxrubrica.html}{\textsf{pxrubrica}パッケージ}% +\href{http://zrbabbler.sp.land.to/pxrubrica.html}{\Pkg{pxrubrica}パッケージ}% での用法に準ずる. \begin{quote} @@ -125,15 +128,15 @@ plain \LuaTeX でのロードはまだサポートしておらず, なお,本パッケージでは親文字と直前・直後の文字の間に0でない和文処理グルー \footnote{JFMで指定されたグルーや,標準の和文間空白(\Param{kanjiskip}),標準の和欧文間空白(\Param{xkanjiskip}).}% -がくることも考慮しているため,「\emph{前後の文字への}\underline{進入(許容)量}」と「進入(許容)量」とは異なる可能性がある. +がくることも考慮しているため,「\emph{前後の文字への}\ActIntr{進入(許容)量}」と「進入(許容)量」とは異なる可能性がある. この文書では次のように称する: \begin{description} - \item[\underline{文字進入量}] 前後の文字へルビ文字が実際にかかる長さ.常に下線を引くことにする. + \item[\ActIntr{文字進入量}] 前後の文字へルビ文字が実際にかかる長さ.常に下線を引くことにする. \item[進入量] 前後の文字,およびそれとルビの間の和文処理グルーにかかる長さ \end{description} -多くの場合,和文処理グルーは0以上の長さのため,進入量は\underline{文字進入量}以上である. +多くの場合,和文処理グルーは0以上の長さのため,進入量は\ActIntr{文字進入量}以上である. -例えば次の例では,直前の文字「来」への\underline{前文字進入量}は0であるが, +例えば次の例では,直前の文字「来」への\ActIntr{前文字進入量}は0であるが, 前進入量は(和欧文間空白にかかる分まで含めるので)正である. \begin{quote} \Large @@ -145,15 +148,15 @@ plain \LuaTeX でのロードはまだサポートしておらず, \cs{zw},~\cs{zh}命令で取得できる値を表す.多くの場合は両者は同じ値であるが,いつでもそうであるという保証はない. 「ルビ全角幅」「ルビ全角高さ」についても同様である. -\subsection{\ruby{命|令}{めい|れい}} +\subsection[命令]{\ruby{命|令}{めい|れい}} \label{ssec:ltjruby} \paragraph{\cs{ltjruby}} -ルビ出力用命令の本体.\verb+\ruby+ という別名を定義している. +ルビ出力用命令の本体.\cs{ruby}という別名を定義している. \begin{quote} \ttfamily \textbackslash ltjruby[<option>]\{親|文|字\}\{おや|も|じ\} \end{quote} のように親文字→ルビの順序で指定する. -第2・第3引数内の「\verb+|+」はグループの区切りを表す.詳細は\ref{ssec:grp}\nobreak 小節を参照. +第2・第3引数内の「\texttt{|}」はグループの区切りを表す.詳細は\ref{ssec:grp}\nobreak 小節を参照. \medskip <option>には以下の内容をkey-valueリストで指定可能である. @@ -162,16 +165,16 @@ plain \LuaTeX でのロードはまだサポートしておらず, \begin{description} \def\makelabel#1{\ttfamily\bfseries #1} -\item[pre=<real>] \underline{前文字進入許容量}をルビ全角単位で指定. +\item[pre=<real>] \ActIntr{前文字進入許容量}をルビ全角単位で指定. 負の長さを指定した場合は,ルビの状況や直前の文字に応じた自動指定を意味する. 既定値は負(つまり,自動指定). -\item[post=<real>] 同様に,\underline{後文字進入許容量}を指定する.既定値は負(自動指定). +\item[post=<real>] 同様に,\ActIntr{後文字進入許容量}を指定する.既定値は負(自動指定). \item[mode] 進入処理のモードを表すbit vector.下位2\,bitは,\texttt{pre}や \texttt{post}が負である場合にしか効力を発揮しない.既定値は$(00001)_2 = 1$. \begin{description} - \item[bit 0] 前後の\underline{文字への進入}を無効にするならば0,有効にするならば1. + \item[bit 0] 前後の\ActIntr{文字への進入}を無効にするならば0,有効にするならば1. \item[bit 1] 前進入許容量$B$と後進入許容量$A$が異なった場合, そのまま処理する場合は0,小さい方に揃えるならば1. \item[bit 2--4] ルビ文字の突出量から実際の前・後進入量の計算方法を指定する. @@ -186,44 +189,41 @@ plain \LuaTeX でのロードはまだサポートしておらず, \item[stretchruby=\{<left>\}\{<middle>\}\{<right>\}] 親文字の合計長が ルビ文字の合計長より長い時に,ルビ文字の前・間・後に入れる空白の割合であり, それぞれ0--7の自然数で指定する. -既定値は\ \verb+{1}{2}{1}+ である. +既定値は\>\verb+{1}{2}{1}+\>である. <left>はルビ文字の先頭までの空き量,<middle>はルビ文字間の空き量,<right>はルビ文字の末尾からの 空き量(の比)を表す.以下が例である. -\begin{LTXexample}[width=0.3\textwidth, preset=\Large] +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] \ltjruby[stretchruby=123,maxmargin=2]% {◯◯◯◯}{◆◆} \end{LTXexample} \item[stretch=\{<left>\}\{<middle>\}\{<right>\}] 行中形でルビ文字の方が長い場合,親文字の前・中・後に入れる空白の割合. -既定値は\ \verb+{1}{2}{1}+ である.それ以外の代表的な値としては,例えば次のようなものがある. +既定値は\>\verb+{1}{2}{1}+\>である.それ以外の代表的な値としては,例えば次のようなものがある. \begin{description} -\item[親文字均等割禁止] \verb+{1}{0}{1}+\ など<middle>を0にした値 +\item[親文字均等割禁止] \verb+{1}{0}{1}+\>など<middle>を0にした値 \item[前突出禁止] \verb+{0}{1}{1}+ \item[後突出禁止] \verb+{1}{1}{0}+ \end{description} \item[stretchbol=\{<left>\}\{<middle>\}\{<right>\}] 行頭形に対する\texttt{stretch}と同様の指定. -既定値は\ \verb+{0}{1}{1}+ である. +既定値は\>\verb+{0}{1}{1}+\>である. \item[stretcheol=\{<left>\}\{<middle>\}\{<right>\}] 行末形に対する\texttt{stretch}と同様の指定. -既定値は\ \verb+{1}{1}{0}+ である. +既定値は\>\verb+{1}{1}{0}+\>である. \item[maxmargin=<real>] 親文字の方がルビより長い時に,ルビの先頭と親文字の先頭,及び -ルビ末尾と親文字の末尾の間に許される最大の空白量.\textbf{親文字全角幅単位}で指定し,既定値は0.5. +ルビ末尾と親文字の末尾の間に許される最大の空白量.\emph{親文字全角幅単位}で指定し,既定値は0.5. \medskip \item[size=<real>] ルビ文字の親文字に対する大きさ.既定値は0.5. \item[intergap=<real>] ルビ文字と親文字との空きを親文字全角高さ単位で指定.既定値は0. \item[rubysmash=<bool>] ルビの高さを0にするか.既定値は偽.次が例である. -\begin{LTXexample}[width=0.3\textwidth, preset=\Large] +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] \ \vrule width 0pt height 2\zw depth 1\zw \frame{\ltjruby[rubysmash=false]{本}{ほん}}\ \frame{\ltjruby[rubysmash=true]{本}{ほん}}\ -\frame{\ltjruby[rubysmash=false,intergap=0.2] - {本}{ほん}}\ -\frame{\ltjruby[rubysmash=true,intergap=0.2] - {本}{ほん}}\ -\frame{\ltjruby[rubysmash=false,intergap=-1.5] - {本}{ほん}} +\frame{\ltjruby[rubysmash=false,intergap=0.2]{本}{ほん}}\ +\frame{\ltjruby[rubysmash=true,intergap=0.2]{本}{ほん}}\ +\frame{\ltjruby[rubysmash=false,intergap=-1.5]{本}{ほん}} \end{LTXexample} \item[ybaseheight=<real>] 非負の値が指定された場合, \emph{縦組以外での}親文字の高さを親文字全角高さの<real>倍と強制的に固定する. @@ -233,7 +233,7 @@ plain \LuaTeX でのロードはまだサポートしておらず, 既定値は$0.5$. \item[baseheight=<real>] \texttt{ybaseheight},\texttt{tbaseheight}を同時に指定したことと同義. 次の例や\autoref{fig:ruby_vertical}を参照. -\begin{LTXexample}[width=0.3\textwidth, preset=\Large] +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] \noindent \ltjruby[baseheight=0.88]{本}{ほん}\ \ltjruby[baseheight=0.88]{dvi}{ディーヴィーアイ}\\ @@ -252,7 +252,7 @@ plain \LuaTeX でのロードはまだサポートしておらず, 既定値は$0.5$. \item[rubydepth=<real>] \texttt{yrubydepth},\texttt{trubydepth}を同時に指定したことと同義. 次の例や\autoref{fig:ruby_vertical}を参照. -\begin{LTXexample}[width=0.3\textwidth, preset=\Large] +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] \noindent \ltjruby[rubydepth=0.12]{◆}{ほん}\ \ltjruby[rubydepth=0.12]{◆}{pdf}\ @@ -305,20 +305,43 @@ plain \LuaTeX でのロードはまだサポートしておらず, \item[kenten=<command>]各文字につく圏点の出力命令を指定する. - 既定値は「\verb+\textbullet+」である. + 既定値は「\cs{textbullet}」である. \item[fontcmd=<command>]ルビ用のフォント切り替え命令を指定する. このキーの内容が実行された後に\ \verb+\fontsize...\selectfont+\ が実行されるので, -このキーの指定では最後に\ \verb+\selectfont+ を加える必要はない. +このキーの指定では最後に\cs{selectfont}を加える必要はない. -この \texttt{fontcmd} キーの内容は多くの回数実行される. -例えば,\textsf{luatexja-fontspec}パッケージを用いてOpenTypeフォントを用いる場合, +この \texttt{fontcmd}キーの内容は多くの回数実行される. +例えば,\Pkg{luatexja-fontspec}パッケージを用いてOpenTypeフォントを用いる場合, \begin{lstlisting} fontcmd=\addjfontfeatures{Style=Ruby} \end{lstlisting} のようにしてルビ用字形を用いることが可能だが,現在の実装ではタイプセットに時間がかかるようになる. + \item[always\_highlight\_protrusion=<bool>] この\cs{ltjruby}命令が\Pkg{lua-ul}パッケージの提供する「下線」命令 + \footnote{\cs{underLine}, \cs{highLight},およびそのほか.}の引数に含まれていた場合, + ルビの突出部(ただし\ActIntr{文字進入部分}は除く)に「下線」がいつでも引かれるか否か. + + 既定値は偽.この場合は,突出部に「下線」が引かれるのは,ルビの前後の文字も同じ「下線」命令の有効範囲になっているときに + 限られる.\autoref{fig:always-highlight-protrusion}を参照. \end{description} +\begin{figure}[t] +\begin{LTXexample}[width=13.2\zw, preset=\large] + \ltjsetruby{stretchbol=121,stretcheol=121} + あ\highLight{\ruby{◆}{□□□□□□□□}}あ + い\highLight{\ruby{◆}{□□□□□□□□}い}\\ + \highLight{う\ruby{◆}{□□□□□□□□}}う\\\kern7\zw + あ\highLight{\ruby{◆|◆}{□□□□□|□□□□□}}あ + + \ltjsetruby{always_highlight_protrusion} + あ\highLight{\ruby{◆}{□□□□□□□□}}あ + い\highLight{\ruby{◆}{□□□□□□□□}い}\\ + \highLight{う\ruby{◆}{□□□□□□□□}}う\\\kern7\zw + あ\highLight{\ruby{◆|◆}{□□□□□|□□□□□}}あ +\end{LTXexample} + \caption{\texttt{always\_highlight\_protrusion}キー有無による組版結果の違い} + \label{fig:always-highlight-protrusion} +\end{figure} \medskip 次の2つは,以上で説明した複数のオプションを一度に設定するためのものである. @@ -337,7 +360,7 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \end{description} \paragraph{\cs{ltjsetruby}\{<option>\}} -<option>の既定値を指定する.\textsf{luatexja-ruby}読み込み時の値は +<option>の既定値を指定する.\Pkg{luatexja-ruby}読み込み時の値は 各項目の所で既に説明してあるが,次のようになっている. \begin{verbatim} pre=-1, post=-1, mode=1, @@ -346,24 +369,51 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} maxmargin=0.5, size=0.5, intergap=0, rubysmash=false, kenten=\textbullet, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5, yrubydepth=0.12, trubydepth=0.5, - intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip + intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip, + always_highlight_protrusion=false \end{verbatim} \paragraph{\cs{ltjsetparamater} に追加されるキー} \begin{description} \item[\Param{rubypreintrusion}\ttfamily =\{<chr\_code>, <pre\_int>\}] - 文字<chr\_code> に,その\textbf{直後}のルビによって掛けられるルビ文字列の最大長 - (つまり,\underline{前文字進入許容量})をルビ全角幅単位で指定. - - \textbf{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,実際の\underline{前文字進入許容量}は$a$となるが, - 文字<chr\_code>の前のJFMグルーに進入が発生した場合には,\underline{前文字進入許容量}が0でなかった場合は,の後のJFMグルーにはルビの進入は発生しない. - + 文字<chr\_code> に,その\emph{直後}のルビによって掛けられるルビ文字列の最大長 + (つまり,\ActIntr{前文字進入許容量})をルビ全角幅単位で指定. + + \emph{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,次のようになる. + \begin{itemize} + \item 実際の\ActIntr{前文字進入許容量}は$a$となる. + \item ただし,文字<chr\_code>の直前のルビによって + 文字の前のJFMグルーに進入が発生した場合,文字<chr\_code>の直後のルビの前進入は発生しない. + \end{itemize} + 後者の状況の例を以下に載せる. +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] +\ltjsetparameter{rubypreintrusion={`\【,-1}} +\ruby{鴎}{かもめ}【\ruby{隼}{はやぶさ} +% 「\ruby{鴎}{かもめ}」は,「【」直前のJFMグルーに +% ルビ半角だけ進入している +% →「\ruby{隼}{はやぶさ}」の「【」への進入はない. +\end{LTXexample} + + \item[\Param{rubypostintrusion}\ttfamily =\{<chr\_code>, <post\_int>\}] - 文字<chr\_code> に,その\textbf{直前}のルビによって掛けられるルビ文字列の最大長 - (つまり,\underline{後文字進入許容量})をルビ全角幅単位で指定. - - \textbf{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,実際の\underline{後文字進入許容量}は$a$となるが, - 実際の\underline{後文字進入量}が0でなかった場合は,文字<chr\_code>の後のJFMグルーにはルビの進入は発生しない. + 文字<chr\_code>に,その\emph{直前}のルビによって掛けられるルビ文字列の最大長 + (つまり,\ActIntr{後文字進入許容量})をルビ全角幅単位で指定. + + \emph{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,次のようになる. + \begin{itemize} + \item 実際の\ActIntr{後文字進入許容量}は$a$となる. + \item ただし,文字<chr\_code>の直前のルビによってこの文字への実際の\ActIntr{後文字進入}が + 発生した場合,文字<chr\_code>の直後のJFMグルーにはルビの前進入は発生しない. + \end{itemize} + 今回も後者の状況の例を以下に載せる. +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] +\ltjsetparameter{rubypostintrusion={`\】,-1}} +\ruby{鴎}{かもめ}】\ruby{隼}{はやぶさ}\\ +\hskip.25\zw 鴎】隼\\% 比較用 +% 「\ruby{鴎}{かもめ}」は,「】」にルビ半角だけ進入 +% →「\ruby{隼}{はやぶさ}」は「】」直前のJFMグルー +% には進入しない. +\end{LTXexample} \end{description} 以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は1である: \begin{quote} @@ -374,51 +424,51 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \end{quote} 次に,以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は0.5である: \begin{quote} - 中点類\@for\@tmp:=`\・,`\:,`\; \do{\mybox{\@tmp}} + 中点類\@for\@tmp:=`\・,`\:,`\; \do{\mybox={\@tmp}} \end{quote} また,以下の文字は\Param{rubypreintrusion}のみ初期値は$-1$である: -\begin{quote} +\begin{itemize} + \item 始め括弧類 - \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox{\@tmp}}\unskip, - 「文字コード$-1$の文字 - \footnote{段落開始の\ \cs{parindent}分インデントを表す. + \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox({\@tmp}}\unskip + \item 「文字コード$-1$の文字 + \footnote{ここでは段落開始の\ \cs{parindent}分インデントを表す. 通常の\LuaTeX-jaにおける指定では「文字コード$-1$」は文中数式境界を表していることに注意.}」 -\end{quote} +\end{itemize} さらに,以下の文字は\Param{rubypostintrusion}のみ初期値は$-1$である: -\begin{quote} - 閉じ括弧類 - \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox{\@tmp}}\unskip, - 句読点類\@for\@tmp:=`\、,`\,,`\。,`\. \do{\mybox{\@tmp}} -\end{quote} +\begin{itemize} + \item 閉じ括弧類 + \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox){\@tmp}} + \item 句読点類\@for\@tmp:=`\、,`\,,`\。,`\. \do{\mybox){\@tmp}} +\end{itemize} \makeatother 以上で記述されていない\Param{rubypreintrusion},~\Param{rubypostintrusion}の初期値はすべて0である. - \paragraph{\cs{ltjkenten}} 圏点を出力する命令であり, \begin{quote} \ttfamily\cs{ltjkenten}[<option>]\{親文字\} \end{quote} -のように使用する.複数文字に圏点をつける場合でも,\verb+\ltjruby+ のように「\texttt{|}」を使って -文字を区切る\textbf{必要はない}(\verb+\kenten+内では「\texttt{|}」は特別な意味を持たない) +のように使用する.複数文字に圏点をつける場合でも,\cs{ltjruby}のように「\texttt{|}」を使って +文字を区切る\emph{必要はない}(\cs{kenten}内では「\texttt{|}」は特別な意味を持たない) ことに注意してほしい. 圏点として出力される文字は\texttt{kenten}キーによって指定し, 圏点自身の大きさは(ルビと同様に)\texttt{size}キーで指定する. -\subsection{グループの\ruby{指|定}{し|てい}} +\subsection[グループの指定]{グループの\ruby{指|定}{し|てい}} \label{ssec:grp} \begin{quote} \ttfamily\cs{ltjruby}[<option>]\{親|文|字\}\{おや|も|じ\} \end{quote} -のように,\verb+\ltjruby+\ の第2・第3引数内の「\verb+|+」はグループの区切りを表す. +のように,\cs{ltjruby}の第2・第3引数内の「\texttt{|}」はグループの区切りを表す. グループの数は両者で一致しなければならず, \verb+\ltjruby{紋章}{もん|しよう}+ のようには\emph{できない}. 1グループのみのルビ(単純グループルビ)はグループルビとして組まれる.そのため, もしモノルビを使いたければ,面倒でも -\begin{LTXexample}[width=0.4\textwidth, preset=\Large] +\begin{LTXexample}[width=0.25\textwidth, preset=\Large] の\ltjruby{紋}{もん}\ltjruby{章}{しよう}が \end{LTXexample} のように,複数回使用すること. @@ -427,7 +477,7 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} 実際には\TeX での長さの計算誤差($2^{-16}$~ptの整数倍として計算していることによる)を考慮し, 親文字全角の$1/1000$だけルビ文字列が長くなることを許容している. }であれば, -単純グループルビの並びとして扱われる.すなわち,次ページ冒頭の2行は全くの等価となる. +単純グループルビの並びとして扱われる.すなわち,次の2行は全くの等価となる. \begin{verbatim} \ltjruby{普|通|車}{ふ|つう|しや} \ltjruby{普}{ふ}\ltjruby{通}{つう}\ltjruby{車}{しや} @@ -439,20 +489,23 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \begin{verbatim} …の\ltjruby{表|現|力}{ひよう|げん|りよく}は… \end{verbatim} -という入力からは得られる組版結果は,次のいずれかになる. -\begin{center} - \begin{tabular}{ll} +という入力からは得られる組版結果は,\autoref{tab:group_ruby}のいずれかになる. +\begin{table}[t] +\centering\small + \begin{tabular}{lll} \toprule 改行なし(行中形)&\Large …の\ltjruby{表|現|力}{ひよう|げん|りよく}は…\\ 直前で改行&\Large \vrule \ltjruby[stretch=011]{表|現|力}{ひよう|げん|りよく}は…\\ -&\Large …の\ltjruby[stretch=110]{表}{ひよう} - \vrule\ltjruby[stretch=011]{現|力}{げん|りよく}は…\\ -&\Large …の\ltjruby[stretch=110]{表|現}{ひよう|げん} - \vrule\ltjruby[stretch=011]{力}{りよく}は…\\ + 途中で改行&\Large …の\ltjruby[stretch=110]{表}{ひよう} + \vrule\ltjruby[stretch=011]{現|力}{げん|りよく}は… + &\Large …の\ltjruby[stretch=110]{表|現}{ひよう|げん} + \vrule\ltjruby[stretch=011]{力}{りよく}は…\\ 直後に改行&\Large …の\ltjruby[stretch=110]{表|現|力}{ひよう|げん|りよく}\vrule\\ \bottomrule \end{tabular} -\end{center} + \caption{可動グループルビの組まれ方(縦線は行の境目)} + \label{tab:group_ruby} +\end{table} \begin{itemize} \item これらの行分割によってペナルティは発生しない. \item 上記の例で見られるように, @@ -481,44 +534,44 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \item \cs{kenten}がすでに定義されていない場合に限り,\cs{kenten}が\cs{ltjkenten}の別名として定義される. \end{itemize} -\section{\ruby{注|意|点}{ちゆう|い|てん}} +\section[注意点]{\ruby{注|意|点}{ちゆう|い|てん}} \paragraph{前後からのルビ文字のはみ出し1} 「日本語組版処理の要件」の図117\footnote{2020-08-11版での番号.2012-04-03版では図3.82.}のように, 前後からのルビ文字のはみ出しが繋がらないようにする処理が組み込まれている. 例えば, -\begin{LTXexample}[preset=\Large,width=0.3\textwidth] +\begin{LTXexample}[preset=\Large,width=0.25\textwidth] \ltjruby{陵}{りよう}と\ltjruby{陵}{みささぎ}\\ \ltjruby{陵}{りよう}と\ltjruby[pre=1]{陵}{みささぎ} \end{LTXexample} において,1行目右側の「\ltjruby{陵}{みささぎ}」のルビが前の「と」にかかる量は次のように決まる: \begin{enumerate} -\item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の\underline{後文字進入量}は前もって知ることはでき +\item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の\ActIntr{後文字進入量}は前もって知ることはでき ない.そのため,「\ltjruby{陵}{りよう}」は行中形で組まれるものと想定し, 「\ltjruby{陵}{みささぎ}」の前文字進入許容量は \[ \underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}} --\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(行中形)}}=0.25\,\mathrm{zw} +-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\ActIntr{後文字進入量}(行中形)}}=0.25\,\mathrm{zw} \] -となる.行分割後,「\ltjruby{陵}{りよう}」の実際の\underline{後文字進入量}は +となる.行分割後,「\ltjruby{陵}{りよう}」の実際の\ActIntr{後文字進入量}は <jobname>\texttt{.ltjruby}ファイルに記述される. -\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の\underline{後文字進入量} -を用いて,「\ltjruby{陵}{みささぎ}」の\underline{前文字進入許容量}を次のように計算する: +\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の\ActIntr{後文字進入量} +を用いて,「\ltjruby{陵}{みささぎ}」の\ActIntr{前文字進入許容量}を次のように計算する: \[ \underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}} --\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}. +-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\ActIntr{後文字進入量}(from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}. \] \end{enumerate} -<jobname>\texttt{.ltjruby}ファイルに保存する際,各 \verb+\ltjruby+ 命令の呼び出しを識別するキーが必要になるが, -そのキーとしては単純に「何個目の \verb+\ltjruby+ 命令か」である. +<jobname>\texttt{.ltjruby}ファイルに保存する際,各\cs{ltjruby}命令の呼び出しを識別するキーが必要になるが, +そのキーとしては単純に「何個目の\cs{ltjruby}命令か」である. なお,以上の処理は,1行目と2行目を比較すれば分かるように, -「\ltjruby{陵}{みささぎ}」の\emph{\underline{前文字進入許容量}指定(\texttt{pre})が自動}になっている場合のみ -実施される. - +「\ltjruby{陵}{みささぎ}」の\emph{\ActIntr{前文字進入許容量}指定が自動(\texttt{pre}の値が負)}に +なっている場合のみ実施される. +\newpage \paragraph{前後からのルビ文字のはみ出し2} -また,本パッケージのv0.**以降では,「日本語組版処理の要件」にある +また,本パッケージでは,「日本語組版処理の要件」にある \begin{quote} 後ろにくる終わり括弧類,句点類若しくは読点類,又は前にくる始め括弧類には, 最大でルビ文字サイズの全角までルビ文字を掛けてもよい. @@ -533,17 +586,17 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} これは,段落の「本当の」末尾には \verb+\penalty10000\parfillskip+ があるためで, ルビ処理用に作った最後のグルー(\ref{ssec:impl}\nobreak 小節の説明では$g_2$)が消去されないことによる. -\verb+\parfillskip+ の長さ(や,場合によっては \verb+\rightskip+)を実測し, +\cs{parfillskip}(や,場合によっては\cs{rightskip})の長さを実測し, それによって処理を変えるのも可能だが,そのようなことはしなかった. -段落がルビで終わることは普通ない(最低でも句点が続くだろう)と思うからである. +段落がルビで終わることは普通ない(最低でも句点が続くだろう)と考えられるからである. \paragraph{段落先頭のルビ} 同様に,段落先頭のルビは行頭形にはならない. -\texttt{pre}が負(つまり,自動指定)のとき,段落最初の \verb+\parindent+ 分への -進入は可能である.ここ\verb+\parindent+ 分のインデントへの\underline{進入許容量}は +\texttt{pre}が負(つまり,自動指定)のとき,段落最初の\cs{parindent}分への +進入は可能である.この\cs{parindent}分のインデントへの\ActIntr{進入許容量}は 「文字$-1$」に対する\Param{rubypreintrusion}(既定値は1,ルビ全角単位)と -\ \verb+\parindent+ の長さのうち小さい方である. -\begin{LTXexample}[preset=\Large,width=0.4\textwidth] +\cs{parindent}の長さのうち小さい方である. +\begin{LTXexample}[preset=\Large,width=0.25\textwidth] \parindent1\zw\noindent 012345\par \ltjruby{陵}{みささぎ}は……\par \ltjruby{承}{うけたまわ}り……\par @@ -561,54 +614,52 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} 例えば,標準設定での中黒「・」の直後のルビからの中黒への進入許容量は \begin{quote} - 中黒「・」への\underline{前進入許容量}はルビ全角の半分で, + 中黒「・」への\ActIntr{前進入許容量}はルビ全角の半分で, 中黒本体の後の四分空きには進入可能 \end{quote} となっている.そのため,下の例の1, 2行目ともルビの前進入量は0.5\,zwとなる. しかし,2行目では詰め量の0.5\,zwがほとんど中黒周囲の四分空きで負担されるため, 実際には「中黒本体にほぼ0.5\,zwが進入する」という望ましくない結果が得られている. + \typeout{===========} \begin{LTXexample}[preset=\Large,width=0.4\textwidth] \leavevmode\hbox{あ・\ltjruby{◆}{◆◆◆◆}漢字}\\ \hbox spread-0.5\zw{あ・\ltjruby{◆}{◆◆◆◆}漢字} \end{LTXexample} -また,次の例では2行目では前後の\underline{文字進入量}がルビ1字分と等しくなっているが, -3行目のように1全角伸ばすという調整が行われた後は\underline{文字進入量}が不揃いになってしまっている. +また,次の例では2行目では前後の\ActIntr{文字進入量}がルビ1字分と等しくなっているが, +3行目のように1全角伸ばすという調整が行われた後は\ActIntr{文字進入量}が不揃いになってしまっている. これはもともと「\texttt{;}」には後側にのみ和欧文間空白が入ることと,3行目ではこの和欧文間空白が 伸びているためである. -\begin{LTXexample}[preset=\Large,width=0.4\textwidth] -\leavevmode\hbox{……に% - \ltjruby{\texttt{;}}{セミコロン}という……}\\ -\hbox spread\zw{……に% - \ltjruby{\texttt{;}}{セミコロン}という……} +\begin{LTXexample}[preset=\Large,width=0.25\textwidth] +\leavevmode\hbox{に\ltjruby{\texttt{;}}{セミコロン}という}\\ +\hbox spread\zw{に\ltjruby{\texttt{;}}{セミコロン}という} \end{LTXexample} -\newpage -\section{\ruby{実|装}{じつ|そう}について} +\section[実装について]{\ruby{実|装}{じつ|そう}について} \subsection{進入量の計算} \label{ssec:calc_intrusion} ルビ文字を自然に組んだときの幅が親文字のそれより多い場合, ルビの前後への進入量は次のように決定される. \begin{enumerate}[label=\emph{Step~\arabic*},labelindent=0pt,itemindent=*,itemsep=\medskipamount] - \item \underline{前文字進入許容量}$B_0$,\underline{後進入文字許容量}$A_0$の算出. + \item \ActIntr{前文字進入許容量}$B_0$,\ActIntr{後進入文字許容量}$A_0$の算出. ルビ全角の長さを$r$とする. \begin{enumerate} - \item \texttt{pre}の指定値が非負であった場合は,それに$r$を掛けたものを$B_0$とする.\\ + \item \texttt{pre}の指定値が非負であった場合は,それに$r$を掛けたものを$B_0$とする. + そうでなかった場合は,「ルビの直前の文字」に対する - \Param{rubypreintrusion}の値に$r$を掛けたものを$B_0$とする + \Param{rubypreintrusion}の絶対値に$r$を掛けたものを$B_0$とする \footnote{% なお,「ルビの直前の文字」が段落最初の\cs{parindent}分のインデントであった場合, $B_0$を,「文字コード$-1$の文字」\Param{rubypreintrusion}の値に$r$を掛けた値と\cs{parindent}のうち 小さい方とする. - }. + }.ここで,もし2つ前の文字がルビで,その直後(つまりいま処理しているルビから見れば直前) + の文字へ$a'$だけの進入があった場合,現在のルビについて$B_0←\min(0,B_0-a')$とする. \item \texttt{post}の指定値が非負であった場合は,それに$r$を掛けたものを$A_0$とする.\\ そうでなかった場合は,「ルビの直後の文字」に対する - \Param{rubypostintrusion}の値にルビ全角の値を掛けたものを$A_0$とする. - \item \texttt{mode}の最下位ビット(bit~0)が0であった場合は,$B_0\leftarrow 0$, $A\leftarrow 0$とする. - \item もし2つ前の文字がルビで,その直後(つまりいま処理しているルビから見れば直前) - の文字へ$a'$だけの進入があった場合,現在のルビについて$B_0←\min(0,B_0-a')$とする. + \Param{rubypostintrusion}の絶対値にルビ全角の値を掛けたものを$A_0$とする. + \item \texttt{mode}の最下位ビット(bit~0)が0であった場合は,$B_0\leftarrow 0$, $A_0\leftarrow 0$とする. \end{enumerate} \item 前進入許容量$B$,後進入許容量$A$の算出. \begin{enumerate} @@ -624,8 +675,8 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} それぞれ$g$の自然長を$B$に加算する. ルビとその直後の文字との間に和文処理グルーが挿入された場合も同様である. - - \item \texttt{mode}の2番目のビット(bit~1)が0であった場合は,$B$,~$A\leftarrow \min(B,A)$とする. + + \item \texttt{mode}の2番目のビット(bit~1)が1であった場合は,$B$,~$A\leftarrow \min(B,A)$とする. \end{enumerate} \item 実際の前進入量$b$,後進入量$a$の計算. @@ -704,21 +755,28 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \end{LTXexample} \begin{enumerate} -\item \verb|\ltjruby|コマンド自体は,一旦次のnode listを値とするwhatsit~$W$を作って, -現在の水平リストへと挿入する(必要ならば\verb|\leavevmode|も実行): +\item \cs{ltjruby}命令自体は,一旦次のnode listを値とするwhatsit~$W$を作って, +現在の水平リストへと挿入する(必要ならば\cs{leavevmode}も実行): \[ \Node{whatsit $w$}{value: 2}\longrightarrow \Node{hlist $s_1$}{「りゆう」}\longrightarrow \Node{hlist $p_1$}{「流」}\longrightarrow \Node{hlist $s_2$}{「ちよう」}\longrightarrow - \Node{hlist $p_2$}{「暢」} + \Node{hlist $p_2$}{「暢」}\longrightarrow + \Node{kern $k_b$}{}\longrightarrow + \Node{kern $k_a$}{} \] ここで,最初の$w$の値2は,ルビが2つのパーツ「\ltjruby{流}{りゆう}」「\ltjruby{暢}{ちよう}」からなっていることを 表している.この値を$\mathit{cmp}$とおこう. $s_i$達の中の文字は既にルビの大きさである. + +また,$k_b$,~$k_a$は\texttt{always\_highlight\_protrusion}キーが偽の場合にのみ生成されるが, +実際に使われるのは行分割後になってからである.\Pkg{lua-ul}対応のためには,和文処理グルーの挿入処理で +「前・後のクラスタそれぞれとのattributeの共通部分」を保存する必要があり,この段階でノードとして$k_b$,~$k_a$を +準備している. \item \LuaTeX-jaの和文処理グルー挿入処理において, このwhatsit~$W$はまとめて -「先頭が『流』,最後が『暢』であるようなhboxを \verb|\unhbox| で展開したもの」と扱われる. +「先頭が『流』,最後が『暢』であるようなhboxを\cs{unhbox}で展開したもの」と扱われる. 言い換えれば,ルビ部分を無視した単なる「流暢」という和文文字の並びとして扱われる\footnote{「流」「暢」の間のグルーは既に入っている,と扱われる.}. 次のサンプルを参照 \begin{LTXexample}[preset=\Large] @@ -729,7 +787,10 @@ $s_i$達の中の文字は既にルビの大きさである. \end{LTXexample} \item 和文処理グルーの挿入が終わった後で,可動グループルビのためのノードの挿入に入る. \begin{enumerate} -\item $W$の前後に$2\mathit{cmp}+1=5$個のノードが挿入され,$W$の周辺は次のようなノード列になる. +\item $W$の前後に$2\mathit{cmp}+1=5$個のノードが挿入され,$W$の周辺は次のようなノード列になる + \footnote{% + $r_2$と$g_2$の間には,ルビと直後の文字の間にある禁則処理のためのペナルティなどが入っているかもしれない. + }. \begin{align*} (\text{other nodes})&\longrightarrow \Node{glue $g_0$}{}\longrightarrow \Node{whatsit~$W$}{元からある}\longrightarrow \Node{rule $r_1$}{} @@ -743,14 +804,14 @@ $s_i$達の中の文字は既にルビの大きさである. \begin{gather*} (\text{other nodes})\longrightarrow \Node{glue $g_0$}{}\longrightarrow \Node{whatsit~$W$}{元からある}\longrightarrow \Node{rule $r_1$}{}\\ -\noalign{\hrulefill 行の境目\hrulefill} +\noalign{\leavevmode\hskip 2\zw\hrulefill 行の境目\hrulefill\kern 2\zw\null} \Node{rule $r_2$}{}\longrightarrow \Node{glue $g_2$}{}\longrightarrow (\text{other nodes}) \end{gather*} のようになったとしたら,「\ltjruby{流}{りゆう}」「\ltjruby{暢}{ちよう}」の間で行分割が起きた,ということがわかり, $g_i$,~$r_i$達のノードを適切に置き換えればよい(後で詳しく説明する). -\begin{figure}\centering\small +\begin{table}\centering\small \begin{tabular}{cllll} \toprule \multicolumn{1}{c}{\bf ノード}&\multicolumn{1}{c}{\bf 組み方}&\multicolumn{1}{c}{\bf サンプル}% @@ -766,16 +827,16 @@ $n_2$&行末2グループ& \fbox{を}{\color{blue!50!black}\gt\ltjruby[pre=1,mode=1,stretch=110]{流|暢}{りゆう|ちよう}}\vrule & $g_0\rightarrow W\rightarrow r_1\rightarrow g_2 \rightarrow r_2$\\ -$n_3$&行頭1グループ& -\Large -\vrule{\color{blue!50!black}\gt\ltjruby[post=1,mode=1,stretch=011]{暢}{ちよう}}\fbox{に} -& -$r_2\rightarrow g_2$\\ -$n_4$&行頭2グループ& +$n_3$&行頭2グループ& \Large \vrule{\color{blue!50!black}\gt\ltjruby[post=1,mode=1,stretch=011]{流|暢}{りゆう|ちよう}}\fbox{に} & $W\rightarrow r_1\rightarrow g_2 \rightarrow r_2\rightarrow g_2$\\ +$n_4$&行頭1グループ& +\Large +\vrule{\color{blue!50!black}\gt\ltjruby[post=1,mode=1,stretch=011]{暢}{ちよう}}\fbox{に} +& +$r_2\rightarrow g_2$\\ $n_5$&行中& \Large \fbox{を}{\color{blue!50!black}\gt\ltjruby[post=0.5,pre=0.5,mode=1]{流|暢}{りゆう|ちよう}}\fbox{に} @@ -785,32 +846,31 @@ $g_0\rightarrow W\rightarrow r_1\rightarrow g_2 \rightarrow r_2\rightarrow g_2$\ \bottomrule \end{tabular} \caption{ルビの組み方と対応するノード並び} -\label{fig:node} -\end{figure} +\label{tab:node} +\end{table} \item なお,$r_i$達の高さ・深さは組み上がった後のそれである. -$g_i$,~$r_i$達の幅は,図\nobreak\ref{fig:node}に示したような対応に沿って算出する. -例えばこの場合,行中形$n_5$に対して +$g_i$,~$r_i$達の幅は,\autoref{tab:node}に示したような対応に沿って算出する. +例えば,行中形$n_5$に対して,記号は乱用気味であるが, \[ g_0+r_1+g_2+r_2+g_2 = (3-0.25\times 2)\,\mathrm{zw}=2.5\,\mathrm{zw} \] -という方程式が立つ(zwは親文字全角の幅,進入量込). -$n_1$から$n_5$まで計5本の方程式が立つが,これらはGau\ss の消去法で解くことができて -$g_i$,~$r_i$達の幅が求まる. +という方程式が立つ(zwは親文字全角の幅,引き算は進入量の分). +方程式と未知数($g_i$,~$r_i$達の幅)はどちらも$2\mathit{cmp}+1$であるので, +Gau\ss の消去法により$g_i$,~$r_i$達の幅が求まる. \item また,ルビ処理を統括しているwhatsit~$W$の値も -\[ - \Node{whatsit $w$}{value: 2}\longrightarrow - \Node{vlist $n_1$}{末1}\longrightarrow - \Node{vlist $n_2$}{末2}\longrightarrow - \Node{vlist $n_3$}{頭1}\longrightarrow - \Node{vlist $n_4$}{頭2}\longrightarrow - \Node{vlist $n_5$}{中} -\] +\begin{align*} + \Node{whatsit $w$}{value: 2} + &\longrightarrow\Node{vlist $n_1$}{末1}\longrightarrow\Node{vlist $n_2$}{末2} + \longrightarrow\Node{vlist $n_3$}{頭2}\longrightarrow\Node{vlist $n_4$}{頭1} + \longrightarrow\Node{vlist $n_5$}{中}\\ + &\longrightarrow\Node{kern $k_b$}{}\longrightarrow\Node{kern $k_a$}{} +\end{align*} に置き換えておく. \end{enumerate} -\item \LuaTeX の行分割処理を普通に行う. +\item \LuaTeX の行分割処理を通常通りに行う. \item 行分割の結果に従って,$g_i$,~$r_i$達を適切に置換する. 例えば行分割の結果 @@ -818,7 +878,7 @@ $g_i$,~$r_i$達の幅が求まる. (\text{other nodes})\longrightarrow \Node{glue $g_0$}{}\longrightarrow \Node{whatsit~$W$}{元からある}\longrightarrow \Node{rule $r_1$}{} \tag{行A}\\ -\noalign{\hrulefill 行の境目\hrulefill} +\noalign{\leavevmode\hskip 2\zw\hrulefill 行の境目\hrulefill\kern 2\zw\null} \Node{rule $r_2$}{}\longrightarrow \Node{glue $g_2$}{}\longrightarrow (\text{other nodes})\tag{行B} \end{gather*} @@ -833,25 +893,32 @@ $g_i$,~$r_i$達の幅が求まる. $g_0$,~($W$,)~$r_1$というノードの並びは,「行末1グループ」$n_1$に対応しているので, $g_0$,~$r_1$を行Aから除去・メモリ解放し,代わりに$n_1$を行Aの中身に追加する. +\item +\texttt{always\_highlight\_protrusion}キーが偽であり,かつルビの前への突出量から\ActIntr{前文字進入量}を引いた値 + $\mathit{prot\_b}$が0でない場合は,$n_1$の直前にkern~$k_b$(長さ$\mathit{prot\_b}$)と,それを打ち消すkern(長さ$-\mathit{prot\_b}$)を挿入する. + \item 次に行Bの処理にうつる.行Aでルビの処理は完了していない(2グループのルビなのにまだ1グループしか使っていない)ので, 「whatsit~$W$由来」のノードがいくつか行B内に残っているはずである. -案の定,$r_2$,~$g_2$というノード列が見つかった.これは「行頭1グループ」$n_3$に対応しているので, -$r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行Bの中身に挿入する. - +案の定,$r_2$,~$g_2$というノード列が見つかった.これは「行頭1グループ」$n_4$に対応しているので, +$r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_4$を行Bの中身に挿入する. +\texttt{always\_highlight\_protrusion}キーが偽であったときは,行Aのときと同様にkernを2つ挿入する. + \item これで2グループとも使い切ったことになるので, 隔離しておいた$W$を,(使われなかった$n_2$,~$n_4$,~$n_5$などと共に)メモリ解放する.結果として -次のようになった: +次のようになる. \begin{gather*} - (\text{other nodes})\longrightarrow - \Node{vlist $n_1$}{末1}\tag{行A}\\ -\noalign{\hrulefill 行の境目\hrulefill} -\Node{vlist $n_3$}{頭1}\longrightarrow (\text{other nodes})\tag{行B} + (\text{other nodes})\longrightarrow \Node{kern~$k_b$}{$\mathit{prot\_b}$} + \longrightarrow \Node*{kern}{$-\mathit{prot\_b}$}\longrightarrow \Node*{vlist $n_1$}{末1}\tag{行A}\\ +\noalign{\leavevmode\hskip 2\zw\hrulefill 行の境目\hrulefill\kern 2\zw\null} +\Node*{vlist $n_4$}{頭1}\longrightarrow \Node*{kern}{$-\mathit{prot\_a}$} + \longrightarrow \Node{kern~$k_a$}{$\mathit{prot\_a}$}\longrightarrow (\text{other nodes})\tag{行B} \end{gather*} + ここで,色付きの4ノードは,\Pkg{lua-ul}パッケージの提供する「下線」命令が + \cs{ltjruby}のみを有効範囲として発行された場合の,「下線」がかかってくるノードたちである. \end{enumerate} \end{enumerate} -\newpage \section{いくつかの例} \def\rubytest{\ruby{黄金橋}{ゴールデンゲートブリッジ}\relax} @@ -949,7 +1016,6 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B \item[肩つき] {\ltjsetruby{kata}\sample} \end{description} -\newpage \begin{LTXexample}[pos=t] {\ltjsetruby{stretch=101}% 親文字均等割り禁止 \ruby{休|憩|中}{きゆう|けい|ちゆう}かつ\ruby{視|聴|中}{し|ちよう|ちゆう}% @@ -961,7 +1027,6 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B \end{LTXexample} -\typeout{AAAAAA} \setbox0=\vbox{\hsize20\zw \ltjsetparameter{rubypreintrusion={`◆,1}} \ltjsetparameter{rubypostintrusion={`◆,1}} @@ -1005,6 +1070,18 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B } \fbox{\box0} +\medskip +\begin{LTXexample}[pos=t] +% lua-ul +たとえば\strikeThrough{\ruby{取|消|線}{とりけしの|いちじゆう|せん}を}引いてみる. +\strikeThrough{\ruby{取|消|線}{とりけしの|いちじゆう|せん}}だとどうかな + +\ltjsetparameter{prebreakpenalty={`な,2893}}% デバッグ用.あっても正常動作を確認. +\highLight{周囲が}\ruby{aaaaaaaaaaa}{全く}\highLight{ない} +ああああああああああああああああああああああああああ +周囲が\highLight{\ruby{あ|い|う|え}{おそらく|きっと|たぶん|maybe}}ないと思う +\end{LTXexample} + \newpage \section{『日本語組版処理の要件』20120403の例} @@ -1053,7 +1130,6 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B \obeylines 3.62 の\ruby{葯}{やく}に 3.63 版面の\ruby{地}{ち}に\quad 版面の\ruby[kata]{地}{ち}に -% 横組肩つきはしないが,現状では縦組未サポートだし,仕方ないね 3.65 の\ruby{砦}{とりで}に {\ltjsetruby{kata}% 3.66上 の\ruby{旬}{しゆん}に\quad 後\ruby{旬}{しゆん}に @@ -1094,29 +1170,32 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B の\ruby{成|就}{じよう|じゆ}を\quad の\ruby{紋|章}{もん|しよう}を\quad% の\ruby{象|徴}{しよう|ちよう}を} % モノルビ配置.望ましくない -3.76× の\ruby{流}{りゆう}\ruby{儀}{ぎ}を\quad の\ruby{無}{む}\ruby{常}{じよう}を\quad% - -3.77 {\ltjsetruby{stretchbol=121, stretcheol=121}% 行頭・行末揃えず - \hbox{\vrule\vbox{\hsize=10\zw\noindent\kern.75\zw - あああああああの\ruby{流|儀}{りゆう|ぎ}がある.}\vrule}\quad% +3.76× の\ruby{流}{りゆう}\ruby{儀}{ぎ}を\quad の\ruby{無}{む}\ruby{常}{じよう}を +3.77 {\ltjsetruby{stretchbol=121, stretcheol=121}% 行頭・行末揃えず + \hbox{\vrule\vbox{\hsize=5.25\zw ……等を\ruby{流|儀}{りゆう|ぎ}が}\vrule}\quad% \hbox{\vrule\vbox{\hsize=5\zw ……等の\ruby{無|常}{む|じよう}を}\vrule}} \end{LTXexample} \paragraph{3.3.8節 ルビはみ出し}\ \begin{LTXexample}[pos=t] -\obeylines +\obeylines\RULER{3.78}{4} 3.78 \ruby{人}{ひと}は\ruby{死}{し}して\ruby{名}{な}を\ruby{残}{のこ}す 3.79 漢字の部首には\ruby{偏}{へん}・\ruby{冠}{かんむり}・\ruby{脚}{きやく}・% \ruby{旁}{つくり}がある +3.79 {\ltjsetparameter{rubypreintrusion={`\,,1}}% +漢字の部首には\ruby{偏}{へん},\ruby{冠}{かんむり},\ruby{脚}{きやく},% +\ruby{旁}{つくり}がある} +% 上が『要件』にある例.標準(下)では句読点の直前にはルビがかからない. 3.79 漢字の部首には\ruby{偏}{へん},\ruby{冠}{かんむり},\ruby{脚}{きやく},% - \ruby{旁}{つくり}がある +\ruby{旁}{つくり}がある \end{LTXexample} \begin{LTXexample}[pos=t] -\obeylines +\obeylines\RULER{3.79}{9} 3.79 この\ruby{\噂}{うわさ}の好きな人は\ruby{懐}{ふところ}ぐあいもよく、\ruby{檜}{ひのき}を 3.80 漢字の部首には「\ruby{偏}{へん}」「\ruby{冠}{かんむり}」「\ruby{脚}{きやく}」% 「\ruby{旁}{つくり}」がある -3.80 この\ruby{\噂}{うわさ}好きな人は\ruby{懐}{ふところ}具合もよく、\ruby{檜}{ひのき}材を +3.80 {\ltjsetparameter{rubypreintrusion={`\,,1}}% +この\ruby{\噂}{うわさ}好きな人は\ruby{懐}{ふところ}具合もよく、\ruby{檜}{ひのき}材を} 3.81× に\ruby{暁}{あかつき}の\kern-1\zw の\ruby{趣}{おもむき}を(良くない例) 3.82 に\ruby{暁}{あかつき}の\ruby{趣}{おもむき}を diff --git a/macros/luatex/generic/luatexja/doc/luatexja.dtx b/macros/luatex/generic/luatexja/doc/luatexja.dtx index b550dc58d4..9ad5209465 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja.dtx +++ b/macros/luatex/generic/luatexja/doc/luatexja.dtx @@ -1467,14 +1467,19 @@ Alphabetic fonts &\cs{fontspec}&\cs{setmainfont}&\cs{setsansfont}&\cs{setmonofont}\\ \midrule Japanese fonts -&\cs{newjfontfamily}&\cs{renewjfontfamily}&\cs{setjfontfamily}\\ +&\cs{newjfontfamily}&\cs{renewjfontfamily}&\cs{setjfontfamily}&\cs{providejfontfamily}\\ Alphabetic fonts -&\cs{newfontfamily}&\cs{renewfontfamily}&\cs{setfontfamily}\\ +&\cs{newfontfamily}&\cs{renewfontfamily}&\cs{setfontfamily}&\cs{providefontfamily}\\ \midrule Japanese fonts -&\cs{newjfontface}&\cs{defaultjfontfeatures}&\cs{addjfontfeatures}\\ +&\cs{newjfontface}&\cs{renewjfontface}&\cs{setjfontface}&\cs{providejfontface}\\ Alphabetic fonts -&\cs{newfontface}&\cs{defaultfontfeatures}&\cs{addfontfeatures}\\ +&\cs{newfontface}&\cs{renewfontface}&\cs{setfontface}&\cs{providefontface}\\ +\midrule +Japanese fonts +&\cs{defaultjfontfeatures}&\cs{addjfontfeatures}\\ +Alphabetic fonts +&\cs{defaultfontfeatures}&\cs{addfontfeatures}\\ \bottomrule \end{tabular}\par} \end{table} @@ -1492,14 +1497,19 @@ Alphabetic fonts &\cs{fontspec}&\cs{setmainfont}&\cs{setsansfont}&\cs{setmonofont}\\ \midrule \emph{和文} -&\cs{newjfontfamily}&\cs{renewjfontfamily}&\cs{setjfontfamily}\\ +&\cs{newjfontfamily}&\cs{renewjfontfamily}&\cs{setjfontfamily}&\cs{providejfontfamily}\\ +\emph{欧文} +&\cs{newfontfamily}&\cs{renewfontfamily}&\cs{setfontfamily}&\cs{providefontfamily}\\ +\midrule +\emph{和文} +&\cs{newjfontface}&\cs{renewjfontface}&\cs{setjfontface}&\cs{providejfontface}\\ \emph{欧文} -&\cs{newfontfamily}&\cs{renewfontfamily}&\cs{setfontfamily}\\ +&\cs{newfontface}&\cs{renewfontface}&\cs{setfontface}&\cs{providefontface}\\ \midrule \emph{和文} -&\cs{newjfontface}&\cs{defaultjfontfeatures}&\cs{addjfontfeatures}\\ +&\cs{defaultjfontfeatures}&\cs{addjfontfeatures}\\ \emph{欧文} -&\cs{newfontface}&\cs{defaultfontfeatures}&\cs{addfontfeatures}\\ +&\cs{defaultfontfeatures}&\cs{addfontfeatures}\\ \bottomrule \end{tabular}\par} \end{table} @@ -7833,7 +7843,7 @@ stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50} さらに,バージョン20220211.0以降では次の命令が提供される. \begin{cslist} - \item[\cs{ltjghostbeginjachar}] + \item[\cs{ltjghostbeforejachar}] \LuaTeX-ja本体が提供している\cs{ltjfakeparbegin}, \cs{ltjfakeboxbdd}と類似の命令である. 実行された箇所が(限定・非限定を問わず)水平モードであった場合に,実行された箇所は 「文字クラス0の\textbf{JAchar}」の直前であると, @@ -7850,7 +7860,7 @@ A\LG 字 \par% ==> ALchar--(xkanjiskip)--\LG \end{LTXexample} \item[\cs{ltjghostafterjachar}] - \cs{ltjghostbeginjachar}と対を成す命令で,実行された箇所は + \cs{ltjghostbeforejachar}と対を成す命令で,実行された箇所は 「文字クラス0の\textbf{JAchar}」の直後であると, \LuaTeX-jaの和文処理グルー挿入処理に認識させる.以下の実行例を参照. diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty index 76ebf8716c..6ef3ff1751 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-fontspec-27c}[2024-02-19 fontspec support of LuaTeX-ja] +\ProvidesPackage{luatexja-fontspec-27c}[2024-05-27 fontspec support of LuaTeX-ja] \RequirePackage{l3keys2e} \ExplSyntaxOn @@ -359,10 +359,24 @@ \setfontfamily #1 [#2,#4] {#3} \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn } +\DeclareDocumentCommand \providejfontfamily { m O{} m O{} } { + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn + \providefontfamily #1 [#2,#4] {#3} + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn +} \DeclareDocumentCommand \newjfontface { m O{} m O{} } { \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } +\DeclareDocumentCommand \renewjfontface { m O{} m O{} } { + \renewjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} +\DeclareDocumentCommand \setjfontface { m O{} m O{} } { + \setjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} +\DeclareDocumentCommand \providejfontface { m O{} m O{} } { + \providejfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} \prop_new:N \l__ltj_fontspec_tmp_prop \prop_new:N \g__ltj_fontspec_fontopts_prop diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29c.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29c.sty index 1415cee127..51af33447c 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29c.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29c.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-fontspec-29c}[2024-05-05 fontspec support of LuaTeX-ja] +\ProvidesPackage{luatexja-fontspec-29c}[2024-05-27 fontspec support of LuaTeX-ja] \RequirePackage{l3keys2e} \ExplSyntaxOn @@ -359,10 +359,24 @@ \setfontfamily #1 [#2,#4] {#3} \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn } +\DeclareDocumentCommand \providejfontfamily { m O{} m O{} } { + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn + \providefontfamily #1 [#2,#4] {#3} + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn +} \DeclareDocumentCommand \newjfontface { m O{} m O{} } { \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } +\DeclareDocumentCommand \renewjfontface { m O{} m O{} } { + \renewjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} +\DeclareDocumentCommand \setjfontface { m O{} m O{} } { + \setjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} +\DeclareDocumentCommand \providejfontface { m O{} m O{} } { + \providejfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} \prop_new:N \l__ltj_fontspec_tmp_prop \prop_new:N \g__ltj_fontspec_fontopts_prop diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29e.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29e.sty index e763d91ad7..02a79ad6ca 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29e.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-29e.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-fontspec-29e}[2024-05-14 fontspec support of LuaTeX-ja] +\ProvidesPackage{luatexja-fontspec-29e}[2024-05-27 fontspec support of LuaTeX-ja] \RequirePackage{l3keys2e} \ExplSyntaxOn @@ -359,10 +359,24 @@ \setfontfamily #1 [#2,#4] {#3} \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn } +\DeclareDocumentCommand \providejfontfamily { m O{} m O{} } { + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn + \providefontfamily #1 [#2,#4] {#3} + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn +} \DeclareDocumentCommand \newjfontface { m O{} m O{} } { \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } +\DeclareDocumentCommand \renewjfontface { m O{} m O{} } { + \renewjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} +\DeclareDocumentCommand \setjfontface { m O{} m O{} } { + \setjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} +\DeclareDocumentCommand \providejfontface { m O{} m O{} } { + \providejfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} \prop_new:N \l__ltj_fontspec_tmp_prop \prop_new:N \g__ltj_fontspec_fontopts_prop diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty index d0d8e5488d..4c64b27d14 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty @@ -4,7 +4,7 @@ % LaTeX only! \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-ruby}[2023-10-08 v0.62] +\ProvidesPackage{luatexja-ruby}[2024-09-09 v0.7] \RequirePackage{luatexja} %%------------------ @@ -18,9 +18,9 @@ %% 引数:ルビ全角を単位とした実数 %% この文字への pre-, post-intrusion の許容量 \define@key[ltj]{japaram}{rubypreintrusion}{% - \ltj@@set@stack@real{RIPRE}{-0x7FFFFFFF}{0x7FFFFFFF}#1 } + \ltj@@set@stack@real{RIPRE}{-0x7FFFFFFF}{0x7FFFFFFF}#1\relax} \define@key[ltj]{japaram}{rubypostintrusion}{% - \ltj@@set@stack@real{RIPOST}{-0x7FFFFFFF}{0x7FFFFFFF}#1 } + \ltj@@set@stack@real{RIPOST}{-0x7FFFFFFF}{0x7FFFFFFF}#1\relax} \def\ltj@@set@stack@real#1#2#3{% \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1, #2, #3, token.scan_word)}} @@ -29,7 +29,6 @@ \def\ltj@@rkeydef#1{ \define@key[ltj]{ruby}{#1}{\expandafter\def\csname ltj@@rubyip@#1\endcsname{##1}} } -%% attr_ruby_mode %% bit 0: intrusion を有効にするか(1: 有効) %% bit 1: 前後の intrusion 許容量を小さい方に揃える (1: yes) %% bit 2--4: intrusion をどう使って親文字を配置するか @@ -42,10 +41,10 @@ %% ※ 01--100 で,intrusion で賄えきれなかった場合はいつものように伸長する. %% bit 5: 熟語ルビの際の処理方法(0: 常にグループ,1: 可能な限りブロックごとに) %% ↑bit 5 は今は無効 +%% bit 6: 突出部分について lua-ul 有効範囲から除外する処理するか \ltj@@rkeydef{mode} %% intrusion 量強制固定(bit 0, bit 1 より優先,負数で「自動」) %% attr は sp 単位だが,ユーザーはルビ全角単位で指定する -%% attr_ruby_maxprep, attr_ruby_maxpostp \ltj@@rkeydef{pre} \ltj@@rkeydef{post} %% 親文字伸長の際の比,{0}{1}{1} などと0--7 の数 3 つで指定 @@ -54,14 +53,11 @@ \ltj@@rkeydef{stretcheol} % 行末形 \ltj@@rkeydef{stretch} % 行中形 %% ルビが伸長するときの比 {1}{2}{1} などと0--7 の数 3 つで指定 -%% attr_ruby_mode 上位部分 \ltj@@rkeydef{stretchruby} %% ルビ<親のとき,ルビと親文字の端の最大値 -%% attr_ruby_maxmargin %% attr は sp 単位だが,ユーザーは親文字全角単位で指定 \ltj@@rkeydef{maxmargin} %% ルビと親文字の垂直方向の空き -%% attr_ruby_intergap %% attr は sp 単位だが,ユーザーは親文字全角単位で指定 \ltj@@rkeydef{intergap} @@ -92,6 +88,7 @@ \define@boolkey[ltj]{ruby}{intrude_xkanjiskip}[true]{} \define@boolkey[ltj]{ruby}{intrude_kanjiskip}[true]{} +\define@boolkey[ltj]{ruby}{always_highlight_protrusion}[true]{} %%%%%%%% setkeys の別名 \protected\def\ltjsetruby{\setkeys[ltj]{ruby}} @@ -141,7 +138,8 @@ [luatexja.icflag_table.XKANJI_SKIP]=true, [luatexja.icflag_table.XKANJI_SKIP_JFM]=true, \fi - \string} + \string}, + quirk_protrusion = \ifltj@ruby@always_highlight_protrusion false \else true \fi \string} } \egroup @@ -264,7 +262,7 @@ kenten=\textbullet, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5, yrubydepth=0.12, trubydepth=0.5, intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip, - epsilon=0.0001, + epsilon=0.0001, always_highlight_protrusion=false, } \endinput diff --git a/macros/luatex/generic/luatexja/src/lltjext.sty b/macros/luatex/generic/luatexja/src/lltjext.sty index a83c9305c9..aebdc3987c 100644 --- a/macros/luatex/generic/luatexja/src/lltjext.sty +++ b/macros/luatex/generic/luatexja/src/lltjext.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjext}[2022-08-24 v1.2k-ltj-14 Macros for vertical writing] +\ProvidesPackage{lltjext}[2024-07-23 v1.2k-ltj-16 Macros for vertical writing] \RequirePackage{luatexja} \newcount\ltj@ext@dir \let\ltj@lltjext@orig@tabular=\tabular @@ -27,7 +27,7 @@ \def\p@stabular<#1>#2{% \setlength\dimen@{#2}% \edef\@halignto{to\the\dimen@}\p@tabular<#1>} -\def\p@tabular<#1>{\leavevmode \hbox \bgroup +\def\p@tabular<#1>{\leavevmode\null \hbox \bgroup % fixed for unwanted xkanjiskip \ltj@ext@dir=\ltjgetparameter{direction}\relax $\let\@acol\@tabacol \let\@classz\@tabclassz @@ -78,7 +78,7 @@ \ifhmode \@preamerr\z@ \@@par\fi \@preamble} \def\endarray{\crcr\egroup\egroup\@end@alignbox} -\def\endtabular{\endarray$\egroup} +\def\endtabular{\endarray$\egroup\null} \expandafter \let \csname endtabular*\endcsname = \endtabular % ↓中身\周囲→ yoko tate utod dtou % yoko A* B* B B @@ -541,17 +541,11 @@ \else \let\box@dir\utod \fi \fi -\ifltj@ltfilehook@avail % LaTeX2e >= 2020-10-01 \@defaultunitsset\@picht{#3}\unitlength \@defaultunitsset\@picwd{#2}\unitlength \setbox\@picbox\hbox to\@picwd\bgroup\box@dir \@defaultunitsset\@tempdimc{#4}\unitlength\hskip-\@tempdimc \@defaultunitsset\@tempdimc{#5}\unitlength\lower\@tempdimc\hbox\bgroup -\else % <= 2020-02-02 - \@picwd=#2\unitlength \@picht=#3\unitlength - \setbox\@picbox\hbox to\@picwd\bgroup\box@dir - \hskip-#4\unitlength\lower#5\unitlength\hbox\bgroup -\fi \ltj@@pic@reset@blshift \ignorespaces} \def\endpicture{% @@ -675,6 +669,7 @@ %% Compatibility with array package +\ExplSyntaxOn \def\ltj@lltjext@patch@array{% \patchcmd{\@tabular}{\hbox\bgroup}{% \hbox\bgroup\ltj@ext@dir=\ltjgetparameter{direction}\relax}{}{} @@ -682,10 +677,6 @@ {\ltj@ext@dir=\ltjgetparameter{direction}\relax}{}{} \expandafter\let\csname tabular*\endcsname=\ltj@lltjext@orig@tabularS \patchcmd{\p@stabular}{\p@tabular}{\@tabular}{}{} - \@ifpackagelater{array}{2018/09/13} - {\expandafter\@firstoftwo} - {\expandafter\@secondoftwo} - {% = for 2018/09/13 v2.4i or newer \def\@startpbox##1{\bgroup \color@begingroup \box@dir\adjustbaseline%%% これを追加 @@ -694,16 +685,8 @@ \vrule \@height \ltjgetht\@arstrutbox \@width \z@ \everypar{}}% }% - }{ % = for 2018/04/30 v2.4h or older - \def\@startpbox##1{\bgroup - \box@dir\adjustbaseline%%% これを追加 - \setlength\hsize{##1}\@arrayparboxrestore - \everypar{% - \vrule \@height \ltjgetht\@arstrutbox \@width \z@ - \everypar{}}% - }% - }% \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}} +\ifcsname tbl_save_outer_table_cols:\endcsname %%%%%% >=2024-06-01 \def\p@array<##1>[##2]##3{% \ifnum\ltj@ext@dir=0 \ltj@ext@dir=\ltjgetparameter{direction}\relax\fi \let\box@dir\relax @@ -736,20 +719,98 @@ \@depth \arraystretch \ltjgetdp \@tempcnta \@width \z@}% \fork@array@option<##1>[##2]% + \tbl_save_outer_table_cols: \begingroup \@mkpream{##3}% - \xdef\@preamble{\noexpand\ialign \noexpand \@halignto - \bgroup \tabskip \z@skip \@arstrut \@preamble - \tabskip \z@ \cr}% + \tbl_count_table_cols: + \xdef\@preamble{ + \noexpand\ar@ialign + \@halignto + \bgroup \@arstrut + \UseTaggingSocket{tbl/row/begin} + \tbl_init_cell_data_for_row: + \@preamble + \tabskip \z@ \cr}% \endgroup \@arrayleft - \@begin@alignbox\bgroup\box@dir\adjustbaseline - \let\par\@empty - \let\@sharp####\let\protect\relax - \let\\\@arraycr\let\tabularnewline\\\let\par\@empty - \lineskip\z@skip\baselineskip\z@skip\@preamble} - \def\endarray{\crcr\egroup\egroup\@end@alignbox\@arrayright} + \@begin@alignbox + \bgroup + \box@dir\adjustbaseline + \let\@sharp####\let\protect\relax + \lineskip \z@ + \baselineskip \z@ + \mathsurround \z@ + \let\\\@arraycr \let\tabularnewline\\\let\par\@empty + \UseTaggingSocket{tbl/init} + \@preamble + } + \def\endtabular{\endarray$\egroup + \UseTaggingSocket {tbl/hmode/end}\null} + \def\endarray{ + \tbl_crcr:n{endarray} \egroup + \UseTaggingSocket{tbl/finalize} + \tbl_restore_outer_cell_data: + \egroup\@end@alignbox + \@arrayright \gdef\@preamble{}% + } +\else %%%%%% <2024-06-01 + \def\p@array<##1>[##2]##3{% + \ifnum\ltj@ext@dir=0 \ltj@ext@dir=\ltjgetparameter{direction}\relax\fi + \let\box@dir\relax + \if ##1z\relax + \ifnum\ltj@ext@dir=3\relax + \let\box@dir\utod\@tempcnta=\zstrutbox + \fi + \else + \if ##1y\relax + \let\box@dir\yoko\@tempcnta=\ystrutbox + \else\if ##1t\relax + \let\box@dir\tate\@tempcnta=\tstrutbox + \else\if ##1d\relax + \let\box@dir\dtou\@tempcnta=\dstrutbox + \else\if ##1u\relax + \let\box@dir\utod\@tempcnta=\zstrutbox + \fi\fi\fi\fi + \fi + \ifx\box@dir\relax + \ifcase\ltj@ext@dir + \or \let\box@dir\dtou\@tempcnta=\dstrutbox% dtou + \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate + \or \let\box@dir\yoko\@tempcnta=\ystrutbox% yoko + \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod + \fi + \fi + \setbox \@arstrutbox \hbox{\box@dir\vrule + \@height \arraystretch + \dimexpr \ltjgetht\@tempcnta+\extrarowheight\relax + \@depth \arraystretch \ltjgetdp \@tempcnta + \@width \z@}% + \fork@array@option<##1>[##2]% + \begingroup + \@mkpream{##3}% + \xdef\@preamble{\noexpand\ialign \@halignto + \bgroup \@arstrut\@preamble \tabskip \z@ \cr}% + \endgroup + \@arrayleft + \@begin@alignbox + \bgroup + \box@dir\adjustbaseline + \let\@sharp####\let\protect\relax + \lineskip \z@ + \baselineskip \z@ + \m@th + \let\\\@arraycr \let\tabularnewline\\\let\par\@empty + \@preamble + } + \def\endtabular{\endarray\m@th$\egroup\null} + \def\endarray{ + \crcr\egroup\egroup\@end@alignbox + \@arrayright \gdef\@preamble{}% + } +\fi + \expandafter \let \csname endtabular*\endcsname = \endtabular } +\ExplSyntaxOff \@ifpackageloaded{array}{% \let\tabular=\ltj@lltjext@orig@tabular \let\array=\ltj@lltjext@orig@array @@ -760,9 +821,4 @@ \ltj@ExecuteAfterPackage{array}{\ltj@lltjext@patch@array} } -%%%%%%%%%%%%%%%% LuaTeX-ja original - -%%\define@key[ltj]{japaram}{autouprightnum}{% %COUNT -%% \ltj@@set@stack{AURN}{0}{10000}\z@#1 } - \endinput diff --git a/macros/luatex/generic/luatexja/src/ltj-ivd_aj1.lua b/macros/luatex/generic/luatexja/src/ltj-ivd_aj1.lua index de18150d79..bb265c7e54 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: -- # +-- # 2022-09-13 Registration of additional sequences in the Adobe-Japan1 +-- # collection. +-- # -- # 2020-11-06 Registration of additional sequences in the MSARG -- # collection. -- # @@ -36,7 +39,7 @@ table_ivd_aj1 = { -- # For more details on the IVD, see UTS #37: -- # https://www.unicode.org/reports/tr37/ -- # --- # Copyright 2006-2020 Unicode, Inc. +-- # Copyright 2006-2022 Unicode, Inc. -- # For terms of use, see: https://www.unicode.org/copyright.html#8 -- # -- # EOF @@ -1952,7 +1955,7 @@ table_ivd_aj1 = { 0x209dbf,0x209db5,0x209db9,0x209dbd,0x209dc9,0x209dda,0x209de0,0x209de3,0x204d07,0x209e0a, 0x209e02,0x209e0d,0x209e1c,0x209e7b,0x222218,0x209e80,0x209e85,0x209e9b,0x22a38c,0x209ebd, 0x22a437,0x209edf,0x209eff,0x209f02,0x204d77,0x209f03,0x209f3a,0x209f3d,0x209f46,0x209f53, - 0x209f55,0x209f58,0x22a5f1,0x209f5d,0x22a602,0x209f69,0x209f6d,0x209f70,0x22a6b2,0x20793a, + 0x209f55,0x209f58,0x22a5f1,0x209f5d,0x22a602,0x209f69,0x209f6d,0x209f70,0x22a6b2,0x231350, 0x203614,0x2038ad,0x203dcc,0x203fdc,0x2045be,0x204610,0x204b7e,0x204c38,0x204ce1,0x204e0c, 0x204e23,0x204e24,0x204e79,0x204ef3,0x204f0c,0x204f19,0x204f2b,0x204f2e,0x204f31,0x204f84, 0x204f9e,0x204fb7,0x205004,0x20500c,0x20504c,0x20505f,0x205062,0x205077,0x20508e,0x20509e, diff --git a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua index ed7ab6daa8..6eda9f0fde 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 = '2022-08-29', + date = '2024-09-01', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -741,7 +741,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, widow_Np.nuc) + local p = node_new(id_penalty, nil, widow_Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end setpenalty(p, a); head = insert_before(head, widow_Np.first, p) widow_Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) @@ -1059,7 +1059,7 @@ local function handle_np_jachar(mode) real_insert(g) end if mode and Np.kcat%2~=1 then - widow_Np.first, widow_Bp, Bp = Np.first, Bp, widow_Bp + widow_Np.nuc, widow_Np.first, widow_Bp, Bp = Np.nuc, Np.first, Bp, widow_Bp end end diff --git a/macros/luatex/generic/luatexja/src/ltj-jfont.lua b/macros/luatex/generic/luatexja/src/ltj-jfont.lua index 26c76d88a1..3e685c0b41 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 = '2023-04-06', + date = '2024-07-25', description = 'Loader for Japanese fonts', }) @@ -434,17 +434,18 @@ do end -- extract jfm_name, jfm_spec and jfm_var -- normalize position of 'jfm=' and 'jfmvar=' keys + local match, sub = string.match, string.sub local function extract_jfm_spec(name) - name = (name:match '^{(.*)}$') or (name:match '^"(.*)"$') or name + name = (match(name,'^{(.*)}$')) or (match(name,'^"(.*)"$')) or name jfm_spec, jfm_var = '', '' - local tmp, index = name:sub(1, 5), 1 + local tmp, index = sub(name,1, 5), 1 if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then index = 6 end name = lpegmatch(jf_remainder, name) if jfm_name~='' then if luatexja.jfont.jfm_feature then - local l, t2 = name:sub(-1), {} + local l, t2 = sub(name,-1), {} for i,v in pairs(luatexja.jfont.jfm_feature) do -- print(i,type(v),v) t2[#t2+1] = (v==true) and i @@ -454,7 +455,7 @@ do else jfm_spec = jfm_name end - l = name:sub(-1) + l = sub(name,-1) name = name .. ((l==':' or l==';') and '' or ';') .. 'jfm=' .. jfm_spec if jfm_var~='' then name = name .. ';jfmvar=' .. jfm_var @@ -806,9 +807,9 @@ local list_rotate_glyphs do local ceil = math.ceil -- output of function_uax50.lua - -- UAX#50 for Unicode 14.0.0 + -- UAX#50 for Unicode 15.1.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, 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 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, 3316, 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, 3791, 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, 69373, 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, 70210, 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, 72448, 72458, 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, 73472, 73489, 73490, 73531, 73534, 73562, 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, 119488, 119508, 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, 122661, 122667, 122880, 122887, 122888, 122905, 122907, 122914, 122915, 122917, 122918, 122923, 122928, 122990, 123023, 123024, 123136, 123181, 123184, 123198, 123200, 123210, 123214, 123216, 123536, 123567, 123584, 123642, 123647, 123648, 124112, 124154, 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 @@ -902,9 +903,10 @@ do end end + local sub = string.sub local function prepare_extra_data_font(id, res, name) if type(res)=='table' and (res.psname or res.filename) then - if (res.embedding=='no') and (type(name)=='string') and (name:sub(1,5)=='psft:') then + if (res.embedding=='no') and (type(name)=='string') and (sub(name,1,5)=='psft:') then font_extra_info[id] = res.resources.ltj_extra else local bname = res.psname or nameonly(res.filename) diff --git a/macros/luatex/generic/luatexja/src/ltj-latex.sty b/macros/luatex/generic/luatexja/src/ltj-latex.sty index 7e091d161d..9f6e4d0a36 100644 --- a/macros/luatex/generic/luatexja/src/ltj-latex.sty +++ b/macros/luatex/generic/luatexja/src/ltj-latex.sty @@ -12,45 +12,14 @@ \def\luatexjalatexLoaded{\endinput} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ltj-latex}[2022-10-15 LaTeX support of LuaTeX-ja] +\ProvidesPackage{ltj-latex}[2024-05-16 LaTeX support of LuaTeX-ja] \endlinechar=13 %%% LaTeX version detection -\newif\ifltj@ltfilehook@avail -\@ifl@t@r\fmtversion{2020-10-01}{% - \@ifl@t@r\fmtversion{2020-10-02}% - {\ltj@ltfilehook@availtrue} - {% - \ifnum\patch@level<0\relax \ifnum\patch@level<-6 \ltj@ltfilehook@availtrue\fi - \else\ltj@ltfilehook@availtrue\fi - }% -}{} -\@ifl@t@r\fmtversion{2021-05-01}{\count@=1 }{\count@=0 } -\ifnum \count@<1 -%%%% \shipout - \newluafunction\ltj@@lua@shipout@inner - \directlua{ - local t = lua.get_functions_table() - local getbox, setbox = tex.getbox, tex.setbox - local shipout_lthook = luatexja.direction.shipout_lthook - t[\the\ltj@@lua@shipout@inner]=function () - local a = shipout_lthook(getbox(\the\ltj@afbox)) - if a then setbox(\the\ltj@afbox, a) end - end - } - \protected\luadef\ltj@@lua@shipout\ltj@@lua@shipout@inner - \def\ltj@shipout@{\ltj@@lua@shipout\primitive\shipout\box\ltj@afbox}% - \protected\def\ltj@shipout{\ltj@afterbox\ltj@shipout@} - \ifprimitive\shipout\let\shipout\ltj@shipout\fi - \ifcsname tex_shipout:D\endcsname - \expandafter\let\csname tex_shipout:D\endcsname\ltj@shipout - \fi -\else - \directlua{% - luatexbase.add_to_callback('pre_shipout_filter',luatexja.direction.shipout_lthook, 'ltj.direction', 1) - } -\fi +\directlua{% + luatexbase.add_to_callback('pre_shipout_filter',luatexja.direction.shipout_lthook, 'ltj.direction', 1) +} %%% patch for LaTeX \usepackage{lltjfont} @@ -59,36 +28,30 @@ \RequirePackage{lltjp-atbegshi} %%% patching commands -\ifltj@ltfilehook@avail - %% \ltj@ExecuteBeforePackage <package><code> and \ltj@ExecuteAfterPackage <package><code> - %% no-starred version: do nothing if the <package> is loaded - %% starred version: do <code> right away if the <package> is loaded - \def\ltj@ExecuteAfterPackage{\@ifstar\@@ltj@ExecuteAfterPackage@star\@@ltj@ExecuteAfterPackage} - \def\ltj@ExecuteBeforePackage{\@ifstar\@@ltj@ExecuteBeforePackage@star\@@ltj@ExecuteBeforePackage} - \@ifl@t@r\fmtversion{2021-11-15}{% 2021-11-15 - \def\@@ltj@ExecuteAfterPackage@star#1{\AddToHook{package/#1/after}} - \def\@@ltj@ExecuteBeforePackage@star#1{\AddToHook{package/#1/before}} - \long\def\@@ltj@ExecuteAfterPackage#1#2{% - \@ifpackageloaded{#1}{}{\AddToHook{package/#1/after}{#2}}% - } - \long\def\@@ltj@ExecuteBeforePackage#1#2{% - \@ifpackageloaded{#1}{}{\AddToHook{package/#1/before}{#2}}% - } - }{ - \def\@@ltj@ExecuteAfterPackage#1{\AddToHook{package/after/#1}} - \def\@@ltj@ExecuteBeforePackage#1{\AddToHook{package/before/#1}} - \long\def\@@ltj@ExecuteAfterPackage@star#1#2{% - \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteAfterPackage{#1}{#2}}% - } - \long\def\@@ltj@ExecuteBeforePackage@star#1#2{% - \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteBeforePackage{#1}{#2}}% - } +%% \ltj@ExecuteBeforePackage <package><code> and \ltj@ExecuteAfterPackage <package><code> +%% no-starred version: do nothing if the <package> is loaded +%% starred version: do <code> right away if the <package> is loaded +\def\ltj@ExecuteAfterPackage{\@ifstar\@@ltj@ExecuteAfterPackage@star\@@ltj@ExecuteAfterPackage} +\def\ltj@ExecuteBeforePackage{\@ifstar\@@ltj@ExecuteBeforePackage@star\@@ltj@ExecuteBeforePackage} +\@ifl@t@r\fmtversion{2021-11-15}{% 2021-11-15 + \def\@@ltj@ExecuteAfterPackage@star#1{\AddToHook{package/#1/after}} + \def\@@ltj@ExecuteBeforePackage@star#1{\AddToHook{package/#1/before}} + \long\def\@@ltj@ExecuteAfterPackage#1#2{% + \@ifpackageloaded{#1}{}{\AddToHook{package/#1/after}{#2}}% } -\else - \RequirePackage{filehook} - \let\ltj@ExecuteAfterPackage=\AtEndOfPackageFile - \let\ltj@ExecuteBeforePackage=\AtBeginOfPackageFile -\fi + \long\def\@@ltj@ExecuteBeforePackage#1#2{% + \@ifpackageloaded{#1}{}{\AddToHook{package/#1/before}{#2}}% + } +}{ + \def\@@ltj@ExecuteAfterPackage#1{\AddToHook{package/after/#1}} + \def\@@ltj@ExecuteBeforePackage#1{\AddToHook{package/before/#1}} + \long\def\@@ltj@ExecuteAfterPackage@star#1#2{% + \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteAfterPackage{#1}{#2}}% + } + \long\def\@@ltj@ExecuteBeforePackage@star#1#2{% + \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteBeforePackage{#1}{#2}}% + } +} \def\ltj@pkgpatch@im#1{\@ifnextchar[{\ltj@pkgpatch@im@{#1}}{\ltj@pkgpatch@im@{#1}[lltjp-#1]}}%] \def\ltj@pkgpatch@im@#1[#2]{\ltj@ExecuteAfterPackage*{#1}{\ltj@pkgpatch@im@@{#2}}} \def\ltj@pkgpatch@im@@#1{% @@ -101,11 +64,7 @@ } \def\ltj@pkgpatch#1{\@ifnextchar[{\ltj@pkgpatch@{#1}}{\ltj@pkgpatch@{#1}[lltjp-#1]}}%] -\ifltj@ltfilehook@avail - \def\ltj@pkgpatch@@{\AddToHook{begindocument/before}[luatexja.autopatch]} -\else - \def\ltj@pkgpatch@@{\gpreto\@begindocumenthook} -\fi +\def\ltj@pkgpatch@@{\AddToHook{begindocument/before}[luatexja.autopatch]} \def\ltj@pkgpatch@#1[#2]{% \ltj@pkgpatch@@{% \@ifpackageloaded{#1}{\@ifpackageloaded{#2}{}{\RequirePackage{#2}}}{}% @@ -121,18 +80,12 @@ \ltj@pkgpatch{tascmac} \ltj@pkgpatch{ascmac}[lltjp-tascmac] \ltj@pkgpatch@im{stfloats} -\ifltj@ltfilehook@avail\else - \ltj@pkgpatch{preview} %% at \begin{document} - % (preview package has delayed option) -\fi \ltj@pkgpatch{array} %% at \begin{document} \ltj@pkgpatch{collcell} %% at \begin{document} \ltj@pkgpatch@im{unicode-math} \ltj@pkgpatch@im{siunitx} \ltj@pkgpatch@im{microtype} -\ifltj@ltfilehook@avail\else\ltj@pkgpatch@im{everyshi}\fi - \RequirePackage{lltjp-geometry} \ltj@ExecuteBeforePackage{breqn}{% diff --git a/macros/luatex/generic/luatexja/src/ltj-pretreat.lua b/macros/luatex/generic/luatexja/src/ltj-pretreat.lua index 43ecac806c..8f5632be4e 100644 --- a/macros/luatex/generic/luatexja/src/ltj-pretreat.lua +++ b/macros/luatex/generic/luatexja/src/ltj-pretreat.lua @@ -156,16 +156,17 @@ function set_box_stack_level(head, mode) if ltjs.list_dir == dir_tate then for p in traverse_glyph(to_direct(head)) do if getlang(p)==lang_ja and has_attr(p, attr_icflag, 0) then - local pf = ltjf_replace_altfont(attr_curtfnt, getchar(p), p) + local pc = ltjs_orig_char_table[p] or getchar(p) + local pf = ltjf_replace_altfont(attr_curtfnt, pc, p) if ltjf_font_metric_table[pf].vert_activated then - local pc = ltjf_font_metric_table[pf].vform[pc]; if pc then setchar(p, pc) end + pc = ltjf_font_metric_table[pf].vform[pc]; if pc then setchar(p, pc) end end end end else for p in traverse_glyph(to_direct(head)) do if getlang(p)==lang_ja and has_attr(p, attr_icflag, 0) then - ltjf_replace_altfont(attr_curjfnt, getchar(p), p) + ltjf_replace_altfont(attr_curjfnt, ltjs_orig_char_table[p] or getchar(p), p) end end end diff --git a/macros/luatex/generic/luatexja/src/ltj-rmlgbm.lua b/macros/luatex/generic/luatexja/src/ltj-rmlgbm.lua index 88352dd5b2..23d20be3f3 100644 --- a/macros/luatex/generic/luatexja/src/ltj-rmlgbm.lua +++ b/macros/luatex/generic/luatexja/src/ltj-rmlgbm.lua @@ -15,7 +15,8 @@ do end local cidfont_data = {} local cache_chars = {} -local cache_ver = 13 +local cache_ver = 14 +local sub = string.sub local identifiers = fonts.hashes.identifiers local cid_reg, cid_order, cid_supp, cid_name @@ -147,7 +148,7 @@ do descender = 655360*0.12, }, embedding = "no", cache = "yes", factor = 0, hfactor = 0, vfactor = 0, - tounicode = 1, + tounicode = 1, filename="", properties = { language = "dflt", script = "dflt" }, } cidfont_data[cid_name] = k @@ -300,7 +301,6 @@ local function prepare_cid_font(reg, ord) return cidfont_data[cid_name] or read_cid_font() end - local definers = fonts.definers local function mk_rml(name, size, id) local specification = definers.analyze(name,size) @@ -308,8 +308,8 @@ local function mk_rml(name, size, id) specification.detail = specification.detail or '' do local n = specification.name - if n:sub(1,1)=="{" then n=n:sub(2) end - if n:sub(-1)=="}" then n=n:sub(1,-2) end + if sub(n,1,1)=="{" then n=sub(n,2) end + if sub(n,-1)=="}" then n=sub(n,1,-2) end specification.name=n end local fontdata = {} @@ -382,11 +382,11 @@ local function mk_rml(name, size, id) end local function font_callback(name, size, id, fallback) - if name:sub(1,1)=="{" and name:sub(-1)=="}" then name = name:sub(2,-2) end + if sub(name,1,1)=="{" and sub(name,-1)=="}" then name = sub(name,2,-2) end local p = name:find(":") or 0 - if name:sub(1, p-1) == 'psft' then + if sub(name,1, p-1) == 'psft' then local s = "Adobe-Japan1-7" - local basename = name:sub(p+1) + local basename = sub(name,p+1) local p = basename:find(":") local q = basename:find("/[BI][BI]?") if q and p and q<=p then @@ -394,12 +394,12 @@ local function font_callback(name, size, id, fallback) p = basename:find(":") end if p then - local xname = basename:sub(p+1) + local xname = sub(basename,p+1) p = 1 while p do local q = xname:find(";", p+1) or xname:len()+1 - if xname:sub(p, p+3)=='cid=' and q>p+4 then - s = xname:sub(p+4, q-1) + if sub(xname,p, p+3)=='cid=' and q>p+4 then + s = sub(xname,p+4, q-1) end if xname:len()+1==q then p = nil else p = q + 1 end end diff --git a/macros/luatex/generic/luatexja/src/ltj-ruby.lua b/macros/luatex/generic/luatexja/src/ltj-ruby.lua index 29b6fe1998..2ff41be947 100644 --- a/macros/luatex/generic/luatexja/src/ltj-ruby.lua +++ b/macros/luatex/generic/luatexja/src/ltj-ruby.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.ruby', - date = '2022-12-31', + date = '2024-09-06', description = 'Ruby annotation', }) luatexja.ruby = {} @@ -37,7 +37,7 @@ local setwhd = node.direct.setwhd local setlist = node.direct.setlist local setvalue = node.direct.setdata -local node_new = node.direct.new +local node_new = luatexja.dnode_new local node_remove = node.direct.remove local node_next = node.direct.getnext local node_copy, node_tail = node.direct.copy, node.direct.tail @@ -45,6 +45,7 @@ local node_free = node.direct.flush_node or node.direct.free local get_attr, set_attr = node.direct.get_attribute, node.direct.set_attribute local insert_before, insert_after = node.direct.insert_before, node.direct.insert_after local hpack = node.direct.hpack +local node_inherit_attr = luatexja.node_inherit_attr local id_hlist = node.id 'hlist' local id_vlist = node.id 'vlist' @@ -175,10 +176,10 @@ do set_attr(nh, attr_icflag, get_attr_icflag(nh) + PROCESSED_BEGIN_FLAG) setnext(node_tail(h), nh) - setlist(f, nil); node_free(f) + setlist(f, nil) setlist(b, nil); node_free(b) local g = luatexja.jfmglue.main(h,false) - return hpack(g) + g = node_inherit_attr(hpack(g),f); node_free(f); return g else return f end @@ -207,6 +208,7 @@ end -- box の中身のノードは再利用される local enlarge do + local dimensions = node.direct.dimensions local FROM_JFM = luatexja.icflag_table.FROM_JFM local PROCESSED = luatexja.icflag_table.PROCESSED local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP @@ -239,18 +241,22 @@ do hx = node_next(hx) end -- 先頭の空白を挿入 - local k = node_new(id_glue); - setglue(k, prenw, round(pre*65536), 0, 2, 0) - h = insert_before(h, h, k); + local k1 = node_new(id_glue); + setglue(k1, prenw, round(pre*65536), 0, 2, 0) + h = insert_before(h, h, k1); -- 末尾の空白を挿入 - local k = node_new(id_glue); - setglue(k, postnw, round(post*65536), 0, 2, 0) - insert_after(h, node_tail(h), k); + local k2 = node_new(id_glue); + setglue(k2, postnw, round(post*65536), 0, 2, 0) + insert_after(h, node_tail(h), k2); -- hpack - setlist(box, nil); node_free(box) - box = hpack(h, new_width, 'exactly') - setheight(box, hh); setdepth(box, hd) - return box + setlist(box, nil); + local new_box = node_inherit_attr(hpack(h, new_width, 'exactly'), box) + setheight(new_box, hh); setdepth(new_box, hd) + node_free(box); + local gset, gsign, go + = getfield(new_box,'glue_set'), getfield(new_box,'glue_sign'), getfield(new_box,'glue_order') + return new_box, (dimensions(gset, gsign, go, k1, node_next(k1))), (dimensions(gset, gsign, go, k2)) + -- return value: (enlarged box), (width of left glue), (width of right glue) end end @@ -307,15 +313,18 @@ function luatexja.ruby.texiface(rst, rtlr, rtlp) end ---------------------------------------------------------------- --- pre_line_break +-- pre_linebreak ---------------------------------------------------------------- -- r, p の中身のノードは再利用される local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) -- r: ルビ部分の格納された box,p: 同,親文字 + -- no_begin: 行頭形ではないか + -- no_end: 行末形ではないか local rwidth = getwidth(r) local sumprot = rwidth - getwidth(p) -- >0 local pre_intrusion, post_intrusion + local pre_protrusion, post_protrusion local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost local intmode = (tmp_tbl.mode//4)%8 @@ -325,17 +334,17 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) mapre = min(mapre,mapost); mapost = mapre end if intmode == 0 then -- とりあえず組んでから決める - p = enlarge(p, rwidth, ppre, pmid, ppost, 0, 0) + p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, 0, 0) pre_intrusion = min(mapre, round(ppre*getfield(p, 'glue_set')*65536)) post_intrusion = min(mapost, round(ppost*getfield(p, 'glue_set')*65536)) elseif intmode == 1 then pre_intrusion = min(mapre, sumprot); post_intrusion = min(mapost, max(sumprot-pre_intrusion, 0)) - p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) + p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) elseif intmode == 2 then post_intrusion = min(mapost, sumprot); pre_intrusion = min(mapre, max(sumprot-post_intrusion, 0)) - p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) + p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) elseif intmode==3 then local n = min(mapre, mapost)*2 if n < sumprot then @@ -343,7 +352,7 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) else pre_intrusion = sumprot//2; post_intrusion = sumprot - pre_intrusion end - p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) + p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) pre_intrusion = min(mapre, pre_intrusion + round(ppre*getfield(p, 'glue_set')*65536)) post_intrusion = min(mapost, post_intrusion + round(ppost*getfield(p, 'glue_set')*65536)) else -- intmode == 4 @@ -354,7 +363,7 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) else pre_intrusion, post_intrusion = mapre, min(mapost, sumprot-mapre) end - p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) + p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) end setshift(r, -pre_intrusion) local rwidth = rwidth - pre_intrusion - post_intrusion @@ -371,24 +380,29 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) post_jfmgk = (post_intrusion > 0) end end - return r, p, orig_post_intrusion, post_jfmgk + return r, p, orig_post_intrusion, post_jfmgk, + pre_protrusion - pre_intrusion, post_protrusion - post_intrusion end -- ルビボックスの生成(単一グループ) -- returned value: <new box>, <ruby width>, <post_intrusion> local max_margin -local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) +local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end, w) + -- no_begin: 行頭形ではないか + -- no_end: 行末形ではないか local post_intrusion, post_jfmgk = 0, false local imode local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost local rpre, rmid, rpost, rsmash + local protrusion = {0, 0}; tmp_tbl[tmp_tbl.index] = protrusion imode = tmp_tbl.mode//0x100000; rsmash = (imode%2 ==1) imode = imode//2; rpost = imode%8; imode = (imode-rpost)/8; rmid = imode%8; imode = (imode-rmid)/8; rpre = imode%8 if getwidth(r) > getwidth(p) then -- change the width of p - r, p, post_intrusion, post_jfmgk = enlarge_parent(r, p, tmp_tbl, no_begin, no_end) + r, p, post_intrusion, post_jfmgk, protrusion[1], protrusion[2] + = enlarge_parent(r, p, tmp_tbl, no_begin, no_end) elseif getwidth(r) < getwidth(p) then -- change the width of r r = enlarge(r, getwidth(p), rpre, rmid, rpost, 0, 0) post_intrusion = 0 @@ -406,7 +420,7 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) end if need_repack then local rt = r - r = hpack(getlist(r), getwidth(r), 'exactly') + r = node_inherit_attr(hpack(getlist(r), getwidth(r), 'exactly'), r) setlist(rt, nil); node_free(rt); end end @@ -416,7 +430,8 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) insert_after(r, k, p); setnext(p, nil) if tmp_tbl.rubydepth >= 0 then setdepth(r, tmp_tbl.rubydepth) end if tmp_tbl.baseheight >= 0 then setheight(p, tmp_tbl.baseheight) end - a = node.direct.vpack(r); setshift(a, 0) + a = node_inherit_attr(node.direct.vpack(r), p) + setshift(a, 0) set_attr(a, attr_ruby, post_intrusion) set_attr(a, attr_ruby_post_jfmgk, post_jfmgk and 1 or 0) if rsmash or getheight(a)<getheight(p) then @@ -437,7 +452,10 @@ local max_allow_pre, max_allow_post local flush_list = node.direct.flush_list -- 中付き熟語ルビ,cmp containers -- 「文字の構成を考えた」やつはどうしよう -local function pre_low_cal_box(w, cmp) +local pre_low_cal_box +do + local node_prev = node.direct.getprev +pre_low_cal_box = function (w, cmp) local rb = {} local pb = {} local kf = {} @@ -450,18 +468,24 @@ local function pre_low_cal_box(w, cmp) local coef = {} -- 連立一次方程式の拡大係数行列 local rtb = expand_3bits(rst.stretch) + local kb, ka + if rst.quirk_protrusion then + kb = node_prev(node_tail(wv)); ka = node_next(kb) + node_remove(wv, kb); node_remove(wv, ka) + end -- node list 展開・行末形の計算 local nt, nta, ntb = wv, nil, nil -- nt*: node temp rst.ppre, rst.pmid, rst.ppost = rtb[6], rtb[5], rtb[4] rst.mapre, rst.mapost = max_allow_pre, 0 - for i = 1, cmp do + for i = 1, cmp do nt = node_next(nt); rb[i] = nt; nta = concat(nta, node_copy(nt)) nt = node_next(nt); pb[i] = nt; ntb = concat(ntb, node_copy(nt)) coef[i] = {} for j = 1, 2*i do coef[i][j] = 1 end for j = 2*i+1, 2*cmp+1 do coef[i][j] = 0 end + rst.index = i kf[i], coef[i][2*cmp+2] - = new_ruby_box(node_copy(nta), node_copy(ntb), rst, true, false) + = new_ruby_box(node_copy(nta), node_copy(ntb), rst, true, false, w) end node_free(nta); node_free(ntb) @@ -474,8 +498,9 @@ local function pre_low_cal_box(w, cmp) for j = 1, 2*i-1 do coef[cmp+i][j] = 0 end for j = 2*i, 2*cmp+1 do coef[cmp+i][j] = 1 end nta = concat(node_copy(rb[i]), nta); ntb = concat(node_copy(pb[i]), ntb) + rst.index = 2*cmp+1-i kf[cmp+i], coef[cmp+i][2*cmp+2] - = new_ruby_box(node_copy(nta), node_copy(ntb), rst, false, true) + = new_ruby_box(node_copy(nta), node_copy(ntb), rst, false, true, w) end -- ここで,nta, ntb には全 container を連結した box が入っているので @@ -484,13 +509,17 @@ local function pre_low_cal_box(w, cmp) for j = 1, 2*cmp+1 do coef[2*cmp+1][j] = 1 end rst.ppre, rst.pmid, rst.ppost = rtb[3], rtb[2], rtb[1] rst.mapre, rst.mapost = max_allow_pre, max_allow_post + rst.index = 2*cmp+1 kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup, post_jfmgk_backup - = new_ruby_box(nta, ntb, rst, true, true) + = new_ruby_box(nta, ntb, rst, true, true, w) -- w.value の node list 更新. local nt = wv flush_list(node_next(wv)) for i = 1, 2*cmp+1 do setnext(nt, kf[i]); nt = kf[i] end + if rst.quirk_protrusion then + insert_after(wv, nt, kb); insert_after(wv, kb, ka); + end if cmp==1 then solve_1(coef) elseif cmp==2 then solve_2(coef) @@ -499,6 +528,7 @@ local function pre_low_cal_box(w, cmp) end return coef end +end local first_whatsit do @@ -512,25 +542,40 @@ do end local next_cluster_array = {} +local pre_high -- ノード追加 -local function pre_low_app_node(head, w, cmp, coef, ht, dp) +do + local node_prev = node.direct.getprev + local KINSOKU = luatexja.icflag_table.KINSOKU + local function pre_low_app_node (head, w, cmp, coef, ht, dp) -- メインの node list 更新 - local nt = node_new(id_glue) + local nt = node_new(id_glue, nil, w) -- INHERIT ATTRIBUTES OF w setglue(nt, coef[1][2*cmp+2], 0, 0, 0, 0) set_attr(nt, attr_ruby, 1); set_attr(w, attr_ruby, 2) head = insert_before(head, w, nt) nt = w for i = 1, cmp do -- rule - local nta = node_new(id_rule, 0); + local nta = node_new(id_rule, 0, w); -- INHERIT ATTRIBUTES OF w setwhd(nta, coef[i*2][2*cmp+2], ht, dp) insert_after(head, nt, nta) set_attr(nta, attr_ruby, 2*i+1) -- glue if i~=cmp or not next_cluster_array[w] then - nt = node_new(id_glue); insert_after(head, nta, nt) + nt = node_new(id_glue, nil, w); -- INHERIT ATTRIBUTE OF w + insert_after(head, nta, nt) else - nt = next_cluster_array[w] + nt = next_cluster_array[w]; local f = node_next(nta) + while f and f~=nt do + if getid(f)==id_glue then + node_remove(head, nt); insert_before(head, f, nt); f = nil + else if getid(f)==id_penalty and get_attr_icflag(f)==KINSOKU then + node_inherit_attr(f, w) -- INHERIT ATTRIBUTE OF w; for lua-ul + set_attr(f, attr_icflag, KINSOKU) + end + f = node_next(f) + end + end end setglue(nt, coef[i*2+1][2*cmp+2], 0, 0, 0, 0) set_attr(nt, attr_ruby, 2*i+2) @@ -540,14 +585,13 @@ local function pre_low_app_node(head, w, cmp, coef, ht, dp) next_cluster_array[w]=nil return head, first_whatsit(node_next(nt)) end - -local function pre_high(ahead) +pre_high = function (ahead) if not ahead then return ahead end local head = to_direct(ahead) post_intrusion_backup, post_jfmgk_backup = 0, false local n = first_whatsit(head) while n do - if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then + if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then local nv = getvalue(n) local rst = getvalue(nv) max_allow_pre = rst.pre or 0 @@ -567,13 +611,13 @@ local function pre_high(ahead) if rst.exclude_pre_jfmgk_from_prev_ruby and atr>0 and ((old_break_info[atr] or post_intrusion_backup) > 0) then -- 「直前のルビが文字に進入→現在のルビの和文処理グルーへの進入はなし」という状況 - rst.before_jfmgk = 0 + max_allow_pre = 0;rst.before_jfmgk = 0 end post_intrusion_backup, post_jfmgk_backup = 0, false max_allow_post = rst.post or 0 max_margin = rst.maxmargin or 0 local coef = pre_low_cal_box(n, rst.count) - local s = node_tail(nv) --ルビ文字 + local s = node_tail(nv); if rst.quirk_protrusion then s = node_prev(node_prev(s)) end --ルビ文字 head, n = pre_low_app_node( head, n, rst.count, coef, getheight(s), getdepth(s) ) @@ -583,11 +627,11 @@ local function pre_high(ahead) end return to_node(head) end +end luatexbase.add_to_callback('pre_linebreak_filter', pre_high, 'ltj.ruby.pre', 100) -luatexbase.add_to_callback('hpack_filter', pre_high, 'ltj.ruby.pre', 100) ---------------------------------------------------------------- --- post_line_break +-- post_linebreak ---------------------------------------------------------------- local post_lown do @@ -595,47 +639,110 @@ do local id = get_attr(wv, attr_ruby_id) or 0 if id>0 and cache_handle then cache_handle:write( - 'lrob[' .. tostring(id) .. ']=' .. num .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n') + 'lrob[' .. tostring(id) .. ']=' .. tostring(num) .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n') end end - + local node_prev = node.direct.getprev + local function new_kern(inherit, num) + local k = node_new(id_kern, 1, inherit); setkern(k, num); set_attr(kt, attr_icflag, PROCESSED); + return k; + end post_lown = function (rs, rw, cmp, ch) -- ch: the head of `current' hlist if #rs ==0 or not rw then return ch end local hn = get_attr(rs[1], attr_ruby) local fn = get_attr(rs[#rs], attr_ruby) - local wv = getvalue(rw) + local wv = getvalue(rw); local rst = getvalue(wv) if hn==1 then if fn==2*cmp+2 then - local hn = node_tail(wv) - node_remove(wv, hn) - insert_after(ch, rs[1], hn) - set_attr(hn, attr_icflag, PROCESSED) - write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))-- 行中形 + -- 行中形 + local nn = node_tail(wv); + if rst.quirk_protrusion then + local prot_b,prot_a = rst[fn-1][1], rst[fn-1][2] + local ka=nn; local kb = node_prev(nn); nn = node_prev(kb) + node_remove(wv, nn); node_remove(wv, kb); node_remove(wv, ka) + if prot_b~=0 then + setkern(kb, prot_b); insert_after(ch, rs[1], kb); + local kt = new_kern(rw, -prot_b); insert_after(ch, kb, kt); + insert_after(ch, kt, nn); + else + node_free(kb); insert_after(ch, rs[1], nn) + end + if prot_a~=0 then + local kt = new_kern(rw, -prot_a); insert_after(ch, nn, kt); + setkern(ka, prot_a); insert_after(ch, kt, ka); + else node_free(ka) + end + else + node_remove(wv, nn); insert_after(ch, rs[1], nn) + end + set_attr(nn, attr_icflag, PROCESSED) + write_aux(wv, get_attr(nn, attr_ruby), get_attr(nn, attr_ruby_post_jfmgk)) else - local deg, hn = (fn-1)/2, wv - for i = 1, deg do hn = node_next(hn) end; - node_remove(wv, hn) - setnext(hn, nil) - insert_after(ch, rs[1], hn) - set_attr(hn, attr_icflag, PROCESSED) - write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk)) + -- 行末形 + local deg, nn = (fn-1)/2, wv; for i = 1, deg do nn = node_next(nn) end + if rst.quirk_protrusion then + local prot_b = rst[deg][1] + local ka = node_tail(wv); local kb = node_prev(ka); + node_remove(wv, nn); setnext(nn, nil); node_remove(wv, kb); + if prot_b~=0 then + setkern(kb, prot_b); insert_after(ch, rs[1], kb); + local kt = new_kern(rw, -prot_b); insert_after(ch, kb, kt); + insert_after(ch, kt, nn); + else + node_free(kb); insert_after(ch, rs[1], nn) + end + if deg==cmp then + local prot_a = rst[deg][2]; node_remove(wv,ka) + if prot_a~=0 then + local kt = new_kern(rw, -prot_a); insert_after(ch, nn, kt); + setkern(ka, prot_a); insert_after(ch, kt, ka); + else node_free(ka) + end + end + else + node_remove(wv, nn); setnext(nn, nil); insert_after(ch, rs[1], nn) + end + + set_attr(nn, attr_icflag, PROCESSED) + write_aux(wv, get_attr(nn, attr_ruby), get_attr(nn, attr_ruby_post_jfmgk)) end else - local deg, hn = max((hn-1)/2,2), wv - for i = 1, cmp+deg-1 do hn = node_next(hn) end + -- 行頭形 + local nn = wv; for i = 1, cmp+max((hn-1)/2,2)-1 do nn = node_next(nn) end -- -1 is needed except the case hn = 3, -- because a ending-line form is removed already from the list - node_remove(wv, hn); setnext(hn, nil) - insert_after(ch, rs[1], hn) - set_attr(hn, attr_icflag, PROCESSED) + if rst.quirk_protrusion then + local deg=(hn-1)/2; local prot_b = rst[2*cmp+1-deg][1] + local ka = node_tail(wv); node_remove(wv, nn); setnext(nn, nil); + if deg==1 then + local kb = node_prev(ka); node_remove(wv, kb); + if prot_b~=0 then + setkern(kb, prot_b); insert_after(ch, rs[1], kb); + local kt = new_kern(rw, -prot_b); insert_after(ch, kb, kt); + insert_after(ch, kt, nn); + else + node_free(kb); insert_after(ch, rs[1], nn) + end + else insert_after(ch, rs[1], nn) + end + local prot_a = rst[2*cmp+1-deg][2]; node_remove(wv,ka) + if prot_a~=0 then + local kt = new_kern(rw, -prot_a); insert_after(ch, nn, kt); + setkern(ka, prot_a); insert_after(ch, kt, ka); + else node_free(ka) + end + else + node_remove(wv, nn); setnext(nn, nil); insert_after(ch, rs[1], nn) + end + + set_attr(nn, attr_icflag, PROCESSED) if fn == 2*cmp-1 then - write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk)) + write_aux(wv, get_attr(nn, attr_ruby), get_attr(nn, attr_ruby_post_jfmgk)) end end for i = 1,#rs do - local ri = rs[i] - ch = node_remove(ch, ri); node_free(ri); + local ri = rs[i]; ch = node_remove(ch, ri); node_free(ri) end -- cleanup if fn >= 2*cmp+1 then node_free(rw) end @@ -644,73 +751,86 @@ do end local traverse_id = node.direct.traverse_id -local function post_high_break(head) - local rs = {} -- rs: sequence of ruby_nodes, - local rw = nil -- rw: main whatsit - local cmp = -2 -- dummy - for h in traverse_id(id_hlist, to_direct(head)) do - for i = 1, #rs do rs[i] = nil end - local ha = getlist(h) +local post_high_hbox, post_high_break +do + local rs, rw = {}, nil -- rs: sequence of ruby_nodes, rw: main whatsit + local cmp + post_high_break = function (head) + for h in traverse_id(id_hlist, to_direct(head)) do + for i = 1, #rs do rs[i] = nil end + local ha = getlist(h); + while ha do + local hai = getid(ha) + local i = ((hai == id_glue and getsubtype(ha)==0) + or (hai == id_rule and getsubtype(ha)==0) + or (hai == id_whatsit and getsubtype(ha)==sid_user + and getfield(ha, 'user_id', RUBY_POST))) + and get_attr(ha, attr_ruby) or 0 + if i==0 then + ha = node_next(ha) + elseif i==1 then + setlist(h, post_lown(rs, rw, cmp, getlist(h))) + for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement + rs[1], rw = ha, nil; ha = node_next(ha) + elseif i==2 then + rw = ha + cmp = getvalue(getvalue(rw)).count + local hb, hc = node_remove(getlist(h), rw) + setlist(h, hb); ha = hc + else -- i>=3 + rs[#rs+1] = ha; ha = node_next(ha) + end + end + setlist(h, post_lown(rs, rw, cmp, getlist(h))) + end + return head + end + post_high_hbox = function (ahead) + for i = 1, #rs do rs[i] = nil end; rw = nil + local ha = to_direct(ahead); local head = ha while ha do local hai = getid(ha) local i = ((hai == id_glue and getsubtype(ha)==0) - or (hai == id_rule and getsubtype(ha)==0) - or (hai == id_whatsit and getsubtype(ha)==sid_user - and getfield(ha, 'user_id', RUBY_POST))) - and get_attr(ha, attr_ruby) or 0 + or (hai == id_rule and getsubtype(ha)==0) + or (hai == id_whatsit and getsubtype(ha)==sid_user + and getfield(ha, 'user_id', RUBY_POST))) + and get_attr(ha, attr_ruby) or 0 if i==0 then ha = node_next(ha) elseif i==1 then - setlist(h, post_lown(rs, rw, cmp, getlist(h))) + head = post_lown(rs, rw, cmp, head) for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement rs[1], rw = ha, nil; ha = node_next(ha) elseif i==2 then rw = ha cmp = getvalue(getvalue(rw)).count - local hb, hc = node_remove(getlist(h), rw) - setlist(h, hb); ha = hc - else -- i>=3 + head, ha = node_remove(head, rw) + else -- i >= 3 rs[#rs+1] = ha; ha = node_next(ha) end end - setlist(h, post_lown(rs, rw, cmp, getlist(h))) + return to_node(post_lown(rs, rw, cmp, head)) end - return head end - -local function post_high_hbox(ahead) - local ha = to_direct(ahead); local head = ha - local rs = {}; -- rs: sequence of ruby_nodes, - local rw = nil; -- rw: main whatsit - local cmp - while ha do - local hai = getid(ha) - local i = ((hai == id_glue and getsubtype(ha)==0) - or (hai == id_rule and getsubtype(ha)==0) - or (hai == id_whatsit and getsubtype(ha)==sid_user - and getfield(ha, 'user_id', RUBY_POST))) - and get_attr(ha, attr_ruby) or 0 - if i==0 then - ha = node_next(ha) - elseif i==1 then - head = post_lown(rs, rw, cmp, head) - for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement - rs[1], rw = ha, nil; ha = node_next(ha) - elseif i==2 then - rw = ha - cmp = getvalue(getvalue(rw)).count - head, ha = node_remove(head, rw) - else -- i >= 3 - rs[#rs+1] = ha; ha = node_next(ha) - end +do + -- pre_append_to_vlist_filter.lua: distributed with lua-ul + local found = kpse.find_file('pre_append_to_vlist_filter.lua', 'lua') + if not found then + luatexbase.add_to_callback('post_linebreak_filter', post_high_break, 'ltj.ruby.post_break') + else + require 'pre_append_to_vlist_filter' + luatexbase.add_to_callback('pre_append_to_vlist_filter', + function(head, loc) + return (loc~='post_linebreak') and head or post_high_break(head) + end, + 'ltj.ruby.post_break', + (luatexbase.priority_in_callback('pre_append_to_vlist_filter', 'add underlines to list') or 1)) end - return to_node(post_lown(rs, rw, cmp, head)) + luatexbase.add_to_callback('hpack_filter', + function(head) return post_high_hbox(pre_high(head)) end, 'ltj.ruby', + luatexbase.priority_in_callback('hpack_filter', 'add underlines to list') or nil) end -luatexbase.add_to_callback('post_linebreak_filter', post_high_break, 'ltj.ruby.post_break', 100) -luatexbase.add_to_callback('hpack_filter', post_high_hbox, 'ltj.ruby.post_hbox', 101) - - ---------------------------------------------------------------- -- for jfmglue callbacks ---------------------------------------------------------------- @@ -736,7 +856,7 @@ do p = 0 end rst.pre = -p; rst.exclude_pre_from_prev_ruby = (s<0); - rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST +Nq.char] or 0)<0; + rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST +Nq.char] or 0)<0; end if Nq.prev_ruby then set_attr(lp, attr_ruby, Nq.prev_ruby) @@ -758,6 +878,11 @@ do elseif rst.pre < 0 then -- auto rst.pre = 0 end + if rst.quirk_protrusion then + local lk = node_new(id_kern, 1, Nq.nuc, lp); set_attr(lk, attr_icflag, PROCESSED) + insert_after(lpv, node_tail(lpv), lk) + insert_after(lpv, node_tail(lpv), node_new(id_kern, 1)) + end return Np else return Np @@ -780,10 +905,12 @@ do end local RIPOST = luatexja.stack_table_index.RIPOST local abs = math.abs + local ltjj_after_hlist=luatexja.jfmglue.after_hlist + local ltjj_check_box_high=luatexja.jfmglue.check_box_high local function whatsit_after_callback(s, Nq, Np, head) if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then if Np then - local last_glue = node_new(id_glue) + local last_glue = node_new(id_glue, nil, Nq.nuc) -- INHERIT ATTRIBUTE OF Nq.nuc set_attr(last_glue, attr_icflag, 0) insert_before(Nq.nuc, Np.first, last_glue) Np.first = last_glue @@ -798,8 +925,8 @@ do end local x = node_next(node_next(nqnv)) for i = 2, rst.count do x = node_next(node_next(x)) end - Nq.last_char = luatexja.jfmglue.check_box_high(Nq, getlist(x), nil) - luatexja.jfmglue.after_hlist(Nq) + Nq.last_char = ltjj_check_box_high(Nq, getlist(x), nil) + ltjj_after_hlist(Nq) if Np and Np.id ~=id_pbox_w and type(Np.char)=='number' then -- Np is a JAchar if rst.post < 0 then -- auto @@ -812,12 +939,15 @@ do Np.prev_ruby = get_attr(getvalue(Nq.nuc), attr_ruby_id) -- 前のクラスタがルビであったことのフラグ else -- 直前が文字以外 - local nqnv = getvalue(Nq.nuc) - local rst = getvalue(nqnv) if rst.post < 0 then -- auto rst.post = 0 end end + if rst.quirk_protrusion then + local lk = node_tail(nqnv); + node_inherit_attr(lk, Nq.nuc, Np and Np.nuc) + set_attr(lk, attr_icflag, PROCESSED) + end return head else return s diff --git a/macros/luatex/generic/luatexja/src/ltjsclasses.dtx b/macros/luatex/generic/luatexja/src/ltjsclasses.dtx index a151210339..19f54e35a1 100644 --- a/macros/luatex/generic/luatexja/src/ltjsclasses.dtx +++ b/macros/luatex/generic/luatexja/src/ltjsclasses.dtx @@ -44,7 +44,7 @@ %<*driver> \ProvidesFile{ltjsclasses.dtx} %</driver> - [2022/09/12 ltjsclasses ] + [2023/07/26 ltjsclasses ] %<*driver> \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{} \documentclass[disablejfam]{ltjsarticle} @@ -5139,6 +5139,13 @@ % % [2018-03-11] |\next|などいくつかの内部命令を |\jsc@...| 付きの % ユニークな名前にしました。 +% +% [2022-09-13] \LaTeXe~2021-11-15 (ltfloat.dtx 2021/10/14 v1.2g)で +% |\@currentcounter|が追加されましたので,追随します。 +% なお,\LaTeXe~2021-06-01 (ltfloat.dtx 2021/02/10 v1.2e)で +% parhook対応として\cs{par}が追加されていますが, +% 実は同時に\cs{color@endgroup}も\cs{endgraf}するように変更 +% されていますので,不要だと思います。というわけで追加しません。 % \begin{macrocode} \long\def\@footnotetext{% \insert\footins\bgroup diff --git a/macros/luatex/generic/luatexja/src/luatexja.lua b/macros/luatex/generic/luatexja/src/luatexja.lua index 1013684496..e815ba3d68 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.lua +++ b/macros/luatex/generic/luatexja/src/luatexja.lua @@ -423,9 +423,10 @@ local utfchar = utf.char local function debug_show_node_X(p,print_fn, limit, inner_depth) local k = prefix local s - local pt, pic = node_type(p.id), (get_attr(p, attr_icflag) or 0) % icflag_table.PROCESSED_BEGIN_FLAG - local base = prefix .. '[' .. string.format('%7d', node.direct.todirect(p)) .. '] ' .. - string.format('%X', pic) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' ' + local pt, pic = node_type(p.id), (get_attr(p, attr_icflag) or 0) --% icflag_table.PROCESSED_BEGIN_FLAG + local base = prefix .. '[' .. string.format('%7d', node.direct.todirect(p)) + .. ', ' .. tostring(get_attr(p, 27)) .. '] ' + .. string.format('%X', pic) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' ' if pt == 'glyph' then s = base .. ' ' .. (p.char<0xF0000 and utfchar(p.char) or '') diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty index a54ede6758..90bb4fdf7e 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.sty +++ b/macros/luatex/generic/luatexja/src/luatexja.sty @@ -27,7 +27,7 @@ \newif\ifltj@disablejfam %%%% VERSION -\def\LuaTeXjaversion{20240514.0} +\def\LuaTeXjaversion{20240909.0} %% Check if LaTeX is used. \begingroup\expandafter\expandafter\expandafter\endgroup diff --git a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty index 1c8f9cba4e..121a45ba0b 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty @@ -219,10 +219,6 @@ \@latex@error{Direction change inside float!?\MessageBreak Use \noexpand\layoutcaption provided in \string\usepackage{lltjext}}\@ehc} %%% Remove extra xkanjiskip -\renewcommand\@makefnmark{% - \unless\ifnum\ltjgetparameter{direction}=3 - \hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}% - \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi} \begingroup \@ifpackageloaded{hyperref} {\ifdefined\real@setref\def\ltj@setrefprefix{real}\else\def\ltj@setrefprefix{}\fi} @@ -250,6 +246,11 @@ \gdef\@stopfield{% \inhibitglue\@tempskipa\lastskip\unskip \hskip\@tempskipa\color@endgroup\egroup} +%%%%%% footnote +\renewcommand\@makefnmark{% + \unless\ifnum\ltjgetparameter{direction}=3 + \hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}% + \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi} \pretocmd{\footnote}{\inhibitglue}{}{} \pretocmd{\footnotemark}{\inhibitglue}{}{} \def\@ltj@process@makefnmark#1{% diff --git a/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty b/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty index bb63ac6877..00c858e349 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjdefs}[2022-01-23 Default font settings of LuaTeX-ja] +\ProvidesPackage{lltjdefs}[2024-05-16 Default font settings of LuaTeX-ja] \ifdefined\ltj@stdmcfont\else\def\ltj@stdmcfont{file:HaranoAjiMincho-Regular.otf}\fi \ifdefined\ltj@stdgtfont\else\def\ltj@stdgtfont{file:HaranoAjiGothic-Medium.otf}\fi @@ -18,13 +18,8 @@ \DeclareKanjiEncodingDefaults{}{} \DeclareErrorKanjiFont{JY3}{mc}{m}{n}{10} \kanjifamily{mc} -\ifnum\ltj@@latex@plv<1500 % <=2020-10-01 - \kanjiseries{m} - \kanjishape{n} -\else % >=2021-06-01 - \def\k@series{m} - \def\k@shape{n} -\fi +\def\k@series{m} +\def\k@shape{n} \fontsize{10}{10} \DeclareYokoKanjiEncoding{JY3}{}{} \DeclareKanjiSubstitution{JY3}{mc}{m}{n} @@ -37,12 +32,7 @@ \newcommand\kanjiencodingdefault{JY3} \newcommand\kanjifamilydefault{\mcdefault} \newcommand\kanjiseriesdefault{\mddefault} -\ifnum 0\ifltj@ltfilehook@avail1\fi\ifdefined\@rmfamilyhook1\fi>0 - %% LaTeX 2020-02-02 - \newcommand\kanjishapedefault{\shapedefault} -\else%% LaTeX 2019-10-01 - \newcommand\kanjishapedefault{\updefault} -\fi +\newcommand\kanjishapedefault{\shapedefault} \DeclareKanjiFamily{JY3}{mc}{} \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] @@ -90,57 +80,36 @@ \DeclareMathAlphabet{\mathgt}{JY3}{gt}{m}{n} \fi -\ifnum 0\ifltj@ltfilehook@avail1\fi\ifdefined\@rmfamilyhook1\fi>0 -%%%% LaTeX >= 2020-02-02 \edef\bfseries@mc{\bfdefault} \edef\bfseries@gt{\bfdefault} \def\bfseries@jtt{\bfseries@mc} \edef\mdseries@mc{\mddefault} \edef\mdseries@gt{\mddefault} \def\mdseries@jtt{\mdseries@mc} -\fi \newif\if@ltj@match@family \@ltj@match@familyfalse \def\verbatim@font{\normalfont\ttfamily\kanjifamily\jttdefault\selectfont} -\def\@ltj@hook@family#1#2{% #1: csname #2: contents - \ifltj@ltfilehook@avail % LaTeX 2020-10-01 - \AddToHook{#1}{#2}% - \else\ifcsname @#1hook\endcsname % LaTeX 2020-02-02 - \csappto{@#1hook}{#2}% - \else % LaTeX 2019-10-01 - \ifcsname #1 \endcsname - \expandafter\patchcmd\csname #1 \endcsname{\selectfont}{#2\selectfont}{}{}% - \else - \PackageWarningNoLine{luatexja}{% - Patching to \expandafter\string\csname #1\endcsname\space failed% - }% - \fi - \fi\fi -} -\@ltj@hook@family{rmfamily}{% +\AddToHook{rmfamily}{% \if@ltj@match@family \prepare@family@series@update@kanji{mc}\mcdefault \fi } -\@ltj@hook@family{sffamily}{% +\AddToHook{sffamily}{% \if@ltj@match@family \prepare@family@series@update@kanji{gt}\gtdefault \fi } -\@ltj@hook@family{ttfamily}{% +\AddToHook{ttfamily}{% \if@ltj@match@family \prepare@family@series@update@kanji{jtt}\jttdefault \fi } -\let\@ltj@hook@family\@undefined -\ifltj@ltfilehook@avail % 2020-10-01 - \expandafter\def\expandafter\kanjiseriesdefault - \expandafter{\kanjiseriesdefault\@empty} - \let\kanjiseriesdefault@kernel\kanjiseriesdefault -\fi +\expandafter\def\expandafter\kanjiseriesdefault + \expandafter{\kanjiseriesdefault\@empty} +\let\kanjiseriesdefault@kernel\kanjiseriesdefault %%% \eminnershape \expandafter\patchcmd\csname em \endcsname{\itshape}{\gtfamily\itshape}{}{} diff --git a/macros/luatex/generic/luatexja/src/patches/lltjfont.sty b/macros/luatex/generic/luatexja/src/patches/lltjfont.sty index 2efc9435ab..52ac44d5cc 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjfont.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjfont.sty @@ -3,31 +3,10 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjfont}[2023-04-13 Patch to NFSS2 for LuaTeX-ja] +\ProvidesPackage{lltjfont}[2023-05-16 Patch to NFSS2 for LuaTeX-ja] %%%%%%%% LaTeX2e version detection -\newcount\ltj@@latex@plv \ltj@@latex@plv=-1 -\ifltj@ltfilehook@avail -\ExplSyntaxOn - \cs_if_exist:NTF \__shipout_execute_main_cont:Nnnn - {\ltj@@latex@plv=1500}% 2021-06-01 - {\ifnum\patch@level>2\relax \ltj@@latex@plv=1300\else \ltj@@latex@plv=1000\fi}% 2020-10-01 -\ExplSyntaxOff -\else\ifdefined\@rmfamilyhook % 2020-02-02 - \ifx\@forced@seriestrue\@undefined % 2020-02-02 pl0--2 - \@latex@error - {Please update LaTeX2e!^^J\space\space - At least LaTeX2e 2020-02-02 patch level 3 is required}% - {LaTeX2e 2020-02-02 patch level 2 (and 4) has a bug.} - \else - \ltj@@latex@plv=300 - \unless\ifx\series@maybe@drop@one@m@x\@undefined % pl5 + develop - \ltj@@latex@plv=501 - \else\unless\ifx\series@maybe@drop@one@m\@undefined % patch level 5 - \ltj@@latex@plv=500 - \fi\fi - \fi -\fi\fi +\newcount\ltj@@latex@plv \ltj@@latex@plv=1500 %% patching \DeclareTextComposite \def\ltj@chardef@text@cmd#1{% @@ -400,59 +379,7 @@ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}% }% \fi} -\ifnum\ltj@@latex@plv<1500 % <=2020-10-01 -\protected\def\ltj@selectfont@patch{% - \ltj@@start@time@measure{selectfont}% - \let\tmp@error@fontshape\error@fontshape - \let\error@fontshape\error@kfontshape - \ltj@@is@kyenc{\k@encoding}\ifin@% - \let\cy@encoding\k@encoding - \ensure@KanjiEncodingPair{t}% - \edef\ct@encoding{\csname t@enc@\k@encoding\endcsname}% - \else - \ltj@@is@ktenc{\k@encoding}\ifin@% - \let\ct@encoding\k@encoding - \ensure@KanjiEncodingPair{y}% - \edef\cy@encoding{\csname y@enc@\k@encoding\endcsname}% - \else - \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha - \fi - \fi - \global\let\ltj@afont@name=\font@name - \ltj@selectfont@tate\ltj@selectfont@yoko -% - \edef\tmp@item{{\k@encoding}}\expandafter\def\expandafter\k@encoding\tmp@item - \kenc@update - \global\let\font@name=\ltj@afont@name - \let\error@fontshape\tmp@error@fontshape - \if@knjcmd \@knjcmdfalse - \expandafter\ifx - \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\relax - \expandafter\ifx - \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\relax - \else - \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\selectfont - % 警告: 再び \selectfont を呼んでいる.無限ループの可能性あり - \fi - \else - \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\selectfont - % 警告: 再び \selectfont を呼んでいる.無限ループの可能性あり - \fi - \fi - \global\let\font@name=\ltj@afont@name - \ltj@@stop@time@measure{selectfont}% -} -\RequirePackage{everysel} -\let\ltj@@EverySelectfont@Init=\@EverySelectfont@Init -\expandafter\expandafter\expandafter\let -\expandafter\expandafter\csname ltj@@orig@selectfont\endcsname\csname selectfont\space\endcsname -\@EverySelectfont@Init% for LaTeX2e <=2020-10-01 -\def\@EverySelectfont@Init{% - \expandafter\let\csname selectfont\space \endcsname \ltj@@orig@selectfont - \ltj@@EverySelectfont@Init -} -\EverySelectfont{\ltj@selectfont@patch} -\else % LaTeX2e >=2021-06-01 + \AddToHook{selectfont}[luatexja]{% \ltj@@start@time@measure{selectfont}% \ifx\delayed@k@adjustment\@empty @@ -514,7 +441,6 @@ \global\let\font@name=\ltj@afont@name \ltj@@stop@time@measure{selectfont}% } -\fi \bgroup \def\ltj@@dir@patch#1#2#3{% @@ -721,8 +647,6 @@ } %%%%%% -\ifnum\ltj@@latex@plv>0 -%%%% LaTeX >= 2020-02-02 \newif\if@shape@roman@kanji \def\merge@kanji@series#1{% @@ -740,76 +664,11 @@ \@nil } -\ifnum\ltj@@latex@plv>500 % !!! pl5 + develop \def\set@target@series@kanji#1{% \edef\k@series{#1}% \series@maybe@drop@one@m\k@series\k@series } -\else\ifnum\ltj@@latex@plv>300 % !!! pl5 - \def\set@target@series@kanji#1{% - \edef\k@series{#1}% - \expandafter\series@maybe@drop@one@m\expandafter{\k@series}\k@series - } -\else % !!! pl 3, 4 - \def\set@target@series@kanji#1{% - \edef\k@series{#1}% - \edef\k@series{\expandafter\series@drop@one@m\k@series mm\series@drop@one@m}% - } -\fi\fi -\ifnum\ltj@@latex@plv<1500% <=2020-10-01 -\def\merge@kanji@series@#1#2#3\@nil{% - \def\reserved@a{#3}% - \ifx\reserved@a\@empty - \set@target@series@kanji{#2}% - \else - \begingroup\let\f@encoding\k@encoding\let\f@family\k@family - \maybe@load@fontshape\endgroup - \edef\reserved@a{\k@encoding /\k@family /#1/\k@shape}% - \ifcsname \reserved@a \endcsname - \set@target@series@kanji{#1}% - \else - \ifcsname \k@encoding /\k@family /#2/\k@shape \endcsname - \set@target@series@kanji{#2}% - {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% - \else - \set@target@series@kanji{#3}% - {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% - \fi - \fi - \fi -} -\def\merge@kanji@shape@#1#2#3\@nil{% - \def\reserved@a{#3}% - \ifx\reserved@a\@empty - \if@shape@roman@kanji - \set@safe@kanji@shape{#2}{}% - \else - \edef\k@shape{#2}% - \fi - \else - \begingroup\let\f@encoding\k@encoding\let\f@family\k@family - \maybe@load@fontshape\endgroup - \edef\reserved@a{\k@encoding /\k@family /\k@series/#1}% - \ifcsname \reserved@a\endcsname - \edef\k@shape{#1}% - \else - \ifcsname \k@encoding /\k@family /\k@series/#2\endcsname - \edef\k@shape{#2}% - {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% - \else - \if@shape@roman@kanji - \set@safe@kanji@shape{#3}% - {{\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}}% - \else - \edef\k@shape{#3}% - {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% - \fi - \fi - \fi - \fi -} -\else % >=2021-06-01 \def\merge@kanji@series@#1#2#3\@nil{% \def\reserved@a{#3}% \ifx\reserved@a\@empty @@ -892,20 +751,8 @@ \fi } \let\delayed@merge@kanji@shape\merge@kanji@shape@without@substitution -\fi \newif\if@forced@series@kanji -\ifnum\ltj@@latex@plv=300 % 2020-02-02 pl3, 4 - \DeclareRobustCommand\romanseries[1]{\merge@font@series{#1}} - \DeclareRobustCommand\kanjiseries[1]{\merge@kanji@series{#1}} - \DeclareRobustCommand\romanseriesforce[1]{\edef\f@series{#1}} - \DeclareRobustCommand\kanjiseriesforce[1]{\edef\k@series{#1}} -\else\ifnum\ltj@@latex@plv<1500% >=2020-02-02 pl5 and <=2020-10-01 - \DeclareRobustCommand\romanseries[1]{\@forced@seriesfalse\merge@font@series{#1}} - \DeclareRobustCommand\kanjiseries[1]{\@forced@series@kanjifalse\merge@kanji@series{#1}} - \DeclareRobustCommand\romanseriesforce[1]{\@forced@seriestrue\edef\f@series{#1}} - \DeclareRobustCommand\kanjiseriesforce[1]{\@forced@series@kanjitrue\edef\k@series{#1}} -\else% >=2021-06-01 \DeclareRobustCommand\romanseries[1]{\@forced@seriesfalse \expandafter\def\expandafter\delayed@f@adjustment\expandafter {\delayed@f@adjustment\delayed@merge@font@series{#1}}} @@ -919,22 +766,9 @@ \expandafter\def\expandafter\delayed@k@adjustment\expandafter {\delayed@k@adjustment\edef\k@series{#1}}} \let\delayed@k@adjustment\@empty -\fi\fi \DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}}% \DeclareRobustCommand\fontseriesforce[1]{\kanjiseriesforce{#1}\romanseriesforce{#1}}% -\ifnum\ltj@@latex@plv<1500% <=2020-10-01 - \DeclareRobustCommand\romanshape[1]{\merge@font@shape{#1}} - \DeclareRobustCommand\kanjishape[1]{\merge@kanji@shape{#1}} - \DeclareRobustCommand\fontshape[1]{% - \@shape@roman@kanjitrue - \merge@font@shape{#1}\merge@kanji@shape{#1}% - \@shape@roman@kanjifalse - } - \DeclareRobustCommand\romanshapeforce[1]{\edef\f@shape{#1}} - \DeclareRobustCommand\kanjishapeforce[1]{\edef\k@shape{#1}} - \DeclareRobustCommand\fontshapeforce[1]{\set@safe@kanji@shape{#1}{}\romanshapeforce{#1}} -\else% >=2021-06-01 \DeclareRobustCommand\romanshape[1]{% \expandafter\def\expandafter\delayed@f@adjustment\expandafter {\delayed@f@adjustment\delayed@merge@font@shape{#1}}} @@ -956,9 +790,6 @@ \romanshapeforce{#1}% \expandafter\def\expandafter\delayed@k@adjustment\expandafter {\delayed@k@adjustment\set@safe@kanji@shape{#1}{}}} -\fi -\ifnum\ltj@@latex@plv>1499 -%%%% LaTeX >= 2021-06-01 \DeclareRobustCommand\usekanji[4]{% \kanjiencoding{#1}\edef\k@family{#2}% \set@target@series@kanji{#3}\edef\k@shape{#4}% @@ -969,42 +800,6 @@ \set@target@series{#3}\edef\f@shape{#4}% \let\delayed@f@adjustment\@empty \selectfont\ignorespaces} -\else\ifnum\ltj@@latex@plv>1000 -%%%% 2021-10-01 PL3 <= LaTeX < 2021-06-01 -\DeclareRobustCommand\usekanji[4]{% - \kanjiencoding{#1}\edef\k@family{#2}% - \set@target@series@kanji{#3}\edef\k@shape{#4}% - \selectfont\ignorespaces} -\DeclareRobustCommand\useroman[4]{% - \romanencoding{#1}\edef\f@family{#2}% - \set@target@series{#3}\edef\f@shape{#4}% - \selectfont\ignorespaces} -\else -%%%% 2020-10-01 <= LaTeX < 2020-10-01 PL3 -\DeclareRobustCommand\usekanji[4]{% - \kanjiencoding{#1}\edef\k@family{#2}\edef\k@series{#3}\edef\k@shape{#4}% - \selectfont\ignorespaces} -\DeclareRobustCommand\useroman[4]{% - \romanencoding{#1}\edef\f@family{#2}\edef\f@series{#3}\edef\f@shape{#4}% - \selectfont\ignorespaces} -\fi\fi -%%%% LaTeX >= 2020-02-02 END -\else -%%%% LaTeX 2019-10-01 -\DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}} -\DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}} -\DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}} -\DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}} -\DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}} -\DeclareRobustCommand\fontshape[1]{\set@safe@kanji@shape{#1}{}\romanshape{#1}} -\DeclareRobustCommand\usekanji[4]{% - \kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}% - \selectfont\ignorespaces} -\DeclareRobustCommand\useroman[4]{% - \romanencoding{#1}\romanfamily{#2}\romanseries{#3}\romanshape{#4}% - \selectfont\ignorespaces} -%%%% LaTeX 2019-10-01 END -\fi %%%% \def\set@safe@kanji@shape#1#2{% @@ -1026,8 +821,6 @@ \else\useroman{#1}{#2}{#3}{#4}% \fi} -\ifnum 0\ifltj@ltfilehook@avail1\fi\ifdefined\@rmfamilyhook1\fi>0 -%%%% LaTeX >= 2020-02-02 \let\prepare@family@series@update@kanji=\prepare@family@series@update \patchcmd\prepare@family@series@update{\fontfamily}{\romanfamily}{}{} \patchcmd\prepare@family@series@update@kanji{\if@forced@series}{\if@forced@series@kanji}{}{} @@ -1049,34 +842,16 @@ \patchcmd\update@series@target@value@kanji{\f@series}{\k@series}{}{} \def\@meta@family@list@kanji{\@elt{mc}\@elt{gt}\@elt{jtt}} -\def\@ltj@hook@series@default#1#2#3{% - \ifltj@ltfilehook@avail % 2020-10-01 - \AddToHook{#1/defaults}{#2}% - \else\ifcsname @set#1defaultshook\endcsname %after 2020-04-07 - \expandafter\g@addto@macro\csname @set#1defaultshook\endcsname{#2}% - \else % 2020-02-02 - \expandafter\patchcmd\csname #1 \endcsname{#3}{#3#2}{}{}% - \fi\fi -} -\@ltj@hook@series@default{bfseries}{% +\AddToHook{bfseries/defaults}{% \let\bfseries@mc\bfdef@ult \let\bfseries@gt\bfdef@ult \let\bfseries@jtt\bfdef@ult -}{% - \let\bfseries@rm\bfdef@ult - \let\bfseries@sf\bfdef@ult - \let\bfseries@tt\bfdef@ult } -\@ltj@hook@series@default{mdseries}{% +\AddToHook{mdseries/defaults}{% \let\mdseries@mc\mddef@ult \let\mdseries@gt\mddef@ult \let\mdseries@jtt\mddef@ult -}{% - \let\mdseries@rm\mddef@ult - \let\mdseries@sf\mddef@ult - \let\mdseries@tt\mddef@ult } -\let\@ltj@hook@series@default\@undefined \expandafter\patchcmd\csname bfseries \endcsname{% \ifx\f@family\rmdef@ult \fontseries\bfseries@rm @@ -1105,105 +880,41 @@ \fi\fi\fi }{}{} -\def\@ltj@hook@series#1#2{% - \ifltj@ltfilehook@avail % 2020-10-01 - \AddToHook{#1}{#2}% - \else % 2020-02-02 - \expandafter\patchcmd\csname #1 \endcsname{\selectfont}{#2\selectfont}{}{}% - \fi -} -\@ltj@hook@series{bfseries}{% +\AddToHook{bfseries}{% \ifx\k@family\mcdef@ult \kanjiseries\bfseries@mc \else\ifx\k@family\gtdef@ult \kanjiseries\bfseries@gt \else\ifx\k@family\jttdef@ult\kanjiseries\bfseries@jtt \else \kanjiseries\bfdefault \fi\fi\fi } -\@ltj@hook@series{mdseries}{% +\AddToHook{mdseries}{% \ifx\k@family\mcdef@ult \kanjiseries\mdseries@mc \else\ifx\k@family\gtdef@ult \kanjiseries\mdseries@gt \else\ifx\k@family\jttdef@ult\kanjiseries\mdseries@jtt \else \kanjiseries\mddefault \fi\fi\fi } -\let\@ltj@hook@series\@undefined -\def\@ltj@hook@efd#1#2{% - \ifltj@ltfilehook@avail % 2020-10-01 - \AddToHook{expand@font@defaults}{#1}% - \else\ifdefined\@expandfontdefaultshook %after 2020-04-07 - \g@addto@macro\@expandfontdefaultshook{#1#2}% - \else % 2020-02-02 - \appto\expand@font@defaults{#1#2}% - \fi\fi -} -\@ltj@hook@efd{% +\AddToHook{expand@font@defaults}{% \edef\mcdef@ult{\mcdefault}% \edef\gtdef@ult{\gtdefault}% \edef\jttdef@ult{\jttdefault}% -}{\edef\kanjidef@ult{\kanjifamilydefault}} -\let\@ltj@hook@efd\@undefined + \edef\kanjidef@ult{\kanjifamilydefault}} -\ifltj@ltfilehook@avail % 2020-10-01 - \appto\init@series@setup{% - \ifx\kanjiseriesdefault\kanjiseriesdefault@kernel - \mdseries - \let\kanjiseriesdefault\k@series - \fi - } -\else - \appto\init@series@setup{% - \ifx\kanjidef@ult\mcdef@ult \mcfamily - \else\ifx\kanjidef@ult\gtdef@ult \gtfamily - \else\ifx\kanjidef@ult\jttdef@ult \jttfamily - \fi\fi\fi - } -\fi - -\def\@ltj@hook@dfh#1{% - \ifltj@ltfilehook@avail % 2020-10-01 - \AddToHook{normalfont}{#1}% - \else\ifdefined\@defaultfamilyhook - \g@addto@macro\@defaultfamilyhook{#1}% - \else % 2020-02-02 - \expandafter\patchcmd\csname normalfont \endcsname{\selectfont}{#1\selectfont}{}{}% - \let\reset@font\normalfont - \fi\fi +\appto\init@series@setup{% + \ifx\kanjiseriesdefault\kanjiseriesdefault@kernel + \mdseries + \let\kanjiseriesdefault\k@series + \fi } -\ifnum\ltj@@latex@plv>1499 -\@ltj@hook@dfh{% +\AddToHook{normalfont}{% \kanjiencoding{\kanjiencodingdefault}% \edef\k@family{\kanjifamilydefault}% \edef\k@series{\kanjiseriesdefault}% \edef\k@shape{\kanjishapedefault}% \let\delayed@k@adjustment\empty } -\else -\@ltj@hook@dfh{% - \kanjiencoding{\kanjiencodingdefault}% - \edef\k@family{\kanjifamilydefault}% - \edef\k@series{\kanjiseriesdefault}% - \edef\k@shape{\kanjishapedefault}% -} -\fi -\let\@ltj@hook@dfh\@undefined -%%%% LaTeX >= 2020-02-02 END -\else -%%%% LaTeX 2019-10-01 -\DeclareRobustCommand\normalfont{% - \useroman\encodingdefault\familydefault\seriesdefault\shapedefault - \usekanji\kanjiencodingdefault\kanjifamilydefault\kanjiseriesdefault\kanjishapedefault} -\let\reset@font\normalfont -%%%% LaTeX 2019-10-01 END -\fi - - - -\ifdefined\prepare@family@series@update@kanji\else -%%%% LaTeX 2019-10-01 -\def\prepare@family@series@update@kanji#1{\kanjifamily} -\fi \DeclareRobustCommand\mcfamily{% \unless\ifltj@disablejfam\not@math@alphabet\mcfamily\mathmc\fi diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-array.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-array.sty index 9575dc3c04..fa5fe7b933 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjp-array.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjp-array.sty @@ -3,7 +3,9 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-array}[2019-07-18 Patch to array for LuaTeX-ja] +\ProvidesPackage{lltjp-array}[2024-07-21 Patch to array for LuaTeX-ja] + +\@ifpackageloaded{array}{\def\lltjp@array@array@loaded{1}}{\let\lltjp@array@array@loaded\relax} \RequirePackage{etoolbox,array} @@ -11,16 +13,23 @@ \ignorespaces\@sharp\unskip }{% \ltj@sharp -}{}{} +}{}{% >=2024-06-01 + \def\ltj@sharp{\relax\pltx@next@inhibitglue\ltjfakeboxbdd\ignorespaces\@sharp\textonly@unskip\ltjfakeboxbdd} + \patchcmd\insert@column{% + \ignorespaces\@sharp\textonly@unskip + }{% + \ltj@sharp + }{}{} +} \@ifpackageloaded{lltjext}{}{% %% remove extra \xkanjiskip (pLaTeX2e 2016/04/17) -\def\@tabular{% - \leavevmode \null - \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup - \let\d@llarend\endgroup - \@tabarray} -\def\endtabular{\endarray $\egroup\null} +\ifnum0<0\lltjp@array@array@loaded + \patchcmd{\@tabular}{\leavevmode}{\leavevmode\null}{}{} + \patchcmd{\@tabular}{\leavevmode\null\null}{\leavevmode\null}{}{} + \apptocmd{\endtabular}{\null}{}{} + \let\lltjp@array@array@loaded\undefined +\fi \expandafter \let \csname endtabular*\endcsname = \endtabular } \endinput diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-footmisc.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-footmisc.sty index edde267d3c..5ee7d407ce 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjp-footmisc.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjp-footmisc.sty @@ -3,63 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-footmisc}[2022-02-19 Patch to footmisc for LuaTeX-ja] +\ProvidesPackage{lltjp-footmisc}[2024-07-22 Patch to footmisc for LuaTeX-ja] -\@ifpackagelater{footmisc}{2022-02-10}{%% v6.0a or later - \patchcmd{\@makenormalcolbox}{\vskip -\@outputbox@depth\@textbottom}% - {\pltx@adjust@wd@outputbox\vskip -\@outputbox@depth\@textbottom}{}{}% - \let\ltj@next\endinput -}{\let\ltj@next\relax} -\ltj@next - -% old (v5.5) -\let \if@tempswa \ifFN@bottom -\ifFN@para \@tempswatrue \fi -\if@tempswa - \ifFN@bottom - \toks@{\setbox\@outputbox \box\@cclv - \xdef\@freelist{\@freelist\@midlist}% - \global\let\@midlist\@empty - \@combinefloats - \ifvoid\footins - \else - \setbox\@outputbox \vbox\bgroup - \boxmaxdepth\@maxdepth - \unvbox\@outputbox - \vfill\relax - } - \the\FN@temptoken - \toks@\expandafter{\the\toks@\egroup\fi} - \else - \toks@{\ifvoid\footins - \setbox\@outputbox\box\@cclv - \else - \setbox\@outputbox \vbox\bgroup - \boxmaxdepth\@maxdepth - \unvbox\@cclv - } - \the\FN@temptoken - \toks@\expandafter{\the\toks@ - \egroup - \fi - \xdef\@freelist{\@freelist\@midlist}% - \global\let\@midlist\@empty - \@combinefloats - }% - \fi - \toks@\expandafter{\the\toks@ - \ifvbox\@kludgeins - \@makespecialcolbox - \else - \setbox\@outputbox \vbox to\@colht{% - \@texttop \dimen@\dp\@outputbox - \unvbox\@outputbox - \pltx@adjust@wd@outputbox - \vskip -\dimen@\@textbottom - }% - \fi - \global\maxdepth\@maxdepth - } - \edef\@makecol{\the\toks@} -\fi -\endinput +\patchcmd{\@makenormalcolbox}{\vskip -\@outputbox@depth\@textbottom}% + {\pltx@adjust@wd@outputbox\vskip -\@outputbox@depth\@textbottom}{}{}% diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty index 67b0f5de7f..641fa4a34d 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-geometry}[2021-10-24 Patch to geometry for LuaTeX-ja with vertical writing mode] +\ProvidesPackage{lltjp-geometry}[2024-05-16 Patch to geometry for LuaTeX-ja with vertical writing mode] \RequirePackage{expl3} \ifdefined\if@ltj@@geometry@tate\expandafter\endinput\fi \newif\if@ltj@@geometry@tate @@ -31,15 +31,6 @@ %============================================ \unless\ifdefined\ltj@ExecuteAfterPackage -\expandafter\newif\csname ifltj@ltfilehook@avail\endcsname -\@ifl@t@r\fmtversion{2020-10-01}{% - \@ifl@t@r\fmtversion{2020-10-02}{\ltj@ltfilehook@availtrue} - {% - \ifnum\patch@level<0\relax \ifnum\patch@level<-6 \ltj@ltfilehook@availtrue\fi - \else\ltj@ltfilehook@availtrue\fi - }% -}{} -\ifltj@ltfilehook@avail %% \ltj@ExecuteBeforePackage <package><code> and \ltj@ExecuteAfterPackage <package><code> %% no-starred version: do nothing if the <package> is loaded %% starred version: do <code> right away if the <package> is loaded @@ -64,11 +55,6 @@ \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteBeforePackage{#1}{#2}}% } } -\else - \RequirePackage{filehook} - \let\ltj@ExecuteAfterPackage=\AtEndOfPackageFile - \let\ltj@ExecuteBeforePackage=\AtBeginOfPackageFile -\fi \fi %============================================ @@ -89,12 +75,8 @@ \else \@gobble\iftrue\csname iftdir\endcsname \bool_set_true:N \l_tmpa_bool \fi \fi -\ifltj@ltfilehook@avail - \prop_map_inline:Nn \g__hook_begindocument_code_prop - { \tl_if_in:nnT {#2} {\tate} {\bool_set_true:N \l_tmpa_bool} } -\else - \tl_if_in:NnT \@begindocumenthook {\tate} {\bool_set_true:N \l_tmpa_bool} -\fi +\prop_map_inline:Nn \g__hook_begindocument_code_prop + { \tl_if_in:nnT {#2} {\tate} {\bool_set_true:N \l_tmpa_bool} } \bool_if:NT \l_tmpa_bool { \if@ltj@@geometry@forceoff \@ltj@@geometry@tatefalse diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-siunitx.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-siunitx.sty index 9c4526c3fd..292cbf00bf 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjp-siunitx.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjp-siunitx.sty @@ -1,5 +1,5 @@ % -% lltjp-siunitx.sty 2022-12-14 +% lltjp-siunitx.sty 2024-06-10 % \NeedsTeXFormat{LaTeX2e} @@ -7,7 +7,6 @@ \RequirePackage{siunitx} \makeatletter \ExplSyntaxOn -\cs_if_exist:NTF \siunitx_print_text:n {% siunitx v3.00 \cs_set_protected:Npn \siunitx_print_text:n #1 { \text @@ -32,104 +31,26 @@ } } \cs_set_eq:NN \ltj_orig__siunitx_table_collect_begin:w \__siunitx_table_collect_begin:w -\cs_set_protected:Npn \__siunitx_table_collect_begin:w #1 \relax - { \ltj_orig__siunitx_table_collect_begin:w } -\RenewDocumentCommand \tablenum { O { } m } - { - \mode_leave_vertical: - \group_begin: - \keys_set:nn { siunitx } {#1} - \siunitx_cell_begin:w - \relax \ignorespaces #2 - \siunitx_cell_end: - \group_end: - } -}% siunitx v3.00 end -{% siunitx v2.xx -\cs_generate_variant:Nn \tl_if_in:NnT { coT } -\cs_new:Nn \__ltj_siunix_patch_inner:n { - \cs_if_exist:cT { #1_tl } { - \tl_if_in:coT { #1_tl } { \tex_char:D } { - \tl_replace_all:cnn { #1_tl } { \tex_char:D } { \ltjalchar } - } +\cs_set_protected:Npn \__siunitx_table_collect_begin:w #1 { + \token_if_eq_meaning:NNTF #1 \relax + {\ltj_orig__siunitx_table_collect_begin:w } + {\ltj_orig__siunitx_table_collect_begin:w #1 } } -} -\cs_new:Nn \__ltj_siunix_patch_inner_math:n { - \__ltj_siunix_patch_inner:n { l__siunitx_#1_math } - \__ltj_siunix_patch_inner:n { l__siunitx_#1_text } -} -\AtBeginDocument { - \__ltj_siunix_patch_inner:n { c__siunitx_minus } - \__ltj_siunix_patch_inner:n { c__siunitx_mu } - \__ltj_siunix_patch_inner_math:n { angstrom } - \__ltj_siunix_patch_inner_math:n { arcminute } - \__ltj_siunix_patch_inner_math:n { arcsecond } - \__ltj_siunix_patch_inner_math:n { ohm } -} - -%%%% new table column: S and s -\bool_new:N \l__ltj_siunitx_table_collect_relax_bool -\cs_set_protected:Npn \__siunitx_table_collect_begin_s: { - \bool_set_false:N \l__ltj_siunitx_table_collect_relax_bool - \cs_set_eq:NN \__siunitx_table_collect_token:N - \__siunitx_table_collect_token_s:N - \cs_set_eq:NN \__siunitx_table_print: \__siunitx_table_print_s: - \__siunitx_table_collect_init_s: - \__siunitx_table_collect_get: -} - -\cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1 +\cs_set_protected:Npn \__siunitx_table_collect_token:N #1 { - \token_if_eq_meaning:NNTF #1 \tex_relax:D { - \bool_if:NTF \l__ltj_siunitx_table_collect_relax_bool { - \__siunitx_table_collect_not_braced_aux_i:N #1 - } { - \bool_set_true:N \l__ltj_siunitx_table_collect_relax_bool - } - } { - \token_if_eq_meaning:NNF #1 \ltjfakeboxbdd { - \token_if_eq_meaning:NNF #1 \pltx@next@inhibitglue { - \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D + \__siunitx_table_collect_search:NnF #1 { - \token_if_eq_meaning:NNF #1 \tex_unskip:D - { \__siunitx_table_collect_not_braced_aux_i:N #1 } + \ignorespaces { \__siunitx_table_collect_ignore_spaces:N #1} + \pltx@next@inhibitglue { \__siunitx_table_collect_loop:} + \ltjfakeboxbdd { \__siunitx_table_collect_loop:} + \textonly@unskip { \__siunitx_table_collect_loop:} + \unskip { \__siunitx_table_collect_loop:} + \end { \tabularnewline \end } + \relax { \__siunitx_table_collect_relax:N #1 } + \tabularnewline { \tabularnewline } + \siunitx_cell_end: { \siunitx_cell_end:} } - }}} - \__siunitx_table_collect_next: - } - -\AtBeginDocument - { - \@ifpackageloaded { mdwtab } - { - \cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1 - { - \token_if_eq_meaning:NNTF #1 \tex_relax:D { - \bool_if:NTF \l__ltj_siunitx_table_collect_relax_bool { - \__siunitx_table_collect_not_braced_aux_i:N #1 - } { - \bool_set_true:N \l__ltj_siunitx_table_collect_relax_bool - } - } { - \token_if_eq_meaning:NNF #1 \ltjfakeboxbdd { - \token_if_eq_meaning:NNF #1 \pltx@next@inhibitglue { - \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D - { - \token_if_eq_meaning:NNF #1 \tex_unskip:D - { - \token_if_eq_meaning:NNF #1 \tab@setcr - { - \token_if_eq_meaning:NNF #1 \@maybe@unskip - { \__siunitx_table_collect_not_braced_aux_i:N #1 } - } - } - } - }}} - \__siunitx_table_collect_next: - } - } - { } - } + { \__siunitx_table_collect_token_aux:N #1 } } \ExplSyntaxOff \endinput diff --git a/macros/luatex/generic/luaxml/README b/macros/luatex/generic/luaxml/README index 5df074c453..6a81ab25ce 100644 --- a/macros/luatex/generic/luaxml/README +++ b/macros/luatex/generic/luaxml/README @@ -32,7 +32,7 @@ Author ------ Michal Hoftich Email: michal.h21@gmail.com -Version: v0.1r, 2024-02-23 +Version: v0.2, 2024-07-14 Original authors: Paul Chakravarti and Manoel Campos (http://manoelcampos.com) diff --git a/macros/luatex/generic/luaxml/luaxml-cssquery.lua b/macros/luatex/generic/luaxml/luaxml-cssquery.lua index ebb29abb15..452656845c 100644 --- a/macros/luatex/generic/luaxml/luaxml-cssquery.lua +++ b/macros/luatex/generic/luaxml/luaxml-cssquery.lua @@ -156,7 +156,7 @@ local function cssquery() -- make sure we deal with a string value = tostring(value) -- make the search string safe for pattern matching - local escaped_search = search:gsub("([%(%)%.%%%+%–%*%?%[%^%$])", "%%%1") + local escaped_search = search:gsub("([%(%)%.%%%+%-%#%*%?%[%^%$])", "%%%1") if modifier == "" then return value == search elseif modifier == "|" then @@ -434,6 +434,18 @@ local function cssquery() return querylist end + --- Remove selector from the CSS list object. + -- All actions that literaly match the given selector will be removed. + function CssQuery:remove_selector( + selector -- CSS selector to be removed + ) + for pos, obj in ipairs(self.querylist) do + if obj.source == selector then + table.remove(self.querylist, pos) + end + end + end + --- It tests list of queries agaings a DOM element and executes the --- coresponding function that is saved for the matched query. -- @return nothing diff --git a/macros/luatex/generic/luaxml/luaxml-domobject.lua b/macros/luatex/generic/luaxml/luaxml-domobject.lua index 73689add5a..dca38df0db 100644 --- a/macros/luatex/generic/luaxml/luaxml-domobject.lua +++ b/macros/luatex/generic/luaxml/luaxml-domobject.lua @@ -6,16 +6,20 @@ local dom = {} local xml local handler local css_query +local html if kpse then xml = require("luaxml-mod-xml") handler = require("luaxml-mod-handler") css_query = require("luaxml-cssquery") + html = require("luaxml-mod-html") else xml = require("luaxml.mod-xml") handler = require("luaxml.mod-handler") css_query = require("luaxml.cssquery") + html = require("luaxml.mod-html") end +local HtmlParser = html.HtmlParser local void = {area = true, base = true, br = true, col = true, hr = true, img = true, input = true, link = true, meta = true, param = true} @@ -91,9 +95,14 @@ local function serialize_dom(parser, current,level, output) local format = get_action(typ, "start") insert(format, el, prepare_attributes(attr)) end - local function text(typ, text) + local function text(typ, text, parent) + local parent = parent or {} local format = get_action(typ, "text") - insert(format, escape_element(text)) + if parent.verbatim then + insert(format, text) + else + insert(format, escape_element(text)) + end end local function stop(typ, el) local format = get_action(typ, "stop") @@ -141,7 +150,7 @@ local function serialize_dom(parser, current,level, output) end start(xtype, name, attributes) - text(xtype,text_content) + text(xtype,text_content, (current or {})._parent) local children = root._children or {} for _, child in ipairs(children) do output = serialize_dom(parser,child, level + 1, output) @@ -411,8 +420,8 @@ local parse = function( return strings end - --- Get table with the inner text of an element -- leading and trailing spaces are removed and elements that contain only white space are ignored. - --- @return table + --- Get table with the inner text of an element - leading and trailing spaces are removed and elements that contain only white space are ignored. + -- @return table function DOM_Object:stripped_strings( current --- [optional] element to be selected ) @@ -612,11 +621,83 @@ local parse = function( -- include the methods to all xml nodes save_methods(parser._handler.root) -- parser: - return parser + return parser, DOM_Object +end + +-- table of elements that should be kept without XML escaping in the DOM serialization +local verbatim_elements = {script=true, style=true} + +local function html_to_dom(html_object) + -- convert parsed HTML DOM to the XML DOM + local dom, DOM_Object = parse("") -- use empty text to just initialize the DOM object + -- use root of the DOM object as the original parent + local current_parent = dom._handler.root + + local function create_node(tbl) + -- create node suitable for LuaXML DOM object + tbl._children = {} + -- this should copy methods from the DOM object to the newly created object + tbl.__index = DOM_Object + return setmetatable(tbl, DOM_Object) + end + + local function build_tree(object) + -- convert tree produced by the HTML parser to LuaXML DOM + local typ = object._type + -- process particular node types from the HTML parser + if typ == "doctype" then + current_parent:add_child_node(create_node {_name=object.name, _type="DTD"}) + elseif typ == "comment" then + current_parent:add_child_node(create_node {_text=object.text, _type="COMMENT"}) + elseif typ == "element" then + local attributes = {} + -- convert attributes to the form expected by the DOM object + for _, attr in ipairs(object.attr) do + attributes[attr.name] = attr.value + end + local element = current_parent:create_element(object.tag, attributes) + -- disable escaping of text in dom:serialize() for <script> or <style> elements + if verbatim_elements[string.lower(object.tag)] then element.verbatim = true end + current_parent:add_child_node(element) + -- set the current element as parent for the processing of children + local old_parent = current_parent + current_parent = element + -- process children + for k,v in ipairs(object.children) do + build_tree(v) + end + -- restore original parent + current_parent = old_parent + elseif typ == "text" then + local text = current_parent:create_text_node(object.text) + current_parent:add_child_node(text) + else + -- for other node types, just process the children + for k,v in ipairs(object.children) do + build_tree(v) + end + end + + end + build_tree(html_object) + return dom +end + +--- Parse HTML text as a DOM object. +-- It supports all methods as the object returned by the parse() function. +-- @param html_str string with the HTML code to be parsed +-- @return DOM_Object +local function html_parse(html_str) + local html_obj = HtmlParser:init(html_str) + local html_dom = html_obj:parse() + return html_to_dom(html_dom) end + + --- @export return { parse = parse, - serialize_dom= serialize_dom + serialize_dom= serialize_dom, + html_parse = html_parse } diff --git a/macros/luatex/generic/luaxml/luaxml-encodings.lua b/macros/luatex/generic/luaxml/luaxml-encodings.lua new file mode 100644 index 0000000000..71bfc81dd1 --- /dev/null +++ b/macros/luatex/generic/luaxml/luaxml-encodings.lua @@ -0,0 +1,88 @@ +--- Convert 8-bit encodings to UTF-8 +--- @module luaxml-encodings +-- this table is generated automatically by this command: +-- texlua encodings/make_encodings.lua +local encodings = { + ['ibm866'] = 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ ', + ['iso-8859-5'] = '�������������������������������� ЁЂЃЄЅІЇЈЉЊЋЌЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ', + ['macintosh'] = 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', + ['windows-1251'] = 'ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя', + ['iso-8859-13'] = '�������������������������������� ”¢£¤„¦§Ø©Ŗ«¬®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’', + ['iso-8859-6'] = '�������������������������������� ���¤�������،�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ', + ['iso-8859-8'] = '�������������������������������� �¢£¤¥¦§¨©×«¬®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��', + ['iso-8859-4'] = '�������������������������������� ĄĸŖ¤ĨĻ§¨ŠĒĢŦŽ¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙', + ['koi8-r'] = '─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ', + ['iso-8859-7'] = '�������������������������������� ‘’£€₯¦§¨©ͺ«¬�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ', + ['iso-8859-3'] = '�������������������������������� Ħ˘£¤�Ĥ§¨İŞĞĴ�Ż°ħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙', + ['windows-1256'] = '€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œں ،¢£¤¥¦§¨©ھ«¬®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûüے', + ['windows-1258'] = '€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ', + ['iso-8859-14'] = '�������������������������������� Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ', + ['windows-1252'] = '€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', + ['iso-8859-15'] = '�������������������������������� ¡¢£€¥Š§š©ª«¬®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', + ['x-mac-cyrillic'] = 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю€', + ['windows-1254'] = '€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ', + ['windows-1255'] = '€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��', + ['windows-1250'] = '€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙', + ['koi8-u'] = '─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ', + ['iso-8859-10'] = '�������������������������������� ĄĒĢĪĨĶ§ĻĐŠŦŽŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ', + ['windows-1257'] = '€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙', + ['windows-1253'] = '€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ', + ['iso-8859-2'] = '�������������������������������� Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙', + ['windows-874'] = '€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛', + ['iso-8859-16'] = '�������������������������������� ĄąŁ€„Š§š©Ș«ŹźŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ', +} + + +local utfchar = utf8.char + +--- Try to find an encoding in HTML string +---@param str string HTML document +---@param len number count of characters from the start of the string where it should search for the encoding metadata +---@return string encoding identifier, or nil and message if no encoding was found +local function find_html_encoding(str, len) + -- try to find encoding in the html document + -- we limit search length, because encoding should be in the document head, ideally near the start + local len = len or 4096 + local sub = str:sub(1, len) + for meta in sub:gmatch("<meta (.-)>") do + local charset = meta:match("charset%s*=%s*[\"']?(.-)[\"']") + if charset then return string.lower(charset) end + end + return nil, "Cannot find the document encoding" +end + +local function load_mapping(enc_name) + local enc_name = enc_name or "" + local enc = encodings[enc_name] + if not enc then return nil, "Cannot load encoding " .. enc_name end + local mapping,i = {}, 128 + for pos, codepoint in utf8.codes(enc) do + mapping[i] = utfchar(codepoint) + i = i + 1 + end + return mapping +end + +--- Convert string to utf-8 +---@param text string for converting +---@param mapping table +---@return string converted string +local function recode(text, mapping) + return text:gsub("(.)", function(char) + local charpoint = string.byte(char) + if charpoint > 127 then + return mapping[charpoint] + else + return false + end + end) +end + + +return { + encodings = encodings, + find_html_encoding = find_html_encoding, + load_mapping = load_mapping, + recode = recode +} + diff --git a/macros/luatex/generic/luaxml/luaxml-mod-html.lua b/macros/luatex/generic/luaxml/luaxml-mod-html.lua index 69e32b16e2..d8c2b7e932 100644 --- a/macros/luatex/generic/luaxml/luaxml-mod-html.lua +++ b/macros/luatex/generic/luaxml/luaxml-mod-html.lua @@ -1,3 +1,6 @@ +--- HTML parsing module for LuaXML +-- @module luaxml-mod-html +-- @author Michal Hoftich <michal.h21@gmail.com -- Copyright Michal Hoftich, 2022 -- HTML parser inspired by https://browser.engineering/html.html -- but then redone using https://html.spec.whatwg.org/multipage/parsing.html @@ -1540,9 +1543,14 @@ local function is_formatting_element(name) return formatting_element_names[name] end -local special_elements = {} +local function hash_from_array(tbl) + local t = {} + for _, v in ipairs(tbl) do t[v] = true end + return t +end + -local special_elements_list = {"address", "applet", "area", "article", "aside", +local special_elements_list = hash_from_array {"address", "applet", "area", "article", "aside", "base", "basefont", "bgsound", "blockquote", "body", "br", "button", "caption", "center", "col", "colgroup", "dd", "details", "dir", "div", "dl", "dt", "embed", "fieldset", "figcaption", "figure", "footer", "form", "frame", @@ -1555,13 +1563,9 @@ local special_elements_list = {"address", "applet", "area", "article", "aside", "mi","mo","mn","ms","mtext", "annotation-xml","foreignObject","desc", "title" } -for k,v in ipairs(special_elements_list) do - special_elements[v] = true -end - local function is_special(name) - return special_elements[name] + return special_elements_list[name] end -- these lists are used in HtmlParser:generate_implied_endtags() @@ -1649,8 +1653,12 @@ local HtmlTreeStates = {} +--- @type HtmlParser local HtmlParser = {} +--- Initialize the HTML Object +---@param body string HTML to be parsed +---@return table initialized object function HtmlParser:init(body) local o ={} setmetatable(o, self) @@ -1686,10 +1694,11 @@ for _,v in ipairs(self_closing_tags_list) do self_closing_tags[v] = true end - +--- Execute the HTML parser +--- @return table Root node of the HTML DOM function HtmlParser:parse() -- we assume utf8 input, you must convert it yourself if the source is - -- in a different encoding + -- in a different encoding. for example using luaxml-encodings library self.text = {} self.state = self.default_state -- this should enable us to pass over some characters that we want to ignore @@ -1791,6 +1800,7 @@ function HtmlParser:emit(token) elseif token_type == "start_tag" then self:add_text() -- self:start_attribute() + self:reset_insertion_mode() self:start_tag() -- print("Emit start tag", table.concat(token.name)) -- save last attribute @@ -1882,8 +1892,139 @@ function HtmlParser:set_xmlns(node, parent) end end +function HtmlParser:pop_element() + -- close the current element and add it to the DOM + local el = self:close_element() + local parent = self:get_parent() + parent:add_child(el) + return el +end + +local close_p_at_start = hash_from_array {"address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", "search", "section", "summary", "ul", "pre", "listing", "form", "table", "xmp", "hr"} + +local close_headers = hash_from_array {"h1", "h2", "h3", "h4", "h5", "h6"} + +local body_modes = hash_from_array {"in_body", "in_cell", "in_row", "in_select", "in_table", "in_table_body", "in_frameset"} + +local list_items = hash_from_array {"li", "dt", "dd"} + +local close_address_at_end = hash_from_array{"address", "article", "aside", "blockquote", "button", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "search", "section", "summary", "ul", "form"} + + +function HtmlParser:close_unfinished(name) + -- close all unfinished elements until the element with the given name is found + for i = #self.unfinished, 1, -1 do + local el = self:pop_element() + if el.tag == name then + break + end + end +end + + +function HtmlParser:close_paragraph() + -- close currently open <p> elements + self:close_unfinished("p") +end + +function HtmlParser:current_element_name() + -- return name of the current element + return self:get_parent().tag +end + +local not_specials = hash_from_array { "address", "div", "p"} + +local function handle_list_item(self, name) + -- we handle li, dt and dd. dt and dd should close each other, li closes only itself + local names = {dt = true, dd = true} + if name == "li" then names = {li=true} end + for i = #self.unfinished, 1, -1 do + local current = self.unfinished[i] + local current_tag = current.tag + if names[current_tag] then + self:generate_implied_endtags(nil, {current.tag}) + for j = #self.unfinished, i, -1 do + self:pop_element() + end + break + elseif is_special(current_tag) and not not_specials[name] then + break + end + end +end + +local close_paragraph = function(self) + if is_in_button_scope(self, "p") then + self:close_paragraph() + end +end + +function HtmlParser:handle_insertion_mode(token) + -- simple handling of https://html.spec.whatwg.org/multipage/parsing.html#tree-construction + -- we don't support most rules, just the most important for avoiding mismatched tags + + if body_modes[self.insertion_mode] then + if token.type == "start_tag" then + local name = table.concat(token.name) + if close_p_at_start[name] then close_paragraph(self) end + if close_headers[name] then + close_paragraph(self) + -- close current element if it is already header + if close_headers[self:current_element_name()] then + self:pop_element() + end + elseif name == "pre" or name == "listing" then + -- we should ignore next "\n" char token + elseif name == "image" then + -- image tag is an error, change to <img> + token.name = {"img"} + elseif list_items[name] then + handle_list_item(self, name) + close_paragraph(self) + end + elseif token.type == "end_tag" then + local name = table.concat(token.name) + if close_address_at_end[name] then + if is_in_scope(self, name, {}) then + self:close_unfinished(name) + else + token.type = "ignore" + end + elseif name == "p" then + if not is_in_button_scope(self, "p") then + local parent = self:get_parent() + local node = Element:init("p", parent) + table.insert(self.unfinished, node) + end + -- use self:close_paragraph() instead of close_paragraph() because we don't need to check scope at this point + self:close_paragraph() + elseif name == "br" then + token.type = "start_tag" + elseif close_headers[name] then + local header_in_scope = false + -- detect, if there are any open h1-h6 tag and close it + for el, _ in pairs(close_headers) do + if is_in_scope(self, el, {}) then + header_in_scope = el + break + end + end + if not header_in_scope then + token.type = "ignore" + else + self:close_unfinished(header_in_scope) + end + end + end + end +end + +local rawtext_elements = hash_from_array {"style", "textarea", "xmp"} + + function HtmlParser:start_tag() local token = self.current_token + self:handle_insertion_mode(token) if token.type == "start_tag" then -- close all currently opened attributes self:start_attribute() @@ -1894,18 +2035,18 @@ function HtmlParser:start_tag() node.attr = token.attr node.self_closing = token.self_closing self:set_xmlns(node) - -- + -- in this handler we should close <p> or <li> elements without explicit closing tags if token.self_closing -- <img /> or self_closing_tags[name] -- void elements then - parent:add_child(node) + parent:add_child(node, node.tag) else -- add to the unfinished list table.insert(self.unfinished, node) end if name == "title" then self.element_state = "rcdata" - elseif name == "style" then + elseif rawtext_elements[name] then self.element_state = "rawtext" elseif name == "script" then self.element_state = "script_data" @@ -1916,11 +2057,13 @@ end function HtmlParser:end_tag() -- close current opened element local token = self.current_token + self:handle_insertion_mode(token) if token.type == "end_tag" then if #self.unfinished==0 then return nil end - local node = self:close_element() - local parent = self:get_parent() - parent:add_child(node) + -- close the current element only if the token is in the current scope + if is_in_scope(self, table.concat(token.name), {}) then + self:pop_element() + end end end @@ -1964,6 +2107,21 @@ function HtmlParser:adjusted_current_node() end +local simple_modes = { + body = "in_body", + td = "in_cell", + th = "in_cell", + tr = "in_row", + tbody = "in_table_body", + thead = "in_table_body", + tfoot = "in_table_body", + caption = "in_caption", + colgroup = "in_column_group", + table = "in_table", + template = "current_template_insertion_mode", + frameset = "in_frameset" +} + function HtmlParser:reset_insertion_mode() -- https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately local last = false @@ -1977,16 +2135,33 @@ function HtmlParser:reset_insertion_mode() if name == "head" and last == true then self:switch_insertion("in_head") return - elseif name == "body" then - self:switch_insertion("in_body") - return elseif name == "html" then - if self.head_pointer then + if not self.head_pointer then self:switch_insertion("before_head") return else self:switch_insertion("after_head") + return + end + elseif name == "select" then + if not last then + for x = position -1, 1, -1 do + if x == 1 then break end + local ancestor = self.unfinished[x] + local ancestor_name = ancestor.tag + if ancestor_name == "template" then + break + elseif ancestor_name == "table" then + self:switch_insertion("in_select_in_table") + return + end + end end + self:switch_insertion("in_select") + return + elseif simple_modes[name] then + self:switch_insertion(simple_modes[name]) + return elseif last == true then self:switch_insertion("in_body") return @@ -2006,8 +2181,8 @@ function HtmlParser:generate_implied_endtags(included, ignored) local current = self:current_node() or {} -- keep removing elements while they are in the "included" list if included[current.tag] then - table.remove(self.unfinished) - self:generate_implied_endtags(ignored) + self:pop_element() + self:generate_implied_endtags(included, ignored) end end @@ -2023,9 +2198,7 @@ function HtmlParser:finish() self:start_tag("html") end while #self.unfinished > 0 do - local node = self:close_element() - local parent = self:get_parent() - parent:add_child(node) + self:pop_element() end -- return root element return self.Document -- self:close_element() diff --git a/macros/luatex/generic/luaxml/luaxml-namedentities.lua b/macros/luatex/generic/luaxml/luaxml-namedentities.lua index 0e6399ab13..5c5ff00777 100644 --- a/macros/luatex/generic/luaxml/luaxml-namedentities.lua +++ b/macros/luatex/generic/luaxml/luaxml-namedentities.lua @@ -1,2234 +1,2233 @@ -local utf8 = require "utf8" return { -["Subset"]="⋐", -["Chi"]="Χ", -["tprime"]="‴", -["lneq"]="⪇", -["RightUpTeeVector"]="⥜", -["cscr"]="𝒸", -["leftrightarrows"]="⇆", -["LeftRightVector"]="⥎", -["Laplacetrf"]="ℒ", -["boxHd"]="╤", -["GreaterSlantEqual"]="⩾", -["sqsub"]="⊏", -["nvdash"]="⊬", -["boxHu"]="╧", -["vcy"]="в", -["DiacriticalDoubleAcute"]="˝", -["nvHarr"]="⤄", -["lnapprox"]="⪉", -["fscr"]="𝒻", -["OverBracket"]="⎴", -["pm"]="±", -["ovbar"]="⌽", -["larrhk"]="↩", -["atilde"]="ã", -["Igrave"]="Ì", -["profsurf"]="⌓", -["Sigma"]="Σ", -["rHar"]="⥤", -["Gcedil"]="Ģ", -["sect"]="§", -["nmid"]="∤", -["escr"]="ℯ", -["delta"]="δ", -["male"]="♂", -["Integral"]="∫", -["RightUpVectorBar"]="⥔", -["alefsym"]="ℵ", -["nsqsube"]="⋢", -["Nacute"]="Ń", -["mcomma"]="⨩", -["ApplyFunction"]=utf8.char(0x2061), -["rfisht"]="⥽", -["phmmat"]="ℳ", -["rarrw"]="↝", -["backepsilon"]="϶", -["hscr"]="𝒽", -["middot"]="·", -["ldrushar"]="⥋", -["supne"]="⊋", -["Longleftrightarrow"]="⟺", -["Oacute"]="Ó", -["af"]="", +["Implies"]="⇒", +["longrightarrow"]="⟶", +["precneqq"]="⪵", +["geqslant"]="⩾", +["Product"]="∏", +["Scirc"]="Ŝ", +["lvnE"]="≨︀", +["dotminus"]="∸", +["sscr"]="𝓈", +["capdot"]="⩀", +["dlcrop"]="⌍", +["omacr"]="ō", +["sext"]="✶", +["xutri"]="△", +["xrArr"]="⟹", +["glE"]="⪒", +["NotSupersetEqual"]="⊉", +["backsim"]="∽", ["sup"]="⊃", -["lozenge"]="◊", -["scy"]="с", -["gscr"]="ℊ", -["smallsetminus"]="∖", +["realpart"]="ℜ", ["hardcy"]="ъ", -["DoubleVerticalBar"]="∥", -["Yuml"]="Ÿ", -["plusdu"]="⨥", -["NotSucceedsSlantEqual"]="⋡", -["nwnear"]="⤧", -["lfloor"]="⌊", -["rcy"]="р", -["jscr"]="𝒿", -["AMP"]="&", -["acute"]="´", -["uacute"]="ú", -["Or"]="⩔", -["rdldhar"]="⥩", -["langd"]="⦑", -["Iacute"]="Í", -["spar"]="∥", -["ucy"]="у", -["rsh"]="↱", -["Kcedil"]="Ķ", -["iscr"]="𝒾", -["lambda"]="λ", -["lbrkslu"]="⦍", -["napE"]="⩰̸", -["shcy"]="ш", -["nsupE"]="⫆̸", -["Ycirc"]="Ŷ", -["sect"]="§", -["precnapprox"]="⪹", -["iocy"]="ё", -["dzcy"]="џ", +["sqcap"]="⊓", +["brvbar"]="¦", +["LT"]="<", +["udarr"]="⇅", +["lozf"]="⧫", +["Eogon"]="Ę", +["frac18"]="⅛", +["lesssim"]="≲", +["wedbar"]="⩟", +["EmptyVerySmallSquare"]="▫", +["aring"]="å", +["lesdoto"]="⪁", +["ltquest"]="⩻", +["LeftUpTeeVector"]="⥠", +["FilledSmallSquare"]="◼", +["mho"]="℧", +["NotGreaterTilde"]="≵", +["xharr"]="⟷", +["NotSucceedsEqual"]="⪰̸", +["sqsupset"]="⊐", +["Ccedil"]="Ç", +["aacute"]="á", +["succcurlyeq"]="≽", +["gneq"]="⪈", +["forall"]="∀", +["rightharpoonup"]="⇀", +["leftarrow"]="←", +["ang"]="∠", +["mapstoup"]="↥", +["xscr"]="𝓍", +["NotTildeEqual"]="≄", +["ograve"]="ò", +["boxdl"]="┐", +["DownLeftVectorBar"]="⥖", +["nsup"]="⊅", +["shchcy"]="щ", +["demptyv"]="⦱", +["apos"]="'", +["between"]="≬", +["leftrightsquigarrow"]="↭", +["gtcc"]="⪧", +["grave"]="`", +["bigodot"]="⨀", +["oline"]="‾", +["angmsdad"]="⦫", +["NotCongruent"]="≢", +["gtquest"]="⩼", +["fltns"]="▱", +["smeparsl"]="⧤", +["Eta"]="Η", +["ltdot"]="⋖", +["rhard"]="⇁", +["rscr"]="𝓇", ["ETH"]="Ð", -["GreaterTilde"]="≳", -["coprod"]="∐", -["rpar"]=")", -["lthree"]="⋋", -["ImaginaryI"]="ⅈ", -["DoubleUpDownArrow"]="⇕", -["intercal"]="⊺", -["spadesuit"]="♠", -["boxVH"]="╬", -["smashp"]="⨳", -["nu"]="ν", -["Agrave"]="À", -["boxtimes"]="⊠", -["sext"]="✶", -["nsub"]="⊄", -["oelig"]="œ", -["GreaterEqual"]="≥", -["TRADE"]="™", -["dtrif"]="▾", -["nless"]="≮", -["mu"]="μ", -["larrsim"]="⥳", -["GreaterEqualLess"]="⋛", -["Uuml"]="Ü", -["LeftArrowBar"]="⇤", -["ntrianglerighteq"]="⋭", -["DiacriticalDot"]="˙", -["LongLeftArrow"]="⟵", -["agrave"]="à", -["lmoustache"]="⎰", -["nvDash"]="⊭", -["para"]="¶", -["nlt"]="≮", -["Eacute"]="É", -["spades"]="♠", -["lrcorner"]="⌟", -["checkmark"]="✓", -["lessdot"]="⋖", -["opar"]="⦷", -["nVDash"]="⊯", -["pertenk"]="‱", -["range"]="⦥", -["Pr"]="⪻", -["Gammad"]="Ϝ", -["ape"]="≊", -["Longleftarrow"]="⟸", -["boxV"]="║", -["rightthreetimes"]="⋌", +["iocy"]="ё", +["semi"]=";", +["nexists"]="∄", +["approxeq"]="≊", +["compfn"]="∘", +["sstarf"]="⋆", +["angrtvbd"]="⦝", ["gnap"]="⪊", -["vzigzag"]="⦚", -["Ecirc"]="Ê", -["npar"]="∦", -["notinvb"]="⋷", -["Tau"]="Τ", -["blank"]="␣", -["Kappa"]="Κ", -["rmoust"]="⎱", -["GJcy"]="Ѓ", -["ufisht"]="⥾", -["NotLeftTriangleBar"]="⧏̸", -["bigvee"]="⋁", -["lrhar"]="⇋", -["supset"]="⊃", -["uwangle"]="⦧", -["UpTeeArrow"]="↥", -["supE"]="⫆", -["imof"]="⊷", -["leg"]="⋚", -["notniva"]="∌", -["nvgt"]=">⃒", -["rthree"]="⋌", -["yfr"]="𝔶", -["uHar"]="⥣", -["nshortmid"]="∤", -["biguplus"]="⨄", -["barvee"]="⊽", -["iff"]="⇔", -["boxvH"]="╪", -["simrarr"]="⥲", -["Egrave"]="È", -["ntilde"]="ñ", -["VerticalTilde"]="≀", -["sigmaf"]="ς", -["khcy"]="х", -["planck"]="ℏ", -["NotNestedGreaterGreater"]="⪢̸", -["NonBreakingSpace"]=" ", -["OpenCurlyQuote"]="‘", -["supsim"]="⫈", -["cudarrl"]="⤸", -["theta"]="θ", -["notindot"]="⋵̸", -["Omicron"]="Ο", -["ccedil"]="ç", -["colone"]="≔", -["bscr"]="𝒷", -["Dagger"]="‡", -["comma"]=",", +["mDDot"]="∺", +["udblac"]="ű", ["Acirc"]="Â", -["plankv"]="ℏ", -["boxdr"]="┌", -["rarrap"]="⥵", -["rmoustache"]="⎱", -["LeftAngleBracket"]="⟨", -["Cacute"]="Ć", -["blk34"]="▓", -["rfloor"]="⌋", -["awconint"]="∳", -["sfrown"]="⌢", -["middot"]="·", -["ascr"]="𝒶", -["dot"]="˙", -["caron"]="ˇ", -["image"]="ℑ", -["esdot"]="≐", -["ohbar"]="⦵", -["rarrb"]="⇥", -["submult"]="⫁", -["plusb"]="⊞", -["oopf"]="𝕠", -["breve"]="˘", -["conint"]="∮", -["angrt"]="∟", -["nbump"]="≎̸", -["raquo"]="»", -["Iuml"]="Ï", -["Rcedil"]="Ŗ", -["minus"]="−", -["nsucceq"]="⪰̸", -["telrec"]="⌕", -["CHcy"]="Ч", -["nrightarrow"]="↛", -["NotRightTriangle"]="⋫", -["zfr"]="𝔷", -["succ"]="≻", -["Aacute"]="Á", -["NestedLessLess"]="≪", -["RightTeeArrow"]="↦", -["homtht"]="∻", -["Cup"]="⋓", -["lcub"]="{", -["race"]="∽̱", -["THORN"]="Þ", -["propto"]="∝", -["odblac"]="ő", -["mumap"]="⊸", -["filig"]="fi", -["ecir"]="≖", -["DoubleRightArrow"]="⇒", -["npreceq"]="⪯̸", -["female"]="♀", -["LeftFloor"]="⌊", -["gtrarr"]="⥸", -["dotsquare"]="⊡", -["map"]="↦", -["OverBrace"]="⏞", -["zopf"]="𝕫", -["rang"]="⟩", -["laquo"]="«", -["elsdot"]="⪗", -["frac56"]="⅚", -["Iuml"]="Ï", -["ocirc"]="ô", -["clubs"]="♣", -["IOcy"]="Ё", -["scnE"]="⪶", -["deg"]="°", -["simgE"]="⪠", -["nap"]="≉", -["blacktriangle"]="▴", -["edot"]="ė", -["epsiv"]="ϵ", -["napprox"]="≉", -["NotGreaterSlantEqual"]="⩾̸", -["prap"]="⪷", -["lnap"]="⪉", -["circledS"]="Ⓢ", -["lang"]="⟨", -["qprime"]="⁗", -["aelig"]="æ", -["ncongdot"]="⩭̸", -["supdsub"]="⫘", -["nltrie"]="⋬", -["xopf"]="𝕩", +["UnderParenthesis"]="⏝", +["nisd"]="⋺", +["lneq"]="⪇", +["Dagger"]="‡", +["qscr"]="𝓆", +["gneqq"]="≩", +["doteqdot"]="≑", +["DoubleVerticalBar"]="∥", +["emptyset"]="∅", +["lEg"]="⪋", +["subseteq"]="⊆", +["dwangle"]="⦦", +["dotplus"]="∔", +["NotPrecedesSlantEqual"]="⋠", +["bnot"]="⌐", ["LeftDownVector"]="⇃", -["duarr"]="⇵", -["urcorner"]="⌝", -["nvltrie"]="⊴⃒", -["Pi"]="Π", +["leg"]="⋚", +["Therefore"]="∴", +["Omega"]="Ω", +["acE"]="∾̳", +["Auml"]="Ä", +["xvee"]="⋁", ["Eacute"]="É", -["nGtv"]="≫̸", -["icirc"]="î", -["twoheadleftarrow"]="↞", +["LeftFloor"]="⌊", +["swnwar"]="⤪", +["Jukcy"]="Є", +["nless"]="≮", +["NotSquareSupersetEqual"]="⋣", +["larrfs"]="⤝", +["gcy"]="г", +["solbar"]="⌿", +["rharul"]="⥬", +["dscy"]="ѕ", +["yen"]="¥", +["ForAll"]="∀", +["DownArrow"]="↓", +["qprime"]="⁗", +["NegativeThickSpace"]="", +["part"]="∂", +["Iukcy"]="І", +["ltcc"]="⪦", +["xlArr"]="⟸", +["fcy"]="ф", +["gl"]="≷", +["rsh"]="↱", +["lrhar"]="⇋", ["divide"]="÷", -["yopf"]="𝕪", -["ntlg"]="≸", -["Darr"]="↡", +["bemptyv"]="⦰", +["rx"]="℞", +["ecy"]="э", +["ApplyFunction"]="", +["divideontimes"]="⋇", +["prod"]="∏", +["boxHU"]="╩", +["HARDcy"]="Ъ", +["mstpos"]="∾", +["llcorner"]="⌞", +["rsquor"]="’", +["NotTildeFullEqual"]="≇", +["mlcp"]="⫛", +["cemptyv"]="⦲", +["Proportional"]="∝", +["DiacriticalDoubleAcute"]="˝", +["dcy"]="д", +["Yacute"]="Ý", +["egsdot"]="⪘", ["hslash"]="ℏ", -["Coproduct"]="∐", -["profline"]="⌒", -["imagline"]="ℐ", -["chcy"]="ч", -["ccedil"]="ç", -["PrecedesEqual"]="⪯", -["jcirc"]="ĵ", -["nang"]="∠⃒", -["Icirc"]="Î", -["nbumpe"]="≏̸", -["incare"]="℅", -["tint"]="∭", -["nhArr"]="⇎", -["emsp13"]=" ", -["blacktriangleleft"]="◂", -["Star"]="⋆", -["hkswarow"]="⤦", -["NegativeThickSpace"]="", -["eDot"]="≑", -["Euml"]="Ë", -["scaron"]="š", -["RightDownVectorBar"]="⥕", -["cent"]="¢", -["jukcy"]="є", -["backsimeq"]="⋍", -["Ncy"]="Н", -["DD"]="ⅅ", -["circledast"]="⊛", -["ccirc"]="ĉ", -["rsaquo"]="›", -["YIcy"]="Ї", -["iquest"]="¿", -["NotExists"]="∄", -["iukcy"]="і", -["Tab"]=" ", -["Equilibrium"]="⇌", -["nLt"]="≪⃒", -["yen"]="¥", -["CircleDot"]="⊙", -["CircleMinus"]="⊖", -["topf"]="𝕥", -["equivDD"]="⩸", -["DoubleLeftRightArrow"]="⇔", -["ngsim"]="≵", -["upuparrows"]="⇈", -["ll"]="≪", -["cirscir"]="⧂", -["ShortLeftArrow"]="←", -["angmsdag"]="⦮", -["shortmid"]="∣", -["ngeqslant"]="⩾̸", -["subset"]="⊂", -["curvearrowleft"]="↶", -["gdot"]="ġ", -["circledcirc"]="⊚", -["Pcy"]="П", -["asymp"]="≈", -["boxUr"]="╙", -["uopf"]="𝕦", -["frac15"]="⅕", -["Iacute"]="Í", -["Utilde"]="Ũ", -["Congruent"]="≡", -["nhpar"]="⫲", -["capbrcup"]="⩉", -["ordf"]="ª", -["SOFTcy"]="Ь", -["nlArr"]="⇍", -["not"]="¬", -["ffllig"]="ffl", -["nprec"]="⊀", -["Hat"]="^", +["infin"]="∞", ["Auml"]="Ä", -["ntriangleleft"]="⋪", -["longmapsto"]="⟼", -["nvrtrie"]="⊵⃒", -["timesb"]="⊠", -["lsh"]="↰", -["Jcy"]="Й", -["gcirc"]="ĝ", -["Oacute"]="Ó", -["vartriangleright"]="⊳", -["NotRightTriangleEqual"]="⋭", -["Rightarrow"]="⇒", -["ast"]="*", -["hamilt"]="ℋ", -["Ncedil"]="Ņ", -["apE"]="⩰", -["macr"]="¯", -["cwconint"]="∲", -["Kcy"]="К", -["Ucirc"]="Û", -["hcirc"]="ĥ", -["yacy"]="я", -["uml"]="¨", -["popf"]="𝕡", -["bumpE"]="⪮", -["varnothing"]="∅", -["RightUpVector"]="↾", -["curren"]="¤", -["Scedil"]="Ş", -["FilledVerySmallSquare"]="▪", -["dollar"]="$", -["Lcy"]="Л", -["longrightarrow"]="⟶", -["LeftTee"]="⊣", -["excl"]="!", -["acirc"]="â", -["wp"]="℘", -["lcaron"]="ľ", -["NotGreaterFullEqual"]="≧̸", -["CounterClockwiseContourIntegral"]="∳", -["sup2"]="²", -["rnmid"]="⫮", -["Lcedil"]="Ļ", -["ddotseq"]="⩷", -["tbrk"]="⎴", -["mlcp"]="⫛", -["rarrhk"]="↪", -["Tilde"]="∼", -["Mcy"]="М", -["aring"]="å", -["rarrsim"]="⥴", -["nopf"]="𝕟", -["aelig"]="æ", -["order"]="ℴ", -["diamondsuit"]="♦", -["nvsim"]="∼⃒", -["lhard"]="↽", -["commat"]="@", -["qint"]="⨌", -["lsquo"]="‘", -["sqcaps"]="⊓︀", -["circlearrowleft"]="↺", -["NotElement"]="∉", -["measuredangle"]="∡", -["Atilde"]="Ã", -["CapitalDifferentialD"]="ⅅ", -["kgreen"]="ĸ", -["Cscr"]="𝒞", +["Wcirc"]="Ŵ", +["larrtl"]="↢", +["Aacute"]="Á", +["LeftTriangleEqual"]="⊴", +["NegativeMediumSpace"]="", +["TripleDot"]="⃛", +["utdot"]="⋰", +["isinv"]="∈", +["looparrowright"]="↬", +["loang"]="⟬", +["multimap"]="⊸", ["NotLessEqual"]="≰", -["trpezium"]="⏢", -["ne"]="≠", -["NotSuperset"]="⊃⃒", -["nearrow"]="↗", -["ncong"]="≇", -["doteqdot"]="≑", -["supmult"]="⫂", -["longleftrightarrow"]="⟷", -["Rarr"]="↠", -["DoubleUpArrow"]="⇑", -["Dscr"]="𝒟", -["mp"]="∓", -["jmath"]="ȷ", -["erarr"]="⥱", -["searrow"]="↘", -["Sup"]="⋑", -["lvnE"]="≨︀", -["ffilig"]="ffi", -["NotSquareSupersetEqual"]="⋣", -["bullet"]="•", -["bigstar"]="★", -["cylcty"]="⌭", -["nvle"]="≤⃒", -["TildeFullEqual"]="≅", -["lopf"]="𝕝", -["sqsupseteq"]="⊒", -["lt"]="<", -["geqslant"]="⩾", +["midcir"]="⫰", +["nge"]="≱", ["quot"]="\"", -["le"]="≤", -["square"]="□", -["sigma"]="σ", -["prE"]="⪳", -["rtrie"]="⊵", -["triangleq"]="≜", +["REG"]="®", +["div"]="÷", +["complexes"]="ℂ", +["lhblk"]="▄", +["gvnE"]="≩︀", +["leftharpoonup"]="↼", +["it"]="", +["clubsuit"]="♣", +["iff"]="⇔", +["Hacek"]="ˇ", +["CircleTimes"]="⊗", +["Cacute"]="Ć", +["rarrtl"]="↣", +["RightDownVector"]="⇂", +["rarrfs"]="⤞", +["UpArrowBar"]="⤒", +["male"]="♂", +["RightTriangle"]="⊳", +["GreaterTilde"]="≳", +["Barwed"]="⌆", +["ltlarr"]="⥶", +["Zdot"]="Ż", +["parsim"]="⫳", +["Ugrave"]="Ù", +["Dot"]="¨", +["circleddash"]="⊝", +["rsaquo"]="›", +["hyphen"]="‐", +["angrt"]="∟", +["RightTriangleEqual"]="⊵", +["Darr"]="↡", +["ulcrop"]="⌏", +["olcir"]="⦾", +["gimel"]="ℷ", +["gel"]="⋛", +["SquareSubset"]="⊏", +["Uacute"]="Ú", +["gt"]=">", +["lnap"]="⪉", +["Union"]="⋃", +["nu"]="ν", +["and"]="∧", +["ltcir"]="⩹", ["Fscr"]="ℱ", +["ee"]="ⅇ", +["laquo"]="«", +["Hfr"]="ℌ", +["prec"]="≺", +["imagline"]="ℐ", +["precnsim"]="⋨", +["zhcy"]="ж", +["mu"]="μ", +["rlarr"]="⇄", +["pound"]="£", +["origof"]="⊶", +["rfloor"]="⌋", +["lnsim"]="⋦", +["nVdash"]="⊮", +["otimes"]="⊗", +["iuml"]="ï", +["Cscr"]="𝒞", +["lsime"]="⪍", +["ngeqq"]="≧̸", +["Del"]="∇", +["Coproduct"]="∐", +["NotSubsetEqual"]="⊈", +["HilbertSpace"]="ℋ", +["frac58"]="⅝", +["cap"]="∩", +["roang"]="⟭", +["intlarhk"]="⨗", +["DownTee"]="⊤", +["thickapprox"]="≈", +["prnap"]="⪹", +["laquo"]="«", +["lesdot"]="⩿", +["inodot"]="ı", +["Hscr"]="ℋ", +["YIcy"]="Ї", +["ctdot"]="⋯", +["thetav"]="ϑ", +["DoubleUpDownArrow"]="⇕", +["succ"]="≻", +["nbumpe"]="≏̸", +["ReverseElement"]="∋", +["Oacute"]="Ó", +["equest"]="≟", +["Lt"]="≪", +["Nacute"]="Ń", ["DiacriticalTilde"]="˜", -["SucceedsSlantEqual"]="≽", -["mopf"]="𝕞", -["Ecaron"]="Ě", -["UpArrowDownArrow"]="⇅", -["ges"]="⩾", -["nsqsupe"]="⋣", -["ubrcy"]="ў", -["Gscr"]="𝒢", -["HARDcy"]="Ъ", -["jopf"]="𝕛", -["gtquest"]="⩼", -["iinfin"]="⧜", -["twixt"]="≬", +["Escr"]="ℰ", +["boxvH"]="╪", +["Ifr"]="ℑ", +["mp"]="∓", +["ell"]="ℓ", +["Iacute"]="Í", +["NotNestedGreaterGreater"]="⪢̸", +["raquo"]="»", +["Zcy"]="З", +["micro"]="µ", +["dzigrarr"]="⟿", +["rtrif"]="▸", +["Uuml"]="Ü", +["nvHarr"]="⤄", +["leqslant"]="⩽", +["tritime"]="⨻", +["nlarr"]="↚", +["NotRightTriangle"]="⋫", +["apid"]="≋", +["succeq"]="⪰", +["NotEqualTilde"]="≂̸", +["varphi"]="ϕ", +["Vert"]="‖", +["int"]="∫", +["lurdshar"]="⥊", +["lneqq"]="≨", +["Jsercy"]="Ј", +["Superset"]="⊃", +["subsetneqq"]="⫋", +["gap"]="⪆", +["ssmile"]="⌣", +["Ugrave"]="Ù", +["IOcy"]="Ё", +["ltimes"]="⋉", +["UnderBracket"]="⎵", +["subseteqq"]="⫅", +["Dscr"]="𝒟", +["dtrif"]="▾", +["raquo"]="»", +["hbar"]="ℏ", +["ge"]="≥", +["cudarrr"]="⤵", +["icy"]="и", +["plusdo"]="∔", +["bull"]="•", +["weierp"]="℘", +["mapsto"]="↦", +["Uring"]="Ů", +["supplus"]="⫀", +["Succeeds"]="≻", +["Ascr"]="𝒜", +["cdot"]="ċ", +["nwarr"]="↖", +["target"]="⌖", +["dharr"]="⇂", +["curlyvee"]="⋎", +["supE"]="⫆", +["emsp13"]=" ", ["ltrie"]="⊴", +["olarr"]="↺", +["RightTeeVector"]="⥛", +["Vvdash"]="⊪", +["larrsim"]="⥳", +["varsubsetneq"]="⊊︀", +["Not"]="⫬", +["CenterDot"]="·", +["PlusMinus"]="±", +["aring"]="å", +["Nscr"]="𝒩", +["delta"]="δ", +["npre"]="⪯̸", +["Vcy"]="В", +["NotVerticalBar"]="∤", +["scpolint"]="⨓", +["rcedil"]="ŗ", +["Lmidot"]="Ŀ", +["DScy"]="Ѕ", +["nsubseteq"]="⊈", +["ngE"]="≧̸", +["NotSquareSubsetEqual"]="⋢", +["edot"]="ė", +["Ucy"]="У", +["lessapprox"]="⪅", +["niv"]="∋", +["Kscr"]="𝒦", +["LeftVectorBar"]="⥒", +["nhpar"]="⫲", +["scedil"]="ş", +["Uacute"]="Ú", +["ntrianglelefteq"]="⋬", +["Otilde"]="Õ", +["iexcl"]="¡", +["lbrke"]="⦋", +["simdot"]="⩪", +["sigmaf"]="ς", +["Bfr"]="𝔅", +["pitchfork"]="⋔", +["ngeqslant"]="⩾̸", +["Pscr"]="𝒫", +["gsime"]="⪎", +["Ouml"]="Ö", +["rarrsim"]="⥴", +["subE"]="⫅", +["otimesas"]="⨶", +["lfloor"]="⌊", +["prop"]="∝", +["imacr"]="ī", +["blacktriangleleft"]="◂", +["Ntilde"]="Ñ", +["llarr"]="⇇", +["nsucc"]="⊁", +["PartialD"]="∂", +["Iacute"]="Í", +["gdot"]="ġ", +["Afr"]="𝔄", +["Igrave"]="Ì", ["csub"]="⫏", -["Hscr"]="ℋ", -["leftharpoondown"]="↽", +["Mscr"]="ℳ", +["Scy"]="С", +["bsime"]="⋍", +["nequiv"]="≢", +["scnap"]="⪺", +["Tab"]=" ", +["Equal"]="⩵", +["blacklozenge"]="⧫", +["nrarrc"]="⤳̸", +["divide"]="÷", ["RightUpDownVector"]="⥏", -["LongLeftRightArrow"]="⟷", -["Im"]="ℑ", -["dcaron"]="ď", +["iinfin"]="⧜", +["precnapprox"]="⪹", +["dArr"]="⇓", +["orslope"]="⩗", +["Rcy"]="Р", +["sqsub"]="⊏", +["OverBracket"]="⎴", +["sum"]="∑", +["ncedil"]="ņ", +["ltrPar"]="⦖", +["ii"]="ⅈ", +["Gcirc"]="Ĝ", +["SucceedsTilde"]="≿", +["RightFloor"]="⌋", +["osol"]="⊘", ["barwedge"]="⌅", -["nexist"]="∄", -["blacktriangledown"]="▾", -["fork"]="⋔", -["rhard"]="⇁", -["cent"]="¢", -["RightTriangle"]="⊳", -["Eta"]="Η", -["dotminus"]="∸", -["nles"]="⩽̸", -["larrtl"]="↢", -["LeftTriangleEqual"]="⊴", -["hopf"]="𝕙", -["gammad"]="ϝ", -["gsime"]="⪎", -["llhard"]="⥫", -["precapprox"]="⪷", -["profalar"]="⌮", -["lnE"]="≨", -["ddagger"]="‡", -["leq"]="≤", -["smile"]="⌣", -["robrk"]="⟧", -["Jscr"]="𝒥", -["triangleleft"]="◃", -["acd"]="∿", -["prod"]="∏", -["atilde"]="ã", -["seArr"]="⇘", -["therefore"]="∴", -["iopf"]="𝕚", -["solbar"]="⌿", -["kcedil"]="ķ", -["NotHumpEqual"]="≏̸", -["nspar"]="∦", -["frac14"]="¼", -["nsime"]="≄", -["DoubleLongLeftArrow"]="⟸", -["sccue"]="≽", -["models"]="⊧", -["SupersetEqual"]="⊇", -["iquest"]="¿", -["oline"]="‾", -["lparlt"]="⦓", -["triplus"]="⨹", -["nequiv"]="≢", -["nlE"]="≦̸", -["nldr"]="‥", -["equals"]="=", -["Agrave"]="À", -["ccaron"]="č", -["Yacute"]="Ý", -["Oslash"]="Ø", -["udarr"]="⇅", -["ang"]="∠", -["dopf"]="𝕕", -["comp"]="∁", -["caps"]="∩︀", -["bowtie"]="⋈", -["glj"]="⪤", -["ltquest"]="⩻", -["cirmid"]="⫯", -["ordm"]="º", -["esim"]="≂", -["reals"]="ℝ", -["LeftTriangle"]="⊲", -["flat"]="♭", -["eopf"]="𝕖", -["lap"]="⪅", -["not"]="¬", -["ENG"]="Ŋ", -["DiacriticalAcute"]="´", -["sharp"]="♯", -["longleftarrow"]="⟵", -["dblac"]="˝", -["UpArrow"]="↑", -["npre"]="⪯̸", -["bopf"]="𝕓", -["DScy"]="Ѕ", +["twoheadrightarrow"]="↠", +["Gscr"]="𝒢", +["acy"]="а", +["dtdot"]="⋱", +["rbrke"]="⦌", +["imath"]="ı", +["Hcirc"]="Ĥ", +["num"]="#", +["nprec"]="⊀", +["smallsetminus"]="∖", +["lesges"]="⪓", +["LeftUpVector"]="↿", +["gtdot"]="⋗", +["theta"]="θ", +["kappav"]="ϰ", +["jmath"]="ȷ", +["Lscr"]="ℒ", +["Aogon"]="Ą", +["ltrif"]="◂", +["DownArrowUpArrow"]="⇵", +["prap"]="⪷", +["Racute"]="Ŕ", +["curlyeqprec"]="⋞", ["bepsi"]="϶", -["angrtvb"]="⊾", -["ccaps"]="⩍", -["UnderParenthesis"]="⏝", -["subne"]="⊊", -["succnsim"]="⋩", -["Bumpeq"]="≎", -["xvee"]="⋁", -["colon"]=":", -["deg"]="°", -["fnof"]="ƒ", -["Uarr"]="↟", -["Zcaron"]="Ž", -["copf"]="𝕔", -["Theta"]="Θ", -["omicron"]="ο", -["ntriangleright"]="⋫", -["DoubleLongRightArrow"]="⟹", -["UnderBrace"]="⏟", -["GT"]=">", -["lEg"]="⪋", -["supplus"]="⫀", -["acute"]="´", +["blacktriangle"]="▴", +["nvap"]="≍⃒", +["Supset"]="⋑", +["angmsd"]="∡", +["boxul"]="┘", +["LessSlantEqual"]="⩽", ["GT"]=">", -["upsilon"]="υ", -["sc"]="≻", -["xrarr"]="⟶", -["eng"]="ŋ", -["it"]="", -["Ntilde"]="Ñ", -["Mu"]="Μ", -["CircleTimes"]="⊗", -["NotTildeTilde"]="≉", -["NotLessLess"]="≪̸", -["vellip"]="⋮", -["cularrp"]="⤽", -["UnderBracket"]="⎵", -["aopf"]="𝕒", -["itilde"]="ĩ", -["latail"]="⤙", -["Nu"]="Ν", -["Ascr"]="𝒜", -["complement"]="∁", -["gjcy"]="ѓ", -["radic"]="√", -["maltese"]="✠", -["glE"]="⪒", -["plusmn"]="±", -["curvearrowright"]="↷", -["gt"]=">", -["Colone"]="⩴", -["Bscr"]="ℬ", -["ic"]="", -["clubsuit"]="♣", -["djcy"]="ђ", -["Oopf"]="𝕆", -["ltrPar"]="⦖", -["ngtr"]="≯", -["eqcirc"]="≖", -["Hacek"]="ˇ", -["vdash"]="⊢", -["NotCupCap"]="≭", -["Gdot"]="Ġ", -["jsercy"]="ј", -["marker"]="▮", +["nexist"]="∄", +["ccupssm"]="⩐", +["Eacute"]="É", +["ddarr"]="⇊", +["ntlg"]="≸", +["Iscr"]="ℐ", +["Jcirc"]="Ĵ", +["Sacute"]="Ś", +["capand"]="⩄", +["gesdoto"]="⪂", +["olcross"]="⦻", +["amalg"]="⨿", +["rarrlp"]="↬", +["NotLeftTriangle"]="⋪", +["reals"]="ℝ", +["bigcup"]="⋃", +["NJcy"]="Њ", +["Odblac"]="Ő", +["hArr"]="⇔", +["RightArrowLeftArrow"]="⇄", +["SOFTcy"]="Ь", +["Lambda"]="Λ", +["RightCeiling"]="⌉", +["Vdash"]="⊩", +["elinters"]="⏧", +["lsimg"]="⪏", ["Nopf"]="ℕ", -["Wfr"]="𝔚", -["boxHD"]="╦", -["mho"]="℧", -["ulcrop"]="⌏", -["DifferentialD"]="ⅆ", -["aacute"]="á", -["lpar"]="(", +["Esim"]="⩳", +["vzigzag"]="⦚", +["acd"]="∿", +["ccedil"]="ç", +["lbarr"]="⤌", +["nmid"]="∤", +["Backslash"]="∖", +["Laplacetrf"]="ℒ", +["npr"]="⊀", +["nap"]="≉", +["nsupseteqq"]="⫆̸", +["igrave"]="ì", +["LJcy"]="Љ", +["lessgtr"]="≶", ["angle"]="∠", -["rharu"]="⇀", -["Breve"]="˘", -["Dot"]="¨", -["rect"]="▭", -["NotNestedLessLess"]="⪡̸", -["boxplus"]="⊞", -["NotSucceeds"]="⊁", -["gnapprox"]="⪊", -["DownLeftTeeVector"]="⥞", -["Xfr"]="𝔛", -["Lang"]="⟪", -["Element"]="∈", -["sung"]="♪", -["RightVectorBar"]="⥓", -["simne"]="≆", -["LeftVector"]="↼", -["Idot"]="İ", +["lAarr"]="⇚", +["notin"]="∉", +["orv"]="⩛", +["gtreqqless"]="⪌", +["CircleMinus"]="⊖", +["Diamond"]="⋄", +["map"]="↦", +["nvsim"]="∼⃒", +["pi"]="π", +["pluscir"]="⨢", +["boxVH"]="╬", ["QUOT"]="\"", -["nsmid"]="∤", -["fjlig"]="fj", -["Ufr"]="𝔘", -["cuvee"]="⋎", +["duarr"]="⇵", +["lgE"]="⪑", +["lmoust"]="⎰", +["lsquo"]="‘", +["rightrightarrows"]="⇉", +["times"]="×", +["iuml"]="ï", +["andslope"]="⩘", +["order"]="ℴ", +["Sub"]="⋐", +["capcap"]="⩋", +["nabla"]="∇", +["ntriangleleft"]="⋪", +["blk14"]="░", +["Kopf"]="𝕂", +["lArr"]="⇐", +["Qopf"]="ℚ", +["circledS"]="Ⓢ", +["omid"]="⦶", +["ord"]="⩝", +["lvertneqq"]="≨︀", +["updownarrow"]="↕", +["yacute"]="ý", +["ni"]="∋", +["hamilt"]="ℋ", +["Jopf"]="𝕁", +["CupCap"]="≍", +["lbrack"]="[", +["preccurlyeq"]="≼", +["Ropf"]="ℝ", +["lessdot"]="⋖", +["blank"]="␣", +["SucceedsEqual"]="⪰", +["triangleleft"]="◃", +["ring"]="˚", +["omega"]="ω", +["bowtie"]="⋈", +["Sqrt"]="√", +["uuml"]="ü", +["Udblac"]="Ű", +["diams"]="♦", +["Oslash"]="Ø", ["real"]="ℜ", -["luruhar"]="⥦", -["NotRightTriangleBar"]="⧐̸", -["target"]="⌖", -["lharu"]="↼", -["CloseCurlyQuote"]="’", -["rAtail"]="⤜", -["nparallel"]="∦", -["brvbar"]="¦", -["Vfr"]="𝔙", -["wedbar"]="⩟", -["REG"]="®", -["boxur"]="└", -["Rcaron"]="Ř", -["Rang"]="⟫", -["sqsubseteq"]="⊑", -["div"]="÷", -["boxul"]="┘", -["Cdot"]="Ċ", -["vsupnE"]="⫌︀", -["zeetrf"]="ℨ", -["Sfr"]="𝔖", -["roang"]="⟭", -["LessTilde"]="≲", -["equiv"]="≡", -["frac12"]="½", -["eacute"]="é", -["rrarr"]="⇉", -["nearhk"]="⤤", -["Zopf"]="ℤ", -["SucceedsTilde"]="≿", +["egrave"]="è", +["prurel"]="⊰", +["LeftUpDownVector"]="⥑", +["TildeEqual"]="≃", +["cuwed"]="⋏", +["times"]="×", ["ap"]="≈", -["lfisht"]="⥼", -["timesd"]="⨰", -["UpDownArrow"]="↕", -["xuplus"]="⨄", -["cularr"]="↶", -["iprod"]="⨼", -["AElig"]="Æ", -["rationals"]="ℚ", -["geqq"]="≧", -["Tfr"]="𝔗", -["Yopf"]="𝕐", -["rtimes"]="⋊", -["Tcaron"]="Ť", -["srarr"]="→", -["diam"]="⋄", -["mid"]="∣", -["imath"]="ı", -["PlusMinus"]="±", -["isin"]="∈", -["vprop"]="∝", -["RightArrowLeftArrow"]="⇄", -["NotSubset"]="⊂⃒", -["bigtriangledown"]="▽", -["ldsh"]="↲", -["Qfr"]="𝔔", -["nvap"]="≍⃒", -["vert"]="|", -["Xopf"]="𝕏", -["lBarr"]="⤎", -["egsdot"]="⪘", -["Tcedil"]="Ţ", -["xi"]="ξ", -["LeftUpVectorBar"]="⥘", -["circ"]="ˆ", -["ocir"]="⊚", -["gtlPar"]="⦕", -["Rfr"]="ℜ", -["RightTriangleBar"]="⧐", -["nwarhk"]="⤣", -["zhcy"]="ж", -["Iukcy"]="І", -["plusdo"]="∔", +["lowast"]="∗", +["Lopf"]="𝕃", +["bdquo"]="„", +["blacktriangledown"]="▾", +["vBarv"]="⫩", +["Longleftarrow"]="⟸", +["lesg"]="⋚︀", +["Popf"]="ℙ", +["iogon"]="į", +["vellip"]="⋮", +["Ntilde"]="Ñ", +["cwconint"]="∲", ["boxv"]="│", -["minusb"]="⊟", -["Ncaron"]="Ň", -["angmsdaa"]="⦨", -["varsubsetneqq"]="⫋︀", -["cirfnint"]="⨐", -["LongRightArrow"]="⟶", -["ddarr"]="⇊", -["piv"]="ϖ", -["fopf"]="𝕗", -["Ofr"]="𝔒", -["fflig"]="ff", -["Jukcy"]="Є", -["xhArr"]="⟺", -["ncy"]="н", -["Scaron"]="Š", -["TildeEqual"]="≃", -["subrarr"]="⥹", -["iacute"]="í", -["ogt"]="⧁", -["nvge"]="≥⃒", -["vee"]="∨", -["UnderBar"]="_", -["andslope"]="⩘", -["gopf"]="𝕘", -["Pfr"]="𝔓", -["die"]="¨", +["boxbox"]="⧉", +["langd"]="⦑", +["diam"]="⋄", +["boxHu"]="╧", +["acute"]="´", ["Uopf"]="𝕌", +["Fcy"]="Ф", +["vee"]="∨", +["eqslantless"]="⪕", +["NotLeftTriangleEqual"]="⋬", +["OverBrace"]="⏞", +["beta"]="β", +["Otilde"]="Õ", +["fjlig"]="fj", +["uacute"]="ú", +["CirclePlus"]="⊕", +["Mellintrf"]="ℳ", +["Vopf"]="𝕍", +["Gcy"]="Г", +["searhk"]="⤥", +["boxur"]="└", +["LeftTeeVector"]="⥚", +["nsubE"]="⫅̸", +["gvertneqq"]="≩︀", +["eqcirc"]="≖", +["nrightarrow"]="↛", +["DJcy"]="Ђ", +["tdot"]="⃛", +["Dcy"]="Д", +["Sopf"]="𝕊", +["range"]="⦥", +["agrave"]="à", +["gtrsim"]="≳", ["RightArrowBar"]="⇥", -["orarr"]="↻", -["Precedes"]="≺", -["oror"]="⩖", -["straightepsilon"]="ϵ", -["cong"]="≅", -["TScy"]="Ц", -["nleftarrow"]="↚", -["DZcy"]="Џ", -["horbar"]="―", +["larrlp"]="↫", +["le"]="≤", +["xi"]="ξ", +["gla"]="⪥", +["GT"]=">", +["leftarrowtail"]="↢", +["commat"]="@", +["rightarrowtail"]="↣", +["approx"]="≈", +["sdot"]="⋅", ["Topf"]="𝕋", -["Cayleys"]="ℭ", -["leqq"]="≦", -["curlyeqprec"]="⋞", -["nLeftarrow"]="⇍", -["pcy"]="п", -["realine"]="ℛ", -["nlsim"]="≴", +["Ecy"]="Э", +["eplus"]="⩱", +["cir"]="○", ["Rarrtl"]="⤖", -["CupCap"]="≍", -["vDash"]="⊨", -["shortparallel"]="∥", -["ExponentialE"]="ⅇ", -["Sopf"]="𝕊", -["iiota"]="℩", -["Nfr"]="𝔑", -["pointint"]="⨕", -["NotGreaterLess"]="≹", -["olcross"]="⦻", -["kcy"]="к", -["complexes"]="ℂ", -["varepsilon"]="ϵ", -["Fouriertrf"]="ℱ", -["rho"]="ρ", -["Lsh"]="↰", -["exponentiale"]="ⅇ", -["hookrightarrow"]="↪", -["Ropf"]="ℝ", -["lAtail"]="⤛", -["Kfr"]="𝔎", -["bsim"]="∽", -["jcy"]="й", -["frac34"]="¾", -["DotDot"]="⃜", +["Emacr"]="Ē", +["Dcaron"]="Ď", +["Sc"]="⪼", +["cent"]="¢", +["rtri"]="▹", +["cedil"]="¸", +["spades"]="♠", +["upsilon"]="υ", +["boxminus"]="⊟", +["angmsdaa"]="⦨", +["zdot"]="ż", +["Bcy"]="Б", +["Zscr"]="𝒵", +["looparrowleft"]="↫", +["Dfr"]="𝔇", +["Bumpeq"]="≎", +["nLeftarrow"]="⇍", +["equiv"]="≡", +["Ccaron"]="Č", +["UpperLeftArrow"]="↖", +["SubsetEqual"]="⊆", +["nrArr"]="⇏", +["loarr"]="⇽", +["minusdu"]="⨪", +["sup3"]="³", +["Zopf"]="ℤ", +["elsdot"]="⪗", +["NotLessLess"]="≪̸", +["eta"]="η", +["ubrcy"]="ў", +["Yscr"]="𝒴", +["subset"]="⊂", +["Cfr"]="ℭ", +["harrcir"]="⥈", +["supsetneq"]="⊋", +["LeftUpVectorBar"]="⥘", +["LT"]="<", +["DoubleLeftArrow"]="⇐", +["circledcirc"]="⊚", +["bkarow"]="⤍", +["rangd"]="⦒", +["downharpoonright"]="⇂", +["Wopf"]="𝕎", +["ast"]="*", +["planck"]="ℏ", +["gtrdot"]="⋗", +["Ffr"]="𝔉", +["rArr"]="⇒", +["VeryThinSpace"]=" ", +["Ecaron"]="Ě", +["RightVectorBar"]="⥓", +["divonx"]="⋇", +["Xopf"]="𝕏", +["nsubset"]="⊂⃒", +["Otimes"]="⨷", +["bot"]="⊥", +["nsime"]="≄", ["thorn"]="þ", -["ThickSpace"]=" ", -["SquareUnion"]="⊔", -["frac58"]="⅝", -["dfisht"]="⥿", -["MediumSpace"]=" ", -["Lfr"]="𝔏", -["Qopf"]="ℚ", +["subsetneq"]="⊊", +["nltri"]="⋪", +["Cayleys"]="ℭ", +["Efr"]="𝔈", +["Intersection"]="⋂", +["UnderBar"]="_", +["fpartint"]="⨍", +["Iuml"]="Ï", +["rsquo"]="’", +["ecir"]="≖", +["nis"]="⋼", +["fscr"]="𝒻", +["hellip"]="…", +["ogt"]="⧁", ["ntgl"]="≹", -["LessFullEqual"]="≦", -["malt"]="✠", -["mcy"]="м", -["NotGreaterEqual"]="≱", -["bottom"]="⊥", -["NotSucceedsEqual"]="⪰̸", -["lcedil"]="ļ", -["infintie"]="⧝", -["Lcaron"]="Ľ", -["NotSquareSubset"]="⊏̸", -["brvbar"]="¦", -["fallingdotseq"]="≒", -["AElig"]="Æ", -["swarhk"]="⤦", -["Ifr"]="ℑ", -["pi"]="π", -["lcy"]="л", -["copy"]="©", -["dlcorn"]="⌞", -["oacute"]="ó", -["gtreqless"]="⋛", -["neArr"]="⇗", +["frac14"]="¼", +["squf"]="▪", +["circ"]="ˆ", +["prE"]="⪳", +["ordf"]="ª", ["ZHcy"]="Ж", -["Vdashl"]="⫦", -["darr"]="↓", -["circeq"]="≗", +["NegativeVeryThinSpace"]="", +["quot"]="\"", +["excl"]="!", +["sqcaps"]="⊓︀", +["gfr"]="𝔤", +["varsigma"]="ς", +["nwarrow"]="↖", +["reg"]="®", +["longmapsto"]="⟼", +["And"]="⩓", +["cuvee"]="⋎", +["zwj"]="", +["plankv"]="ℏ", +["varepsilon"]="ϵ", +["Aopf"]="𝔸", +["UpTee"]="⊥", +["lescc"]="⪨", +["ltri"]="◃", +["iiint"]="∭", +["ccups"]="⩌", +["alefsym"]="ℵ", +["succneqq"]="⪶", +["hscr"]="𝒽", +["Or"]="⩔", ["yuml"]="ÿ", -["Jfr"]="𝔍", -["Product"]="∏", -["boxDL"]="╗", -["el"]="⪙", -["supe"]="⊇", -["frac13"]="⅓", -["Barwed"]="⌆", -["larrpl"]="⤹", -["SHCHcy"]="Щ", -["LeftUpDownVector"]="⥑", -["Diamond"]="⋄", -["DownLeftVectorBar"]="⥖", -["Cross"]="⨯", -["ncup"]="⩂", -["supnE"]="⫌", -["lne"]="⪇", -["micro"]="µ", -["lowbar"]="_", -["perp"]="⊥", -["sqcap"]="⊓", -["Gfr"]="𝔊", -["raemptyv"]="⦳", -["gesl"]="⋛︀", -["drcrop"]="⌌", -["boxUL"]="╝", -["becaus"]="∵", -["gne"]="⪈", -["scap"]="⪸", -["swarrow"]="↙", -["nesim"]="≂̸", -["DoubleDot"]="¨", -["Mopf"]="𝕄", -["apid"]="≋", -["InvisibleComma"]="", -["Backslash"]="∖", -["mnplus"]="∓", -["niv"]="∋", -["Hfr"]="ℌ", -["rarrlp"]="↬", -["Because"]="∵", -["parsl"]="⫽", -["sup1"]="¹", -["Lt"]="≪", -["par"]="∥", -["Iota"]="Ι", -["beth"]="ℶ", -["Lopf"]="𝕃", +["rcub"]="}", +["lt"]="<", +["vArr"]="⇕", +["EqualTilde"]="≂", +["vDash"]="⊨", +["RightArrow"]="→", +["dlcorn"]="⌞", +["Barv"]="⫧", +["nsc"]="⊁", +["Proportion"]="∷", +["iota"]="ι", +["gscr"]="ℊ", +["abreve"]="ă", +["ThickSpace"]=" ", +["szlig"]="ß", +["lhard"]="↽", +["emptyv"]="∅", +["Tau"]="Τ", +["sharp"]="♯", +["bNot"]="⫭", +["LongLeftRightArrow"]="⟷", +["frac23"]="⅔", +["NotEqual"]="≠", +["scE"]="⪴", +["jfr"]="𝔧", +["bscr"]="𝒷", +["uhblk"]="▀", +["frac35"]="⅗", +["TSHcy"]="Ћ", +["ntrianglerighteq"]="⋭", +["Tcedil"]="Ţ", +["NotGreaterFullEqual"]="≧̸", +["asympeq"]="≍", +["oror"]="⩖", +["ecirc"]="ê", +["ohbar"]="⦵", +["Rho"]="Ρ", +["iacute"]="í", +["ascr"]="𝒶", +["RightUpVector"]="↾", +["Ocirc"]="Ô", +["cedil"]="¸", +["sect"]="§", +["angmsdab"]="⦩", +["FilledVerySmallSquare"]="▪", +["curlywedge"]="⋏", +["lesdotor"]="⪃", +["esdot"]="≐", +["eqvparsl"]="⧥", ["Cap"]="⋒", -["Aring"]="Å", -["rarr"]="→", -["Efr"]="𝔈", -["bigcup"]="⋃", -["DownLeftRightVector"]="⥐", -["lesges"]="⪓", -["NegativeThinSpace"]="", -["DownRightTeeVector"]="⥟", -["npolint"]="⨔", -["gEl"]="⪌", -["lltri"]="◺", -["ogon"]="˛", -["LessEqualGreater"]="⋚", -["sqsupset"]="⊐", -["NotSubsetEqual"]="⊈", -["Ubrcy"]="Ў", -["ShortDownArrow"]="↓", -["ugrave"]="ù", -["Dcaron"]="Ď", -["subE"]="⫅", -["divide"]="÷", -["bigotimes"]="⨂", -["dscy"]="ѕ", -["wreath"]="≀", -["Jopf"]="𝕁", -["pre"]="⪯", -["tdot"]="⃛", -["Cfr"]="ℭ", -["Uogon"]="Ų", -["softcy"]="ь", -["isinE"]="⋹", -["Dstrok"]="Đ", -["Jsercy"]="Ј", -["capdot"]="⩀", -["realpart"]="ℜ", -["hearts"]="♥", -["Atilde"]="Ã", -["LeftArrowRightArrow"]="⇆", -["upharpoonleft"]="↿", -["Iopf"]="𝕀", -["Intersection"]="⋂", -["midcir"]="⫰", -["ocirc"]="ô", -["sdot"]="⋅", -["Dfr"]="𝔇", -["gla"]="⪥", -["DiacriticalGrave"]="`", +["dscr"]="𝒹", +["rbrace"]="}", +["nsccue"]="⋡", +["neArr"]="⇗", +["rightthreetimes"]="⋌", +["plusmn"]="±", ["Ubreve"]="Ŭ", -["int"]="∫", -["PrecedesSlantEqual"]="≼", -["Square"]="□", -["Acy"]="А", +["ifr"]="𝔦", +["Poincareplane"]="ℌ", +["leftrightarrows"]="⇆", +["scnsim"]="⋩", +["cscr"]="𝒸", +["NotHumpEqual"]="≏̸", +["capbrcup"]="⩉", +["curarr"]="↷", +["notinvb"]="⋷", +["LeftArrow"]="←", +["Gopf"]="𝔾", +["ldrushar"]="⥋", +["nscr"]="𝓃", +["Gg"]="⋙", +["ouml"]="ö", +["nsce"]="⪰̸", +["cupbrcap"]="⩈", +["nLt"]="≪⃒", +["bullet"]="•", +["nsqsupe"]="⋣", +["rect"]="▭", +["lbrace"]="{", +["Fopf"]="𝔽", +["COPY"]="©", +["epar"]="⋕", +["mscr"]="𝓂", +["odsold"]="⦼", +["cupor"]="⩅", +["not"]="¬", +["subsim"]="⫇", +["hoarr"]="⇿", +["Scedil"]="Ş", +["eacute"]="é", +["emsp"]=" ", +["uml"]="¨", +["igrave"]="ì", +["pscr"]="𝓅", +["LeftTee"]="⊣", +["Cedilla"]="¸", +["Iopf"]="𝕀", +["HumpEqual"]="≏", +["les"]="⩽", +["Rcedil"]="Ŗ", +["lsquor"]="‚", +["raemptyv"]="⦳", +["NotSucceedsSlantEqual"]="⋡", +["SuchThat"]="∋", +["vert"]="|", +["backcong"]="≌", ["Hopf"]="ℍ", -["precsim"]="≾", -["nleq"]="≰", -["urcorn"]="⌝", -["hyphen"]="‐", -["FilledSmallSquare"]="◼", -["zdot"]="ż", -["ndash"]="–", -["hbar"]="ℏ", -["Wopf"]="𝕎", -["Esim"]="⩳", -["subsetneq"]="⊊", -["boxhD"]="╥", -["searhk"]="⤥", -["late"]="⪭", +["CircleDot"]="⊙", +["Kappa"]="Κ", +["conint"]="∮", +["DZcy"]="Џ", +["prsim"]="≾", +["Copf"]="ℂ", +["curvearrowright"]="↷", +["twixt"]="≬", +["curren"]="¤", +["rtriltri"]="⧎", +["jscr"]="𝒿", +["cupcup"]="⩊", +["Lcedil"]="Ļ", +["supseteqq"]="⫆", +["bfr"]="𝔟", +["lesseqqgtr"]="⪋", +["leftleftarrows"]="⇇", +["Bopf"]="𝔹", +["acute"]="´", ["blacktriangleright"]="▸", -["auml"]="ä", -["NotLessTilde"]="≴", -["Bfr"]="𝔅", -["grave"]="`", -["ltlarr"]="⥶", -["Aogon"]="Ą", -["sdote"]="⩦", -["gtrsim"]="≳", -["nvinfin"]="⧞", -["lgE"]="⪑", -["mdash"]="—", -["Vopf"]="𝕍", -["leftrightarrow"]="↔", -["RBarr"]="⤐", -["amalg"]="⨿", -["preccurlyeq"]="≼", -["EqualTilde"]="≂", -["scpolint"]="⨓", -["NotHumpDownHump"]="≎̸", -["uparrow"]="↑", -["downarrow"]="↓", -["boxdL"]="╕", -["Hstrok"]="Ħ", -["Ccaron"]="Č", -["succsim"]="≿", -["RightFloor"]="⌋", -["DownBreve"]="̑", -["succapprox"]="⪸", -["dsol"]="⧶", -["napid"]="≋̸", -["nprcue"]="⋠", +["frac34"]="¾", +["Gbreve"]="Ğ", +["Updownarrow"]="⇕", +["iscr"]="𝒾", +["sigmav"]="ς", +["trade"]="™", +["minusb"]="⊟", +["GJcy"]="Ѓ", +["TildeFullEqual"]="≅", +["DoubleRightTee"]="⊨", +["nang"]="∠⃒", +["ddotseq"]="⩷", +["copy"]="©", ["Eopf"]="𝔼", -["ell"]="ℓ", -["cupdot"]="⊍", -["Not"]="⫬", -["zigrarr"]="⇝", -["downharpoonright"]="⇂", -["nisd"]="⋺", -["lotimes"]="⨴", -["plusmn"]="±", -["ngE"]="≧̸", -["odash"]="⊝", -["emptyset"]="∅", +["Psi"]="Ψ", +["UpperRightArrow"]="↗", +["geqq"]="≧", +["subedot"]="⫃", +["nvlArr"]="⤂", +["Ncedil"]="Ņ", +["vsupne"]="⊋︀", +["supset"]="⊃", ["squarf"]="▪", -["NotGreaterTilde"]="≵", -["NotTildeFullEqual"]="≇", -["DownArrowUpArrow"]="⇵", -["nwarrow"]="↖", -["looparrowright"]="↬", +["LeftDoubleBracket"]="⟦", +["utrif"]="▴", ["Dopf"]="𝔻", -["oplus"]="⊕", -["UpEquilibrium"]="⥮", -["leftthreetimes"]="⋋", -["DoubleLeftTee"]="⫤", -["nabla"]="∇", -["RuleDelayed"]="⧴", -["euml"]="ë", -["varsupsetneqq"]="⫌︀", -["upsi"]="υ", -["supsup"]="⫖", -["bsol"]="\\", -["Copf"]="ℂ", -["DDotrahd"]="⤑", -["Upsilon"]="Υ", -["UpperRightArrow"]="↗", -["nedot"]="≐̸", -["NotEqual"]="≠", -["bumpeq"]="≏", -["emsp14"]=" ", -["frac38"]="⅜", -["DownTeeArrow"]="↧", -["Bopf"]="𝔹", -["capand"]="⩄", -["nleqq"]="≦̸", -["ratio"]="∶", -["eplus"]="⩱", -["nge"]="≱", -["laquo"]="«", -["urtri"]="◹", -["LeftUpVector"]="↿", -["gl"]="≷", -["Gt"]="≫", -["andd"]="⩜", +["ape"]="≊", +["gEl"]="⪌", +["COPY"]="©", +["afr"]="𝔞", +["Acy"]="А", +["ldquor"]="„", +["because"]="∵", +["Pr"]="⪻", +["OverBar"]="‾", +["lang"]="⟨", +["mopf"]="𝕞", +["crarr"]="↵", +["Epsilon"]="Ε", +["Nfr"]="𝔑", +["kjcy"]="ќ", +["TildeTilde"]="≈", +["bsim"]="∽", +["lcy"]="л", +["larrb"]="⇤", +["ncong"]="≇", +["ENG"]="Ŋ", +["brvbar"]="¦", +["Rightarrow"]="⇒", +["nopf"]="𝕟", +["Wfr"]="𝔚", +["ljcy"]="љ", +["diamondsuit"]="♦", +["latail"]="⤙", +["lambda"]="λ", +["frac14"]="¼", +["mcy"]="м", +["nparsl"]="⫽⃥", +["lBarr"]="⤎", +["subdot"]="⪽", +["frac12"]="½", +["kopf"]="𝕜", +["LeftCeiling"]="⌈", +["erarr"]="⥱", +["pre"]="⪯", +["varr"]="↕", +["Pi"]="Π", +["sub"]="⊂", +["ncy"]="н", +["marker"]="▮", +["rpargt"]="⦔", +["supe"]="⊇", +["veebar"]="⊻", +["checkmark"]="✓", +["nbsp"]=" ", +["sqsupseteq"]="⊒", +["upharpoonright"]="↾", +["lopf"]="𝕝", +["Omicron"]="Ο", +["ccaps"]="⩍", +["lrhard"]="⥭", ["Lstrok"]="Ł", -["gamma"]="γ", -["Sc"]="⪼", -["Aopf"]="𝔸", -["pluscir"]="⨢", -["Itilde"]="Ĩ", -["DoubleRightTee"]="⊨", -["pluse"]="⩲", -["iiint"]="∭", -["dotplus"]="∔", -["vrtri"]="⊳", -["Proportion"]="∷", -["bne"]="=⃥", -["cuepr"]="⋞", +["Mfr"]="𝔐", +["njcy"]="њ", +["ocy"]="о", +["Zcaron"]="Ž", +["NotSucceeds"]="⊁", +["rarrbfs"]="⤠", +["gtrapprox"]="⪆", +["oS"]="Ⓢ", +["diamond"]="⋄", +["gesdot"]="⪀", +["urcorner"]="⌝", +["lotimes"]="⨴", +["pertenk"]="‱", +["rfisht"]="⥽", +["Zfr"]="ℨ", +["Map"]="⤅", +["cross"]="✗", +["DifferentialD"]="ⅆ", +["boxtimes"]="⊠", +["horbar"]="―", +["lg"]="≶", +["orarr"]="↻", +["Vbar"]="⫫", +["ropf"]="𝕣", +["NotDoubleVerticalBar"]="∦", +["Sfr"]="𝔖", +["Iuml"]="Ï", +["leftharpoondown"]="↽", +["atilde"]="ã", +["VerticalTilde"]="≀", +["DoubleContourIntegral"]="∯", +["longleftarrow"]="⟵", +["Im"]="ℑ", +["RightUpVectorBar"]="⥔", +["nGg"]="⋙̸", +["scap"]="⪸", +["nrarr"]="↛", +["ycy"]="ы", +["ucirc"]="û", +["qopf"]="𝕢", +["oopf"]="𝕠", +["yacute"]="ý", +["Xfr"]="𝔛", +["fork"]="⋔", +["in"]="∈", +["xcap"]="⋂", +["check"]="✓", +["jcy"]="й", +["Phi"]="Φ", +["doteq"]="≐", ["vBar"]="⫨", -["yucy"]="ю", -["PrecedesTilde"]="≾", -["varr"]="↕", -["leftarrowtail"]="↢", -["rangle"]="⟩", -["subsub"]="⫕", -["rightarrowtail"]="↣", -["oslash"]="ø", -["mapstodown"]="↧", -["sqsube"]="⊑", -["NewLine"]="\n", -["Vdash"]="⊩", -["num"]="#", -["umacr"]="ū", -["InvisibleTimes"]="", -["bemptyv"]="⦰", +["frown"]="⌢", ["Iogon"]="Į", -["ssmile"]="⌣", -["timesbar"]="⨱", -["Tstrok"]="Ŧ", -["Icy"]="И", -["zacute"]="ź", -["Cedilla"]="¸", -["daleth"]="ℸ", -["semi"]=";", -["ssetmn"]="∖", -["subdot"]="⪽", -["Bernoullis"]="ℬ", -["otimesas"]="⨶", -["circleddash"]="⊝", -["circlearrowright"]="↻", -["NotLeftTriangleEqual"]="⋬", -["NotTilde"]="≁", -["npart"]="∂̸", -["Gbreve"]="Ğ", -["gtrless"]="≷", -["pound"]="£", -["curlyeqsucc"]="⋟", -["blacklozenge"]="⧫", -["ldca"]="⤶", -["nsucc"]="⊁", -["top"]="⊤", -["ufr"]="𝔲", -["sscr"]="𝓈", -["eDDot"]="⩷", -["Updownarrow"]="⇕", -["loz"]="◊", -["Gcy"]="Г", -["boxdl"]="┐", +["gnsim"]="⋧", +["nsupset"]="⊃⃒", +["equals"]="=", +["angmsdac"]="⦪", +["odash"]="⊝", +["Hstrok"]="Ħ", +["homtht"]="∻", +["maltese"]="✠", +["esim"]="≂", +["realine"]="ℛ", +["straightepsilon"]="ϵ", +["utri"]="▵", +["primes"]="ℙ", +["dbkarow"]="⤏", +["NotLessTilde"]="≴", +["nvrArr"]="⤃", +["cularrp"]="⤽", +["supsup"]="⫖", +["rang"]="⟩", +["nshortmid"]="∤", +["NotCupCap"]="≭", +["gnE"]="≩", +["otilde"]="õ", +["LeftTriangle"]="⊲", +["oelig"]="œ", +["curarrm"]="⤼", +["orderof"]="ℴ", +["DoubleLongLeftArrow"]="⟸", +["OverParenthesis"]="⏜", +["amacr"]="ā", +["copysr"]="℗", +["acirc"]="â", +["LeftArrowRightArrow"]="⇆", +["filig"]="fi", +["uopf"]="𝕦", +["rlhar"]="⇌", +["dharl"]="⇃", +["rAarr"]="⇛", +["rarrw"]="↝", +["isin"]="∈", +["simg"]="⪞", +["NoBreak"]="", +["rAtail"]="⤜", +["ndash"]="–", +["IJlig"]="IJ", +["dfr"]="𝔡", +["ohm"]="Ω", +["breve"]="˘", +["ccedil"]="ç", +["topf"]="𝕥", +["nvDash"]="⊭", +["RBarr"]="⤐", +["clubs"]="♣", ["napos"]="ʼn", -["Sqrt"]="√", -["xsqcup"]="⨆", -["Implies"]="⇒", -["uring"]="ů", -["thetav"]="ϑ", -["iiiint"]="⨌", -["nLeftrightarrow"]="⇎", -["lobrk"]="⟦", -["xfr"]="𝔵", -["Abreve"]="Ă", -["micro"]="µ", -["quatint"]="⨖", -["congdot"]="⩭", -["nrtrie"]="⋭", -["Fcy"]="Ф", -["hksearow"]="⤥", -["LowerLeftArrow"]="↙", -["rdca"]="⤷", -["OverBar"]="‾", -["frac12"]="½", -["imacr"]="ī", -["boxVL"]="╣", -["sfr"]="𝔰", -["ensp"]=" ", -["dwangle"]="⦦", -["boxh"]="─", -["Eogon"]="Ę", +["ngtr"]="≯", +["Tstrok"]="Ŧ", +["lrarr"]="⇆", +["eqslantgtr"]="⪖", +["efr"]="𝔢", +["gne"]="⪈", +["csube"]="⫑", +["Xi"]="Ξ", +["sopf"]="𝕤", +["LeftVector"]="↼", +["ggg"]="⋙", +["Ubrcy"]="Ў", +["die"]="¨", +["topbot"]="⌶", +["Rfr"]="ℜ", +["ofcir"]="⦿", ["imped"]="Ƶ", -["Ecy"]="Э", -["lates"]="⪭︀", -["phi"]="φ", -["minusd"]="∸", -["planckh"]="ℎ", -["Ocirc"]="Ô", -["lE"]="≦", -["sum"]="∑", -["lrtri"]="⊿", -["ruluhar"]="⥨", -["lAarr"]="⇚", -["DownArrow"]="↓", -["zscr"]="𝓏", -["questeq"]="≟", -["ngeqq"]="≧̸", -["And"]="⩓", -["Dcy"]="Д", -["angrtvbd"]="⦝", -["rarrpl"]="⥅", -["thkap"]="≈", -["Otimes"]="⨷", -["lesssim"]="≲", -["gE"]="≧", -["ouml"]="ö", -["nsubseteq"]="⊈", -["bigcirc"]="◯", +["plusmn"]="±", +["nles"]="⩽̸", +["pcy"]="п", +["permil"]="‰", +["notinE"]="⋹̸", +["bigoplus"]="⨁", +["boxplus"]="⊞", +["doublebarwedge"]="⌆", +["ccaron"]="č", +["asymp"]="≈", +["sup1"]="¹", +["bumpeq"]="≏", +["nrtrie"]="⋭", +["larrbfs"]="⤟", +["emacr"]="ē", +["gtrless"]="≷", +["Kfr"]="𝔎", +["plus"]="+", +["risingdotseq"]="≓", +["notindot"]="⋵̸", +["Subset"]="⋐", +["CloseCurlyDoubleQuote"]="”", +["nlsim"]="≴", +["dcaron"]="ď", ["boxVR"]="╠", -["Vert"]="‖", -["naturals"]="ℕ", -["plussim"]="⨦", -["wscr"]="𝓌", -["raquo"]="»", -["bigodot"]="⨀", -["dashv"]="⊣", -["hairsp"]=" ", -["inodot"]="ı", -["vnsup"]="⊃⃒", +["lne"]="⪇", +["Pfr"]="𝔓", +["rightsquigarrow"]="↝", +["phone"]="☎", +["DiacriticalDot"]="˙", +["Congruent"]="≡", +["SquareIntersection"]="⊓", +["ordf"]="ª", +["loz"]="◊", ["cire"]="≗", -["vartriangleleft"]="⊲", -["rbrke"]="⦌", -["boxuL"]="╛", -["sce"]="⪰", -["nrtri"]="⋫", -["loarr"]="⇽", -["ShortRightArrow"]="→", -["xscr"]="𝓍", -["Bcy"]="Б", -["HumpEqual"]="≏", -["lmidot"]="ŀ", -["DownLeftVector"]="↽", -["leftharpoonup"]="↼", +["ecaron"]="ě", +["nsub"]="⊄", +["Fouriertrf"]="ℱ", +["Qfr"]="𝔔", +["dblac"]="˝", +["sc"]="≻", +["xrarr"]="⟶", +["ImaginaryI"]="ⅈ", +["angmsdag"]="⦮", +["wopf"]="𝕨", +["middot"]="·", +["gsiml"]="⪐", +["biguplus"]="⨄", +["Prime"]="″", +["bigcirc"]="◯", +["vsubnE"]="⫋︀", +["lrtri"]="⊿", +["nparallel"]="∦", ["lbbrk"]="❲", -["rarrtl"]="↣", -["SucceedsEqual"]="⪰", -["HumpDownHump"]="≎", -["Vee"]="⋁", -["Gopf"]="𝔾", -["otilde"]="õ", -["ofr"]="𝔬", -["Sub"]="⋐", -["gnE"]="≩", -["SquareSuperset"]="⊐", -["leftrightharpoons"]="⇋", -["tosa"]="⤩", -["Ucirc"]="Û", -["mscr"]="𝓂", -["Exists"]="∃", -["langle"]="⟨", -["rfr"]="𝔯", -["THORN"]="Þ", -["gtreqqless"]="⪌", -["eqvparsl"]="⧥", -["NotCongruent"]="≢", -["phiv"]="ϕ", -["lsquor"]="‚", -["prec"]="≺", -["igrave"]="ì", -["Fopf"]="𝔽", -["nwArr"]="⇖", -["nscr"]="𝓃", -["gescc"]="⪩", -["intprod"]="⨼", -["larrlp"]="↫", -["AMP"]="&", -["psi"]="ψ", -["mDDot"]="∺", -["VDash"]="⊫", -["Lleftarrow"]="⇚", -["mfr"]="𝔪", +["dotsquare"]="⊡", +["rceil"]="⌉", ["gesles"]="⪔", -["kscr"]="𝓀", -["Omega"]="Ω", -["bumpe"]="≏", -["NotDoubleVerticalBar"]="∦", -["frac18"]="⅛", -["ecolon"]="≕", -["compfn"]="∘", -["supdot"]="⪾", -["Alpha"]="Α", -["rsquor"]="’", +["roarr"]="⇾", +["simplus"]="⨤", +["lagran"]="ℒ", +["pr"]="≺", +["mnplus"]="∓", +["Iota"]="Ι", +["NestedLessLess"]="≪", +["utilde"]="ũ", +["mldr"]="…", +["bigstar"]="★", +["micro"]="µ", ["percnt"]="%", -["pfr"]="𝔭", -["frasl"]="⁄", -["lscr"]="𝓁", -["aleph"]="ℵ", -["swArr"]="⇙", -["uuml"]="ü", -["uacute"]="ú", -["scE"]="⪴", -["hellip"]="…", +["fllig"]="fl", +["euml"]="ë", +["circledR"]="®", +["lltri"]="◺", +["IEcy"]="Е", +["notniva"]="∌", +["or"]="∨", +["curvearrowleft"]="↶", +["gnapprox"]="⪊", +["NotLessSlantEqual"]="⩽̸", +["Cconint"]="∰", +["NotSucceedsTilde"]="≿̸", +["gammad"]="ϝ", +["rightharpoondown"]="⇁", +["CounterClockwiseContourIntegral"]="∳", +["supdot"]="⪾", +["upsi"]="υ", +["nvle"]="≤⃒", +["beth"]="ℶ", +["nhArr"]="⇎", +["Gamma"]="Γ", +["complement"]="∁", +["xoplus"]="⨁", +["chi"]="χ", +["backepsilon"]="϶", +["nsube"]="⊈", +["aopf"]="𝕒", +["para"]="¶", +["drbkarow"]="⤐", +["Dstrok"]="Đ", +["isinE"]="⋹", +["Ecirc"]="Ê", +["aelig"]="æ", ["ulcorner"]="⌜", -["prnap"]="⪹", -["Gg"]="⋙", -["wedge"]="∧", -["SquareSubset"]="⊏", -["qscr"]="𝓆", -["kfr"]="𝔨", -["RightTee"]="⊢", -["eqsim"]="≂", -["rbrksld"]="⦎", -["ohm"]="Ω", -["lozf"]="⧫", -["cups"]="∪︀", -["epsilon"]="ε", -["ncap"]="⩃", -["Leftarrow"]="⇐", -["ultri"]="◸", -["egrave"]="è", -["vBarv"]="⫩", -["bNot"]="⫭", -["nfr"]="𝔫", -["rsqb"]="]", -["OpenCurlyDoubleQuote"]="“", -["rsquo"]="’", -["Del"]="∇", -["smtes"]="⪬︀", -["varphi"]="ϕ", -["CirclePlus"]="⊕", -["prcue"]="≼", -["curren"]="¤", -["nltri"]="⋪", -["oscr"]="ℴ", -["Wcirc"]="Ŵ", -["prime"]="′", -["ifr"]="𝔦", -["apos"]="'", -["UpTee"]="⊥", -["lescc"]="⪨", -["NegativeMediumSpace"]="", -["DownTee"]="⊤", -["NotSquareSubsetEqual"]="⋢", -["LowerRightArrow"]="↘", -["wr"]="≀", +["Lcaron"]="Ľ", +["bopf"]="𝕓", +["midast"]="*", +["barvee"]="⊽", +["nvgt"]=">⃒", +["bnequiv"]="≡⃥", +["caron"]="ˇ", ["andand"]="⩕", -["gvnE"]="≩︀", -["lfr"]="𝔩", -["lowast"]="∗", -["gfr"]="𝔤", -["digamma"]="ϝ", -["cemptyv"]="⦲", -["ubreve"]="ŭ", -["dstrok"]="đ", +["eparsl"]="⧣", +["xhArr"]="⟺", +["Yuml"]="Ÿ", +["fallingdotseq"]="≒", +["vltri"]="⊲", +["gtrarr"]="⥸", +["nGtv"]="≫̸", +["congdot"]="⩭", +["lfisht"]="⥼", +["nrtri"]="⋫", +["prnsim"]="⋨", +["nsupE"]="⫆̸", +["Colone"]="⩴", +["SquareSuperset"]="⊐", +["boxUL"]="╝", +["Rrightarrow"]="⇛", +["nleftrightarrow"]="↮", +["Conint"]="∯", +["ffilig"]="ffi", +["nleqq"]="≦̸", +["drcrop"]="⌌", +["boxh"]="─", +["Lang"]="⟪", +["ldrdhar"]="⥧", +["rbrack"]="]", +["nvinfin"]="⧞", +["succsim"]="≿", +["boxhu"]="┴", +["tau"]="τ", +["incare"]="℅", +["flat"]="♭", +["angst"]="Å", +["Oslash"]="Ø", +["Vfr"]="𝔙", +["tscy"]="ц", +["lates"]="⪭︀", +["eopf"]="𝕖", +["Because"]="∵", +["frac25"]="⅖", +["daleth"]="ℸ", +["ic"]="", +["ensp"]=" ", +["lrm"]="", +["DoubleLeftRightArrow"]="⇔", +["kappa"]="κ", +["fopf"]="𝕗", +["cularr"]="↶", +["shy"]="", +["yen"]="¥", +["glj"]="⪤", +["dzcy"]="џ", ["expectation"]="ℰ", -["sime"]="≃", -["ltrif"]="◂", -["iacute"]="í", -["chi"]="χ", +["dash"]="‐", +["female"]="♀", +["UnderBrace"]="⏟", +["rotimes"]="⨵", +["caps"]="∩︀", +["copf"]="𝕔", +["lparlt"]="⦓", +["NotLess"]="≮", +["simrarr"]="⥲", +["dtri"]="▿", +["supne"]="⊋", +["block"]="█", +["siml"]="⪝", +["blk12"]="▒", +["natural"]="♮", +["frac34"]="¾", +["frac38"]="⅜", +["Ufr"]="𝔘", +["gg"]="≫", +["Square"]="□", +["lt"]="<", ["erDot"]="≓", -["Vcy"]="В", +["RightAngleBracket"]="⟩", +["LeftDownTeeVector"]="⥡", +["NotGreaterGreater"]="≫̸", +["uogon"]="ų", +["ocirc"]="ô", +["sung"]="♪", +["dollar"]="$", +["Scaron"]="Š", +["top"]="⊤", +["iopf"]="𝕚", +["udhar"]="⥮", +["gjcy"]="ѓ", +["ncap"]="⩃", +["circlearrowleft"]="↺", +["bernou"]="ℬ", +["angmsdaf"]="⦭", +["ldsh"]="↲", +["isins"]="⋴", +["RoundImplies"]="⥰", +["bigtriangledown"]="▽", +["LeftAngleBracket"]="⟨", +["HorizontalLine"]="─", +["Vdashl"]="⫦", +["rHar"]="⥤", +["Tcaron"]="Ť", +["LeftDownVectorBar"]="⥙", +["jopf"]="𝕛", +["LeftRightVector"]="⥎", +["LessGreater"]="≶", +["npart"]="∂̸", +["nsmid"]="∤", +["RightTriangleBar"]="⧐", +["nesim"]="≂̸", +["deg"]="°", +["LeftTeeArrow"]="↤", +["NotHumpDownHump"]="≎̸", +["tridot"]="◬", +["lceil"]="⌈", +["ExponentialE"]="ⅇ", +["tosa"]="⤩", +["gopf"]="𝕘", +["ContourIntegral"]="∮", +["late"]="⪭", +["bbrk"]="⎵", +["half"]="½", ["boxhd"]="┬", -["DoubleDownArrow"]="⇓", -["lArr"]="⇐", -["demptyv"]="⦱", -["smt"]="⪪", -["intcal"]="⊺", -["in"]="∈", -["capcup"]="⩇", -["kjcy"]="ќ", -["Ccirc"]="Ĉ", -["bnequiv"]="≡⃥", -["Emacr"]="Ē", -["siml"]="⪝", -["jfr"]="𝔧", -["gesdoto"]="⪂", -["efr"]="𝔢", -["precneqq"]="⪵", -["because"]="∵", -["Udblac"]="Ű", -["lg"]="≶", -["boxvr"]="├", -["fpartint"]="⨍", -["rbbrk"]="❳", -["LT"]="<", -["cap"]="∩", -["circledR"]="®", -["notinvc"]="⋶", -["zwj"]="", -["nle"]="≰", -["hfr"]="𝔥", -["bigsqcup"]="⨆", -["nGg"]="⋙̸", -["doublebarwedge"]="⌆", +["hopf"]="𝕙", +["Ouml"]="Ö", +["Atilde"]="Ã", +["planckh"]="ℎ", +["MinusPlus"]="∓", +["uharl"]="↿", +["aleph"]="ℵ", +["boxHD"]="╦", +["lesseqgtr"]="⋚", +["colon"]=":", +["SquareSupersetEqual"]="⊒", +["isinsv"]="⋳", +["lnapprox"]="⪉", +["PrecedesSlantEqual"]="≼", +["boxuL"]="╛", +["csup"]="⫐", +["hstrok"]="ħ", +["leftrightharpoons"]="⇋", +["boxuR"]="╘", +["DD"]="ⅅ", +["Longrightarrow"]="⟹", +["epsilon"]="ε", +["NotTildeTilde"]="≉", +["nfr"]="𝔫", +["Vscr"]="𝒱", +["Ncy"]="Н", +["boxUl"]="╜", +["searr"]="↘", +["ddagger"]="‡", +["KHcy"]="Х", +["NotSuperset"]="⊃⃒", +["Uparrow"]="⇑", +["nsqsube"]="⋢", +["Imacr"]="Ī", +["nspar"]="∦", +["supsetneqq"]="⫌", +["Sscr"]="𝒮", +["lobrk"]="⟦", +["mfr"]="𝔪", +["acirc"]="â", +["subne"]="⊊", +["Icirc"]="Î", +["Re"]="ℜ", +["nearrow"]="↗", ["YUcy"]="Ю", -["empty"]="∅", -["nacute"]="ń", -["Acirc"]="Â", -["bigtriangleup"]="△", -["hybull"]="⁃", -["Ycy"]="Ы", -["isindot"]="⋵", -["iota"]="ι", -["numero"]="№", -["cfr"]="𝔠", -["llarr"]="⇇", -["lrhard"]="⥭", -["cross"]="✗", +["eqsim"]="≂", +["UnionPlus"]="⊎", +["topcir"]="⫱", +["boxVL"]="╣", +["Xscr"]="𝒳", +["QUOT"]="\"", +["RightDownVectorBar"]="⥕", +["epsi"]="ε", +["natur"]="♮", +["leftthreetimes"]="⋋", +["hercon"]="⊹", +["lHar"]="⥢", +["Aring"]="Å", +["Kcedil"]="Ķ", +["kfr"]="𝔨", +["Oacute"]="Ó", ["zwnj"]="", +["plusdu"]="⨥", +["Kcy"]="К", +["sqcup"]="⊔", +["zscr"]="𝓏", +["Assign"]="≔", +["zopf"]="𝕫", +["lstrok"]="ł", +["zigrarr"]="⇝", +["ShortDownArrow"]="↓", +["simlE"]="⪟", +["mid"]="∣", ["zeta"]="ζ", -["precnsim"]="⋨", -["zcy"]="з", +["gE"]="≧", +["zeetrf"]="ℨ", +["qfr"]="𝔮", ["zcaron"]="ž", -["xodot"]="⨀", -["RightDownTeeVector"]="⥝", -["ljcy"]="љ", +["Yacute"]="Ý", +["hksearow"]="⤥", +["Atilde"]="Ã", +["zacute"]="ź", +["bsemi"]="⁏", +["bigtriangleup"]="△", +["yuml"]="ÿ", +["yucy"]="ю", ["yscr"]="𝓎", +["yopf"]="𝕪", ["yicy"]="ї", -["Rcy"]="Р", -["nsubset"]="⊂⃒", -["yen"]="¥", -["ycy"]="ы", -["simeq"]="≃", -["dharr"]="⇂", -["ycirc"]="ŷ", -["hArr"]="⇔", -["yacute"]="ý", -["yacute"]="ý", +["urcorn"]="⌝", +["Aacute"]="Á", +["backsimeq"]="⋍", +["ShortUpArrow"]="↑", ["xwedge"]="⋀", -["xoplus"]="⨁", -["nparsl"]="⫽⃥", -["PartialD"]="∂", -["YAcy"]="Я", -["xrArr"]="⟹", -["xotime"]="⨂", -["sstarf"]="⋆", -["yuml"]="ÿ", -["Int"]="∬", -["bsolb"]="⧅", +["Jcy"]="Й", +["nltrie"]="⋬", +["starf"]="★", +["zfr"]="𝔷", +["comma"]=",", +["xsqcup"]="⨆", +["boxVr"]="╟", +["cirscir"]="⧂", +["ucirc"]="û", +["Cross"]="⨯", +["naturals"]="ℕ", +["quaternions"]="ℍ", +["xopf"]="𝕩", +["xodot"]="⨀", ["xnis"]="⋻", -["xmap"]="⟼", -["hercon"]="⊹", -["xlArr"]="⟸", -["xharr"]="⟷", -["rbrack"]="]", +["lsaquo"]="‹", +["xlarr"]="⟵", +["Zacute"]="Ź", +["vdash"]="⊢", +["submult"]="⫁", +["Oscr"]="𝒪", ["xdtri"]="▽", -["diamond"]="⋄", +["LowerRightArrow"]="↘", ["xcup"]="⋃", -["subsup"]="⫓", -["lneqq"]="≨", -["dharl"]="⇃", -["Scy"]="С", -["wopf"]="𝕨", -["rightleftharpoons"]="⇌", -["wfr"]="𝔴", -["nsupseteqq"]="⫆̸", -["boxuR"]="╘", -["permil"]="‰", +["Ycy"]="Ы", +["timesb"]="⊠", +["Ucirc"]="Û", +["eth"]="ð", +["wscr"]="𝓌", +["ratail"]="⤚", +["wr"]="≀", +["Ograve"]="Ò", +["wp"]="℘", +["euml"]="ë", +["yfr"]="𝔶", +["rangle"]="⟩", +["hearts"]="♥", ["wedgeq"]="≙", -["eparsl"]="⧣", -["RoundImplies"]="⥰", -["afr"]="𝔞", -["vsubne"]="⊊︀", -["sup2"]="²", +["wedge"]="∧", +["gtcir"]="⩺", +["par"]="∥", +["swarr"]="↙", +["phiv"]="ϕ", +["NotElement"]="∉", +["alpha"]="α", +["SquareUnion"]="⊔", +["parsl"]="⫽", ["vscr"]="𝓋", +["rharu"]="⇀", +["vrtri"]="⊳", +["comp"]="∁", +["Agrave"]="À", +["rdca"]="⤷", +["vprop"]="∝", +["Tscr"]="𝒯", ["vopf"]="𝕧", -["lbrace"]="{", +["ldca"]="⤶", ["vnsub"]="⊂⃒", -["vltri"]="⊲", -["Uacute"]="Ú", -["vfr"]="𝔳", -["sacute"]="ś", -["njcy"]="њ", -["frac35"]="⅗", -["squf"]="▪", +["gbreve"]="ğ", +["NotSquareSubset"]="⊏̸", +["verbar"]="|", +["YAcy"]="Я", ["veeeq"]="≚", -["lsime"]="⪍", -["mapstoleft"]="↤", +["downharpoonleft"]="⇃", +["Star"]="⋆", +["xfr"]="𝔵", +["nges"]="⩾̸", +["GreaterGreater"]="⪢", +["vartriangleright"]="⊳", +["rcy"]="р", +["vartheta"]="ϑ", +["varsupsetneqq"]="⫌︀", +["dashv"]="⊣", ["varsupsetneq"]="⊋︀", -["varsubsetneq"]="⊊︀", -["Tcy"]="Т", -["cwint"]="∱", -["varsigma"]="ς", -["LessGreater"]="≶", +["Ncaron"]="Ň", +["varsubsetneqq"]="⫋︀", ["varrho"]="ϱ", -["varpropto"]="∝", -["pr"]="≺", -["backprime"]="‵", +["triangledown"]="▿", +["varpi"]="ϖ", +["sol"]="/", +["ssetmn"]="∖", +["varnothing"]="∅", ["varkappa"]="ϰ", -["Poincareplane"]="ℌ", -["roplus"]="⨮", -["Edot"]="Ė", -["copysr"]="℗", +["vangrt"]="⦜", +["Leftarrow"]="⇐", +["Qscr"]="𝒬", +["uwangle"]="⦧", +["rarrap"]="⥵", ["uuml"]="ü", -["dfr"]="𝔡", ["uuarr"]="⇈", -["uogon"]="ų", -["Uscr"]="𝒰", -["gel"]="⋛", -["olarr"]="↺", -["lsaquo"]="‹", -["omacr"]="ō", -["utdot"]="⋰", -["or"]="∨", -["Ocirc"]="Ô", -["ClockwiseContourIntegral"]="∲", -["SmallCircle"]="∘", -["gtcc"]="⪧", ["uscr"]="𝓊", +["urtri"]="◹", +["uring"]="ů", +["sect"]="§", +["quatint"]="⨖", ["urcrop"]="⌎", -["ContourIntegral"]="∮", -["szlig"]="ß", -["egs"]="⪖", -["Ucy"]="У", -["ange"]="⦤", -["upharpoonright"]="↾", -["xcap"]="⋂", +["wfr"]="𝔴", +["duhar"]="⥯", +["upuparrows"]="⇈", +["macr"]="¯", +["SmallCircle"]="∘", +["upsih"]="ϒ", +["uplus"]="⊎", +["shy"]="", +["uparrow"]="↑", ["uml"]="¨", -["nsubseteqq"]="⫅̸", +["eDot"]="≑", +["blk34"]="▓", +["umacr"]="ū", +["ultri"]="◸", +["rbbrk"]="❳", ["ulcorn"]="⌜", -["uhblk"]="▀", -["scirc"]="ŝ", -["shy"]="", -["uharl"]="↿", +["uharr"]="↾", ["ugrave"]="ù", -["lstrok"]="ł", -["Gamma"]="Γ", -["udhar"]="⥮", -["udblac"]="ű", -["ucirc"]="û", -["loang"]="⟬", -["uarr"]="↑", +["Ograve"]="Ò", +["nsupseteq"]="⊉", +["ufisht"]="⥾", +["Breve"]="˘", +["ucy"]="у", +["cylcty"]="⌭", +["ubreve"]="ŭ", +["SHcy"]="Ш", +["boxdR"]="╒", +["awint"]="⨑", +["uHar"]="⥣", ["uArr"]="⇑", -["twoheadrightarrow"]="↠", +["REG"]="®", +["twoheadleftarrow"]="↞", ["tstrok"]="ŧ", +["iprod"]="⨼", ["tshcy"]="ћ", -["tscy"]="ц", -["angsph"]="∢", -["kappa"]="κ", ["tscr"]="𝓉", -["tritime"]="⨻", -["trisb"]="⧍", +["trpezium"]="⏢", +["ycirc"]="ŷ", +["larrhk"]="↩", +["triplus"]="⨹", ["triminus"]="⨺", -["trie"]="≜", -["tridot"]="◬", -["aacute"]="á", +["Rsh"]="↱", +["becaus"]="∵", +["Acirc"]="Â", ["trianglerighteq"]="⊵", -["RightTeeVector"]="⥛", ["triangleright"]="▹", +["hkswarow"]="⤦", +["triangleq"]="≜", +["AElig"]="Æ", ["trianglelefteq"]="⊴", +["varpropto"]="∝", ["triangle"]="▵", -["NegativeVeryThinSpace"]="", -["triangledown"]="▿", -["dash"]="‐", -["trade"]="™", +["tprime"]="‴", ["topfork"]="⫚", -["Upsi"]="ϒ", -["topcir"]="⫱", -["loplus"]="⨭", -["Zdot"]="Ż", -["lbrke"]="⦋", -["angmsd"]="∡", -["dArr"]="⇓", -["topbot"]="⌶", ["toea"]="⤨", -["iexcl"]="¡", -["acirc"]="â", -["easter"]="⩮", -["CloseCurlyDoubleQuote"]="”", -["cupcup"]="⩊", -["rlhar"]="⇌", -["nsimeq"]="≄", -["Uparrow"]="⇑", -["tau"]="τ", -["npr"]="⊀", -["phone"]="☎", -["emacr"]="ē", -["SHcy"]="Ш", -["gtdot"]="⋗", -["ReverseUpEquilibrium"]="⥯", +["ac"]="∾", +["timesd"]="⨰", +["UpArrowDownArrow"]="⇅", +["timesbar"]="⨱", +["llhard"]="⥫", +["CHcy"]="Ч", +["odblac"]="ő", +["THORN"]="Þ", +["notni"]="∌", +["nbump"]="≎̸", +["eqcolon"]="≕", ["tilde"]="˜", -["angmsdac"]="⦪", -["duhar"]="⥯", -["approxeq"]="≊", -["NotSupersetEqual"]="⊉", -["thorn"]="þ", -["thksim"]="∼", -["subsim"]="⫇", -["bnot"]="⌐", +["simgE"]="⪠", +["intercal"]="⊺", +["thetasym"]="ϑ", +["xcirc"]="◯", ["thinsp"]=" ", ["thicksim"]="∼", -["gt"]=">", -["UpperLeftArrow"]="↖", -["thetasym"]="ϑ", -["simlE"]="⪟", -["bbrktbrk"]="⎶", -["Jcirc"]="Ĵ", -["cedil"]="¸", -["NotLessSlantEqual"]="⩽̸", -["rx"]="℞", -["infin"]="∞", -["curlyvee"]="⋎", -["LeftArrow"]="←", -["tfr"]="𝔱", -["blacksquare"]="▪", -["emptyv"]="∅", -["Mellintrf"]="ℳ", -["aogon"]="ą", -["succnapprox"]="⪺", -["tcy"]="т", -["ecaron"]="ě", +["LeftArrowBar"]="⇤", +["Uuml"]="Ü", +["DownTeeArrow"]="↧", +["cent"]="¢", +["hookleftarrow"]="↩", +["odiv"]="⨸", +["therefore"]="∴", +["ClockwiseContourIntegral"]="∲", +["Ofr"]="𝔒", +["auml"]="ä", +["frac12"]="½", +["nRightarrow"]="⇏", +["kcedil"]="ķ", +["DownRightVectorBar"]="⥗", +["boxDL"]="╗", ["tcedil"]="ţ", -["boxhU"]="╨", -["boxVl"]="╢", -["gacute"]="ǵ", -["tcaron"]="ť", -["boxDr"]="╓", -["bump"]="≎", -["blk12"]="▒", -["RightArrow"]="→", -["els"]="⪕", -["apacir"]="⩯", -["acy"]="а", -["omid"]="⦶", -["boxbox"]="⧉", -["iecy"]="е", -["szlig"]="ß", -["upsih"]="ϒ", -["swnwar"]="⤪", -["Icirc"]="Î", -["swarr"]="↙", -["times"]="×", -["Ograve"]="Ò", -["hoarr"]="⇿", -["NotTildeEqual"]="≄", -["IEcy"]="Е", -["iexcl"]="¡", -["bdquo"]="„", -["TildeTilde"]="≈", +["boxUr"]="╙", +["icirc"]="î", +["lmoustache"]="⎰", +["prime"]="′", +["ngeq"]="≱", ["nshortparallel"]="∦", -["subedot"]="⫃", -["supsetneq"]="⊋", -["CenterDot"]="·", -["lessapprox"]="⪅", -["LeftVectorBar"]="⥒", -["bigoplus"]="⨁", -["supseteqq"]="⫆", -["drcorn"]="⌟", -["hstrok"]="ħ", -["HorizontalLine"]="─", -["curarrm"]="⤼", -["lopar"]="⦅", +["szlig"]="ß", +["Egrave"]="È", +["sqsubset"]="⊏", +["NotRightTriangleEqual"]="⋭", +["swarrow"]="↙", +["Ucirc"]="Û", +["DownArrowBar"]="⤓", +["Lfr"]="𝔏", ["wcirc"]="ŵ", +["LessLess"]="⪡", +["Tilde"]="∼", +["empty"]="∅", +["swarhk"]="⤦", +["DownLeftVector"]="↽", +["Uscr"]="𝒰", +["khcy"]="х", +["gesl"]="⋛︀", +["supsub"]="⫔", +["malt"]="✠", +["cirmid"]="⫯", +["PrecedesTilde"]="≾", +["lharul"]="⥪", +["rightleftharpoons"]="⇌", +["Ccedil"]="Ç", +["plusb"]="⊞", +["nsupe"]="⊉", +["geq"]="≥", +["dHar"]="⥥", +["lcedil"]="ļ", +["ange"]="⦤", +["supseteq"]="⊇", +["Upsi"]="ϒ", +["mapstodown"]="↧", +["profalar"]="⌮", +["cupdot"]="⊍", +["mapstoleft"]="↤", +["xotime"]="⨂", +["tbrk"]="⎴", +["supmult"]="⫂", +["disin"]="⋲", ["suphsub"]="⫗", -["Otilde"]="Õ", -["EmptySmallSquare"]="◻", +["eg"]="⪚", ["supedot"]="⫄", -["Kopf"]="𝕂", -["boxminus"]="⊟", -["csupe"]="⫒", -["Ffr"]="𝔉", -["origof"]="⊶", -["sup3"]="³", -["boxH"]="═", -["vsubnE"]="⫋︀", -["Hcirc"]="Ĥ", -["block"]="█", +["NonBreakingSpace"]=" ", +["Euml"]="Ë", ["bsolhsub"]="⟈", -["Supset"]="⋑", -["GreaterFullEqual"]="≧", +["supdsub"]="⫘", +["sup3"]="³", +["DoubleLeftTee"]="⫤", +["angrtvb"]="⊾", +["supsim"]="⫈", +["sup2"]="²", +["sup2"]="²", +["circledast"]="⊛", +["rfr"]="𝔯", +["darr"]="↓", +["rarrhk"]="↪", +["macr"]="¯", ["sup1"]="¹", -["llcorner"]="⌞", -["sopf"]="𝕤", -["larrbfs"]="⤟", -["succneqq"]="⪶", -["part"]="∂", -["eacute"]="é", -["COPY"]="©", -["frac23"]="⅔", -["dbkarow"]="⤏", -["succeq"]="⪰", -["notni"]="∌", -["Euml"]="Ë", -["harrcir"]="⥈", -["leftrightsquigarrow"]="↭", -["xcirc"]="◯", -["caret"]="⁁", -["les"]="⩽", -["lharul"]="⥪", -["bsime"]="⋍", -["DoubleLeftArrow"]="⇐", -["ecirc"]="ê", -["subsetneqq"]="⫋", -["crarr"]="↵", -["cuwed"]="⋏", -["Ugrave"]="Ù", -["Gcirc"]="Ĝ", -["LeftTriangleBar"]="⧏", +["aacute"]="á", +["oscr"]="ℴ", +["lharu"]="↼", +["telrec"]="⌕", +["Dashv"]="⫤", +["succnsim"]="⋩", +["AElig"]="Æ", +["Vee"]="⋁", +["succnapprox"]="⪺", +["CapitalDifferentialD"]="ⅅ", ["gsim"]="≳", -["RightTriangleEqual"]="⊵", -["lacute"]="ĺ", -["Ccedil"]="Ç", -["ee"]="ⅇ", -["heartsuit"]="♥", -["coloneq"]="≔", -["subseteq"]="⊆", -["NotSucceedsTilde"]="≿̸", +["succapprox"]="⪸", +["rmoustache"]="⎱", +["DotEqual"]="≐", +["subsup"]="⫓", +["Gcedil"]="Ģ", +["questeq"]="≟", +["lthree"]="⋋", +["cong"]="≅", +["lcub"]="{", +["radic"]="√", +["subrarr"]="⥹", +["nvlt"]="<⃒", ["subplus"]="⪿", -["cupcap"]="⩆", -["Amacr"]="Ā", -["angst"]="Å", -["supsetneqq"]="⫌", -["sube"]="⊆", -["imagpart"]="ℑ", -["Lambda"]="Λ", -["Afr"]="𝔄", -["sub"]="⊂", +["bigsqcup"]="⨆", +["downarrow"]="↓", +["auml"]="ä", +["boxdL"]="╕", +["boxvr"]="├", +["lbrkslu"]="⦍", +["bigwedge"]="⋀", +["apacir"]="⩯", +["Wscr"]="𝒲", +["iecy"]="е", +["VerticalSeparator"]="❘", +["Yfr"]="𝔜", ["strns"]="¯", ["straightphi"]="ϕ", -["boxvL"]="╡", -["dagger"]="†", -["eta"]="η", -["KHcy"]="Х", -["Yfr"]="𝔜", -["lbrack"]="[", -["VerticalBar"]="∣", -["rightleftarrows"]="⇄", -["fltns"]="▱", -["verbar"]="|", -["RightAngleBracket"]="⟩", -["DownRightVector"]="⇁", -["Lacute"]="Ĺ", -["sol"]="/", -["lrm"]="", -["lesdot"]="⩿", -["nleqslant"]="⩽̸", -["capcap"]="⩋", +["kcy"]="к", +["aogon"]="ą", +["star"]="☆", +["caret"]="⁁", +["cups"]="∪︀", +["iquest"]="¿", +["spar"]="∥", +["NotExists"]="∄", +["Gt"]="≫", ["squ"]="□", -["xutri"]="△", -["TSHcy"]="Ћ", -["gap"]="⪆", -["gtrdot"]="⋗", -["scnap"]="⪺", -["bkarow"]="⤍", -["NotPrecedes"]="⊀", -["suphsol"]="⟉", +["sqsupe"]="⊒", +["subnE"]="⫋", ["sqsup"]="⊐", -["epsi"]="ε", -["sqsubset"]="⊏", -["check"]="✓", -["UpArrowBar"]="⤒", -["NotPrecedesEqual"]="⪯̸", -["csube"]="⫑", -["nsupset"]="⊃⃒", -["lesdoto"]="⪁", +["sqsubseteq"]="⊑", +["ffr"]="𝔣", +["UpTeeArrow"]="↥", +["middot"]="·", +["DoubleLongRightArrow"]="⟹", +["sqsube"]="⊑", +["sce"]="⪰", +["Sup"]="⋑", +["cacute"]="ć", +["GreaterFullEqual"]="≧", +["pfr"]="𝔭", +["Lleftarrow"]="⇚", +["heartsuit"]="♥", +["precsim"]="≾", +["nsucceq"]="⪰̸", ["sqcups"]="⊔︀", -["suplarr"]="⥻", -["nsim"]="≁", -["NotEqualTilde"]="≂̸", -["nearr"]="↗", -["SquareIntersection"]="⊓", -["intlarhk"]="⨗", -["Ecirc"]="Ê", -["vangrt"]="⦜", -["fllig"]="fl", -["Leftrightarrow"]="⇔", -["primes"]="ℙ", -["nvlArr"]="⤂", +["Igrave"]="Ì", +["iquest"]="¿", +["Pcy"]="П", +["thksim"]="∼", +["djcy"]="ђ", +["hfr"]="𝔥", +["spadesuit"]="♠", +["rbrkslu"]="⦐", +["shcy"]="ш", +["barwed"]="⌅", +["rpar"]=")", +["iiiint"]="⨌", +["solb"]="⧄", +["Integral"]="∫", +["napE"]="⩰̸", +["softcy"]="ь", +["NotRightTriangleBar"]="⧐̸", +["Mu"]="Μ", +["frasl"]="⁄", +["Icy"]="И", +["dfisht"]="⥿", ["smte"]="⪬", -["ltri"]="◃", -["Tscr"]="𝒯", +["smt"]="⪪", +["bottom"]="⊥", +["oacute"]="ó", +["ofr"]="𝔬", ["smid"]="∣", -["smeparsl"]="⧤", -["rarrc"]="⤳", -["divideontimes"]="⋇", -["eth"]="ð", -["boxvR"]="╞", -["copy"]="©", -["nges"]="⩾̸", -["fcy"]="ф", -["ShortUpArrow"]="↑", -["simplus"]="⨤", -["frac45"]="⅘", -["nexists"]="∄", -["LeftTeeArrow"]="↤", -["leftleftarrows"]="⇇", -["simg"]="⪞", -["euro"]="€", -["simdot"]="⩪", -["sim"]="∼", -["sigmav"]="ς", -["iuml"]="ï", -["updownarrow"]="↕", -["shy"]="", -["solb"]="⧄", +["ReverseUpEquilibrium"]="⥯", +["smashp"]="⨳", +["slarr"]="←", +["simne"]="≆", +["LeftRightArrow"]="↔", +["thkap"]="≈", +["nlArr"]="⇍", +["chcy"]="ч", +["not"]="¬", +["kgreen"]="ĸ", +["simeq"]="≃", +["LongRightArrow"]="⟶", +["sime"]="≃", +["sigma"]="σ", +["odot"]="⊙", +["amp"]="&", +["Longleftrightarrow"]="⟺", +["Upsilon"]="Υ", +["upharpoonleft"]="↿", +["bigotimes"]="⨂", +["parallel"]="∥", +["ffllig"]="ffl", +["shortparallel"]="∥", +["boxdr"]="┌", +["shortmid"]="∣", +["Euml"]="Ë", +["UpDownArrow"]="↕", +["lcaron"]="ľ", +["sfrown"]="⌢", +["harr"]="↔", +["dsol"]="⧶", +["Beta"]="Β", +["srarr"]="→", +["boxHd"]="╤", ["nesear"]="⤨", -["Umacr"]="Ū", -["uharr"]="↾", -["Therefore"]="∴", -["Barv"]="⫧", -["amacr"]="ā", ["setmn"]="∖", +["DoubleDot"]="¨", ["setminus"]="∖", -["Sscr"]="𝒮", +["andd"]="⩜", +["leftrightarrow"]="↔", ["seswar"]="⤩", -["ccupssm"]="⩐", -["searr"]="↘", +["eogon"]="ę", +["bne"]="=⃥", +["DownBreve"]="̑", +["nLtv"]="≪̸", +["nprcue"]="⋠", +["SucceedsSlantEqual"]="≽", +["downdownarrows"]="⇊", +["seArr"]="⇘", +["Utilde"]="Ũ", +["Gammad"]="Ϝ", +["sdote"]="⩦", +["iexcl"]="¡", +["nvdash"]="⊬", +["csupe"]="⫒", ["sdotb"]="⊡", -["icirc"]="î", -["amp"]="&", -["gcy"]="г", -["Aacute"]="Á", -["boxvh"]="┼", -["bfr"]="𝔟", -["OverParenthesis"]="⏜", -["sqsupe"]="⊒", -["amp"]="&", -["frac14"]="¼", -["ZeroWidthSpace"]="", -["Colon"]="∷", -["Proportional"]="∝", -["thickapprox"]="≈", -["subseteqq"]="⫅", -["IJlig"]="IJ", -["scedil"]="ş", -["lrarr"]="⇆", -["angmsdaf"]="⦭", -["downharpoonleft"]="⇃", +["scsim"]="≿", +["bcy"]="б", +["NotTilde"]="≁", +["minus"]="−", +["scnE"]="⪶", +["scirc"]="ŝ", +["oplus"]="⊕", +["para"]="¶", +["Ycirc"]="Ŷ", +["notinva"]="∉", +["nLl"]="⋘̸", +["Aring"]="Å", +["THORN"]="Þ", +["numero"]="№", +["scaron"]="š", +["bsol"]="\\", +["harrw"]="↭", +["exponentiale"]="ⅇ", +["eDDot"]="⩷", +["AMP"]="&", +["gamma"]="γ", +["opar"]="⦷", +["cwint"]="∱", +["GreaterEqual"]="≥", +["bigcap"]="⋂", +["rtimes"]="⋊", +["integers"]="ℤ", +["easter"]="⩮", ["RightDoubleBracket"]="⟧", -["half"]="½", -["larr"]="←", ["sbquo"]="‚", -["Vscr"]="𝒱", -["nVdash"]="⊮", -["DownRightVectorBar"]="⥗", -["RightDownVector"]="⇂", -["disin"]="⋲", -["nsce"]="⪰̸", -["rbrace"]="}", -["MinusPlus"]="∓", -["rtrif"]="▸", -["parsim"]="⫳", -["supseteq"]="⊇", -["Superset"]="⊃", -["Verbar"]="‖", +["cfr"]="𝔠", +["ruluhar"]="⥨", +["image"]="ℑ", +["nleqslant"]="⩽̸", +["Yopf"]="𝕐", +["apE"]="⩰", +["NotPrecedesEqual"]="⪯̸", +["rsqb"]="]", +["rtrie"]="⊵", +["rthree"]="⋌", +["amp"]="&", +["eng"]="ŋ", +["ll"]="≪", +["rrarr"]="⇉", +["RightTee"]="⊢", +["ETH"]="Ð", +["ReverseEquilibrium"]="⇋", +["langle"]="⟨", ["Zeta"]="Ζ", -["nsccue"]="⋡", -["bsemi"]="⁏", -["ldquor"]="„", -["curarr"]="↷", -["rscr"]="𝓇", -["rppolint"]="⨒", -["rpargt"]="⦔", -["rotimes"]="⨵", -["Equal"]="⩵", -["ropf"]="𝕣", -["ropar"]="⦆", -["roarr"]="⇾", -["odot"]="⊙", -["natural"]="♮", -["slarr"]="←", -["angmsdae"]="⦬", -["acE"]="∾̳", +["roplus"]="⨮", +["there4"]="∴", +["DownRightTeeVector"]="⥟", +["npar"]="∦", +["robrk"]="⟧", +["exist"]="∃", +["lfr"]="𝔩", +["VDash"]="⊫", +["rnmid"]="⫮", +["rmoust"]="⎱", ["rlm"]="", -["COPY"]="©", -["iogon"]="į", -["nleftrightarrow"]="↮", -["reg"]="®", -["risingdotseq"]="≓", -["rightsquigarrow"]="↝", -["dtri"]="▿", -["Larr"]="↞", -["icy"]="и", -["gimel"]="ℷ", +["Ccirc"]="Ĉ", +["imagpart"]="ℑ", +["Equilibrium"]="⇌", +["dd"]="ⅆ", +["cuepr"]="⋞", +["Agrave"]="À", +["cuesc"]="⋟", +["square"]="□", +["notnivc"]="⋽", +["rbrksld"]="⦎", ["cup"]="∪", -["DJcy"]="Ђ", -["gtrapprox"]="⪆", -["rightharpoonup"]="⇀", -["prsim"]="≾", -["rightharpoondown"]="⇁", -["frac16"]="⅙", -["nbsp"]=" ", -["cedil"]="¸", -["numsp"]=" ", +["OpenCurlyDoubleQuote"]="“", +["Lacute"]="Ĺ", +["NewLine"]="\n", +["Sigma"]="Σ", +["Abreve"]="Ă", +["rightleftarrows"]="⇄", +["tint"]="∭", +["angmsdae"]="⦬", +["Leftrightarrow"]="⇔", +["rdquor"]="”", +["Verbar"]="‖", +["Gfr"]="𝔊", ["rightarrow"]="→", ["rhov"]="ϱ", -["rdquo"]="”", -["rharul"]="⥬", -["frac34"]="¾", -["ldrdhar"]="⥧", -["gnsim"]="⋧", -["rtriltri"]="⧎", -["emsp"]=" ", -["rlarr"]="⇄", -["Oslash"]="Ø", -["LeftDownTeeVector"]="⥡", +["Alpha"]="Α", +["rho"]="ρ", +["DownLeftTeeVector"]="⥞", +["ntriangleright"]="⋫", ["reg"]="®", -["LeftTeeVector"]="⥚", -["gsiml"]="⪐", -["QUOT"]="\"", -["blk14"]="░", -["rightrightarrows"]="⇉", -["NotGreaterGreater"]="≫̸", -["Xscr"]="𝒳", -["Re"]="ℜ", -["Ouml"]="Ö", +["Int"]="∬", +["agrave"]="à", +["Ecirc"]="Ê", +["NotReverseElement"]="∌", +["backprime"]="‵", +["Jfr"]="𝔍", ["rdsh"]="↳", -["and"]="∧", -["larrb"]="⇤", -["TripleDot"]="⃛", -["bcy"]="б", -["diams"]="♦", -["veebar"]="⊻", -["rcub"]="}", -["Scirc"]="Ŝ", -["ac"]="∾", -["rceil"]="⌉", -["rcedil"]="ŗ", -["cupbrcap"]="⩈", -["rcaron"]="ř", -["cuesc"]="⋟", -["HilbertSpace"]="ℋ", -["plus"]="+", -["rbrkslu"]="⦐", -["LessLess"]="⪡", -["macr"]="¯", -["notinE"]="⋹̸", +["jsercy"]="ј", +["Bscr"]="ℬ", +["boxH"]="═", +["leq"]="≤", +["NotPrecedes"]="⊀", +["coloneq"]="≔", +["boxvh"]="┼", +["larr"]="←", +["ncup"]="⩂", +["EmptySmallSquare"]="◻", +["vartriangleleft"]="⊲", +["iacute"]="í", +["nVDash"]="⊯", +["lap"]="⪅", +["precapprox"]="⪷", +["ecolon"]="≕", +["lsqb"]="[", ["rbarr"]="⤍", -["abreve"]="ă", -["sqcup"]="⊔", -["ratail"]="⤚", -["VeryThinSpace"]=" ", -["Uarrocir"]="⥉", -["rarrfs"]="⤞", -["Odblac"]="Ő", -["Imacr"]="Ī", -["ordm"]="º", -["odsold"]="⦼", -["NJcy"]="Њ", -["Yacute"]="Ý", -["rarrbfs"]="⤠", -["prop"]="∝", -["notin"]="∉", -["vsupne"]="⊋︀", -["bigcap"]="⋂", -["Phi"]="Φ", -["Ograve"]="Ò", -["Yscr"]="𝒴", -["approx"]="≈", -["racute"]="ŕ", -["ggg"]="⋙", -["lmoust"]="⎰", +["yacy"]="я", +["efDot"]="≒", +["ratio"]="∶", +["wreath"]="≀", +["nearhk"]="⤤", +["rarrpl"]="⥅", +["nvge"]="≥⃒", +["searrow"]="↘", +["thorn"]="þ", +["rdquo"]="”", +["LessFullEqual"]="≦", +["nvrtrie"]="⊵⃒", +["nsubseteqq"]="⫅̸", +["nedot"]="≐̸", +["VerticalLine"]="|", +["lsh"]="↰", +["DownRightVector"]="⇁", +["ecirc"]="ê", +["andv"]="⩚", +["trie"]="≜", +["race"]="∽̱", ["rBarr"]="⤏", -["gneqq"]="≩", -["isinv"]="∈", -["harr"]="↔", -["rArr"]="⇒", -["rAarr"]="⇛", -["quot"]="\"", +["lbrksld"]="⦏", +["emsp14"]=" ", +["RuleDelayed"]="⧴", +["vsubne"]="⊊︀", +["ShortLeftArrow"]="←", +["gtlPar"]="⦕", ["quest"]="?", -["iuml"]="ï", -["LeftRightArrow"]="↔", -["LeftDoubleBracket"]="⟦", -["gesdot"]="⪀", -["Ntilde"]="Ñ", -["boxUR"]="╚", -["exist"]="∃", -["subnE"]="⫋", -["ograve"]="ò", -["qopf"]="𝕢", -["Zacute"]="Ź", -["qfr"]="𝔮", -["dcy"]="д", -["NotReverseElement"]="∌", -["DotEqual"]="≐", -["VerticalLine"]="|", -["pscr"]="𝓅", -["prurel"]="⊰", -["cdot"]="ċ", -["bprime"]="‵", -["ltdot"]="⋖", -["prnsim"]="⋨", -["curlywedge"]="⋏", -["prnE"]="⪵", -["REG"]="®", -["sup3"]="³", +["dot"]="˙", +["RightVector"]="⇀", +["rppolint"]="⨒", +["Hat"]="^", +["zcy"]="з", +["suplarr"]="⥻", +["boxhU"]="╨", +["puncsp"]=" ", +["GreaterLess"]="≷", +["psi"]="ψ", +["ncaron"]="ň", +["SupersetEqual"]="⊇", +["propto"]="∝", ["preceq"]="⪯", -["LeftDownVectorBar"]="⥙", -["ForAll"]="∀", +["frac56"]="⅚", +["NotLessGreater"]="≸", +["jukcy"]="є", +["swArr"]="⇙", +["profline"]="⌒", +["prnE"]="⪵", +["larrpl"]="⤹", +["af"]="", +["profsurf"]="⌓", +["Larr"]="↞", ["forkv"]="⫙", -["varpi"]="ϖ", -["nrArr"]="⇏", +["prcue"]="≼", +["RightUpTeeVector"]="⥜", ["pound"]="£", +["ugrave"]="ù", +["popf"]="𝕡", +["frac78"]="⅞", +["suphsol"]="⟉", +["loplus"]="⨭", +["pointint"]="⨕", +["cupcap"]="⩆", +["LessTilde"]="≲", +["pm"]="±", +["blacksquare"]="▪", ["plustwo"]="⨧", -["shchcy"]="щ", -["cacute"]="ć", -["Dashv"]="⫤", -["lHar"]="⥢", -["NotLeftTriangle"]="⋪", -["gbreve"]="ğ", -["boxDl"]="╖", -["Beta"]="Β", -["ReverseEquilibrium"]="⇋", +["copy"]="©", +["plussim"]="⨦", +["Lcy"]="Л", +["pluse"]="⩲", +["ropar"]="⦆", +["OpenCurlyQuote"]="‘", ["plusacir"]="⨣", -["eqslantgtr"]="⪖", -["ecy"]="э", -["pitchfork"]="⋔", -["ctdot"]="⋯", -["odiv"]="⨸", -["lesseqqgtr"]="⪋", -["GreaterLess"]="≷", -["Ocy"]="О", -["weierp"]="℘", -["Uring"]="Ů", -["period"]=".", -["nis"]="⋼", -["cudarrr"]="⤵", -["boxHU"]="╩", -["Ouml"]="Ö", -["Assign"]="≔", -["Lscr"]="ℒ", -["parallel"]="∥", -["there4"]="∴", -["cupor"]="⩅", -["nwarr"]="↖", -["para"]="¶", -["ouml"]="ö", -["otimes"]="⊗", -["drbkarow"]="⤐", -["puncsp"]=" ", -["otilde"]="õ", -["Vvdash"]="⊪", -["osol"]="⊘", +["Exists"]="∃", +["piv"]="ϖ", +["phmmat"]="ℳ", +["angzarr"]="⍼", +["vsupnE"]="⫌︀", +["phi"]="φ", +["perp"]="⊥", +["rdldhar"]="⥩", +["ccirc"]="ĉ", +["Tfr"]="𝔗", +["Tcy"]="Т", +["circeq"]="≗", +["InvisibleTimes"]="", +["OElig"]="Œ", +["trisb"]="⧍", +["Rcaron"]="Ř", +["olt"]="⧀", +["UpArrow"]="↑", +["DDotrahd"]="⤑", +["Uarrocir"]="⥉", +["lacute"]="ĺ", ["oslash"]="ø", -["dd"]="ⅆ", -["NotPrecedesSlantEqual"]="⋠", -["orv"]="⩛", -["orslope"]="⩗", -["KJcy"]="Ќ", -["larrfs"]="⤝", -["orderof"]="ℴ", -["asympeq"]="≍", -["ord"]="⩝", -["NotLess"]="≮", -["NotGreater"]="≯", -["ThinSpace"]=" ", -["ominus"]="⊖", +["Uarr"]="↟", +["bsolb"]="⧅", +["gt"]=">", +["ordm"]="º", +["Itilde"]="Ĩ", +["ordm"]="º", +["Jscr"]="𝒥", +["Rarr"]="↠", +["measuredangle"]="∡", ["DoubleLongLeftRightArrow"]="⟺", -["lesseqgtr"]="⋚", +["lmidot"]="ŀ", +["period"]=".", ["operp"]="⦹", -["quaternions"]="ℍ", -["boxdR"]="╒", -["omega"]="ω", -["Kscr"]="𝒦", -["lessgtr"]="≶", -["utilde"]="ũ", -["olt"]="⧀", -["Rho"]="Ρ", -["olcir"]="⦾", -["oint"]="∮", +["bprime"]="‵", +["numsp"]=" ", +["ominus"]="⊖", +["nldr"]="‥", ["ograve"]="ò", -["Succeeds"]="≻", -["Igrave"]="Ì", -["eogon"]="ę", -["Uacute"]="Ú", -["bbrk"]="⎵", -["ocy"]="о", -["bcong"]="≌", +["omicron"]="ο", +["nearr"]="↗", +["jcirc"]="ĵ", +["nlE"]="≦̸", +["deg"]="°", +["frac13"]="⅓", +["tcy"]="т", +["lowbar"]="_", +["vfr"]="𝔳", +["ogon"]="˛", +["sim"]="∼", +["ocirc"]="ô", +["Icirc"]="Î", +["ocir"]="⊚", +["ZeroWidthSpace"]="", ["oast"]="⊛", +["smile"]="⌣", +["bigvee"]="⋁", ["oacute"]="ó", -["cir"]="○", -["angmsdab"]="⦩", -["Iscr"]="ℐ", -["ldquo"]="“", -["RightVector"]="⇀", -["euml"]="ë", -["between"]="≬", -["oS"]="Ⓢ", -["downdownarrows"]="⇊", -["nvlt"]="<⃒", -["lurdshar"]="⥊", -["starf"]="★", -["xlarr"]="⟵", -["Aring"]="Å", -["Xi"]="Ξ", -["gtcir"]="⩺", -["Nscr"]="𝒩", -["elinters"]="⏧", -["ntrianglelefteq"]="⋬", -["Vbar"]="⫫", +["Egrave"]="È", +["nwnear"]="⤧", +["nwarhk"]="⤣", +["rationals"]="ℚ", +["DiacriticalGrave"]="`", +["npreceq"]="⪯̸", +["rarrc"]="⤳", +["Uogon"]="Ų", +["InvisibleComma"]="", +["nvltrie"]="⊴⃒", +["digamma"]="ϝ", +["cirE"]="⧃", +["AMP"]="&", +["Theta"]="Θ", +["frac15"]="⅕", +["fnof"]="ƒ", +["icirc"]="î", +["Cdot"]="Ċ", +["ngsim"]="≵", +["sube"]="⊆", +["tcaron"]="ť", ["ntilde"]="ñ", -["andv"]="⩚", -["Rsh"]="↱", -["angmsdad"]="⦫", -["nsup"]="⊅", -["nbsp"]=" ", -["SquareSupersetEqual"]="⊒", -["ETH"]="Ð", -["nsube"]="⊈", -["DoubleContourIntegral"]="∯", -["nsubE"]="⫅̸", -["angmsdah"]="⦯", -["NotLessGreater"]="≸", -["awint"]="⨑", -["rtri"]="▹", -["nsc"]="⊁", -["boxvl"]="┤", -["beta"]="β", -["LessSlantEqual"]="⩽", -["supsub"]="⫔", -["agrave"]="à", -["LeftUpTeeVector"]="⥠", -["nrarrw"]="↝̸", -["ltcc"]="⪦", -["nrarrc"]="⤳̸", -["frac78"]="⅞", -["nvrArr"]="⤃", -["igrave"]="ì", -["barwed"]="⌅", -["Mscr"]="ℳ", -["nrarr"]="↛", -["SubsetEqual"]="⊆", -["notnivc"]="⋽", -["notnivb"]="⋾", -["succcurlyeq"]="≽", -["eth"]="ð", -["notinva"]="∉", -["Otilde"]="Õ", -["star"]="☆", -["rangd"]="⦒", -["Psi"]="Ψ", -["nsupe"]="⊉", -["mapstoup"]="↥", -["LJcy"]="Љ", -["looparrowleft"]="↫", -["nlarr"]="↚", -["Ll"]="⋘", -["ordf"]="ª", -["ni"]="∋", +["ufr"]="𝔲", +["Mcy"]="М", ["Delta"]="Δ", -["NotVerticalBar"]="∤", -["backcong"]="≌", -["NoBreak"]="", +["vnsup"]="⊃⃒", +["lAtail"]="⤛", +["DoubleUpArrow"]="⇑", +["aelig"]="æ", +["lscr"]="𝓁", +["Rscr"]="ℛ", +["capcup"]="⩇", +["npolint"]="⨔", +["gesdotol"]="⪄", +["uacute"]="ú", +["bumpE"]="⪮", +["drcorn"]="⌟", +["notnivb"]="⋾", +["notinvc"]="⋶", +["ovbar"]="⌽", +["Mopf"]="𝕄", +["NotGreater"]="≯", +["boxDr"]="╓", +["lrcorner"]="⌟", +["nleq"]="≰", +["nleftarrow"]="↚", +["nle"]="≰", +["boxvl"]="┤", +["Downarrow"]="⇓", +["hcirc"]="ĥ", ["nharr"]="↮", +["tfr"]="𝔱", +["nlt"]="≮", +["gacute"]="ǵ", +["colone"]="≔", +["Rang"]="⟫", ["ngt"]="≯", -["Pscr"]="𝒫", -["laemptyv"]="⦴", -["utrif"]="▴", -["ngeq"]="≱", -["ncedil"]="ņ", -["ncaron"]="ň", -["boxhu"]="┴", -["NotSquareSuperset"]="⊐̸", -["bull"]="•", +["ntilde"]="ñ", +["vcy"]="в", +["boxvL"]="╡", +["NotLeftTriangleBar"]="⧏̸", +["NestedGreaterGreater"]="≫", +["xmap"]="⟼", +["napid"]="≋̸", +["LeftTriangleBar"]="⧏", ["SquareSubsetEqual"]="⊑", -["VerticalSeparator"]="❘", -["natur"]="♮", -["ffr"]="𝔣", -["rdquor"]="”", -["lagran"]="ℒ", -["nRightarrow"]="⇏", -["nLtv"]="≪̸", -["nLl"]="⋘̸", -["Epsilon"]="Ε", -["csup"]="⫐", -["leftarrow"]="←", -["nGt"]="≫⃒", -["multimap"]="⊸", -["mstpos"]="∾", -["SuchThat"]="∋", -["mldr"]="…", -["midast"]="*", -["Sum"]="∑", -["vartheta"]="ϑ", -["mapsto"]="↦", -["nsupseteq"]="⊉", -["Oscr"]="𝒪", -["forall"]="∀", -["aring"]="å", -["ltimes"]="⋉", -["ltcir"]="⩹", -["lt"]="<", -["ii"]="ⅈ", -["equest"]="≟", -["scsim"]="≿", -["lsqb"]="[", -["lsimg"]="⪏", -["Egrave"]="È", -["Downarrow"]="⇓", -["lsim"]="≲", -["eqslantless"]="⪕", -["ucirc"]="û", -["Auml"]="Ä", -["lnsim"]="⋦", -["uplus"]="⊎", -["lhblk"]="▄", -["Ugrave"]="Ù", -["dlcrop"]="⌍", -["OElig"]="Œ", -["lesg"]="⋚︀", -["lesdotor"]="⪃", -["eg"]="⪚", -["lvertneqq"]="≨︀", -["leqslant"]="⩽", -["ccups"]="⩌", -["lceil"]="⌈", -["auml"]="ä", -["RightCeiling"]="⌉", -["lbrksld"]="⦏", -["lbarr"]="⤌", +["eacute"]="é", +["ne"]="≠", +["ncongdot"]="⩭̸", +["boxvR"]="╞", +["PrecedesEqual"]="⪯", +["Omacr"]="Ō", +["egs"]="⪖", +["ouml"]="ö", +["nbsp"]=" ", +["xuplus"]="⨄", +["napprox"]="≉", +["CloseCurlyQuote"]="’", +["nacute"]="ń", +["Chi"]="Χ", +["subsub"]="⫕", +["gescc"]="⪩", +["gcirc"]="ĝ", +["Lsh"]="↰", +["sfr"]="𝔰", +["circlearrowright"]="↻", +["rcaron"]="ř", +["ThinSpace"]=" ", +["otilde"]="õ", +["TRADE"]="™", +["cudarrl"]="⤸", ["lat"]="⪫", -["Rscr"]="ℛ", -["Zcy"]="З", -["bigwedge"]="⋀", -["Prime"]="″", +["nLeftrightarrow"]="⇎", +["leqq"]="≦", +["dagger"]="†", +["dstrok"]="đ", +["sacute"]="ś", +["Amacr"]="Ā", +["mumap"]="⊸", +["models"]="⊧", +["DiacriticalAcute"]="´", +["minusd"]="∸", +["hybull"]="⁃", +["ijlig"]="ij", +["fflig"]="ff", +["NotGreaterEqual"]="≱", +["Colon"]="∷", +["boxV"]="║", +["DotDot"]="⃜", +["mdash"]="—", +["hairsp"]=" ", +["bcong"]="≌", +["mcomma"]="⨩", +["cirfnint"]="⨐", +["TScy"]="Ц", +["luruhar"]="⥦", +["awconint"]="∳", +["nsim"]="≁", +["els"]="⪕", +["imof"]="⊷", +["lpar"]="(", +["lozenge"]="◊", +["oint"]="∮", +["Umacr"]="Ū", +["Sum"]="∑", +["lopar"]="⦅", +["racute"]="ŕ", +["LessEqualGreater"]="⋚", +["Wedge"]="⋀", +["bbrktbrk"]="⎶", +["RightDownTeeVector"]="⥝", +["HumpDownHump"]="≎", +["rarrb"]="⇥", +["longleftrightarrow"]="⟷", +["lnE"]="≨", +["NotGreaterSlantEqual"]="⩾̸", +["Nu"]="Ν", +["NotNestedLessLess"]="⪡̸", +["UpEquilibrium"]="⥮", +["boxhD"]="╥", +["el"]="⪙", ["boxDR"]="╔", -["scnsim"]="⋩", -["efDot"]="≒", -["kopf"]="𝕜", -["minusdu"]="⨪", -["kappav"]="ϰ", +["Gdot"]="Ġ", +["itilde"]="ĩ", +["isindot"]="⋵", +["GreaterEqualLess"]="⋛", +["Ll"]="⋘", +["nrarrw"]="↝̸", +["supnE"]="⫌", +["epsiv"]="ϵ", +["Element"]="∈", +["gtreqless"]="⋛", +["laemptyv"]="⦴", +["nGt"]="≫⃒", +["angsph"]="∢", +["lE"]="≦", +["kscr"]="𝓀", +["Ocy"]="О", +["LowerLeftArrow"]="↙", +["dopf"]="𝕕", +["iukcy"]="і", +["atilde"]="ã", +["DoubleRightArrow"]="⇒", +["oslash"]="ø", +["rarr"]="→", +["intprod"]="⨼", +["hookrightarrow"]="↪", +["intcal"]="⊺", +["infintie"]="⧝", +["escr"]="ℯ", +["iiota"]="℩", +["curren"]="¤", +["Bernoullis"]="ℬ", +["angmsdah"]="⦯", +["ShortRightArrow"]="→", +["boxUR"]="╚", +["ges"]="⩾", +["DoubleDownArrow"]="⇓", +["NotSquareSuperset"]="⊐̸", +["lsim"]="≲", +["bump"]="≎", +["curlyeqsucc"]="⋟", +["SHCHcy"]="Щ", +["frac45"]="⅘", +["qint"]="⨌", +["Precedes"]="≺", +["RightTeeArrow"]="↦", +["frac16"]="⅙", +["euro"]="€", +["smtes"]="⪬︀", +["eth"]="ð", +["ldquo"]="“", +["equivDD"]="⩸", +["Oopf"]="𝕆", ["boxVh"]="╫", -["Uuml"]="Ü", -["centerdot"]="·", -["isinsv"]="⋳", -["isins"]="⋴", -["bot"]="⊥", -["integers"]="ℤ", -["Racute"]="Ŕ", -["ijlig"]="ij", -["bernou"]="ℬ", -["Cconint"]="∰", -["doteq"]="≐", -["hookleftarrow"]="↩", -["epar"]="⋕", -["harrw"]="↭", -["dzigrarr"]="⟿", -["Zscr"]="𝒵", -["alpha"]="α", -["times"]="×", +["GreaterSlantEqual"]="⩾", +["KJcy"]="Ќ", ["egrave"]="è", -["UnionPlus"]="⊎", -["Qscr"]="𝒬", -["Omacr"]="Ō", -["Zfr"]="ℨ", -["gneq"]="⪈", -["divonx"]="⋇", -["gesdotol"]="⪄", -["gvertneqq"]="≩︀", -["geq"]="≥", -["utri"]="▵", -["ge"]="≥", -["vArr"]="⇕", -["Rrightarrow"]="⇛", -["frac25"]="⅖", -["LeftCeiling"]="⌈", -["GreaterGreater"]="⪢", -["LT"]="<", -["Longrightarrow"]="⟹", -["eqcolon"]="≕", -["ofcir"]="⦿", -["boxUl"]="╜", -["Wscr"]="𝒲", -["Sacute"]="Ś", -["Union"]="⋃", -["gg"]="≫", -["DownArrowBar"]="⤓", -["Escr"]="ℰ", -["ecirc"]="ê", -["Lmidot"]="Ŀ", -["Wedge"]="⋀", -["frown"]="⌢", -["ring"]="˚", -["dtdot"]="⋱", -["Ccedil"]="Ç", -["Conint"]="∯", -["dscr"]="𝒹", -["Map"]="⤅", -["EmptyVerySmallSquare"]="▫", -["backsim"]="∽", -["angzarr"]="⍼", -["dHar"]="⥥", -["Mfr"]="𝔐", -["cirE"]="⧃", -["Popf"]="ℙ", -["NestedGreaterGreater"]="≫", -["ReverseElement"]="∋", -["boxVr"]="╟", +["NotGreaterLess"]="≹", +["boxVl"]="╢", +["MediumSpace"]=" ", +["LongLeftArrow"]="⟵", +["uarr"]="↑", +["Ocirc"]="Ô", +["Idot"]="İ", +["bumpe"]="≏", +["nwArr"]="⇖", +["NegativeThinSpace"]="", +["coprod"]="∐", +["VerticalBar"]="∣", +["sccue"]="≽", +["boxDl"]="╖", +["NotSubset"]="⊂⃒", +["Edot"]="Ė", +["scy"]="с", +["Cup"]="⋓", +["centerdot"]="·", +["nsimeq"]="≄", +["DownLeftRightVector"]="⥐", } diff --git a/macros/luatex/generic/luaxml/luaxml-transform.lua b/macros/luatex/generic/luaxml/luaxml-transform.lua index b6841fea5f..4b51eed117 100644 --- a/macros/luatex/generic/luaxml/luaxml-transform.lua +++ b/macros/luatex/generic/luaxml/luaxml-transform.lua @@ -198,6 +198,10 @@ local function add_action(selector, template, parameters, csspar) end +local function reset_actions(selector, csspar) + local css = csspar or css + css:remove_selector(selector) +end --- Transform XML string @@ -243,7 +247,7 @@ end local Transformer --- Make new Transformer object --- @return Tranformer object +-- @return Transformer object local function new() local self = setmetatable({}, Transformer) self.css = cssquery() @@ -289,6 +293,12 @@ function Transformer:add_custom_action(selector, fn ) add_custom_action(selector, fn, self.css) end +--- Remove all actions that match the given selector +---@param selector string +function Transformer:reset_actions(selector) + reset_actions(selector, self.css) +end + -- all methods that use transformation functions must -- correctly handle the cssquery object that this library uses @@ -338,6 +348,7 @@ local M = { print_tex = print_tex, add_action = add_action, add_custom_action = add_custom_action, + reset_actions = reset_actions, simple_content = simple_content, load_file = load_file, process_dom = process_dom, diff --git a/macros/luatex/generic/luaxml/luaxml.pdf b/macros/luatex/generic/luaxml/luaxml.pdf Binary files differindex f574a0a528..071fa4e4cd 100644 --- a/macros/luatex/generic/luaxml/luaxml.pdf +++ b/macros/luatex/generic/luaxml/luaxml.pdf diff --git a/macros/luatex/generic/luaxml/luaxml.tex b/macros/luatex/generic/luaxml/luaxml.tex index 5031a0468e..bf3b8fbaa7 100644 --- a/macros/luatex/generic/luaxml/luaxml.tex +++ b/macros/luatex/generic/luaxml/luaxml.tex @@ -7,7 +7,7 @@ \usepackage{framed} % Version is defined in the makefile, use default values when compiled directly \ifdefined\version\else -\def\version{v0.1r} +\def\version{v0.2} \let\gitdate\date \fi \newcommand\modulename[1]{\subsection{#1}\label{sec:#1}} @@ -99,6 +99,67 @@ end \end{luacode*} \end{framed} +\subsection{HTML parsing} + +You can parse HTML documents using the \verb|DOM_Object.html_parse| function. This parser is slower +than the default XML parser, but it can load files that would cause errors in the XML mode. +It can handle wrongly nested HTML tags, inline JavaScript and CSS styles, and other HTML features +that would cause XML errors. + +\begin{verbatim} +dom = require "luaxml-domobject" +local document = [[ +<html> +<head><title>sample</title></head> +<body> +<h1>test</h1> +<p>hello +<p>another paragraph +<ul> +<li>first +<li>second +</ul> +</body> +</html> + ]] + +-- dom.html_parse returns the DOM_Object +obj = dom.html_parse(document) +-- print names of all elements contained in body +for _, x in ipairs(obj:query_selector("body *")) do + tex.print(x:get_element_name().. "\\par") +end +\end{verbatim} + + +\begin{framed} +\begin{luacode*} +dom = require "luaxml-domobject" +local document = [[ +<html> +<head><title>sample</title></head> +<body> +<h1>test</h1> +<p>hello +<p>another paragraph +<ul> +<li>first +<li>second +</ul> +</body> +</html> + ]] + +-- dom.html_parse returns the DOM_Object +obj = dom.html_parse(document) +-- print names of all elements contained in body +for _, x in ipairs(obj:query_selector("body *")) do + tex.print(x:get_element_name().. "\\par") +end +\end{luacode*} +\end{framed} + + \subsection{Void elements} The \verb|DOM_Object.parse| function tries to support the HTML void elements, @@ -641,6 +702,35 @@ transform.print_tex("\\verb|" .. result .. "|") \end{luacode*} \end{framed} +\section{Character sets handling} + +The \texttt{luaxml-encodings} library provides functions to convert texts in legacy 8-bit encodings such as WINDOWS-1250 +or ISO-8859-2 to UTF-8. This can be useful in fixing document encoding before HTML parsing using the \texttt{luaxml-mod-html} +library. + +\subsection{Example} + + +\begin{verbatim} +kpse.set_program_name "luatex" +local encodings = require "luaxml-encodings" + +--read HTML page from the standard input +local text = io.read("*all") +-- find the character encoding in HTML metadata +local enc = encodings.find_html_encoding(text) +if enc then + -- local conversion table for the found encoding + local mapping = encodings.load_mapping(enc) + if mapping then + -- if the mapping exists, recode the HTML input and print it + local converted = encodings.recode(text, mapping) + print(converted) + end +end +\end{verbatim} + + \section{The API documentation} diff --git a/macros/luatex/generic/nodetree/README.md b/macros/luatex/generic/nodetree/README.md index f9fdb53fff..71297fb7f1 100644 --- a/macros/luatex/generic/nodetree/README.md +++ b/macros/luatex/generic/nodetree/README.md @@ -18,7 +18,7 @@ terminal to generate the document. # License -Copyright (C) 2016-2023 by Josef Friedrich <josef@friedrich.rocks> +Copyright (C) 2016-2024 by Josef Friedrich <josef@friedrich.rocks> ------------------------------------------------------------------------ This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license @@ -150,8 +150,8 @@ if not modules then modules = { } end modules ['nodetree'] = { ### Update the copyright year: ``` -sed -i 's/(C) 2016-2023/(C) 2016-2021/g' nodetree.ins -sed -i 's/(C) 2016-2023/(C) 2016-2021/g' nodetree.dtx +sed -i 's/(C) 2016-2024/(C) 2016-2021/g' nodetree.ins +sed -i 's/(C) 2016-2024/(C) 2016-2021/g' nodetree.dtx ``` ### Command line tasks: diff --git a/macros/luatex/generic/nodetree/nodetree-doc.tex b/macros/luatex/generic/nodetree/nodetree-doc.tex index d9531ad9f2..c992d70246 100644 --- a/macros/luatex/generic/nodetree/nodetree-doc.tex +++ b/macros/luatex/generic/nodetree/nodetree-doc.tex @@ -107,7 +107,7 @@ \href{https://github.com/Josef-Friedrich/nodetree}{github.com/Josef-Friedrich/nodetree}\\% with contributions by Werner Lemberg } -\date{v2.3.0 from 2023/09/10} +\date{v2.4.0 from 2024/09/17} \maketitle diff --git a/macros/luatex/generic/nodetree/nodetree.dtx b/macros/luatex/generic/nodetree/nodetree.dtx index 0b3668a8ce..6c274899d3 100644 --- a/macros/luatex/generic/nodetree/nodetree.dtx +++ b/macros/luatex/generic/nodetree/nodetree.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2016-2023 by Josef Friedrich <josef@friedrich.rocks> +% Copyright (C) 2016-2024 by Josef Friedrich <josef@friedrich.rocks> % ---------------------------------------------------------------------- % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3 of this license @@ -28,7 +28,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{nodetree} %<*package> - [2023/09/10 v2.3.0 Visualize node lists in a tree view] + [2024/09/17 v2.4.0 Visualize node lists in a tree view] %</package> % \fi % @@ -218,7 +218,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{nodetree-embed} - [2023/09/10 v2.3.0 Embed node trees into a LaTeX document] + [2024/09/17 v2.4.0 Embed node trees into a LaTeX document] % \end{macrocode} % % \begin{macrocode} diff --git a/macros/luatex/generic/nodetree/nodetree.ins b/macros/luatex/generic/nodetree/nodetree.ins index e1ded5bb1b..fce0ba7c8d 100644 --- a/macros/luatex/generic/nodetree/nodetree.ins +++ b/macros/luatex/generic/nodetree/nodetree.ins @@ -1,4 +1,4 @@ -% Copyright (C) 2016-2023 by Josef Friedrich <josef@friedrich.rocks> +% Copyright (C) 2016-2024 by Josef Friedrich <josef@friedrich.rocks> % ---------------------------------------------------------------------- % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3c of this license @@ -21,7 +21,7 @@ This is a generated file. -Copyright (C) 2016-2023 by Josef Friedrich <josef@friedrich.rocks> +Copyright (C) 2016-2024 by Josef Friedrich <josef@friedrich.rocks> ---------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license diff --git a/macros/luatex/generic/nodetree/nodetree.lua b/macros/luatex/generic/nodetree/nodetree.lua index 18a1f204c3..82a3e294d3 100644 --- a/macros/luatex/generic/nodetree/nodetree.lua +++ b/macros/luatex/generic/nodetree/nodetree.lua @@ -30,7 +30,7 @@ --- be either `continue` or `stop`. if not modules then modules = {} end modules ['nodetree'] = { - version = '2.3.0', + version = '2.4.0', comment = 'nodetree', author = 'Josef Friedrich', copyright = 'Josef Friedrich', @@ -649,30 +649,37 @@ end --- Convert a Lua table into a format string. --- ----@param table table # A table to generate an inline view of. +---@param tbl table # A table to generate an inline view of. --- ---@return string -function template.table_inline(table) +function template.table_inline(tbl) local tex_escape = '' if options.channel == 'tex' then tex_escape = '\\' end - if type(table) == 'table' then - table = get_all_table_data(table) + if type(tbl) == 'table' then + tbl = get_all_table_data(tbl) local output = tex_escape .. '{' local kv_list = '' - for key, value in pairs(table) do - if type(key) ~= 'numbers' then - key = '\'' .. - template.colored_string(key, 'cyan', 'dim') .. '\'' - end - kv_list = kv_list .. '[' .. key .. '] = ' .. - template.table_inline(value) .. ', ' + local keys = {} + for key in pairs(tbl) do + keys[#keys + 1] = key + end + table.sort(keys) + for i = 1, #keys do + local key = keys[i] + local value = tbl[key] + if type(key) ~= 'numbers' then + key = '\'' .. + template.colored_string(key, 'cyan', 'dim') .. '\'' + end + kv_list = kv_list .. '[' .. key .. '] = ' .. + template.table_inline(value) .. ', ' end output = output .. kv_list:gsub(', $', '') return output .. tex_escape .. '}' else - return tostring(table) + return tostring(tbl) end end diff --git a/macros/luatex/generic/nodetree/nodetree.pdf b/macros/luatex/generic/nodetree/nodetree.pdf Binary files differindex c15b1e5c17..6c228dbe58 100644 --- a/macros/luatex/generic/nodetree/nodetree.pdf +++ b/macros/luatex/generic/nodetree/nodetree.pdf diff --git a/macros/luatex/generic/penlight/README.md b/macros/luatex/generic/penlight/README.md index a80a51c22e..18427f1141 100644 --- a/macros/luatex/generic/penlight/README.md +++ b/macros/luatex/generic/penlight/README.md @@ -5,7 +5,7 @@ This LuaLaTeX package provides a wrapper to use the [penlight](https://github.co # License -Copyright (C) 2021-2023 Kale Ewasiuk +Copyright (C) 2021-2024 Kale Ewasiuk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/macros/luatex/generic/penlight/penlight.lua b/macros/luatex/generic/penlight/penlight.lua index 6ffcaf49b7..e104886a83 100644 --- a/macros/luatex/generic/penlight/penlight.lua +++ b/macros/luatex/generic/penlight/penlight.lua @@ -275,7 +275,7 @@ function Doc:reset() end ---- Append a child to the currrent Node (ignoring current position). +--- Append a child to the current Node (ignoring current position). -- @param child a child node (either text or a document) -- @return the current node (`self`) -- @usage @@ -311,7 +311,7 @@ end --- Set attributes of a document node. --- Will add/overwite values, but will not remove existing ones. +-- Will add/overwrite values, but will not remove existing ones. -- Operates on the Node itself, will not take position into account. -- @tparam table t a table containing attribute/value pairs -- @return the current node (`self`) @@ -447,7 +447,7 @@ do -- @param self document node to traverse -- @param tag tag-name to look for -- @param list array table to add the matching ones to - -- @param recurse if truthy, recursivly search the node + -- @param recurse if truthy, recursively search the node local function _children_with_name(self, tag, list, recurse) -- TODO: protect against recursion for _, child in ipairs(self) do @@ -942,7 +942,7 @@ local html_empty_elements = { --lists all HTML empty (void) elements } --- Parse a well-formed HTML file as a string. --- Tags are case-insenstive, DOCTYPE is ignored, and empty elements can be .. empty. +-- Tags are case-insensitive, DOCTYPE is ignored, and empty elements can be .. empty. -- @param s the HTML function _M.parsehtml(s) return _M.basic_parse(s,false,true) @@ -1335,7 +1335,7 @@ end -- Multiple short args can be combined like so: ( `-abcd`). -- -- When specifying the `flags_valid` parameter, its contents can also contain --- aliasses, to convert short/long flags to the same output name. See the +-- aliases, to convert short/long flags to the same output name. See the -- example below. -- -- Note: if a flag is repeated, the last value wins. @@ -1354,7 +1354,7 @@ end -- { "hello", "world" }, -- list of flags taking values -- { "l", "a", "b"}) -- list of allowed flags (value ones will be added) -- --- -- More complex example using aliasses: +-- -- More complex example using aliases: -- local valid = { -- long = "l", -- if 'l' is specified, it is reported as 'long' -- new = { "n", "old" }, -- here both 'n' and 'old' will go into 'new' @@ -1397,16 +1397,16 @@ function app.parse_args (args,flags_with_values, flags_valid) valid = setmetatable({},{ __index = function(_, key) return key end }) else valid = {} - for k,aliasses in pairs(flags_valid) do + for k,aliases in pairs(flags_valid) do if type(k) == "number" then -- array/list entry - k = aliasses + k = aliases end - if type(aliasses) == "string" then -- single alias - aliasses = { aliasses } + if type(aliases) == "string" then -- single alias + aliases = { aliases } end - if type(aliasses) == "table" then -- list of aliasses + if type(aliases) == "table" then -- list of aliases -- it's the alternate name, so add the proper mappings - for i, alias in ipairs(aliasses) do + for i, alias in ipairs(aliases) do valid[alias] = k end end @@ -1427,7 +1427,7 @@ function app.parse_args (args,flags_with_values, flags_valid) end -- now check that all flags with values are reported as such under all - -- of their aliasses + -- of their aliases for k, main_alias in pairs(valid) do if with_values[main_alias] then with_values[k] = true @@ -1696,7 +1696,7 @@ function array2d.flatten (t) return makelist(res) end ---- reshape a 2D array. Reshape the aray by specifying a new nr of rows. +--- reshape a 2D array. Reshape the array by specifying a new nr of rows. -- @array2d t 2d array -- @int nrows new number of rows -- @bool co use column-order (Fortran-style) (default false) @@ -1773,7 +1773,7 @@ end --- extract the specified columns. -- @array2d t 2d array -- @tparam {int} cidx a table of column indices --- @return a new 2d array with the extracted colums +-- @return a new 2d array with the extracted columns function array2d.extract_cols (t,cidx) assert_arg(1,t,'table') local res = {} @@ -2097,7 +2097,7 @@ end, -------------------- -- Module: 'pl.class' -------------------- ---- Provides a reuseable and convenient framework for creating classes in Lua. +--- Provides a reusable and convenient framework for creating classes in Lua. -- Two possible notations: -- -- B = class(A) @@ -2124,7 +2124,7 @@ local function call_ctor (c,obj,...) init = rawget(parent_with_init, '_init') parent_with_init = rawget(parent_with_init, '_parent_with_init') end - if parent_with_init then -- super() points to one above whereever _init came from + if parent_with_init then -- super() points to one above wherever _init came from rawset(obj,'super',function(obj,...) call_ctor(parent_with_init,obj,...) end) @@ -2970,9 +2970,9 @@ end local config = {} ---- like `io.lines`, but allows for lines to be continued with '`\`'. +--- like `io.lines`, but allows for lines to be continued with '`\\`'. -- @param file a file-like object (anything where read() returns the next line) or a filename. --- Defaults to stardard input. +-- Defaults to standard input. -- @return an iterator over the lines, or nil -- @return error 'not a file-like object' or 'file is nil' function config.lines(file) @@ -3353,7 +3353,7 @@ function data.read(file,cnfg) -- note that using dot as the thousands separator (@thousands_dot) -- requires a special conversion function! For CSV, _empty fields_ are - -- considered to default to numerial zeroes. + -- considered to default to numerical zeroes. local tonumber = tonumber local function try_number(x) if thousands_dot then x = x:gsub('%.(...)','%1') end @@ -5327,7 +5327,7 @@ function repr (e,lastpred) end func.repr = repr --- collect all the non-PE values in this PE into vlist, and replace each occurence +-- collect all the non-PE values in this PE into vlist, and replace each occurrence -- with a constant PH (_C1, etc). Return the maximum placeholder index found. local collect_values function collect_values (e,vlist) @@ -5411,13 +5411,20 @@ utils.add_function_factory(_PEMT,func.I) func.bind1 = utils.bind1 func.curry = func.bind1 ---- create a function which chains two functions. +--- create a function which chains multiple functions. -- @func f a function of at least one argument -- @func g a function of at least one argument +-- @param ... additional functions to compose -- @return a function --- @usage printf = compose(io.write,string.format) -function func.compose (f,g) - return function(...) return f(g(...)) end +-- @usage printf = compose(io.write, string.format) +-- @usage printf = compose(io.write, string.lower, string.format) +function func.compose (...) + local args = pack(...) + return tablex.reduce(function(f, g) + return function(...) + return f(g(...)) + end + end, args) end --- bind the arguments of a function to given values. @@ -5475,7 +5482,7 @@ end, -------------------- -------------- -- PL loader, for loading all PL libraries, only on demand. --- Whenever a module is implicitly accesssed, the table will have the module automatically injected. +-- Whenever a module is implicitly accessed, the table will have the module automatically injected. -- (e.g. `_ENV.tablex`) -- then that module is dynamically loaded. The submodules are all brought into -- the table that is provided as the argument, or returned in a new table. @@ -5573,7 +5580,7 @@ end, -------------------- -------------- -- Entry point for loading all PL libraries only on demand, into the global space. --- Requiring 'pl' means that whenever a module is implicitly accesssed +-- Requiring 'pl' means that whenever a module is implicitly accessed -- (e.g. `utils.split`) -- then that module is dynamically loaded. The submodules are all brought into -- the global space. @@ -6872,7 +6879,7 @@ function List:insert(i, x) return self end ---- Insert an item at the begining of the list. +--- Insert an item at the beginning of the list. -- @param x a data item -- @return the list function List:put (x) @@ -7282,7 +7289,7 @@ function List:iter () return iter(self) end ---- Create an iterator over a seqence. +--- Create an iterator over a sequence. -- This captures the Python concept of 'sequence'. -- For tables, iterates over all values with integer indices. -- @param seq a sequence; a string (over characters), a table, a file object (over lines) or an iterator function @@ -7637,10 +7644,14 @@ local function makelist(t) return setmetatable(t, require('pl.List')) end ---- list of keys. +--- return a List of all keys. +-- @class function +-- @name Map:keys Map.keys = tablex.keys ---- list of values. +--- return a List of all values. +-- @class function +-- @name Map:values Map.values = tablex.values --- return an iterator over all key-value pairs. @@ -7648,7 +7659,7 @@ function Map:iter () return pairs(self) end ---- return a List of all key-value pairs, sorted by the keys. +--- return a List of all key-value pairs, sorted by the keys in ascending order. function Map:items() local ls = makelist(tablex.pairmap (function (k,v) return makelist {k,v} end, self)) ls:sort(function(t1,t2) return t1[1] < t2[1] end) @@ -8223,12 +8234,12 @@ local function err_func(name, param, err, code) end --- Lua iterator over the entries of a given directory. --- Implicit link to [`luafilesystem.dir`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.dir`](https://lunarmodules.github.io/luafilesystem/manual.html#dir) -- @function dir path.dir = lfs.dir --- Creates a directory. --- Implicit link to [`luafilesystem.mkdir`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.mkdir`](https://lunarmodules.github.io/luafilesystem/manual.html#mkdir) -- @function mkdir path.mkdir = function(d) local ok, err, code = lfs.mkdir(d) @@ -8239,7 +8250,7 @@ path.mkdir = function(d) end --- Removes a directory. --- Implicit link to [`luafilesystem.rmdir`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.rmdir`](https://lunarmodules.github.io/luafilesystem/manual.html#rmdir) -- @function rmdir path.rmdir = function(d) local ok, err, code = lfs.rmdir(d) @@ -8250,7 +8261,7 @@ path.rmdir = function(d) end --- Gets attributes. --- Implicit link to [`luafilesystem.attributes`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.attributes`](https://lunarmodules.github.io/luafilesystem/manual.html#attributes) -- @function attrib path.attrib = function(d, r) local ok, err, code = attrib(d, r) @@ -8261,7 +8272,7 @@ path.attrib = function(d, r) end --- Get the working directory. --- Implicit link to [`luafilesystem.currentdir`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.currentdir`](https://lunarmodules.github.io/luafilesystem/manual.html#currentdir) -- @function currentdir path.currentdir = function() local ok, err, code = currentdir() @@ -8272,7 +8283,7 @@ path.currentdir = function() end --- Gets symlink attributes. --- Implicit link to [`luafilesystem.symlinkattributes`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.symlinkattributes`](https://lunarmodules.github.io/luafilesystem/manual.html#symlinkattributes) -- @function link_attrib path.link_attrib = function(d, r) local ok, err, code = link_attrib(d, r) @@ -8285,7 +8296,7 @@ end --- Changes the working directory. -- On Windows, if a drive is specified, it also changes the current drive. If -- only specifying the drive, it will only switch drive, but not modify the path. --- Implicit link to [`luafilesystem.chdir`](https://keplerproject.github.io/luafilesystem/manual.html#reference) +-- Implicit link to [`luafilesystem.chdir`](https://lunarmodules.github.io/luafilesystem/manual.html#chdir) -- @function chdir path.chdir = function(d) local ok, err, code = lfs.chdir(d) @@ -8329,7 +8340,7 @@ end --- does a path exist? -- @string P A file path --- @return the file path if it exists (either as file, directory, socket, etc), nil otherwise +-- @return the file path if it exists (either as file, directory, socket, etc), false otherwise function path.exists(P) assert_string(1,P) return attrib(P,'mode') ~= nil and P @@ -8426,8 +8437,8 @@ end -- @string[opt] pwd optional start path to use (default is current dir) function path.abspath(P,pwd) assert_string(1,P) - if pwd then assert_string(2,pwd) end local use_pwd = pwd ~= nil + if use_pwd then assert_string(2,pwd) end if not use_pwd and not currentdir() then return P end P = P:gsub('[\\/]$','') pwd = pwd or currentdir() @@ -8671,17 +8682,35 @@ end -- In windows, if HOME isn't set, then USERPROFILE is used in preference to -- HOMEDRIVE HOMEPATH. This is guaranteed to be writeable on all versions of Windows. -- @string P A file path +-- @treturn[1] string The file path with the `~` prefix substituted, or the input path if it had no prefix. +-- @treturn[2] nil +-- @treturn[2] string Error message if the environment variables were unavailable. function path.expanduser(P) assert_string(1,P) - if at(P,1) == '~' then - local home = getenv('HOME') - if not home then -- has to be Windows - home = getenv 'USERPROFILE' or (getenv 'HOMEDRIVE' .. getenv 'HOMEPATH') - end - return home..sub(P,2) - else + if P:sub(1,1) ~= '~' then return P end + + local home = getenv('HOME') + if (not home) and (not path.is_windows) then + -- no more options to try on Nix + return nil, "failed to expand '~' (HOME not set)" + end + + if (not home) then + -- try alternatives on Windows + home = getenv 'USERPROFILE' + if not home then + local hd = getenv 'HOMEDRIVE' + local hp = getenv 'HOMEPATH' + if not (hd and hp) then + return nil, "failed to expand '~' (HOME, USERPROFILE, and HOMEDRIVE and/or HOMEPATH not set)" + end + home = hd..hp + end + end + + return home..sub(P,2) end @@ -8839,7 +8868,7 @@ end --- an iterator over all permutations of the elements of the given lists. -- @param ... list-like tables, they are nil-safe if a length-field `n` is provided (see `utils.pack`) --- @return an iterator which provides the next permutation as return values in the same order as the provided lists, preceeded by an index +-- @return an iterator which provides the next permutation as return values in the same order as the provided lists, preceded by an index -- @usage -- local strs = utils.pack("one", nil, "three") -- adds an 'n' field for nil-safety -- local bools = utils.pack(true, false) @@ -8977,6 +9006,42 @@ local assert_arg = utils.assert_arg local original_tostring = tostring +-- Calculate min and max integer supported by lua_Number +-- Assumptions: +-- 1. max_int = 2 ^ n - 1 +-- 2. min_int = -max_int +-- 3. if n > max_int versions with integer support will have +-- integer overflow and versions without integers will lose least significant bit +-- Note: if lua_Integer is smaller than lua_Number mantissa string.format('%d') +-- can throw runtime error +local max_int, min_int +local next_cand = 1 +while next_cand > 0 and next_cand % 2 == 1 do + max_int = next_cand + min_int = -next_cand + next_cand = next_cand * 2 + 1 +end + +local function is_integer(value) + if _VERSION == "Lua 5.3" or _VERSION == "Lua 5.4" then + return mtype(value) == "integer" + end + if value < min_int or value > max_int then + return false + end + return math.floor(value) == value +end + +local function is_float(value) + if _VERSION == "Lua 5.3" or _VERSION == "Lua 5.4" then + return mtype(value) == "float" + end + if value < min_int or value > max_int then + return true + end + return mfloor(value) == value +end + -- Patch tostring to format numbers with better precision -- and to produce cross-platform results for -- infinite values and NaN. @@ -8989,11 +9054,11 @@ local function tostring(value) return "Inf" elseif value == -mhuge then return "-Inf" - elseif (_VERSION ~= "Lua 5.3" or mtype(value) == "integer") and mfloor(value) == value then + elseif is_integer(value) then return ("%d"):format(value) else local res = ("%.14g"):format(value) - if _VERSION == "Lua 5.3" and mtype(value) == "float" and not res:find("%.") then + if is_float(value) and not res:find("%.") then -- Number is internally a float but looks like an integer. -- Insert ".0" after first run of digits. res = res:gsub("%d+", "%0.0", 1) @@ -11289,7 +11354,7 @@ local function _partition(p,delim,fn) end end ---- partition the string using first occurance of a delimiter +--- partition the string using first occurrence of a delimiter -- @string s the string -- @string ch delimiter (match as plain string, no patterns) -- @return part before ch @@ -11303,7 +11368,7 @@ function stringx.partition(s,ch) return _partition(s,ch,stringx.lfind) end ---- partition the string p using last occurance of a delimiter +--- partition the string p using last occurrence of a delimiter -- @string s the string -- @string ch delimiter (match as plain string, no patterns) -- @return part before ch @@ -11575,7 +11640,7 @@ end ---- Miscelaneous +--- Miscellaneous -- @section misc --- return an iterator over all lines in a string @@ -11593,7 +11658,7 @@ function stringx.lines(s) return s:gmatch('([^\n]*)\n') end ---- inital word letters uppercase ('title case'). +--- initial word letters uppercase ('title case'). -- Here 'words' mean chunks of non-space characters. -- @string s the string -- @return a string with each word's first letter uppercase @@ -11614,7 +11679,7 @@ do --- Return a shortened version of a string. -- Fits string within w characters. Removed characters are marked with ellipsis. -- @string s the string - -- @int w the maxinum size allowed + -- @int w the maximum size allowed -- @bool tail true if we want to show the end of the string (head otherwise) -- @usage ('1234567890'):shorten(8) == '12345...' -- @usage ('1234567890'):shorten(8, true) == '...67890' @@ -11688,7 +11753,7 @@ end --- Python-style formatting operator. -- Calling `text.format_operator()` overloads the % operator for strings to give --- Python/Ruby style formated output. +-- Python/Ruby style formatted output. -- This is extended to also do template-like substitution for map-like data. -- -- Note this goes further than the original, and will allow these cases: @@ -11698,7 +11763,7 @@ end -- 3. a map of var=value pairs -- 4. a function, as in gsub -- --- For the second two cases, it uses $-variable substituion. +-- For the second two cases, it uses $-variable substitution. -- -- When called, this function will monkey-patch the global `string` metatable by -- adding a `__mod` method. @@ -12799,59 +12864,72 @@ end, local utils = require 'pl.utils' -local append,format,strsub,strfind,strgsub = table.insert,string.format,string.sub,string.find,string.gsub +local append, concat = table.insert, table.concat +local format, strsub, strfind, strgsub, strrep = string.format, string.sub, string.find, string.gsub, string.rep -local APPENDER = "\n__R_size = __R_size + 1; __R_table[__R_size] = " +local APPENDER = " __R_size = __R_size + 1; __R_table[__R_size] = " +-- When this function returns, `pieces` is guaranteed to hold a complete Lua +-- statement, meaning that new statements can be appended without creating +-- invalid Lua code. local function parseDollarParen(pieces, chunk, exec_pat, newline) local s = 1 for term, executed, e in chunk:gmatch(exec_pat) do - executed = '('..strsub(executed,2,-2)..')' - append(pieces, APPENDER..format("%q", strsub(chunk,s, term - 1))) - append(pieces, APPENDER..format("__tostring(%s or '')", executed)) + executed = '(' .. strsub(executed, 2, -2) .. ')' + append(pieces, APPENDER .. format("%q;", strsub(chunk, s, term - 1))) + append(pieces, APPENDER .. format("__tostring(%s or '');", executed)) s = e end - local r + local remainder, newlines_removed if newline then - r = format("%q", strgsub(strsub(chunk,s),"\n","")) + remainder, newlines_removed = strgsub(strsub(chunk, s), "\n", "") else - r = format("%q", strsub(chunk,s)) + remainder, newlines_removed = strsub(chunk, s), 0 end - if r ~= '""' then - append(pieces, APPENDER..r) + if remainder ~= "" then + append(pieces, APPENDER .. format("%q;", remainder)) + end + if newlines_removed > 0 then + append(pieces, strrep("\n", newlines_removed)) end end -local function parseHashLines(chunk,inline_escape,brackets,esc,newline) - local exec_pat = "()"..inline_escape.."(%b"..brackets..")()" +local function parseHashLines(chunk, inline_escape, brackets, esc, newline) + -- Escape special characters to avoid invalid expressions + inline_escape = utils.escape(inline_escape) + esc = utils.escape(esc) + + local exec_pat = "()" .. inline_escape .. "(%b" .. brackets .. ")()" - local esc_pat = esc.."+([^\n]*\n?)" - local esc_pat1, esc_pat2 = "^"..esc_pat, "\n"..esc_pat - local pieces, s = {"return function()\nlocal __R_size, __R_table, __tostring = 0, {}, __tostring", n = 1}, 1 + local esc_pat = esc .. "+([^\n]*\n?)" + local esc_pat1, esc_pat2 = "^" .. esc_pat, "\n" .. esc_pat + local pieces, s = {"return function() local __R_size, __R_table, __tostring = 0, {}, __tostring; "}, 1 while true do - local _, e, lua = strfind(chunk,esc_pat1, s) + local _, e, lua = strfind(chunk, esc_pat1, s) if not e then local ss - ss, e, lua = strfind(chunk,esc_pat2, s) - parseDollarParen(pieces, strsub(chunk,s, ss), exec_pat, newline) + ss, e, lua = strfind(chunk, esc_pat2, s) + parseDollarParen(pieces, strsub(chunk, s, ss), exec_pat, newline) if not e then break end end - if strsub(lua, -1, -1) == "\n" then lua = strsub(lua, 1, -2) end - append(pieces, "\n"..lua) + if strsub(lua, -1, -1) ~= "\n" then lua = lua .. "\n" end -- Ensure trailing newline + append(pieces, lua) + -- since `lua` ends with a newline, there is no danger of subsequent + -- statements being gobbled up by comments or being altered s = e + 1 end - append(pieces, "\nreturn __R_table\nend") + append(pieces, "return __R_table; end") -- let's check for a special case where there is nothing to template, but it's -- just a single static string local short = false - if (#pieces == 3) and (pieces[2]:find(APPENDER, 1, true) == 1) then - pieces = { "return " .. pieces[2]:sub(#APPENDER+1,-1) } + if (#pieces == 3) and (strfind(pieces[2], APPENDER, 1, true) == 1) then + pieces = { "return " .. strsub(pieces[2], #APPENDER + 1, -1) } short = true end -- if short == true, the generated function will not return a table of strings, -- but a single string - return table.concat(pieces), short + return concat(pieces), short end local template = {} @@ -12859,33 +12937,34 @@ local template = {} --- expand the template using the specified environment. -- This function will compile and render the template. For more performant -- recurring usage use the two step approach by using `compile` and `ct:render`. --- There are six special fields in the environment table `env` --- --- * `_parent`: continue looking up in this table (e.g. `_parent=_G`). --- * `_brackets`: bracket pair that wraps inline Lua expressions, default is '()'. --- * `_escape`: character marking Lua lines, default is '#' --- * `_inline_escape`: character marking inline Lua expression, default is '$'. --- * `_chunk_name`: chunk name for loaded templates, used if there --- is an error in Lua code. Default is 'TMP'. --- * `_debug`: if truthy, the generated code will be printed upon a render error --- -- @string str the template string --- @tab[opt] env the environment --- @return `rendered template + nil + source_code`, or `nil + error + source_code`. The last --- return value (`source_code`) is only returned if the debug option is used. -function template.substitute(str,env) +-- @tparam[opt] table env the environment. This table has the following special fields: +-- @tparam[opt=nil] table env._parent continue looking up in this table (e.g. `_parent=_G`). +-- @tparam[opt="()"] string env._brackets bracket pair that wraps inline Lua expressions. +-- @tparam[opt="#"] string env._escape character marking Lua lines. +-- @tparam[opt="$"] string env._inline_escape character marking inline Lua expression. +-- @tparam[opt="TMP"] string env._chunk_name chunk name for loaded templates, used if there +-- is an error in Lua code. +-- @tparam[opt=false] boolean env._debug if truthy, the generated code will be printed upon a render error. +-- @treturn[1] string render result +-- @treturn[1] nil +-- @treturn[1] string source_code (only if '`env._debug`' was truthy). +-- @treturn[2] nil +-- @treturn[2] string error message +-- @treturn[2] string source_code (only if '`env._debug`' was truthy). +function template.substitute(str, env) env = env or {} local t, err = template.compile(str, { - chunk_name = rawget(env,"_chunk_name"), - escape = rawget(env,"_escape"), - inline_escape = rawget(env,"_inline_escape"), - inline_brackets = rawget(env,"_brackets"), - newline = nil, - debug = rawget(env,"_debug") + chunk_name = rawget(env, "_chunk_name"), + escape = rawget(env, "_escape"), + inline_escape = rawget(env, "_inline_escape"), + inline_brackets = rawget(env, "_brackets"), + newline = false, + debug = rawget(env, "_debug") }) if not t then return t, err end - return t:render(env, rawget(env,"_parent"), rawget(env,"_debug")) + return t:render(env, rawget(env, "_parent"), rawget(env, "_debug")) end --- executes the previously compiled template and renders it. @@ -12894,12 +12973,16 @@ end -- @tab[opt] parent continue looking up in this table (e.g. `parent=_G`). -- @bool[opt] db if thruthy, it will print the code upon a render error -- (provided the template was compiled with the debug option). --- @return `rendered template + nil + source_code`, or `nil + error + source_code`. The last return value --- (`source_code`) is only returned if the template was compiled with the debug option. +-- @treturn[1] string render result +-- @treturn[1] nil +-- @treturn[1] string source_code (only if '`env._debug`' was truthy). +-- @treturn[2] nil +-- @treturn[2] string error message +-- @treturn[2] string source_code (only if '`env._debug`' was truthy). -- @usage -- local ct, err = template.compile(my_template) -- local rendered , err = ct:render(my_env, parent) -local render = function(self, env, parent, db) +local function render(self, env, parent, db) env = env or {} if parent then -- parent is a bit silly, but for backward compatibility retained setmetatable(env, {__index = parent}) @@ -12911,25 +12994,27 @@ local render = function(self, env, parent, db) if self.code and db then print(self.code) end return nil, out, self.code end - return table.concat(out), nil, self.code + return concat(out), nil, self.code end --- compiles the template. -- Returns an object that can repeatedly be rendered without parsing/compiling --- the template again. --- The options passed in the `opts` table support the following options: --- --- * `chunk_name`: chunk name for loaded templates, used if there --- is an error in Lua code. Default is 'TMP'. --- * `escape`: character marking Lua lines, default is '#' --- * `inline_escape`: character marking inline Lua expression, default is '$'. --- * `inline_brackets`: bracket pair that wraps inline Lua expressions, default is '()'. --- * `newline`: string to replace newline characters, default is `nil` (not replacing newlines). --- * `debug`: if truthy, the generated source code will be retained within the compiled template object, default is `nil`. --- --- @string str the template string --- @tab[opt] opts the compilation options to use --- @return template object, or `nil + error + source_code` +-- the template again. Preserves the line layout of the template so that line +-- numbers in error messages should point to the correct lines in the source +-- string. +-- @tparam string str the template string +-- @tparam[opt] table opts the compilation options to use. This table supports the following options: +-- @tparam[opt="TMP"] string opts.chunk_name chunk name for loaded templates, used if there +-- is an error in Lua code. +-- @tparam[opt="#"] string opts.escape character marking Lua lines. +-- @tparam[opt="$"] string opts.inline_escape character marking inline Lua expression. +-- @tparam[opt="()"] string opts.inline_brackets bracket pair that wraps inline Lua expressions. +-- @tparam[opt=false] boolean opts.newline if truthy, newlines will be stripped from text in the template. +-- @tparam[opt=false] boolean opts.debug if truthy, the generated code will be printed upon a render error. +-- @treturn[1] ct compiled template object +-- @treturn[2] nil +-- @treturn[2] string error message +-- @treturn[2] string source_code -- @usage -- local ct, err = template.compile(my_template) -- local rendered , err = ct:render(my_env, parent) @@ -12940,9 +13025,9 @@ function template.compile(str, opts) local inline_escape = opts.inline_escape or '$' local inline_brackets = opts.inline_brackets or '()' - local code, short = parseHashLines(str,inline_escape,inline_brackets,escape,opts.newline) + local code, short = parseHashLines(str, inline_escape, inline_brackets, escape, opts.newline) local env = { __tostring = tostring } - local fn, err = utils.load(code, chunk_name,'t',env) + local fn, err = utils.load(code, chunk_name, 't', env) if not fn then return nil, err, code end if short then @@ -13453,7 +13538,8 @@ local operators local _function_factories = {} -local utils = { _VERSION = "1.13.1" } +local utils = { _VERSION = "1.14.0" } + for k, v in pairs(compat) do utils[k] = v end --- Some standard patterns @@ -13571,7 +13657,11 @@ end -- @param value1 Value returned if cond is truthy -- @param value2 Value returned if cond is falsy function utils.choose(cond, value1, value2) - return cond and value1 or value2 + if cond then + return value1 + else + return value2 + end end --- convert an array of values to strings. @@ -13727,7 +13817,7 @@ end -- non-existing values, and/or converting strings/identifiers to other values. -- -- Calling on the object does the same, but returns a soft error; `nil + err`, if --- the call is succesful (the key exists), it will return the value. +-- the call is successful (the key exists), it will return the value. -- -- When calling with varargs or an array the values will be equal to the keys. -- The enum object is read-only. @@ -13755,7 +13845,7 @@ end -- }, -- -- some_method = function(self) --- return self.ERR.OUT_OF_BOUNDS +-- return nil, self.ERR.OUT_OF_BOUNDS -- end, -- } -- @@ -14011,6 +14101,11 @@ end --- OS functions -- @section OS-functions +--- Execute a shell command. +-- This function is a copy of `compat.execute`. +-- @class function +-- @name utils.execute + --- execute a shell command and return the output. -- This function redirects the output to tempfiles and returns the content of those files. -- @param cmd a shell command @@ -14121,7 +14216,7 @@ end -- @param s The input string -- @param re optional A Lua string pattern; defaults to '%s+' -- @param plain optional If truthy don't use Lua patterns --- @param n optional maximum number of elements (if there are more, the last will remian un-split) +-- @param n optional maximum number of elements (if there are more, the last will remain un-split) -- @return a list-like table -- @raise error if s is not a string -- @see splitv @@ -14175,8 +14270,8 @@ end -- This is useful if you have a function which is relatively expensive, -- but you don't know in advance what values will be required, so -- building a table upfront is wasteful/impossible. --- @param func a function of at least one argument --- @return a function with at least one argument, which is used as the key. +-- @param func a function that takes exactly one argument (which later serves as the cache key) and returns a single value +-- @return a function taking one argument and returning a single value either from the cache or by running the original input function function utils.memoize(func) local cache = {} return function(k) diff --git a/macros/luatex/generic/penlight/penlight.pdf b/macros/luatex/generic/penlight/penlight.pdf Binary files differindex 3932e74389..928e356b85 100644 --- a/macros/luatex/generic/penlight/penlight.pdf +++ b/macros/luatex/generic/penlight/penlight.pdf diff --git a/macros/luatex/generic/penlight/penlight.sty b/macros/luatex/generic/penlight/penlight.sty index 7a7c94b6a7..8a0bb2c8f0 100644 --- a/macros/luatex/generic/penlight/penlight.sty +++ b/macros/luatex/generic/penlight/penlight.sty @@ -1,6 +1,6 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2023-07-22 -% Copyright (C) 2021-2023 Kale Ewasiuk +% 2024-09-15 +% Copyright (C) 2021-2024 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the "Software"), to deal @@ -22,7 +22,7 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{penlight}[2023-07-22] +\ProvidesPackage{penlight}[2024-09-15] \directlua{penlight = require'penlight'} diff --git a/macros/luatex/generic/penlight/penlight.tex b/macros/luatex/generic/penlight/penlight.tex index 93d7bdbfc3..c3f141bcbe 100644 --- a/macros/luatex/generic/penlight/penlight.tex +++ b/macros/luatex/generic/penlight/penlight.tex @@ -1,6 +1,6 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2023-07-22 -% Copyright (C) 2021-2023 Kale Ewasiuk +% 2024-09-15 +% Copyright (C) 2021-2024 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the "Software"), to deal @@ -64,7 +64,7 @@ Documentation for Penlight can be found here:\\ \mbox{\url{https://lunarmodules.github.io/Penlight}} -\\\\ This package uses version \cmd{1.13.1} +\\\\ This package uses version \cmd{1.14.0} (2024-04-15) \subsection*{Importing Penlight from within LaTeX} Loading this package runs the Lua code: \texttt{penlight = require'penlight'} @@ -95,8 +95,7 @@ Instead of using penlight.sty, you can simply:\\ \newpage \section*{} -This package used to contain \cmd{penlightextras.lua}. -That functionality now belongs to a standalone package named \cmd{penlightplus}. +Additional functionality is provided in the \cmd{penlightplus} package. \section*{} Disclaimer: I am not the author of the Lua Penlight library. diff --git a/macros/luatex/generic/penlightplus/penlightplus.lua b/macros/luatex/generic/penlightplus/penlightplus.lua index e51b01c14b..0e948c3fe1 100644 --- a/macros/luatex/generic/penlightplus/penlightplus.lua +++ b/macros/luatex/generic/penlightplus/penlightplus.lua @@ -1,5 +1,5 @@ --% Kale Ewasiuk (kalekje@gmail.com) ---% 2024-03-14 +--% 2024-08-17 --% Copyright (C) 2021-2024 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -857,6 +857,21 @@ end +function penlight.caseswitch(s, c, kv) + local kvtbl = penlight.luakeys.parse(kv) + local sw = kvtbl[c] -- the returned switch + if sw == nil then -- if switch not found + if s == penlight.tex.xTrue then -- if star, throw error + pl.tex.pkgerror('penlight', 'case: "'..c..'" not found in key-vals: "'..kv..'"') + sw = '' + else + sw = kvtbl['__'] or '' -- use __ as not found case + end + end + tex.sprint(sw) +end + + penlight.tbls = {} diff --git a/macros/luatex/generic/penlightplus/penlightplus.pdf b/macros/luatex/generic/penlightplus/penlightplus.pdf Binary files differindex 2e37875101..d6df378626 100644 --- a/macros/luatex/generic/penlightplus/penlightplus.pdf +++ b/macros/luatex/generic/penlightplus/penlightplus.pdf diff --git a/macros/luatex/generic/penlightplus/penlightplus.sty b/macros/luatex/generic/penlightplus/penlightplus.sty index 3c411d227a..58580036b5 100644 --- a/macros/luatex/generic/penlightplus/penlightplus.sty +++ b/macros/luatex/generic/penlightplus/penlightplus.sty @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2024-03-14 +% 2024-08-17 % Copyright (C) 2021-2024 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,7 +22,7 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{penlightplus}[2024-03-14] +\ProvidesPackage{penlightplus}[2024-08-17] \RequirePackage{luacode} \RequirePackage{luakeys} @@ -97,6 +97,18 @@ + + + +\NewDocumentCommand{\caseswitch}{s m +m}{\ignorespaces\luadirect{penlight.caseswitch(\luastring{#1},\luastring{#2},\luastringN{#3})}\unskip} +% argument 1 is star option, which throws an error if case is not found +% argument 2 is the case, fully expanded +% argument 3 is a luakeys table of options, not expanded + + + + + %%% tbls below \NewDocumentCommand{\tblnew}{m}{\luadirect{% initialize a tbl and set blank diff --git a/macros/luatex/generic/penlightplus/penlightplus.tex b/macros/luatex/generic/penlightplus/penlightplus.tex index 015dac98ef..07a41e244b 100644 --- a/macros/luatex/generic/penlightplus/penlightplus.tex +++ b/macros/luatex/generic/penlightplus/penlightplus.tex @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2024-03-14 +% 2024-08-17 % Copyright (C) 2021-2024 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -59,7 +59,6 @@ \subtitle{Additions to the Penlight Lua Libraries} - \begin{document} % @@ -222,7 +221,7 @@ no, once, twice, or full expansion. For example, we can control the expansion of %\luastringExpTest{ n o t f }{\NOTexp} -\subsection*{Lua boolean expressions for LaTeX conditionals} +\subsection*{Lua boolean expressions and a case-switch for conditionals} \cmd{\ifluax{<Lua expr>}{<do if true>}[<do if false>]} and\\ \cmd{\ifluax{<Lua expr>}{<do if true>}[<do if false>]} for truthy (uses \cmd{penlight.hasval}) @@ -234,6 +233,17 @@ no, once, twice, or full expansion. For example, we can control the expansion of \ifluaxv{''}{true}[false]\\ \end{LTXexample} +\cmd{\caseswitch{case}{kev-val choices}} The starred version will throw an error if the case is not found. +Use \_\_ as a placeholder for a case that isn't matched. + +\begin{LTXexample}[width=0.3\linewidth] +\def\caseswitchexample{\caseswitch{\mycase}{dog=DOG, cat=CAT, __=INVALID}} +\def\mycase{dog} \caseswitchexample \\ +\def\mycase{human} \caseswitchexample +\end{LTXexample} +%\caseswitch*{\mycase}{dog=DOG, cat=CAT, __=INVALID} + + \subsection*{Creating and using Lua tables in LaTeX} \cmd{penlightplus} provides a Lua-table interface. Tables are stored in the \cmd{penlight.tbls} table. |