From 41eb4dfa0badd165fc762b85c3ba592b4e57d38a Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 25 Dec 2020 03:00:51 +0000 Subject: CTAN sync 202012250300 --- macros/latex/contrib/lwarp/README.txt | 2 +- macros/latex/contrib/lwarp/lwarp.dtx | 423 +++++++++++++++++++++--- macros/latex/contrib/lwarp/lwarp.ins | 1 + macros/latex/contrib/lwarp/lwarp.pdf | Bin 3014760 -> 3023923 bytes macros/latex/contrib/lwarp/lwarpmk.lua | 2 +- macros/luatex/generic/chinese-jfm/LICENSE | 21 ++ macros/luatex/generic/chinese-jfm/README.md | 57 ++++ macros/luatex/generic/chinese-jfm/jfm-ja_JP.lua | 297 +++++++++++++++++ macros/luatex/generic/chinese-jfm/jfm-zh_CN.lua | 311 +++++++++++++++++ macros/luatex/generic/chinese-jfm/jfm-zh_TW.lua | 333 +++++++++++++++++++ 10 files changed, 1395 insertions(+), 52 deletions(-) create mode 100644 macros/luatex/generic/chinese-jfm/LICENSE create mode 100644 macros/luatex/generic/chinese-jfm/README.md create mode 100644 macros/luatex/generic/chinese-jfm/jfm-ja_JP.lua create mode 100644 macros/luatex/generic/chinese-jfm/jfm-zh_CN.lua create mode 100644 macros/luatex/generic/chinese-jfm/jfm-zh_TW.lua (limited to 'macros') diff --git a/macros/latex/contrib/lwarp/README.txt b/macros/latex/contrib/lwarp/README.txt index 538276fd29..eccf4ac6a9 100644 --- a/macros/latex/contrib/lwarp/README.txt +++ b/macros/latex/contrib/lwarp/README.txt @@ -1,5 +1,5 @@ -LaTeX lwarp package v0.893 README.txt +LaTeX lwarp package v0.894 README.txt Files included are: diff --git a/macros/latex/contrib/lwarp/lwarp.dtx b/macros/latex/contrib/lwarp/lwarp.dtx index 7d90efe942..397c835190 100644 --- a/macros/latex/contrib/lwarp/lwarp.dtx +++ b/macros/latex/contrib/lwarp/lwarp.dtx @@ -16,7 +16,7 @@ % \iffalse %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{lwarp} -% [2020/11/26 v0.893 Allows LaTeX to directly produce HTML5 output.] +% [2020/12/24 v0.894 Allows LaTeX to directly produce HTML5 output.] % %<*driver> \documentclass{ltxdoc} @@ -1385,9 +1385,13 @@ change between uses. Another problem is complicated contents \margintag{complicated \attribute{alt} tag} which do not expand well in an \attribute{alt} tag. -The macro \cs{inlinemathother} may be used before a dynamic -math expression, and \cs{inlinemathnormal} after. Doing so tells \pkg{lwarp} to -use an unhashed \SVG\ math image, even if MathJax is in use. +Yet another problem is math packages which are only partially emulated +\margintag{\brand{MathJax} limitations} +in \brand{MathJax}. +The macro \cs{inlinemathother} may be used before a sequence of dynamic or complicated +math expressions, and \cs{inlinemathnormal} after. Doing so tells \pkg{lwarp} to +use unhashed \SVG\ math images for those particular expressins, even if MathJax +is otherwise in use. See \cref{sec:localizingdynamicmath}. } @@ -1395,7 +1399,7 @@ See \cref{sec:localizingdynamicmath}. \DescribeMacro{\displaymathnormal} By default, or when selecting \cs{displaymathnormal}, \brand{Mathjax} math display environments print their contents -as text into \HTML, +as text into \HTML\ for \brand{MathJax} to interpret, and \SVG\ display math environments render their contents as \SVG\ images and use their contents as the \attribute{alt} tag of \HTML\ output. To do so, the contents are loaded into a macro for reuse. @@ -3057,7 +3061,7 @@ This boolean may be tested by the user for later use. %<*package> % \fi % -% \CheckSum{51253} +% \CheckSum{51622} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -3192,6 +3196,7 @@ This boolean may be tested by the user for later use. % \changes{v0.891}{2020/09/22}{\ 2020/09/22} % \changes{v0.892}{2020/10/07}{\ 2020/10/07} % \changes{v0.893}{2020/11/26}{\ 2020/11/26} +% \changes{v0.894}{2020/12/24}{\ 2020/12/24} @@ -3415,6 +3420,20 @@ This boolean may be tested by the user for later use. % % \begin{description} % \needspace{2\baselineskip} +% \item[v0.894:] \brand{MathJax} additions and improvements. +% \begin{itemize} +% \item Improved warning message for enabling \SVG\ graphics for +% \margintag{\brand{MathJax}} +% select math expressions while using \brand{MathJax}. +% \item Accept and ignore a star for \cs{hspace}. +% \item Ignores \cs{arabic}, \cs{number}, \cs{noalign}. +% \item Added \brand{MathJax} emulation for \pkg{backnaur}, +% \pkg{colortbl}, \pkg{nicematrix}. +% \margintag{packages} +% \item \pkg{booktabs}: \brand{MathJax} emulation now absorbs and discards trim. +% \item \pkg{menukeys}: Updated to v1.6.1. +% \end{itemize} +% \needspace{2\baselineskip} % \item[v0.893:] Minor fixes, more packages. % \begin{itemize} % \item Added \brand{MathJax} emulation for \cs{mathnormal}. @@ -5433,6 +5452,7 @@ This boolean may be tested by the user for later use. % \item[\sjax:] Supported as-is for \brand{MathJax}, subject to limitations. % \item[\ejax:] Emulated for \brand{MathJax} using custom macros, subject to limitations. % \item[\ijax:] Ignored by \brand{MathJax}, but may be used in the document source. +% May be converted to \SVG\ images. % \end{description} % % \renewcommand{\arraystretch}{1.5} @@ -5600,9 +5620,9 @@ This boolean may be tested by the user for later use. % \mpkg{theorem}, \mpkg{thmbox}, \mpkg{thmtools}. \\ % % Additional math: & Math fonts via \SVG\ images, -% \spkg{accents}\ejax, \spkg{amscd}, \spkg{autobreak}\ejax, \ipkg{autonum}, -% \mpkg{backnaur}, \mpkg{bm}\ejax, \spkg{braket}\ejax, -% \mpkg{breqn}, \mpkg{bussproofs}\ejax, \mpkg{cases}, +% \spkg{accents}\ejax, \spkg{amscd}\sjax, \spkg{autobreak}\ejax, \ipkg{autonum}, +% \mpkg{backnaur}\ejax, \mpkg{bm}\ejax, \spkg{braket}\sjax, +% \mpkg{breqn}\ijax, \mpkg{bussproofs}\sjax, \mpkg{cases}\ijax, % \spkg{centernot}\ejax, \spkg{cmbright}\ejax, % \spkg{colonequals}\ejax, \spkg{decimal}\ejax, % \spkg{delarray}, \mpkg{DotArrow}\ejax, \spkg{dotlessi}\ejax, \spkg{dotlessj}\sjax, @@ -5619,11 +5639,11 @@ This boolean may be tested by the user for later use. % \spkg{mathspec}\ejax, \mpkg{mathtools}\ejax, % \mpkg{mismath}\ejax, \spkg{mleftright}\ejax, % \spkg{multiobjective}\ejax, \mpkg{nccmath}\ejax, -% \spkg{nicematrix}, \spkg{noitcrul}\ejax, +% \spkg{nicematrix}\ejax, \spkg{noitcrul}\ejax, % \spkg{newpxmath}\ejax, \spkg{newtxmath}\ejax, \spkg{newtxsf}\ejax, % \spkg{pb-diagram}, % \spkg{pxfonts}\ejax, -% \ipkg{resizegather}, \spkg{rmathbr}\ejax, \spkg{scalerel}\ejax, +% \ipkg{resizegather}\ijax, \spkg{rmathbr}\ejax, \spkg{scalerel}\ejax, % \epkg{shuffle}\ejax, \spkg{stackrel}\ejax, % \mpkg{statex2}\ejax, \mpkg{statistics}, \spkg{statmath}\ejax, % \spkg{subsupscripts}\ejax, \spkg{textualicomma}\ijax, @@ -5660,7 +5680,7 @@ This boolean may be tested by the user for later use. % Tabular: & % \env{tabular} environment, \mpkg{array}\ejax, \epkg{arydshln}\ejax, % \mpkg{bigdelim}\ejax, \mpkg{bigstrut}\ejax, \mpkg{booktabs}\ejax, -% \mpkg{colortbl}, \mpkg{ctable}, \mpkg{diagbox}, \mpkg{hhline}\ejax, \epkg{longtable}, +% \mpkg{colortbl}\ijax, \mpkg{ctable}, \mpkg{diagbox}, \mpkg{hhline}\ejax, \epkg{longtable}, % \epkg{ltablex}, \epkg{ltxtable}, % \mpkg{multirow}\ejax, \epkg{supertabular}, \epkg{tabularx}, \epkg{tabulary}, % \epkg{threeparttable}, \mpkg{threeparttablex}, @@ -13113,6 +13133,7 @@ This boolean may be tested by the user for later use. \LWR@notmemoirloadafter{nextpage} \LWR@loadafter{nicefrac} \LWR@loadafter{niceframe} +\LWR@loadafter{nicematrix} \LWR@loadafter{noitcrul} \LWR@loadafter{nolbreaks} \LWR@loadafter{nomencl} @@ -13601,7 +13622,7 @@ This boolean may be tested by the user for later use. {% Unable to patch package #1,\MessageBreak macro \LWRbackslash #2.\MessageBreak - Lwarp may need to be updated% + Lwarp or #1 may need to be updated% }% {Please contact the maintainer of the Lwarp package.}% } @@ -17292,6 +17313,7 @@ This boolean may be tested by the user for later use. % \changes{v0.88}{2020/07/04}{\filenm{lwarp.css}: Added \pkg{tcolorbox}, \pkg{thmbox}.} % \changes{v0.88}{2020/07/14}{\filenm{lwarp.css}: Added \optn{indexheading} for \pkg{gindex}.} % \changes{v0.893}{2020/10/18}{\filenm{lwarp.css}: Added \pkg{keystroke}.} +% \changes{v0.894}{2020/12/15}{\filenm{lwarp.css}: \TeX\ logos no longer below baseline.} % % ^^A *lwarp.css % @@ -18187,7 +18209,10 @@ dl dd:after { content: "" ; display: block ; clear: both } dl dd p { margin-top: 0em; } -dd ul, dd ol, dd dl { clear: both ; padding-top: 1ex } +dd ul, dd ol, dd dl { + clear: both ; +/* padding-top: 1ex ; */ +} nav { @@ -18898,6 +18923,9 @@ span.nolbreaks { white-space: nowrap ; } /* For CSS LaTeX and related logos: Based on spacing demonstrated by the metafont package. + +The subscripts are shrunk instead of lowered below the baseline, +to avoid browser rendering errors with the line height in lists, etc. */ .latexlogofont { @@ -18909,7 +18937,6 @@ Based on spacing demonstrated by the metafont package. .latexlogo { font-family: "Linux Libertine O", "Nimbus Roman No 9 L", "FreeSerif", "Hoefler Text", Times, "Times New Roman", serif; - font-size: 1.1em; } .latexlogosup { @@ -18923,10 +18950,11 @@ Based on spacing demonstrated by the metafont package. .latexlogosub { text-transform: uppercase; - vertical-align: -0.27ex; +/* vertical-align: -0.27ex; */ margin-left: -0.08em; margin-right: -0.07em; - font-size: 1em; +/* font-size: 1em; */ + font-size: .7em ; } .latexlogotwoe { @@ -18936,24 +18964,25 @@ Based on spacing demonstrated by the metafont package. .latexlogotwoesub { font-style:italic ; - vertical-align: -0.27ex; +/* vertical-align: -0.27ex; */ margin-left: -0.11em; margin-right: -0.1em; - font-size: 1em; +/* font-size: 1em; */ + font-size: .7em ; } .xelatexlogo { font-family: "Linux Libertine O", "Nimbus Roman No 9 L", "FreeSerif", "Hoefler Text", Times, "Times New Roman", serif; letter-spacing: .03em ; - font-size: 1.1em; } .xelatexlogosub { - vertical-align: -0.27ex; +/* vertical-align: -0.27ex; */ margin-left: -0.0667em; margin-right: -.05em; - font-size: 1em; +/* font-size: 1em; */ + font-size: .7em ; letter-spacing: .03em ; } @@ -20065,7 +20094,7 @@ MathJax = { -- Copyright 2016-2020 Brian Dunn -printversion = "v0.893" +printversion = "v0.894" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () @@ -24707,7 +24736,7 @@ end -- not --version % \end{macrocode} % \end{macro} -% +% ^^A *mathjax customizations % Default customizations: % \margintag{defaults} % @@ -24722,6 +24751,7 @@ end -- not --version % \changes{v0.57}{2018/05/24}{\brand{MathJax}: Supports \cs{footnote}, \cs{footnotemark}.} % \changes{v0.79}{2020/01/24}{\brand{MathJax}: Additional macros.} % \changes{v0.893}{2020/10/14}{\brand{MathJax}: Added \cs{mathnormal}.} +% \changes{v0.894}{2020/12/22}{\brand{MathJax}: Added \cs{arabic}, \cs{number}, \cs{noalign}.} % % For footnotes, \cs{footnotename} is used in most cases, however % for \env{equation} the footnote is picked up from \LaTeX in \cs{LWR@doendequation}. @@ -24753,7 +24783,14 @@ end -- not --version \CustomizeMathJax{\newcommand{\footnote}[2][\LWRfootnote]{{}^{\mathrm{#1}}}} \CustomizeMathJax{\newcommand{\footnotemark}[1][\LWRfootnote]{{}^{\mathrm{#1}}}} % \end{macrocode} - +% +% \cs{hspace} is modified to accept and ignore a star: +% \changes{v0.894}{2020/12/21}{\brand{MathJax}: Accept starred \cs{hspace}.} +% \begin{macrocode} +\CustomizeMathJax{\let\LWRorighspace\hspace} +\CustomizeMathJax{\renewcommand{\hspace}{\ifstar\LWRorighspace\LWRorighspace}} +% \end{macrocode} +% % Various other customizations: % \begin{macrocode} \CustomizeMathJax{\newcommand{\mathnormal}[1]{{#1}}} @@ -24766,6 +24803,9 @@ end -- not --version \CustomizeMathJax{\newcommand{\addtolength}[2]{}} \CustomizeMathJax{\newcommand{\setcounter}[2]{}} \CustomizeMathJax{\newcommand{\addtocounter}[2]{}} +\CustomizeMathJax{\newcommand{\arabic}[1]{}} +\CustomizeMathJax{\newcommand{\number}[1]{}} +\CustomizeMathJax{\newcommand{\noalign}[1]{\text{#1}\notag \\}} \CustomizeMathJax{\newcommand{\cline}[1]{}} \CustomizeMathJax{\newcommand{\directlua}[1]{\text{(directlua)}}} \CustomizeMathJax{\newcommand{\luatexdirectlua}[1]{\text{(directlua)}}} @@ -24779,6 +24819,8 @@ end -- not --version \CustomizeMathJax{\newcommand{\protect}{}} \CustomizeMathJax{\def\LWRabsorbnumber#1 {}} \CustomizeMathJax{\def\LWRabsorbquotenumber"#1 {}} +\CustomizeMathJax{\newcommand{\LWRabsorboption}[1][]{}} +\CustomizeMathJax{\newcommand{\LWRabsorbtwooptions}[1][]{\LWRabsorboption}} \CustomizeMathJax{\def\mathchar{\ifnextchar"\LWRabsorbquotenumber\LWRabsorbnumber}} \CustomizeMathJax{\def\mathcode#1={\mathchar}} \CustomizeMathJax{\let\delcode\mathcode} @@ -41413,13 +41455,12 @@ color:\LWR@origpound\LWR@tempcolor% % % % \section{\brand{MathJax} warnings} -% ^^A *mathjax % % \begin{macro}{\LWR@mathjaxwarn} \marg{packagename} \marg{More text.} % % To be done \cs{AtBeginDocument}. % -% \changes{v0.79}{2020/01/18}{Warn if using packages not supported by \brand{MathJax}.} +% \changes{v0.79}{2020/01/18}{Warn if using packages partially supported by \brand{MathJax}.} % \begin{macrocode} \newcommand*{\LWR@mathjaxwarn}[2]{% \@ifpackageloaded{lwarp-#1}{% @@ -41440,6 +41481,52 @@ color:\LWR@origpound\LWR@tempcolor% }{}% } +% \begin{macro}{\LWR@nomathjaxwarn} \marg{packagename} \marg{More text.} +% +% To be done \cs{AtBeginDocument}. +% +% \changes{v0.894}{2020/12/22}{Warn if using packages not supported by \brand{MathJax}.} +% \begin{macrocode} +\newcommand*{\LWR@nomathjaxwarn}[2]{% + \@ifpackageloaded{lwarp-#1}{% + \ifblank{#2}{% + \PackageWarningNoLine{lwarp} + {% + Lwarp does not provide MathJax support for #1% + } + }{% + \PackageWarningNoLine{lwarp} + {% + Lwarp does not provide MathJax support for #1.\MessageBreak + #2% + } + }% + }{}% +} +% \end{macrocode} +% +% \begin{macro}{\LWR@forceSVGmessage} \marg{packagename} +% \changes{v0.894}{2020/12/22}{Improved MathJax warnings.} +% \begin{macrocode} +\newcommand*{\LWR@forceSVGmessage}[1]{% + SVG math output may be enabled for select math\MessageBreak + expressions to preserve #1 visual\MessageBreak + features for those particular expressions.\MessageBreak + Before the chosen inline math, use \protect\inlinemathother\MessageBreak + to begin using SVG math, and \protect\inlinemathnormal\MessageBreak + afterward to resume using MathJax math.\MessageBreak + Before display math, use \protect\displaymathother\MessageBreak + to begin using SVG math, and use \protect\displaymathnormal\MessageBreak + after to resume using MathJax for the following math% +} +% \end{macrocode} +% \end{macro} +% +% ^^A *mathjax warnings +% +% If \brand{MathJax} is being used, issue a warning for certain packages. +% \changes{v0.894}{2020/12/22}{Improved MathJax warnings.} +% \begin{macrocode} \AtBeginDocument{ \ifbool{mathjax}{ \LWR@mathjaxwarn{arydshln} @@ -41452,20 +41539,24 @@ color:\LWR@origpound\LWR@tempcolor% You may use the warpprint and warpHTML\MessageBreak environments to isolate the package load\MessageBreak and the equation+ environments} - \LWR@mathjaxwarn{backnaur} - {You may enclose its uses inside\MessageBreak - lateximage environments to force SVG output,\MessageBreak - but this also changes the print output} \LWR@mathjaxwarn{bigdelim} {Delimiters appear only of the first line} \LWR@mathjaxwarn{booktabs} - {In a math array, do not use (trim) for \protect\cmidrule} + {\protect\cmidrule\space is not displayed} \LWR@mathjaxwarn{breqn} {Each environment becomes an SVG image} + \LWR@mathjaxwarn{colortbl} + {Colors are ignored in MathJax.\MessageBreak + (Text mode tabular does support colortbl.)\MessageBreak + \LWR@forceSVGmessage{colortbl}} \LWR@mathjaxwarn{delarray} - {Enclose its uses inside lateximage\MessageBreak - environments to force SVG output} - \LWR@mathjaxwarn{jkmath}{} + {\LWR@forceSVGmessage{delarray}} + \LWR@nomathjaxwarn{gauss} + {\LWR@forceSVGmessage{gauss}} + \LWR@mathjaxwarn{hhline} + {A simple \protect\hline\space is used} + \LWR@nomathjaxwarn{jkmath} + {\LWR@forceSVGmessage{jkmath}} \LWR@mathjaxwarn{mathtools} {See the Lwarp manual regarding the disallowspaces\MessageBreak and showonlyrefs options, the alignat environment,\MessageBreak @@ -41478,9 +41569,14 @@ color:\LWR@origpound\LWR@tempcolor% limited emulation is provided for MathJax math.\MessageBreak \protect\multirow\space ignores all arguments except\MessageBreak the text} - \LWR@mathjaxwarn{pb-diagram} - {Enclose its uses inside lateximage environments\MessageBreak - to force SVG output} + \LWR@mathjaxwarn{nicematrix} + {Keys/values are ignored in MathJax.\MessageBreak + \protect\Cdots, etc. do not span multiple cells.\MessageBreak + AutoNiceMatrix, etc. are not supported for MathJax.\MessageBreak + \LWR@forceSVGmessage{nicematrix}% + } + \LWR@nomathjaxwarn{pb-diagram} + {\LWR@forceSVGmessage{pb-diagram}} % \LWR@mathjaxwarn{physics} % % {The third-party extension is not used.\MessageBreak % {The MathJax v3 extension is used.\MessageBreak @@ -41492,13 +41588,13 @@ color:\LWR@origpound\LWR@tempcolor% Some symbol fonts are not supported by MathJax,\MessageBreak and are only approximated.\MessageBreak Latin characters may not be correct} + \LWR@nomathjaxwarn{unitsdef}{} \LWR@mathjaxwarn{witharrows} {Arrows can only point to the next line.\MessageBreak Text is only placed on a single line} - \LWR@mathjaxwarn{xy} - {xy works in text, but in math you must\MessageBreak - enclose its uses inside lateximage\MessageBreak - environments to force SVG output} + \LWR@nomathjaxwarn{xy} + {In text, xy works as-is. SVG images will be generated.\MessageBreak + \LWR@forceSVGmessage{xy}} }{} } % \end{macrocode} @@ -44568,7 +44664,8 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \credits{Adrian P. Robson} % % \DescribePackage{backnaur} -% \pkg{backnaur} is patched for use by \pkg{lwarp}. +% \pkg{backnaur} is patched for use by \pkg{lwarp}, +% and emulated for \brand{MathJax}. % % \changes{v0.72}{2019/05/20}{\pkg{backnaur}: Added.} % @@ -44629,6 +44726,43 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % ^^A % \@ifpackagewith{backnaur}{epsilon}{\renewcommand{\bnfes}{\HTMLunicode{3f5}}}{}% \epsilon % ^^A % \end{macrocode} % +% +% For \brand{MathJax}: +% \begin{macrocode} +\begin{warpMathJax} +\CustomizeMathJax{\newcommand{\bnfpn}[1]{\langle \text{\textrm{#1}} \rangle}} +\CustomizeMathJax{\newcommand{\bnfor}{\; \mid \;}} +\CustomizeMathJax{\newcommand{\bnfsp}{\;}} +\@ifpackagewith{backnaur}{perp}{ + \CustomizeMathJax{\newcommand{\bnfes}{\perp}} +}{ + \@ifpackagewith{backnaur}{epsilon}{ + \CustomizeMathJax{\newcommand{\bnfes}{\epsilon}} + }{ + \CustomizeMathJax{\newcommand{\bnfes}{\lambda}} + } +} +\@ifpackagewith{backnaur}{tsrm}{ + \CustomizeMathJax{\newcommand{\bnfts}[1]{\text{#1}}} +}{ + \CustomizeMathJax{\newcommand{\bnfts}[1]{\text{\texttt{#1}}}} +} +\CustomizeMathJax{\newcommand{\bnftd}[1]{\text{\textit{#1}}}} +\CustomizeMathJax{\newcommand{\bnfsk}{\dots}} +\@ifpackagewith{backnaur}{altpo}{ + \CustomizeMathJax{\newcommand{\bnfpo}{::=}} +}{ + \CustomizeMathJax{\newcommand{\bnfpo}{\models}} +} +\CustomizeMathJax{\newcommand{\bnfprod}{\ifstar{\LWRbnfprodnn}{\LWRbnfprodyn}}} +\CustomizeMathJax{\newcommand{\LWRbnfprodyn}[2]{\bnfpn{#1} & \bnfpo & #2}} +\CustomizeMathJax{\newcommand{\LWRbnfprodnn}[2]{\nonumber \bnfpn{#1} & \bnfpo & #2}} +\CustomizeMathJax{\newcommand{\bnfmore}{\ifstar{\LWRbnfmorenn}{\LWRbnfmoreyn}}} +\CustomizeMathJax{\newcommand{\LWRbnfmoreyn}[1]{ & & #1}} +\CustomizeMathJax{\newcommand{\LWRbnfmorenn}[1]{\nonumber & & #1}} +\end{warpMathJax} +% \end{macrocode} +% % \iffalse % % \fi @@ -45765,12 +45899,17 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % % For \brand{MathJax}: % \changes{v0.79}{2020/01/30}{\pkg{booktabs}: Added \brand{MathJax} emulation.} +% \changes{v0.894}{2020/12/22}{\pkg{booktabs}: \brand{MathJax}: Absorb \cs{cmidrule} trim arg.} % \begin{macrocode} \begin{warpMathJax} \CustomizeMathJax{\newcommand{\toprule}[1][]{\hline}} \CustomizeMathJax{\let\midrule\toprule} \CustomizeMathJax{\let\bottomrule\toprule} -\CustomizeMathJax{\newcommand{\cmidrule}[2][]{}}% avoid (trim) +\CustomizeMathJax{\def\LWRbooktabscmidruleparen(#1)#2{}} +\CustomizeMathJax{\newcommand{\LWRbooktabscmidrulenoparen}[1]{}} +\CustomizeMathJax{\newcommand{\cmidrule}[1][]{% + \ifnextchar(\LWRbooktabscmidruleparen\LWRbooktabscmidrulenoparen% +}} \CustomizeMathJax{\newcommand{\morecmidrules}{}} \CustomizeMathJax{\newcommand{\specialrule}[3]{\hline}} \CustomizeMathJax{\newcommand{\addlinespace}[1][]{}} @@ -49624,6 +49763,17 @@ name = \chemmacros_translate:n {scheme-name} % \end{macrocode} % \end{noindmacro} +% For \brand{MathJax}, colors are discarded. +% \changes{v0.894}{2020/12/22}{\pkg{colortbl}: Added \brand{MathJax} emulation.} +% \begin{macrocode} +\begin{warpMathJax} +\CustomizeMathJax{\newcommand{\columncolor}[2][]{\LWRabsorbtwooptions}} +\CustomizeMathJax{\let\rowcolor\columncolor} +\CustomizeMathJax{\let\cellcolor\columncolor} +\end{warpMathJax} +% \end{macrocode} + + % \iffalse % % \fi @@ -64697,31 +64847,32 @@ background: % \codehtml % % \begin{macrocode} -\LWR@ProvidesPackagePass{menukeys}[2020/10/31] +\LWR@ProvidesPackagePass{menukeys}[2020/12/19] % \end{macrocode} % % Patch to use a \env{lateximage} whose \attribute{alt} text % is the contents of this use of the macro. % A hash on these contents allows the reuse of the image for % each instance of the same contents. +% \changes{v0.893}{2020/12/24}{\pkg{menukeys}: Updated to v1.6.1.} % \begin{macrocode} -\xpatchcmd{\tw@define@menu@macro} +\xpatchcmd{\tw@define@menu@macro@} {\@nameuse{tw@style@#4@pre}} {% \begin{lateximage}*[\detokenize{##2}]% \@nameuse{tw@style@#4@pre}% } {} - {\LWR@patcherror{menukeys}{tw@define@menu@macro}} + {\LWR@patcherror{menukeys}{tw@define@menu@macro@}} -\xpatchcmd{\tw@define@menu@macro} +\xpatchcmd{\tw@define@menu@macro@} {\@nameuse{tw@style@#4@post}} {% \@nameuse{tw@style@#4@post}% \end{lateximage}% } {} - {\LWR@patcherror{menukeys}{tw@define@menu@macro B}} + {\LWR@patcherror{menukeys}{tw@define@menu@macro@ B}} % \end{macrocode} % % Patch the existing macros: @@ -67708,6 +67859,177 @@ do not attempt to patch lwarp's version of `nameref'.)\MessageBreak % % % +% \iffalse +%<*nicematrix> +% \fi +% +% \part{lwarp-nicematrix.sty} +% +% \section{nicematrix} +% +% \credits{F. Pantigny} +% +% \DescribePackage{nicematrix} +% \pkg{nicematrix} is used as-is for \SVG\ math, and +% is emulated for \brand{MathJax}. +% +% Keys/values are ignored in \brand{MathJax}. +% \trouble[\brand{MathJax}]{nicematrix=\pkg{nicematrix}} +% \cs{Cdots}, etc. do not span multiple cells. +% \env{AutoNiceMatrix}, etc. are not supported for \brand{MathJax}. +% SVG math output preserves all nicematrix features. +% To force SVG output for one or more consecutive +% math expressions, for inline math use +% \cs{inlinemathother} and \cs{inlinemathnormal}, or +% for display math use \cs{displaymathother} and \cs{displaymathnormal}. +% +% \changes{v0.894}{2020/12/21}{\pkg{nicematrix}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{nicematrix}[2020/11/23] +% \end{macrocode} +% +% \env{NiceTabular} must be converted to \SVG\ to support the +% various \pkg{nicematrix} options: +% \begin{macrocode} +\begin{warpHTML} +\BeforeBeginEnvironment{NiceTabular}{% + \begin{lateximage}[-nicematrix-~\PackageDiagramAltText]% +} +\AfterEndEnvironment{NiceTabular}{\end{lateximage}} +\BeforeBeginEnvironment{NiceTabular*}{% + \begin{lateximage}[-nicematrix-~\PackageDiagramAltText]% +} +\AfterEndEnvironment{NiceTabular*}{\end{lateximage}} +\end{warpHTML} +% \end{macrocode} +% +% Special handling for the optional arguments, and the lack of a delimiter: +% \begin{macrocode} +\begin{warpMathJax} +\CustomizeMathJax{\newcommand{\LWRnicearrayarray}[1]{\begin{array}{#1}}} +\CustomizeMathJax{\def\LWRnicearrayarrayopt#1[#2] {\begin{array}{#1}}} + +\CustomizeMathJax{% + \newenvironment{NiceArray}[2][]% + {\ifnextchar[{\LWRnicearrayarrayopt{#2}}{\LWRnicearrayarray{#2}}}% + {\end{array}}% +} + +\CustomizeMathJax{% + \newcommand{\LWRnicearraywithdelimtwo}[2][]{% + \ifnextchar[{\LWRnicearrayarrayopt{#2}}{\LWRnicearrayarray{#2}}% + }% +} +% \end{macrocode} +% +% General case with left \Slash right delimiters: +% \begin{macrocode} +\CustomizeMathJax{% + \newenvironment{NiceArrayWithDelims}[2]% + {% + \def\LWRnicearrayrightdelim{\right#2}% + \left#1% + \LWRnicearraywithdelimtwo% + }% + {\end{array}\LWRnicearrayrightdelim}% +} +% \end{macrocode} +% +% Instances of specific delimiters: +% \begin{macrocode} +\CustomizeMathJax{% + \newenvironment{pNiceArray} + {\begin{NiceArrayWithDelims}{(}{)}} + {\end{NiceArrayWithDelims}} +} + +\CustomizeMathJax{% + \newenvironment{bNiceArray} + {\begin{NiceArrayWithDelims}{[}{]}} + {\end{NiceArrayWithDelims}} +} + +\CustomizeMathJax{% + \newenvironment{BNiceArray} + {\begin{NiceArrayWithDelims}{\{}{\}}} + {\end{NiceArrayWithDelims}} +} + +\CustomizeMathJax{% + \newenvironment{vNiceArray} + {\begin{NiceArrayWithDelims}{\vert}{\vert}} + {\end{NiceArrayWithDelims}} +} + +\CustomizeMathJax{% + \newenvironment{VNiceArray} + {\begin{NiceArrayWithDelims}{\Vert}{\Vert}} + {\end{NiceArrayWithDelims}} +} +% \end{macrocode} +% +% Ignore optional arg and use standard environments: +% \begin{macrocode} +\CustomizeMathJax{\newenvironment{NiceMatrix}[1][]{\begin{matrix}}{\end{matrix}}} +\CustomizeMathJax{\newenvironment{pNiceMatrix}[1][]{\begin{pmatrix}}{\end{pmatrix}}} +\CustomizeMathJax{\newenvironment{bNiceMatrix}[1][]{\begin{bmatrix}}{\end{bmatrix}}} +\CustomizeMathJax{\newenvironment{BNiceMatrix}[1][]{\begin{Bmatrix}}{\end{Bmatrix}}} +\CustomizeMathJax{\newenvironment{vNiceMatrix}[1][]{\begin{vmatrix}}{\end{vmatrix}}} +\CustomizeMathJax{\newenvironment{VNiceMatrix}[1][]{\begin{Vmatrix}}{\end{Vmatrix}}} +% \end{macrocode} +% +% Ignore optional argument and size. Print contents. +% \begin{macrocode} +\CustomizeMathJax{\newcommand{\LWRnicematrixBlock}[1]{#1}} +\CustomizeMathJax{\def\LWRnicematrixBlockopt<#1>#2{#2}} + +\CustomizeMathJax{% + \newcommand{\Block}[2][]{\ifnextchar<\LWRnicematrixBlockopt\LWRnicematrixBlock}% +} +% \end{macrocode} +% +% Form an approximation: +% \begin{macrocode} +\CustomizeMathJax{% + \newcommand{\diagbox}[2]{% + \begin{array}{l}\hfill\quad#2\\\hline#1\quad\hfill\end{array}% + }% +} +% \end{macrocode} +% +% More approximations: +% \begin{macrocode} +\CustomizeMathJax{\let\hdottedline\hdashline} + +\CustomizeMathJax{\newcommand{\ldots}[1][]{\dots}} +\CustomizeMathJax{\newcommand{\Cdots}[1][]{\cdots}} +\CustomizeMathJax{\newcommand{\Vdots}[1][]{\vdots}} +\CustomizeMathJax{\newcommand{\Ddots}[1][]{\ddots}} +\CustomizeMathJax{\newcommand{\Iddots}[1][]{\mathinner{\unicode{x22F0}}}} + +\CustomizeMathJax{\newcommand{\Hdotsfor}[1]{\ldots}} +\CustomizeMathJax{\newcommand{\Vdotsfor}[1]{\vdots}} +% \end{macrocode} +% +% There is no way to emulate \env{AutoNiceMatrix} in \brand{MathJax}. +% \begin{macrocode} +\CustomizeMathJax{\newcommand{\AutoNiceMatrix}[2]{\text{(AutoNiceMatrix #1)}}} +\CustomizeMathJax{\let\pAutoNiceMatrix\AutoNiceMatrix} +\CustomizeMathJax{\let\bAutoNiceMatrix\AutoNiceMatrix} +\CustomizeMathJax{\let\BAutoNiceMatrix\AutoNiceMatrix} +\CustomizeMathJax{\let\vAutoNiceMatrix\AutoNiceMatrix} +\CustomizeMathJax{\let\VAutoNiceMatrix\AutoNiceMatrix} +\end{warpMathJax} +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% % % \iffalse %<*noitcrul> @@ -72071,11 +72393,12 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % emulated for \brand{MathJax}. % % \changes{v0.80}{2020/02/17}{\pkg{rmathbr}: Added.} +% \changes{v0.894}{2020/12/16}{\pkg{rmathbr}: Updated to v1.1.} % % \codehtml % % \begin{macrocode} -\LWR@ProvidesPackagePass{rmathbr}[2016/04/10] +\LWR@ProvidesPackagePass{rmathbr}[2020/12/11] % \end{macrocode} % % \begin{macrocode} diff --git a/macros/latex/contrib/lwarp/lwarp.ins b/macros/latex/contrib/lwarp/lwarp.ins index fe88e1a170..22bd7d3004 100644 --- a/macros/latex/contrib/lwarp/lwarp.ins +++ b/macros/latex/contrib/lwarp/lwarp.ins @@ -347,6 +347,7 @@ version 2005/12/01 or later. \file{lwarp-nfssext-cfr.sty}{\from{lwarp.dtx}{nfssext-cfr}} \file{lwarp-nicefrac.sty}{\from{lwarp.dtx}{nicefrac}} \file{lwarp-niceframe.sty}{\from{lwarp.dtx}{niceframe}} +\file{lwarp-nicematrix.sty}{\from{lwarp.dtx}{nicematrix}} \file{lwarp-noitcrul.sty}{\from{lwarp.dtx}{noitcrul}} \file{lwarp-nolbreaks.sty}{\from{lwarp.dtx}{nolbreaks}} \file{lwarp-nomencl.sty}{\from{lwarp.dtx}{nomencl}} diff --git a/macros/latex/contrib/lwarp/lwarp.pdf b/macros/latex/contrib/lwarp/lwarp.pdf index 9a42a92b6a..5f5cf08adf 100644 Binary files a/macros/latex/contrib/lwarp/lwarp.pdf and b/macros/latex/contrib/lwarp/lwarp.pdf differ diff --git a/macros/latex/contrib/lwarp/lwarpmk.lua b/macros/latex/contrib/lwarp/lwarpmk.lua index 74e6a91dc4..ce441dfd01 100755 --- a/macros/latex/contrib/lwarp/lwarpmk.lua +++ b/macros/latex/contrib/lwarp/lwarpmk.lua @@ -2,7 +2,7 @@ -- Copyright 2016-2020 Brian Dunn -printversion = "v0.893" +printversion = "v0.894" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () diff --git a/macros/luatex/generic/chinese-jfm/LICENSE b/macros/luatex/generic/chinese-jfm/LICENSE new file mode 100644 index 0000000000..01171f681d --- /dev/null +++ b/macros/luatex/generic/chinese-jfm/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 ListLee + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/macros/luatex/generic/chinese-jfm/README.md b/macros/luatex/generic/chinese-jfm/README.md new file mode 100644 index 0000000000..e105609705 --- /dev/null +++ b/macros/luatex/generic/chinese-jfm/README.md @@ -0,0 +1,57 @@ +# 中文使用的 luatexja JFM 文件 + +为中文编写的 luatexja JFM 文件,提供全角、半角、开明三种风格,适用于简繁中文及日文字体的横直排。 + +## 使用方法 + +luatexja 可以使用 `/` 来调用 JFM 特性,语法为 `JFM=/{}` 。受北川宏典先生的 [fork 版本](https://github.com/h-kitagawa/ChineseJFM/tree/combine)的影响,所有风格的 JFM 被整合进一个文件内,使用 JFM 特性调用。 + +### 特性一览 + +* `quanjiao`、`banjiao`、`kaiming` + + 最基础的三种特性,即「全角」「半角」与「开明」。此三特性**必须**选择其中一种。 + +* `vert` + + 直排特性,在直排时必须使用。 + +* `hwcl` + + 半宽冒号特性,仅 zh_CN 拥有,必须在直排下使用。适用于部分竖排时冒号只占半宽的字体。 + +* `prop` + + 比例宽度特性,仅 ja_JP 拥有。适用于日文的比例假名字体。 + +## 挤压顺序 + +JFM 文件中同时增加了 `priority` 的设置,配合 luatexja-adjust 包,可以进行有优先顺序的标点挤压。挤压顺序如下: + +* 最优先挤压引号、括号前后与间隔号两边的空格; + +* 其次挤压顿号、逗号、冒号、分号后的空格; + +* 最后挤压句号、问号、叹号后的空格。 + +* 如果进行上述挤压后,仍无法达到行长要求,最后才会进行字间字距调整。 + +\**注:以上对标点空白的描述是针对于简体中文的。对于标点置中的繁体中文,以上调整顺序仍然适用。但此时除括号外,可调整的空白变为标点两边的空白。全宽标点无空白可调整的,不作调整。* + +以上挤压规则是针对于全角风格的标点调整。对于半角与开明这种标点风格,若以「挤压」理解,顺序仍相同,但直观性就有所欠缺。事实上,JFM 文件中的标点是沿袭铅字与 InDesign 的习惯,认为标点只占半宽,全宽标点是半宽标点加上半宽空格的结果。因此上述规则在半宽标点的前提下应描述为: + +* 最先给句号、问号、叹号插空; + +* 其次添加顿号、逗号、冒号、分号后空格; + +* 最后调整引号、括号前后与间隔号两边的空格; + +* 如果进行上述调整后,仍无法达到行长要求,最后才会进行字间字距调整。 + +「加法式」的标点调整,更加直观,也更容易理解。 + +## 修改说明 + +* v1.0.0 + + 初次发布至 CTAN。 diff --git a/macros/luatex/generic/chinese-jfm/jfm-ja_JP.lua b/macros/luatex/generic/chinese-jfm/jfm-ja_JP.lua new file mode 100644 index 0000000000..5be752863c --- /dev/null +++ b/macros/luatex/generic/chinese-jfm/jfm-ja_JP.lua @@ -0,0 +1,297 @@ +-- Chinese JFM for Japanese fonts (ja_JP) +-- v1.0.0 + +local is_vt, is_qj, is_bj, is_km, is_prop + +if luatexja.jfont.jfm_feature then + is_vt = luatexja.jfont.jfm_feature.vert + is_qj = luatexja.jfont.jfm_feature.quanjiao + is_bj = luatexja.jfont.jfm_feature.banjiao + is_km = luatexja.jfont.jfm_feature.kaiming + is_prop = luatexja.jfont.jfm_feature.prop +end + +if + not ((is_qj and not (is_bj or is_km)) or (is_bj and not (is_qj or is_km)) or + (is_km and not (is_qj or is_bj))) + then + tex.error( + 'You must specify ONLY ONE feature among "quanjiao", "banjiao" and ' .. + '"kaiming"' + ) +end + +local function aki(wd, pr, km) + -- 插入空白量 + local p = pr or 0 + return km and + (is_bj and {0, wd, 0, priority = {p, -p}} or + {wd, 0, wd, priority = {p, -p}}) or + (is_qj and {wd, 0, wd, priority = {p, -p}} or + {0, wd, 0, priority = {p, -p}}) +end + +luatexja.jfont.define_jfm { + version = 3, + dir = is_vt and 'tate' or 'yoko', + zw = 1, + zh = 1, + kanjiskip = {0.0, 0.25, 0}, + xkanjiskip = {0.25, 0.25, 0.125}, + [0] = { + align = 'middle', + left = 0, + down = 0, + width = is_prop and 'prop' or 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [22] = aki(0.25), + [3] = aki(0.25, -1) + }, + round_threshold = 0.01 + }, + [1] = { + -- 开括号 + chars = { + '‘', + '“', + '〈', + '《', + '「', + '『', + '【', + '〔', + '〖', + '〘', + '〝', + '(', + '[', + '{', + '⦅' + }, + align = 'right', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [22] = aki(0.25), + [3] = aki(0.25, -1) + } + }, + [2] = { + -- 闭括号 + chars = { + '’', + '”', + '〉', + '》', + '」', + '』', + '】', + '〕', + '〗', + '〙', + '〞', + '〟', + ')', + ']', + '}', + '⦆' + }, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5, -1), + [1] = aki(0.5, -1), + [22] = aki(0.5, -1), + [3] = aki(0.5, -1), + [5] = aki(0.5, -1), + [51] = aki(0.5, -1), + [52] = aki(0.5, -1) + } + }, + [21] = { + -- 逗号、顿号 + chars = {'、', ','}, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5), + [1] = aki(0.5), + [22] = aki(0.5), + [3] = aki(0.5), + [5] = aki(0.5), + [51] = aki(0.5), + [52] = aki(0.5) + } + }, + [22] = { + -- 冒号、分号 + chars = {':', ';'}, + align = 'middle', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.25), + [1] = aki(0.5), + [2] = aki(0.25), + [21] = aki(0.25), + [22] = aki(0.5), + [3] = aki(0.5, -1), + [4] = aki(0.25), + [41] = aki(0.25), + [5] = aki(0.25) + } + }, + [3] = { + -- 间隔号 + chars = {'・', '·'}, + align = 'middle', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.25, -1), + [1] = aki(0.5, -1), + [2] = aki(0.25, -1), + [21] = aki(0.25, -1), + [22] = aki(0.5, -1), + [3] = aki(0.5, -1), + [4] = aki(0.25, -1), + [41] = aki(0.25, -1), + [5] = aki(0.25, -1) + } + }, + [4] = { + -- 句号 + chars = {'。', '.'}, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5, 1, true), + [1] = aki(0.5, 1, true), + [22] = aki(0.5, 1, true), + [3] = aki(0.5, 1, true), + [5] = aki(0.5, 1, true), + [51] = aki(0.5, 1, true), + [52] = aki(0.5, 1, true) + } + }, + [41] = { + -- 叹号、问号 + chars = {'!', '?', '‼', '⁇', '⁈', '⁉'}, + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [22] = aki(0.25), + [3] = aki(0.25, -1) + } + }, + [5] = { + -- 一字线、省略号、波浪线 + chars = { + '—', -- U+2014 + '―', -- U+2015 + '‥', + '…', + '〜', -- U+301C + '~' -- U+FF5E + }, + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [22] = aki(0.25), + [3] = aki(0.25, -1) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [51] = { + -- U+2E3A TWO-EM DASH + chars = {'⸺'}, + align = 'middle', + left = 0, + down = 0, + width = 2, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [22] = aki(0.25), + [3] = aki(0.25, -1) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [52] = { + -- U+2E3B THREE-EM DASH + chars = {'⸻'}, + align = 'middle', + left = 0, + down = 0, + width = 3, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [22] = aki(0.25), + [3] = aki(0.25, -1) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [6] = { + -- box end + chars = {'boxbdd', 'parbdd', 'glue'} + } +} diff --git a/macros/luatex/generic/chinese-jfm/jfm-zh_CN.lua b/macros/luatex/generic/chinese-jfm/jfm-zh_CN.lua new file mode 100644 index 0000000000..fc707eaab6 --- /dev/null +++ b/macros/luatex/generic/chinese-jfm/jfm-zh_CN.lua @@ -0,0 +1,311 @@ +-- Chinese JFM for Simplified Chinese fonts (zh_CN) +-- v1.0.0 + +local is_vt, is_qj, is_bj, is_km, is_hwcl + +if luatexja.jfont.jfm_feature then + is_vt = luatexja.jfont.jfm_feature.vert + is_qj = luatexja.jfont.jfm_feature.quanjiao + is_bj = luatexja.jfont.jfm_feature.banjiao + is_km = luatexja.jfont.jfm_feature.kaiming + is_hwcl = luatexja.jfont.jfm_feature.hwcl +end + +if is_hwcl then + if not is_vt then + tex.error('JFM feature "hwcl" can only be used in vertical mode') + end +end + +if + not ((is_qj and not (is_bj or is_km)) or (is_bj and not (is_qj or is_km)) or + (is_km and not (is_qj or is_bj))) + then + tex.error( + 'You must specify ONLY ONE feature among "quanjiao", "banjiao" and ' .. + '"kaiming"' + ) +end + +local function aki(wd, pr, km) + -- 插入空白量 + local p = pr or 0 + return km and + (is_bj and {0, wd, 0, priority = {p, -p}} or + {wd, 0, wd, priority = {p, -p}}) or + (is_qj and {wd, 0, wd, priority = {p, -p}} or + {0, wd, 0, priority = {p, -p}}) +end + +luatexja.jfont.define_jfm { + version = 3, + dir = is_vt and 'tate' or 'yoko', + zw = 1, + zh = 1, + kanjiskip = {0.0, 0.25, 0}, + xkanjiskip = {0.25, 0.25, 0.125}, + [0] = { + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [3] = aki(0.25, -1) + }, + round_threshold = 0.01 + }, + [1] = { + -- 开括号 + chars = { + '‘', + '“', + '〈', + '《', + '「', + '『', + '【', + '〔', + '〖', + '〘', + '〝', + '(', + '[', + '{', + '⦅' + }, + align = 'right', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [3] = aki(0.25, -1) + } + }, + [2] = { + -- 闭括号 + chars = { + '’', + '”', + '〉', + '》', + '」', + '』', + '】', + '〕', + '〗', + '〙', + '〞', + '〟', + ')', + ']', + '}', + '⦆' + }, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5, -1), + [1] = aki(0.5, -1), + [3] = aki(0.5, -1), + [5] = aki(0.5, -1), + [51] = aki(0.5, -1), + [52] = aki(0.5, -1) + } + }, + [21] = { + -- 逗号、顿号 + chars = {'、', ','}, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5), + [1] = aki(0.5), + [3] = aki(0.5), + [5] = aki(0.5), + [51] = aki(0.5), + [52] = aki(0.5) + } + }, + [22] = { + -- 冒号、分号 + chars = {':', ';'}, + align = 'left', + left = 0, + down = 0, + width = is_vt and (is_hwcl and 0.5 or 1) or 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = is_vt and (is_hwcl and aki(0.5) or {}) or aki(0.5), + [1] = is_vt and (is_hwcl and aki(0.5) or {}) or aki(0.5), + [3] = is_vt and (is_hwcl and aki(0.5) or aki(0.25, 1)) or aki(0.5), + [5] = is_vt and (is_hwcl and aki(0.5) or {}) or aki(0.5), + [51] = is_vt and (is_hwcl and aki(0.5) or {}) or aki(0.5), + [52] = is_vt and (is_hwcl and aki(0.5) or {}) or aki(0.5) + } + }, + [3] = { + -- 间隔号 + chars = {'・', '·'}, + align = 'middle', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.25, -1), + [1] = aki(0.5, -1), + [2] = aki(0.25, -1), + [21] = aki(0.25, -1), + [22] = aki(0.25, -1), + [3] = aki(0.5, -1), + [4] = aki(0.25, -1), + [41] = aki(0.25, -1), + [42] = aki(0.25, -1), + [5] = aki(0.25, -1) + } + }, + [4] = { + -- 句号 + chars = {'。', '.'}, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5, 1, true), + [1] = aki(0.5, 1, true), + [3] = aki(0.5, 1, true), + [5] = aki(0.5, 1, true), + [51] = aki(0.5, 1, true), + [52] = aki(0.5, 1, true) + } + }, + [41] = { + -- 叹号、问号 + chars = {'!', '?'}, + align = is_vt and 'middle' or 'left', + left = 0, + down = 0, + width = is_vt and 1 or 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = is_vt and {} or aki(0.5, 1, true), + [1] = is_vt and {} or aki(0.5, 1, true), + [3] = is_vt and aki(0.25, -1) or aki(0.5, 1, true), + [5] = is_vt and {} or aki(0.5, 1, true), + [51] = is_vt and {} or aki(0.5, 1, true), + [52] = is_vt and {} or aki(0.5, 1, true) + } + }, + [42] = { + -- 复合/连用叹号问号 + chars = {'‼', '⁇', '⁈', '⁉'}, + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [3] = aki(0.25, -1) + } + }, + [5] = { + -- 一字线、省略号、波浪线 + chars = { + '—', -- U+2014 + '―', -- U+2015 + '‥', + '…', + '〜', -- U+301C + '~' -- U+FF5E + }, + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [3] = aki(0.25, -1) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [51] = { + -- U+2E3A TWO-EM DASH + chars = {'⸺'}, + align = 'middle', + left = 0, + down = 0, + width = 2, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [3] = aki(0.25, -1) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [52] = { + -- U+2E3B THREE-EM DASH + chars = {'⸻'}, + align = 'middle', + left = 0, + down = 0, + width = 3, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [3] = aki(0.25, -1) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [6] = { + -- box end + chars = {'boxbdd', 'parbdd', 'glue'} + } +} diff --git a/macros/luatex/generic/chinese-jfm/jfm-zh_TW.lua b/macros/luatex/generic/chinese-jfm/jfm-zh_TW.lua new file mode 100644 index 0000000000..90db78939e --- /dev/null +++ b/macros/luatex/generic/chinese-jfm/jfm-zh_TW.lua @@ -0,0 +1,333 @@ +-- Chinese JFM for Traditional Chinese fonts (zh_TW) +-- v1.0.0 + +local is_vt, is_qj, is_bj, is_km + +if luatexja.jfont.jfm_feature then + is_vt = luatexja.jfont.jfm_feature.vert + is_qj = luatexja.jfont.jfm_feature.quanjiao + is_bj = luatexja.jfont.jfm_feature.banjiao + is_km = luatexja.jfont.jfm_feature.kaiming +end + +if + not ((is_qj and not (is_bj or is_km)) or (is_bj and not (is_qj or is_km)) or + (is_km and not (is_qj or is_bj))) + then + tex.error( + 'You must specify ONLY ONE feature among "quanjiao", "banjiao" and ' .. + '"kaiming"' + ) +end + +local function aki(wd, pr, km) + -- 插入空白量 + local p = pr or 0 + return km and + (is_bj and {0, wd, 0, priority = {p, -p}} or + {wd, 0, wd, priority = {p, -p}}) or + (is_qj and {wd, 0, wd, priority = {p, -p}} or + {0, wd, 0, priority = {p, -p}}) +end + +luatexja.jfont.define_jfm { + version = 3, + dir = is_vt and 'tate' or 'yoko', + zw = 1, + zh = 1, + kanjiskip = {0.0, 0.25, 0}, + xkanjiskip = {0.25, 0.25, .125}, + [0] = { + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, 1, true) + }, + round_threshold = 0.01 + }, + [1] = { + -- 开括号 + chars = { + '‘', + '“', + '〈', + '《', + '「', + '『', + '【', + '〔', + '〖', + '〘', + '〝', + '(', + '[', + '{', + '⦅' + }, + align = 'right', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, 1, true) + } + }, + [2] = { + -- 闭括号 + chars = { + '’', + '”', + '〉', + '》', + '」', + '』', + '】', + '〕', + '〗', + '〙', + '〞', + '〟', + ')', + ']', + '}', + '⦆' + }, + align = 'left', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.5, -1), + [1] = aki(0.5, -1), + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, 1, true), + [5] = aki(0.25, -1), + [51] = aki(0.25, -1), + [52] = aki(0.25, -1) + } + }, + [21] = { + -- 逗号、顿号 + chars = {'、', ','}, + align = 'middle', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.25), + [1] = aki(0.25), + [2] = aki(0.25), + [21] = aki(0.5), + [22] = is_vt and aki(0.5) or aki(0.25), + [3] = aki(0.5, -1), + [4] = is_qj and {0.5, 0, 0.5, priority = {1, -1}} or + (is_bj and {0, 0.5, 0, priority = {1, -1}} or + {0.25, 0.25, 0.25, priority = {1, -1}}), + [41] = aki(0.25), + [5] = aki(0.25), + [51] = aki(0.25), + [52] = aki(0.25) + } + }, + [22] = { + -- 冒号、分号 + chars = {':', ';'}, + align = 'middle', + left = 0, + down = 0, + width = is_vt and 1 or 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = is_vt and {} or aki(0.25), + [1] = is_vt and {} or aki(0.25), + [2] = is_vt and {} or aki(0.25), + [21] = is_vt and aki(0.25) or aki(0.5), + [22] = is_vt and {} or aki(0.5), + [3] = is_vt and aki(0.25, -1) or aki(0.5, -1), + [4] = is_vt and aki(0.25, 1, true) or + (is_qj and {0.5, 0, 0.5, priority = {1, -1}} or + (is_bj and {0, 0.5, 0, priority = {1, -1}} or + {0.25, 0.25, 0.25, priority = {1, -1}})), + [41] = is_vt and {} or aki(0.25), + [5] = is_vt and {} or aki(0.25), + [51] = is_vt and {} or aki(0.25), + [52] = is_vt and {} or aki(0.25) + } + }, + [3] = { + -- 间隔号 + chars = {'・', '·'}, + align = 'middle', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.25, -1), + [1] = aki(0.25, -1), + [2] = aki(0.25, -1), + [21] = aki(0.5, -1), + [22] = is_vt and aki(0.25, -1) or aki(0.5, -1), + [3] = aki(0.5, 1), + [4] = is_qj and {0.5, 0, 0.5, priority = {1, -1}} or + (is_bj and {0, 0.5, 0, priority = {1, -1}} or + {0.25, 0.25, 0.25, priority = {1, -1}}), + [41] = aki(0.25, -1), + [5] = aki(0.25, -1), + [51] = aki(0.25, -1), + [52] = aki(0.25, -1) + } + }, + [4] = { + -- 句号 + chars = {'。', '.'}, + align = 'middle', + left = 0, + down = 0, + width = 0.5, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [0] = aki(0.25, 1, true), + [1] = aki(0.25, 1, true), + [2] = aki(0.25, 1, true), + [21] = aki(0.5, 1, true), + [22] = is_vt and aki(0.25, 1, true) or aki(0.5, 1, true), + [3] = is_qj and {0.5, 0, 0.5, priority = {1, -1}} or + (is_bj and {0, 0.5, 0, priority = {1, -1}} or + {0.25, 0.25, 0.25, priority = {1, -1}}), + [4] = is_qj and {0.5, 0, 0.5, priority = {1, -1}} or + (is_bj and {0, 0.5, 0, priority = {1, -1}} or + {0.25, 0.25, 0.25, priority = {1, -1}}), + [41] = aki(0.25, 1, true), + [5] = aki(0.25, 1, true), + [51] = aki(0.25, 1, true), + [52] = aki(0.25, 1, true) + } + }, + [41] = { + -- 问号、感叹号 + chars = {'?', '!', '‼', '⁇', '⁈', '⁉'}, + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, 1, true) + } + }, + [5] = { + -- 一字线、省略号、波浪线 + chars = { + '—', -- U+2014 + '―', -- U+2015 + '‥', + '…', + '〜', -- U+301C + '~' -- U+FF5E + }, + align = 'middle', + left = 0, + down = 0, + width = 1, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, -1, true) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [51] = { + -- U+2E3A TWO-EM DASH + chars = {'⸺'}, + align = 'middle', + left = 0, + down = 0, + width = 2, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, -1, true) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [52] = { + -- U+2E3B THREE-EM DASH + chars = {'⸻'}, + align = 'middle', + left = 0, + down = 0, + width = 3, + height = is_vt and 0.5 or 0.88, + depth = is_vt and 0.5 or 0.12, + italic = 0, + glue = { + [1] = aki(0.5, -1), + [21] = aki(0.25), + [22] = is_vt and {} or aki(0.25), + [3] = aki(0.25, -1), + [4] = aki(0.25, -1, true) + }, + kern = { + [5] = 0, + [51] = 0, + [52] = 0 + } + }, + [6] = { + -- box end + chars = {'boxbdd', 'parbdd', 'glue'} + } +} -- cgit v1.2.3