summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-14 22:20:59 +0000
committerKarl Berry <karl@freefriends.org>2011-09-14 22:20:59 +0000
commit212490225178a301cd0756b00c5f85d64952e409 (patch)
tree7754d0177d5c780b19e8eee8a3b03a02b2c50f6f
parent5555ff2ea4569008e29412e2e5eac0b264483855 (diff)
lualatex-math post-0.1 (14sep11)
git-svn-id: svn://tug.org/texlive/trunk@23953 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/Makefile23
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/README19
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/lualatex-math.pdfbin227656 -> 258450 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/phst-doc.cls556
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/test-amsmath.tex78
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma-unicode.tex209
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma.tex207
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-alloc.tex241
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-style.tex (renamed from Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel.tex)84
-rw-r--r--Master/texmf-dist/doc/lualatex/lualatex-math/test-unicode.tex78
-rw-r--r--Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx421
-rw-r--r--Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins5
-rw-r--r--Master/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.sty58
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
14 files changed, 1894 insertions, 86 deletions
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/Makefile b/Master/texmf-dist/doc/lualatex/lualatex-math/Makefile
index 9415d2a148e..14c7e6d37bb 100644
--- a/Master/texmf-dist/doc/lualatex/lualatex-math/Makefile
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/Makefile
@@ -41,9 +41,10 @@ driver := $(name).ins
dest_sty := $(name).sty
dest_lua := $(name).lua
destination := $(dest_sty) $(dest_lua)
-tests := test-kernel test-amsmath test-unicode
+tests := test-kernel-alloc test-kernel-style test-amsmath test-unicode test-icomma test-icomma-unicode
tests_src := $(addsuffix .tex, $(tests))
tests_dest := $(addsuffix .pdf, $(tests))
+class := $(shell kpsewhich phst-doc.cls)
manual := $(name).pdf
auctex_style := $(name).el
index_src := $(name).idx
@@ -54,8 +55,17 @@ changes_src := $(name).glo
changes_dest := $(name).gls
changes_log := $(name).glg
changes_sty := gglo.ist
+tds_arch := $(name).tds.zip
+tds_root := texmf-dist
+tds_destdir := $(tds_root)/tex/$(branch)
+tds_docdir := $(tds_root)/doc/$(branch)
+tds_srcdir := $(tds_root)/source/$(branch)
+tds_dest := $(addprefix $(tds_destdir)/, $(destination))
+tds_doc := $(addprefix $(tds_docdir)/, $(manual))
+tds_source := $(addprefix $(tds_srcdir)/, $(source) $(driver))
+tds_files := $(tds_dest) $(tds_doc) $(tds_source)
ctan_arch := $(name).zip
-ctan_files := README MANIFEST Makefile $(source) $(driver) $(destination) $(test_src) $(manual) $(auctex_style)
+ctan_files := $(tds_arch) README MANIFEST Makefile $(source) $(driver) $(destination) $(test_src) $(class) $(manual) $(auctex_style)
all: $(destination) $(auctex_style)
@@ -95,8 +105,15 @@ $(manual): $(source) $(destination)
$(LATEX) $(LATEXFLAGS_DRAFT) $<
$(LATEX) $(LATEXFLAGS_FINAL) $<
+$(tds_destdir)/% $(tds_docdir)/% $(tds_srcdir)/%: %
+ $(INSTALL) -d $(dir $@)
+ $(INSTALL_DATA) $< $(dir $@)
+
+$(tds_arch): $(tds_files)
+ $(ZIP) -p $@ $^
+
$(ctan_arch): $(ctan_files)
- $(ZIP) $@ $^
+ $(ZIP) -j $@ $^
.PHONY: all check pdf complete ctan install install-pdf install-complete
.SUFFIXES:
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/README b/Master/texmf-dist/doc/lualatex/lualatex-math/README
index 95fe5c2b45f..76588f47012 100644
--- a/Master/texmf-dist/doc/lualatex/lualatex-math/README
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/README
@@ -1,9 +1,9 @@
The ``lualatex-math`` package
=============================
-This package patches a few commands of the LaTeX 2ε kernel and the ``amsmath``
-and ``mathtools`` packages to be more compatible with the LuaTeX engine. It is
-only meaningful if you compile your documents with LuaLaTeX.
+This package patches a few commands of the LaTeX 2ε kernel and the ``amsmath``,
+``mathtools`` and ``icomma`` packages to be more compatible with the LuaTeX
+engine. It is only meaningful if you compile your documents with LuaLaTeX.
License
@@ -23,10 +23,15 @@ TeX can find them. The documentation is contained in the file
To produce the runtime files from the Docstrip source, run ``make``. To
produce the PDF manual, run ``make pdf``. To produce and compile a few test
-files, run ``make check``. To install the runtime files in your home TEXMF
-tree, run ``make install``. To install the PDF manual in your home TEXMF tree,
-run ``make install-pdf``. The package includes an AucTeX style file which will
-be installed in ``~/.emacs.d``.
+files, run ``make check``. To compile the manual you’ll need my `custom
+documentation class`_.
+
+To install the runtime files in your home TEXMF tree, run ``make install``. To
+install the PDF manual in your home TEXMF tree, run ``make install-pdf``. The
+package includes an AucTeX style file which will be installed in
+``~/.emacs.d``.
+
+.. _custom documentation class: https://github.com/phst/phst-doc
Usage
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/lualatex-math.pdf b/Master/texmf-dist/doc/lualatex/lualatex-math/lualatex-math.pdf
index f14febac606..84686f58f99 100644
--- a/Master/texmf-dist/doc/lualatex/lualatex-math/lualatex-math.pdf
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/lualatex-math.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/phst-doc.cls b/Master/texmf-dist/doc/lualatex/lualatex-math/phst-doc.cls
new file mode 100644
index 00000000000..93ea6c717f7
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/phst-doc.cls
@@ -0,0 +1,556 @@
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{etex}
+\RequirePackage{expl3}
+\ProvidesExplClass{phst-doc}{2011/07/03}{0.1}{Documentation class for Philipp Stephani's packages}
+\LoadClassWithOptions{ltxdoc}
+\RequirePackage{xparse}
+\RequirePackage{etoolbox}
+\RequirePackage{amsmath}
+\RequirePackage{amsfonts}
+\RequirePackage{mathtools}
+
+\luatex_if_engine:TF {
+ \RequirePackage{fontspec}
+ \RequirePackage{lualatex-math}
+} {
+ \RequirePackage{lmodern}
+ \RequirePackage{textcomp}
+ \RequirePackage[T5, T1]{fontenc}
+ \RequirePackage[utf8]{inputenc}
+}
+
+\RequirePackage{xspace}
+\RequirePackage[includemp=true, hmargin=20mm, vmargin=35mm, marginparwidth=40mm]{geometry}
+\RequirePackage{xcolor}
+\RequirePackage{graphicx}
+\RequirePackage{booktabs}
+\RequirePackage{csquotes}
+\RequirePackage{hologo}
+\RequirePackage{microtype}[2011/02/07]
+
+% The following line is a hack that prevents loading the thumbpdf package
+\tl_new:N \THB@name
+
+\RequirePackage{hypdoc}
+
+% fix bug in hologo package
+\cs_if_exist:cF { HOLOGO@ReflectBox@ \hologodriver } {
+ \tl_new:c { HOLOGO@ReflectBox@ \hologodriver }
+}
+
+% scratch variables
+\tl_new:N \l_phstdoc_tmpa_tl
+\tl_new:N \l_phstdoc_tmpb_tl
+
+% additional xspace exceptions
+\group_begin:
+\char_make_other:n { `\~ }
+\luatex_if_engine:TF {
+ \xspaceaddexceptions { ~ ’ }
+} {
+ \xspaceaddexceptions { ~ ^^e2 } % 0xE2 is the first UTF-8 octet of the right quote ’
+}
+\group_end:
+
+% non-monospaced URLs
+\urlstyle { same }
+
+% abbreviations
+\tl_new:Nn \eg { e.\,g.\@\xspace }
+\tl_new:Nn \ie { i.\,e.\@\xspace }
+\tl_new:Nn \etc { etc. \@\xspace }
+
+\cs_new_protected_nopar:Nn \phstdoc_print:n {
+ \protected@edef \l_phstdoc_tmpa_tl { #1 }
+ \tl_set_rescan:Nno \l_phstdoc_tmpb_tl {
+ \char_make_other:N \:
+ \char_make_other:N \_
+ } \l_phstdoc_tmpa_tl
+ \texttt { \l_phstdoc_tmpb_tl }
+}
+
+\NewDocumentCommand \mail {m} { \href{mailto:#1}{\nolinkurl{#1}} }
+\RenewDocumentCommand \cmd {m} { \cs { \cs_to_str:N #1 } }
+\RenewDocumentCommand \cs {m} {
+ \texttt { \char`\\ \phstdoc_print:n { #1 } }
+}
+\NewDocumentCommand \env {m} { \phstdoc_print:n{#1} }
+\definecolor { term } { rgb } { 0.22, 0.58, 0.09 }
+\NewDocumentCommand \term {m} { \textcolor{term}{\meta{#1}} }
+
+\pdfstringdefDisableCommands {
+ \cs_set_nopar:Npn \mail #1 { \tl_to_str:n { #1 } }
+}
+
+\luatex_if_engine:T {
+ \NewDocumentCommand \textlangle { } { 〈 }
+ \NewDocumentCommand \textrangle { } { 〉 }
+}
+
+% allow hyphenation in metavariables
+\RenewDocumentCommand \meta { m } {
+ \mode_if_math:TF { \nfss@text } { \use:n } {
+ \nobreak \skip_horizontal:N \c_zero_skip
+ \textlangle
+ \group_begin:
+ \meta@font@select
+ #1
+ \/
+ \group_end:
+ \textrangle
+ }
+}
+
+% allow line breaks before and after argument names
+\cs_new_protected_nopar:Nn \phstdoc_renew_arg_cmd:Nnn {
+ \RenewDocumentCommand #1 { m } {
+ \allowbreak
+ \texttt { #2 }
+ \meta { ##1 }
+ \texttt { #3 }
+ \allowbreak
+ }
+}
+\phstdoc_renew_arg_cmd:Nnn \marg {\{} {\}}
+\phstdoc_renew_arg_cmd:Nnn \oarg {[} {]}
+\phstdoc_renew_arg_cmd:Nnn \parg {(} {)}
+
+% indexing
+\tl_new:Nn \idxformat { \hdpindex{usage} }
+\NewDocumentCommand \docindex { o m } {
+ \@bsphack
+ \IfValueTF { #1 } {
+ \index{#1 \actualchar #2 \encapchar idxformat}
+ } {
+ \index{#2 \encapchar idxformat}
+ }
+ \@esphack
+}
+\cs_new_protected_nopar:Nn \phstdoc_object_index:nnnN {
+ \@bsphack
+ \index {
+ #3
+ \actualchar \string #4 { #3 } ~ (#1)
+ \encapchar idxformat
+ }
+ \index {
+ #2 :
+ \levelchar #3
+ \actualchar \string #4 { #3 }
+ \encapchar idxformat
+ }
+ \@esphack
+}
+\pdfstringdefDisableCommands {
+ \cs_set_eq:NN \phstdoc_object_index:nnnN \use_none:nnnn
+}
+
+% one-column index
+\RenewDocumentEnvironment { theindex } { } {
+ \index@prologue
+ \par
+ \addvspace \multicolsep
+ \IndexParms
+ \cs_set_eq:NN \item \@idxitem
+ \ignorespaces
+} { }
+
+% one-column change list
+\RenewDocumentEnvironment { theglossary } { } {
+ \glossary@prologue
+ \par
+ \addvspace \multicolsep
+ \GlossaryParms
+ \cs_set_eq:NN \item \@idxitem
+ \ignorespaces
+} { }
+
+% units
+% <singular name> <plural name> <ref cmd> <format cmd>
+\cs_new_protected_nopar:Nn \phstdoc_new_unit_type:nnNN {
+ \NewDocumentCommand #3 { m } {
+ #4 { ##1 }
+ \phstdoc_object_index:nnnN { #1 } { #2 } { ##1 } #4
+ }
+ \pdfstringdefDisableCommands {
+ \cs_set_eq:NN #3 \use:n
+ }
+}
+\cs_new_protected_nopar:Nn \phstdoc_new_unit_type:nNN {
+ \phstdoc_new_unit_type:nnNN { #1 } { #1 s } #2 #3
+}
+\phstdoc_new_unit_type:nnNN {class} {classes} \cls \textsf
+\phstdoc_new_unit_type:nNN {package} \pkg \textsf
+\phstdoc_new_unit_type:nNN {font} \fnt \textsf
+\phstdoc_new_unit_type:nNN {tool} \tool \texttt
+
+% definitions
+% <singular name> <plural name> <format cmd> <describe cmd>
+\cs_new_protected_nopar:Nn \phstdoc_new_definition_type:nnNN {
+ \NewDocumentCommand #4 { m } {
+ \leavevmode
+ \@bsphack
+ \marginpar {
+ \raggedleft
+ \PrintDescribeDefinition #3 { ##1 }
+ }
+ \SpecialDefinitionIndex { #1 } { #2 } #3 { ##1 }
+ \@esphack
+ \ignorespaces
+ }
+}
+\cs_new_protected_nopar:Nn \phstdoc_new_definition_type:nNN {
+ \phstdoc_new_definition_type:nnNN { #1 } { #1 s } #2 #3
+}
+\NewDocumentCommand \SpecialDefinitionIndex { m m m m } {
+ \@bsphack
+ \HD@target
+ \index {
+ #4
+ \actualchar \string #3 { #4 } ~ (#1)
+ \encapchar hdclindex{\the\c@HD@hypercount}{usage}
+ }
+ \index {
+ #2 :
+ \levelchar #4
+ \actualchar \string #3 { #4 }
+ \encapchar hdclindex{\the\c@HD@hypercount}{usage}
+ }
+ \@esphack
+}
+
+\phstdoc_new_definition_type:nNN { nonterminal~ symbol } \meta \DescribeNonterminal
+
+% members
+% <singular name> <plural name> <ref cmd> <describe cmd> <code env>
+\cs_new_protected_nopar:Nn \phstdoc_new_member_type:nnNNn {
+ \NewDocumentCommand #3 { m } {
+ \phstdoc_print:n { ##1 }
+ \phstdoc_object_index:nnnN { #1 } { #2 } { ##1 } \phstdoc_print:n
+ }
+ \pdfstringdefDisableCommands {
+ \cs_set_eq:NN #3 \use:n
+ }
+ \NewDocumentCommand #4 { } {
+ \leavevmode
+ \@bsphack
+ \group_begin:
+ \MakePrivateLetters
+ \phstdoc_describe_member:nnn { #1 } { #2 }
+ }
+ \NewDocumentEnvironment { #5 } { } {
+ \group_begin:
+ \MakePrivateLetters
+ \phstdoc_member_code:nnn { #1 } { #2 }
+ } {
+ \endtrivlist
+ }
+}
+\cs_new_protected_nopar:Nn \phstdoc_new_member_type:nNNn {
+ \phstdoc_new_member_type:nnNNn { #1 } { #1 s } #2 #3 { #4 }
+}
+\cs_new_protected_nopar:Nn \phstdoc_describe_member:nnn {
+ \group_end:
+ \marginpar {
+ \raggedleft
+ \PrintDescribeMember { #3 }
+ }
+ \SpecialMemberIndex { #1 } { #2 } { #3 }
+ \@esphack
+ \ignorespaces
+}
+
+\cs_new_protected_nopar:Nn \phstdoc_member_code:nnn {
+ \group_end:
+ \topsep = \MacroTopsep
+ \trivlist
+ \tl_set:Nx \saved@macroname { #3 }
+ \cs_set:Npn \makelabel ##1 { \llap { ##1 } }
+ \if@inlabel
+ \cs_set:Npx \makelabel ##1 {
+ \llap {
+ \vtop to \baselineskip {
+ \prg_replicate:nn { \macro@cnt } { \hbox{\strut} }
+ \hbox { ##1 }
+ \vss
+ }
+ }
+ }
+ \int_incr:N \macro@cnt
+ \else:
+ \int_set:Nn \macro@cnt { \c_one }
+ \fi:
+ \protected@edef \l_phstdoc_tmpa_tl {
+ \exp_not:N \item [ \exp_not:N \PrintMemberName { #3 } ]
+ }
+ \tl_use:N \l_phstdoc_tmpa_tl
+ \int_gincr:N \c@CodelineNo
+ \SpecialMainMemberIndex { #1 } { #2 } { #3 }
+ \nobreak
+ \int_gdecr:N \c@CodelineNo
+ \ignorespaces
+}
+\NewDocumentCommand \SpecialMainMemberIndex { m m m } {
+ \@bsphack
+ \special@index {
+ #3
+ \actualchar \string \phstdoc_print:n { #3 } ~ (#1)
+ \encapchar main
+ }
+ \special@index {
+ #2 :
+ \levelchar #3
+ \actualchar \string \phstdoc_print:n { #3 }
+ \encapchar main
+ }
+ \@esphack
+}
+\NewDocumentCommand \SpecialMemberIndex { m m m } {
+ \@bsphack
+ \HD@target
+ \index {
+ #3
+ \actualchar \phstdoc_print:n { #3 } ~ (#1)
+ \encapchar hdclindex{\the\c@HD@hypercount}{usage}
+ }
+ \index {
+ #2 :
+ \levelchar #3
+ \actualchar \phstdoc_print:n { #3 }
+ \encapchar hdclindex{\the\c@HD@hypercount}{usage}
+ }
+ \@esphack
+}
+
+\phstdoc_new_member_type:nNNn {message} \msg \DescribeMessage {l3message}
+\phstdoc_new_member_type:nNNn {option} \opt \DescribeOption {option}
+\phstdoc_new_member_type:nNNn {object~ type} \objtype \DescribeObjectType {l3objtype}
+\phstdoc_new_member_type:nNNn {template} \template \DescribeTemplate {l3template}
+\phstdoc_new_member_type:nNNn {instance} \instance \DescribeInstance {l3instance}
+\phstdoc_new_member_type:nNNn {variable} \var \DescribeVariable {variable}
+\phstdoc_new_member_type:nNNn {function} \func \DescribeFunction {function}
+
+% multiple macros in margin
+\NewDocumentCommand \DescribeMacros { } {
+ \leavevmode
+ \@bsphack
+ \group_begin:
+ \MakePrivateLetters
+ \phstdoc_describe_macros:n
+}
+\bool_new:N \l_phstdoc_first_bool
+\box_new:N \l_phstdoc_comma_box
+\cs_new_protected_nopar:Nn \phstdoc_describe_macros:n {
+ \group_end:
+ \marginpar {
+ \raggedleft
+ \hbox_set:Nn \l_phstdoc_comma_box { , ~ }
+ \bool_set_true:N \l_phstdoc_first_bool
+ \tl_map_inline:nn { #1 } {
+ \bool_if:NTF \l_phstdoc_first_bool {
+ \bool_set_false:N \l_phstdoc_first_bool
+ } {
+ \unskip
+ \discretionary { } { } { \box_use:N \l_phstdoc_comma_box }
+ }
+ \PrintDescribeMacro { ##1 }
+ }
+ }
+ \tl_map_function:nN { #1 } \SpecialUsageIndex
+ \@esphack
+ \ignorespaces
+}
+
+% product names
+\NewDocumentCommand \MiKTeX { } { MiK \TeX \xspace }
+\NewDocumentCommand \TeXLive { } { \TeX \nobreakspace Live \xspace }
+
+% persons
+\luatex_if_engine:TF {
+ \NewDocumentCommand \vietnamese { m } { #1 }
+} {
+ \NewDocumentCommand \vietnamese { m } {
+ \group_begin:
+ \fontencoding { T5 }
+ \selectfont
+ #1
+ \group_end:
+ }
+}
+\NewDocumentCommand \genname { o m m } {
+ #3
+ \docindex[#1]{#2}
+}
+\cs_new_nopar:Npn \nametext #1 #2 { #2 ~ #1 }
+\cs_new_nopar:Npn \nameindex #1 #2 { #1, ~ #2 }
+\NewDocumentCommand \name { m m } {
+ \genname {
+ \nameindex { #1 } { #2 }
+ } {
+ \nametext { #1 } { #2 }
+ }
+}
+\NewDocumentCommand \extname { m m m m m } {
+ \genname [ \nameindex { #3 } { #5 } ] {
+ #1 { \nameindex { #2 } { #4 } }
+ } {
+ #1 { \nametext { #2 } { #4 } }
+ }
+}
+\NewDocumentCommand \NewName { m m m } {
+ \NewDocumentCommand #1 { } { \name{#2}{#3} \xspace }
+}
+\NewDocumentCommand \NewExtName { m m m m m m } {
+ \NewDocumentCommand #1 { } { \extname{#2}{#3}{#4}{#5}{#6} \xspace }
+}
+\NewName \Knuth {Knuth} {Donald \nobreakspace E.}
+\NewName \Arseneau {Arseneau} {Donald}
+\NewName \Setzer {Setzer} {Nick}
+\NewName \Verna {Verna} {Didier}
+\NewName \Wilson {Wilson} {Peter}
+\NewName \Kohm {Kohm} {Markus}
+\NewName \Marvan {Marvan} {Michal}
+\NewName \Robertson {Robertson} {Will}
+\NewName \Breitfeld {Breitfeld} {Peter}
+\NewName \Hoekwater {Taco} {Hoekwater}
+\NewExtName \Hogholm {\use:n} {Høgholm} {Hogholm} {Morten} {Morten}
+\NewExtName \MPG {\use:n} {Pégourié-Gonnard} {Pegourie-Gonnard} {Manuel} {Manuel}
+\NewExtName \Thanh {\vietnamese} {Thành} {Thanh} {Hàn Thế} {Han The}
+
+% boldface, normal width
+\tl_new:Nn \bndefault { b }
+\NewDocumentCommand \bnseries { } { \fontseries\bndefault \selectfont }
+\DeclareTextFontCommand \textbn \bnseries
+
+% light condensed monospaced
+\tl_new:Nn \lcdefault { lc }
+\NewDocumentCommand \lcseries { } { \fontseries\lcdefault \selectfont }
+\RenewDocumentCommand \HDorg@PrintDescribeMacro { m } {
+ \strut
+ \MacroFont
+ \lcseries
+ \string #1
+ \tex_space:D
+}
+\RenewDocumentCommand \HDorg@PrintMacroName { m } {
+ \strut
+ \MacroFont
+ \lcseries
+ \string #1
+ \tex_space:D
+}
+\RenewDocumentCommand \PrintDescribeEnv { m } {
+ \strut
+ \MacroFont
+ \lcseries
+ #1
+ \tex_space:D
+}
+\RenewDocumentCommand \PrintEnvName { m } {
+ \strut
+ \MacroFont
+ \lcseries
+ #1
+ \tex_space:D
+}
+\NewDocumentCommand \PrintDescribeDefinition { m m } {
+ \strut
+ \HD@target
+ #1 { #2 }
+ \tex_space:D
+}
+\NewDocumentCommand \PrintDescribeMember { m } {
+ \strut
+ \HD@target
+ \MacroFont
+ \lcseries
+ #1
+ \tex_space:D
+}
+\NewDocumentCommand \PrintMemberName { m } {
+ \strut
+ \HD@target
+ \MacroFont
+ \lcseries
+ #1
+ \tex_space:D
+}
+\cs_set_nopar:Npn \HDorg@theCodelineNo {
+ \normalfont
+ \scriptsize
+ \color{darkgray}
+ \arabic{CodelineNo}
+}
+
+
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+
+\tl_put_right:Nn \IndexParms {
+ \RenewDocumentCommand \ttfamily { } {
+ \fontfamily\ttdefault
+ \fontseries\lcdefault
+ \selectfont
+ }
+ \ExplSyntaxNamesOn
+}
+
+\RenewDocumentCommand \MakePrivateLetters { } {
+ \makeatletter
+ \ExplSyntaxNamesOn
+}
+
+% special tables
+\NewDocumentCommand \tblhead { m } { \hfil \textbf{#1} \hfil }
+\NewDocumentCommand \tblmath { m } { \( #1 \vphantom{\underline{\overline{#1}}} \) }
+\NewDocumentEnvironment { doctable } { m o +m m } {
+ \table
+ \centering
+ \tabular{#4}
+ \toprule
+} {
+ \tabularnewline
+ \bottomrule
+ \endtabular
+ \IfValueTF { #2 } {
+ \caption[#2]{#3}
+ } {
+ \caption {#3}
+ }
+ \label{#1}
+ \endtable
+}
+\NewDocumentEnvironment { narrowtable } { } {
+ \setlength{\tabcolsep}{2pt}
+ \doctable
+} {
+ \enddoctable
+}
+\setlength{\tabcolsep}{5pt}
+
+% special figures
+\NewDocumentEnvironment { docfigure } { m o m } {
+ \figure
+ \centering
+} {
+ \IfValueTF { #2 } {
+ \caption[#2]{#3}
+ } {
+ \caption {#3}
+ }
+ \label{#1}
+ \endfigure
+}
+
+\luatex_if_engine:T {
+ \setmainfont { Latin~ Modern~ Roman }
+}
+
+\setcounter{IndexColumns}{2}
+\hypersetup{%
+ colorlinks=true,%
+ linkcolor=blue,%
+ pdfstartview=FitH%
+}
+\endinput
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/test-amsmath.tex b/Master/texmf-dist/doc/lualatex/lualatex-math/test-amsmath.tex
index b96f5e9dc87..944e94961a3 100644
--- a/Master/texmf-dist/doc/lualatex/lualatex-math/test-amsmath.tex
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/test-amsmath.tex
@@ -22,7 +22,9 @@
%%
\documentclass[pagesize=auto]{scrartcl}
\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
\msg_new:nnn { test } { pass } { #1 }
\cs_new_protected_nopar:Npn \test_pass:x #1 {
\msg_info:nnx { test } { pass } { #1 }
@@ -115,6 +117,82 @@
\NewDocumentCommand \AssertCrampedStyle { } {
\test_assert_cramped:Nx \int_if_odd_p:n { cramped }
}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
\ExplSyntaxOff
\usepackage{lualatex-math}
\newsavebox{\testbox}
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma-unicode.tex b/Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma-unicode.tex
new file mode 100644
index 00000000000..af097656cd4
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma-unicode.tex
@@ -0,0 +1,209 @@
+%%
+%% This is file `test-icomma-unicode.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lualatex-math.dtx (with options: `test,test-icomma-unicode')
+%%
+%% This is a generated file.
+%%
+%% Copyright 2011 by Philipp Stephani
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX version 2009/09/24 or later.
+%%
+\documentclass[pagesize=auto]{scrartcl}
+\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
+\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
+\msg_new:nnn { test } { pass } { #1 }
+\cs_new_protected_nopar:Npn \test_pass:x #1 {
+ \msg_info:nnx { test } { pass } { #1 }
+}
+\msg_new:nnn { test } { fail } { #1 }
+\cs_new_protected_nopar:Npn \test_fail:x #1 {
+ \msg_error:nnx { test } { fail } { #1 }
+}
+\cs_generate_variant:Nn \tl_const:Nn { Nx }
+\tl_const:Nx \c_test_equal_tl { \c_space_tl == \c_space_tl }
+\tl_const:Nx \c_test_not_equal_tl { \c_space_tl != \c_space_tl }
+\cs_new_protected_nopar:Npn \test_equal_pass:nxnx #1 #2 #3 #4 {
+ \test_pass:x {
+ \exp_not:n { #1 }
+ \c_test_equal_tl
+ #2
+ \c_test_equal_tl
+ #4
+ \c_test_equal_tl
+ \exp_not:n { #3 }
+ }
+}
+\cs_new_protected_nopar:Npn \test_equal_fail:nxnx #1 #2 #3 #4 {
+ \test_fail:x {
+ \exp_not:n { #1 }
+ \c_test_equal_tl
+ #2
+ \c_test_not_equal_tl
+ #4
+ \c_test_equal_tl
+ \exp_not:n { #3 }
+ }
+}
+\cs_new_protected_nopar:Npn
+\test_assert_equal:NNNNNnn #1 #2 #3 #4 #5 #6 #7 {
+ #1 #4 { #6 }
+ #1 #5 { #7 }
+ #3 { #4 } = { #5 } {
+ \test_equal_pass:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
+ } {
+ \test_equal_fail:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
+ }
+}
+\cs_generate_variant:Nn \test_assert_equal:NNNNNnn { ccccc }
+\cs_new_protected_nopar:Npn \test_assert_equal:nnn #1 #2 #3 {
+ \test_assert_equal:cccccnn
+ { #1 _set:Nn } { #1 _use:N } { #1 _compare:nNnTF }
+ { l_test_tmpa_ #1 } { l_test_tmpb_ #1 } { #2 } { #3 }
+}
+\int_new:N \l_test_tmpa_int
+\int_new:N \l_test_tmpb_int
+\NewDocumentCommand \AssertIntEqual { m m } {
+ \test_assert_equal:nnn { int } { #1 } { #2 }
+}
+\dim_new:N \l_test_tmpa_dim
+\dim_new:N \l_test_tmpb_dim
+\NewDocumentCommand \AssertDimEqual { m m } {
+ \test_assert_equal:nnn { dim } { #1 } { #2 }
+}
+\NewDocumentCommand \AssertMathStyle { m } {
+ \AssertIntEqual { \luatexmathstyle } { #1 }
+}
+\cs_new_protected_nopar:Npn \test_assert_cramped:Nx #1 #2 {
+ \int_set:Nn \l_test_tmpa_int { \luatexmathstyle }
+ \bool_if:nTF {
+ \int_compare_p:nNn { \l_test_tmpa_int } > { \c_minus_one }
+ &&
+ #1 { \l_test_tmpa_int }
+ } {
+ \test_pass:x {
+ \exp_not:N \luatexmathstyle
+ \c_test_equal_tl
+ \int_use:N \l_test_tmpa_int
+ \c_space_tl
+ is~ a~ #2~ style
+ }
+ } {
+ \test_fail:x {
+ \exp_not:N \luatexmathstyle
+ \c_test_equal_tl
+ \int_use:N \l_test_tmpa_int
+ \c_space_tl
+ is~ not~ a~ #2~ style
+ }
+ }
+}
+\NewDocumentCommand \AssertNoncrampedStyle { } {
+ \test_assert_cramped:Nx \int_if_even_p:n { non-cramped }
+}
+\NewDocumentCommand \AssertCrampedStyle { } {
+ \test_assert_cramped:Nx \int_if_odd_p:n { cramped }
+}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
+\ExplSyntaxOff
+\usepackage{unicode-math}[2011/05/05]
+\setmathfont{XITS Math}
+\usepackage{lualatex-math}
+\usepackage{icomma}
+\begin{document}
+$1,234 \; (x, y)$
+\AssertNoSpace{$1,234$}
+\AssertMuSpace{$(x, y)$}{\thinmuskip}
+\AssertIntEqual{\mathcomma}{"0C0002C}
+\end{document}
+\endinput
+%%
+%% End of file `test-icomma-unicode.tex'.
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma.tex b/Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma.tex
new file mode 100644
index 00000000000..037b05cb4a4
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma.tex
@@ -0,0 +1,207 @@
+%%
+%% This is file `test-icomma.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lualatex-math.dtx (with options: `test,test-icomma')
+%%
+%% This is a generated file.
+%%
+%% Copyright 2011 by Philipp Stephani
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX version 2009/09/24 or later.
+%%
+\documentclass[pagesize=auto]{scrartcl}
+\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
+\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
+\msg_new:nnn { test } { pass } { #1 }
+\cs_new_protected_nopar:Npn \test_pass:x #1 {
+ \msg_info:nnx { test } { pass } { #1 }
+}
+\msg_new:nnn { test } { fail } { #1 }
+\cs_new_protected_nopar:Npn \test_fail:x #1 {
+ \msg_error:nnx { test } { fail } { #1 }
+}
+\cs_generate_variant:Nn \tl_const:Nn { Nx }
+\tl_const:Nx \c_test_equal_tl { \c_space_tl == \c_space_tl }
+\tl_const:Nx \c_test_not_equal_tl { \c_space_tl != \c_space_tl }
+\cs_new_protected_nopar:Npn \test_equal_pass:nxnx #1 #2 #3 #4 {
+ \test_pass:x {
+ \exp_not:n { #1 }
+ \c_test_equal_tl
+ #2
+ \c_test_equal_tl
+ #4
+ \c_test_equal_tl
+ \exp_not:n { #3 }
+ }
+}
+\cs_new_protected_nopar:Npn \test_equal_fail:nxnx #1 #2 #3 #4 {
+ \test_fail:x {
+ \exp_not:n { #1 }
+ \c_test_equal_tl
+ #2
+ \c_test_not_equal_tl
+ #4
+ \c_test_equal_tl
+ \exp_not:n { #3 }
+ }
+}
+\cs_new_protected_nopar:Npn
+\test_assert_equal:NNNNNnn #1 #2 #3 #4 #5 #6 #7 {
+ #1 #4 { #6 }
+ #1 #5 { #7 }
+ #3 { #4 } = { #5 } {
+ \test_equal_pass:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
+ } {
+ \test_equal_fail:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
+ }
+}
+\cs_generate_variant:Nn \test_assert_equal:NNNNNnn { ccccc }
+\cs_new_protected_nopar:Npn \test_assert_equal:nnn #1 #2 #3 {
+ \test_assert_equal:cccccnn
+ { #1 _set:Nn } { #1 _use:N } { #1 _compare:nNnTF }
+ { l_test_tmpa_ #1 } { l_test_tmpb_ #1 } { #2 } { #3 }
+}
+\int_new:N \l_test_tmpa_int
+\int_new:N \l_test_tmpb_int
+\NewDocumentCommand \AssertIntEqual { m m } {
+ \test_assert_equal:nnn { int } { #1 } { #2 }
+}
+\dim_new:N \l_test_tmpa_dim
+\dim_new:N \l_test_tmpb_dim
+\NewDocumentCommand \AssertDimEqual { m m } {
+ \test_assert_equal:nnn { dim } { #1 } { #2 }
+}
+\NewDocumentCommand \AssertMathStyle { m } {
+ \AssertIntEqual { \luatexmathstyle } { #1 }
+}
+\cs_new_protected_nopar:Npn \test_assert_cramped:Nx #1 #2 {
+ \int_set:Nn \l_test_tmpa_int { \luatexmathstyle }
+ \bool_if:nTF {
+ \int_compare_p:nNn { \l_test_tmpa_int } > { \c_minus_one }
+ &&
+ #1 { \l_test_tmpa_int }
+ } {
+ \test_pass:x {
+ \exp_not:N \luatexmathstyle
+ \c_test_equal_tl
+ \int_use:N \l_test_tmpa_int
+ \c_space_tl
+ is~ a~ #2~ style
+ }
+ } {
+ \test_fail:x {
+ \exp_not:N \luatexmathstyle
+ \c_test_equal_tl
+ \int_use:N \l_test_tmpa_int
+ \c_space_tl
+ is~ not~ a~ #2~ style
+ }
+ }
+}
+\NewDocumentCommand \AssertNoncrampedStyle { } {
+ \test_assert_cramped:Nx \int_if_even_p:n { non-cramped }
+}
+\NewDocumentCommand \AssertCrampedStyle { } {
+ \test_assert_cramped:Nx \int_if_odd_p:n { cramped }
+}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
+\ExplSyntaxOff
+\usepackage{lualatex-math}
+\usepackage{icomma}
+\begin{document}
+$1,234 \; (x, y)$
+\AssertNoSpace{$1,234$}
+\AssertMuSpace{$(x, y)$}{\thinmuskip}
+\AssertIntEqual{\mathcomma}{"1C0003B}
+\end{document}
+\endinput
+%%
+%% End of file `test-icomma.tex'.
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-alloc.tex b/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-alloc.tex
new file mode 100644
index 00000000000..935cb274c81
--- /dev/null
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-alloc.tex
@@ -0,0 +1,241 @@
+%%
+%% This is file `test-kernel-alloc.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lualatex-math.dtx (with options: `test,test-kernel-alloc')
+%%
+%% This is a generated file.
+%%
+%% Copyright 2011 by Philipp Stephani
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX version 2009/09/24 or later.
+%%
+\documentclass[pagesize=auto]{scrartcl}
+\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
+\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
+\msg_new:nnn { test } { pass } { #1 }
+\cs_new_protected_nopar:Npn \test_pass:x #1 {
+ \msg_info:nnx { test } { pass } { #1 }
+}
+\msg_new:nnn { test } { fail } { #1 }
+\cs_new_protected_nopar:Npn \test_fail:x #1 {
+ \msg_error:nnx { test } { fail } { #1 }
+}
+\cs_generate_variant:Nn \tl_const:Nn { Nx }
+\tl_const:Nx \c_test_equal_tl { \c_space_tl == \c_space_tl }
+\tl_const:Nx \c_test_not_equal_tl { \c_space_tl != \c_space_tl }
+\cs_new_protected_nopar:Npn \test_equal_pass:nxnx #1 #2 #3 #4 {
+ \test_pass:x {
+ \exp_not:n { #1 }
+ \c_test_equal_tl
+ #2
+ \c_test_equal_tl
+ #4
+ \c_test_equal_tl
+ \exp_not:n { #3 }
+ }
+}
+\cs_new_protected_nopar:Npn \test_equal_fail:nxnx #1 #2 #3 #4 {
+ \test_fail:x {
+ \exp_not:n { #1 }
+ \c_test_equal_tl
+ #2
+ \c_test_not_equal_tl
+ #4
+ \c_test_equal_tl
+ \exp_not:n { #3 }
+ }
+}
+\cs_new_protected_nopar:Npn
+\test_assert_equal:NNNNNnn #1 #2 #3 #4 #5 #6 #7 {
+ #1 #4 { #6 }
+ #1 #5 { #7 }
+ #3 { #4 } = { #5 } {
+ \test_equal_pass:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
+ } {
+ \test_equal_fail:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
+ }
+}
+\cs_generate_variant:Nn \test_assert_equal:NNNNNnn { ccccc }
+\cs_new_protected_nopar:Npn \test_assert_equal:nnn #1 #2 #3 {
+ \test_assert_equal:cccccnn
+ { #1 _set:Nn } { #1 _use:N } { #1 _compare:nNnTF }
+ { l_test_tmpa_ #1 } { l_test_tmpb_ #1 } { #2 } { #3 }
+}
+\int_new:N \l_test_tmpa_int
+\int_new:N \l_test_tmpb_int
+\NewDocumentCommand \AssertIntEqual { m m } {
+ \test_assert_equal:nnn { int } { #1 } { #2 }
+}
+\dim_new:N \l_test_tmpa_dim
+\dim_new:N \l_test_tmpb_dim
+\NewDocumentCommand \AssertDimEqual { m m } {
+ \test_assert_equal:nnn { dim } { #1 } { #2 }
+}
+\NewDocumentCommand \AssertMathStyle { m } {
+ \AssertIntEqual { \luatexmathstyle } { #1 }
+}
+\cs_new_protected_nopar:Npn \test_assert_cramped:Nx #1 #2 {
+ \int_set:Nn \l_test_tmpa_int { \luatexmathstyle }
+ \bool_if:nTF {
+ \int_compare_p:nNn { \l_test_tmpa_int } > { \c_minus_one }
+ &&
+ #1 { \l_test_tmpa_int }
+ } {
+ \test_pass:x {
+ \exp_not:N \luatexmathstyle
+ \c_test_equal_tl
+ \int_use:N \l_test_tmpa_int
+ \c_space_tl
+ is~ a~ #2~ style
+ }
+ } {
+ \test_fail:x {
+ \exp_not:N \luatexmathstyle
+ \c_test_equal_tl
+ \int_use:N \l_test_tmpa_int
+ \c_space_tl
+ is~ not~ a~ #2~ style
+ }
+ }
+}
+\NewDocumentCommand \AssertNoncrampedStyle { } {
+ \test_assert_cramped:Nx \int_if_even_p:n { non-cramped }
+}
+\NewDocumentCommand \AssertCrampedStyle { } {
+ \test_assert_cramped:Nx \int_if_odd_p:n { cramped }
+}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
+\ExplSyntaxOff
+\usepackage{lualatex-math}
+\makeatletter
+\ExplSyntaxOn
+\prg_stepwise_inline:nnnn { \c_four } { \c_one } {
+ \c_two_hundred_fifty_five - \c_one
+} {
+ \prg_case_int:nnn { \int_mod:nn { #1 } { \c_three } } {
+ { \c_zero } {
+ \chk_if_free_cs:N \g_test_family_int
+ \newfam \g_test_family_int
+ \AssertIntEqual { \g_test_family_int } { #1 }
+ \cs_undefine:N \g_test_family_int
+ }
+ { \c_one } {
+ \chk_if_free_cs:N \g_test_mathgroup_int
+ \new@mathgroup \g_test_mathgroup_int
+ \AssertIntEqual { \g_test_mathgroup_int } { #1 }
+ \cs_undefine:N \g_test_mathgroup_int
+ }
+ { \c_two } {
+ \DeclareSymbolFont { Test #1 } { OT1 } { cmr } { m } { n }
+ \exp_args:Nc \AssertIntEqual { sym Test #1 } { #1 }
+ }
+ } {
+ \test_fail:x { This~ cannot~ happen }
+ }
+}
+\DeclareSymbolFont { Test 255 } { OT1 } { cmr } { bx } { it }
+\DeclareSymbolFontAlphabet { \TestAlphabet } { Test 255 }
+\exp_args:Nc \AssertIntEqual { sym Test 255 }
+ { \c_two_hundred_fifty_five }
+\ExplSyntaxOff
+\makeatother
+\begin{document}
+\[
+\TestAlphabet{
+ abc
+ \AssertIntEqual{\fam}{255}
+ \AssertIntEqual{\mathgroup}{255}
+}
+\]
+\end{document}
+\endinput
+%%
+%% End of file `test-kernel-alloc.tex'.
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel.tex b/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-style.tex
index 68032ec0543..2977120b5b0 100644
--- a/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel.tex
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-style.tex
@@ -1,10 +1,10 @@
%%
-%% This is file `test-kernel.tex',
+%% This is file `test-kernel-style.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
-%% lualatex-math.dtx (with options: `test,test-kernel')
+%% lualatex-math.dtx (with options: `test,test-kernel-style')
%%
%% This is a generated file.
%%
@@ -22,7 +22,9 @@
%%
\documentclass[pagesize=auto]{scrartcl}
\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
\msg_new:nnn { test } { pass } { #1 }
\cs_new_protected_nopar:Npn \test_pass:x #1 {
\msg_info:nnx { test } { pass } { #1 }
@@ -115,6 +117,82 @@
\NewDocumentCommand \AssertCrampedStyle { } {
\test_assert_cramped:Nx \int_if_odd_p:n { cramped }
}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
\ExplSyntaxOff
\usepackage{lualatex-math}
\begin{document}
@@ -157,4 +235,4 @@
\end{document}
\endinput
%%
-%% End of file `test-kernel.tex'.
+%% End of file `test-kernel-style.tex'.
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-math/test-unicode.tex b/Master/texmf-dist/doc/lualatex/lualatex-math/test-unicode.tex
index 1551142aaa3..ef17d68cc05 100644
--- a/Master/texmf-dist/doc/lualatex/lualatex-math/test-unicode.tex
+++ b/Master/texmf-dist/doc/lualatex/lualatex-math/test-unicode.tex
@@ -22,7 +22,9 @@
%%
\documentclass[pagesize=auto]{scrartcl}
\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
\msg_new:nnn { test } { pass } { #1 }
\cs_new_protected_nopar:Npn \test_pass:x #1 {
\msg_info:nnx { test } { pass } { #1 }
@@ -115,6 +117,82 @@
\NewDocumentCommand \AssertCrampedStyle { } {
\test_assert_cramped:Nx \int_if_odd_p:n { cramped }
}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
\ExplSyntaxOff
\ExplSyntaxOn
\msg_redirect_class:nn { warning } { error }
diff --git a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx b/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx
index 12bf9cbd2f8..1e6cf4c7630 100644
--- a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx
+++ b/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.dtx
@@ -31,7 +31,7 @@
%</driver>
% \fi
%
-% \CheckSum{721}
+% \CheckSum{886}
%
% \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
@@ -51,6 +51,7 @@
%
%
% \changes{v0.1}{2011/04/22}{Initial version}
+% \changes{v0.3a}{2011/09/13}{Updated for changes in \pkg{l3kernel}}
%
% \GetFileInfo{lualatex-math.sty}
%
@@ -68,19 +69,19 @@
% \Hologo{LuaTeX} brings major improvements to all areas of \hologo{TeX}
% typesetting and programming. They are made available through new primitives
% or the embedded Lua interpreter, and combining them with existing
-% \hologo{LaTeX2e} package is not a task the average \hologo{LaTeX} user should
-% have to care about. Therefore a multitude of \hologo{LaTeX2e} packages have
-% been written to bridge the gap between documents and the new features. The
-% \thispackage package focuses on the additional possibilities for mathematical
-% typesetting. The most eminent of the new features is the ability to use
-% Unicode and OpenType fonts, as provided by \Robertson’s \pkg{unicode-math}
-% package. However, there is a smaller group of changes unrelated to Unicode:
-% these are to be dealt with in this package. While in principle most
-% \hologo{TeX} documents written for traditional engines should work just fine
-% with \hologo{LuaTeX}, there is a small number of breaking changes that
-% require the attention of package authors. The \thispackage package tries to
-% fix some of the issues encountered while porting traditional macro packages
-% to \hologo{LuaLaTeX}.
+% \hologo{LaTeX2e} packages is not a task the average \hologo{LaTeX} user
+% should have to care about. Therefore a multitude of \hologo{LaTeX2e}
+% packages have been written to bridge the gap between documents and the new
+% features. The \thispackage package focuses on the additional possibilities
+% for mathematical typesetting. The most eminent of the new features is the
+% ability to use Unicode and OpenType fonts, as provided by \Robertson’s
+% \pkg{unicode-math} package. However, there is a smaller group of changes
+% unrelated to Unicode: these are to be dealt with in this package. While in
+% principle most \hologo{TeX} documents written for traditional engines should
+% work just fine with \hologo{LuaTeX}, there is a small number of breaking
+% changes that require the attention of package authors. The \thispackage
+% package tries to fix some of the issues encountered while porting traditional
+% macro packages to \hologo{LuaLaTeX}.
%
% The decision to write patches for existing macro packages should not be made
% lightly: monkey patching done by somebody different from the original package
@@ -109,12 +110,12 @@
% \pkg{unicode-math} package; the fixes provided here are valid for both
% Unicode and legacy math typesetting.
%
-% Currently patches for the \hologo{LaTeX2e} kernel and the \pkg{amsmath} and
-% \pkg{mathtools} packages are provided. It is not relevant whether you load
-% these packages before or after \thispackage. They should work as expected
-% (and ideally you shouldn’t notice anything), but if you load other packages
-% that by themselves overwrite commands patched by this package, bad things may
-% happen, as it is usual with \hologo{LaTeX}.
+% Currently patches for the \hologo{LaTeX2e} kernel and the \pkg{amsmath},
+% \pkg{mathtools} and \pkg{icomma} packages are provided. It is not relevant
+% whether you load these packages before or after \thispackage. They should
+% work as expected (and ideally you shouldn’t notice anything), but if you load
+% other packages that by themselves overwrite commands patched by this package,
+% bad things may happen, as it is usual with \hologo{LaTeX}.
%
% One user-visible change is that the new
% \DescribeMacros{\mathstyle\luatexmathstyle}\cmd{\mathstyle} primitive
@@ -136,8 +137,8 @@
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[2009/09/24]
-\RequirePackage{expl3}[2011/02/17]
-\ProvidesExplPackage{lualatex-math}{2011/05/05}{0.1}%
+\RequirePackage{expl3}[2011/09/05]
+\ProvidesExplPackage{lualatex-math}{2011/09/13}{0.3a}%
{Patches for mathematics typesetting with LuaLaTeX}
\RequirePackage { etoolbox } [ 2007/10/08 ]
\RequirePackage { luatexbase } [ 2010/05/27 ]
@@ -163,7 +164,7 @@
\exp_args:Nx \AtEndOfPackage {
\lltxmath_restore_catcode:N \$
}
-\char_make_math_shift:N \$
+\char_set_catcode_math_toggle:N \$
% \end{macrocode}
%
%
@@ -179,6 +180,22 @@
% \end{macrocode}
% \end{l3message}
%
+% \begin{l3message}{different-meanings}
+% Issued when two control sequences have different meanings, but should not.
+% \begin{macrocode}
+\msg_new:nnnn { lualatex-math } { different-meanings } {
+ I've~ expected~ the~ control~ sequences \\
+ #1~ and~ #3 \\
+ to~ have~ the~ same~ meaning,~ but~ their~ meanings~ are~ different.
+} {
+ The~ meaning~ of~ #1~ is: \\
+ #2 \\
+ The~ meaning~ of~ #3~ is: \\
+ #4
+}
+% \end{macrocode}
+% \end{l3message}
+%
% \begin{l3message}{macro-expected}
% Issued when trying to patch a non-macro. The first argument must be the
% detokenized macro name.
@@ -233,13 +250,45 @@
% \begin{macro}{\lltxmath_temp:w}
% A scratch macro.
% \begin{macrocode}
-\chk_if_free_cs:N \lltxmath_temp:w
+\cs_new_eq:NN \lltxmath_temp:w \prg_do_nothing:
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\luatexUmathcode}
+% \begin{macro}{\luatexUmathcodenum}
+% \begin{macro}{\luatexUmathchardef}
+% We need the extended versions of \cmd{\mathcode} and \cmd{\mathchardef}.
+% The command \cmd{\luatexbase@ensure@primitive}\marg{name} makes sure that
+% the \hologo{LuaTeX} primitive \cs{\meta{name}} is available under the
+% qualified name \cs{luatex\meta{name}}.
+% \begin{macrocode}
+\luatexbase@ensure@primitive { Umathcode }
+\luatexbase@ensure@primitive { Umathcodenum }
+\luatexbase@ensure@primitive { Umathchardef }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lltxmath_assert_eq:NN}
+% The macro \cmd{\lltxmath_assert_eq:NN}\meta{first command}\meta{second
+% command} tests whether the control sequences \meta{first command} and
+% \meta{second command} have the same meaning, and prints an error message if
+% they do not.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \lltxmath_assert_eq:NN #1 #2 {
+ \cs_if_eq:NNF #1 #2 {
+ \msg_error:nnxxxx { lualatex-math } { different-meanings }
+ { \token_to_str:N #1 } { \token_to_meaning:N #1 }
+ { \token_to_str:N #2 } { \token_to_meaning:N #2 }
+ }
+}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lltxmath_patch:NNnnn}
% \begin{macro}{\lltxmath_patch:cNnnn}
-% The macro \cmd{\lltxmath_patch:NNnnn}\meta{command}\meta{factory
+% The auxiliary macro \cmd{\lltxmath_patch:NNnnn}\meta{command}\meta{factory
% command}\marg{parameter text}\marg{expected replacement text}\marg{new
% replacement text} tries to patch \meta{command}. If \meta{command} is
% undefined, do nothing. Otherwise it must be a macro with the given
@@ -275,9 +324,58 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\lltxmath_set_mathchar:NN}
+% The macro \cmd{\lltxmath_set_mathchar:NN}\meta{control
+% sequence}\meta{token} defines the \meta{control sequence} as an extended
+% mathematical character shorthand whose mathematical code is given by the
+% mathematical code of the character \texttt{\textasciigrave}\meta{token}.
+% Since there is no \cmd{\Umathcharnumdef} primitive, we have to extract the
+% class, family, and slot numbers separately.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \lltxmath_set_mathchar:NN #1 #2 {
+ \luatexUmathchardef #1
+ \lua_now:x {
+ lualatex.math.print_class_fam_slot( \int_eval:n { `#2 } )
+ }
+ \scan_stop:
+}
+% \end{macrocode}
+% \end{macro}
+%
%
% \subsection{\Hologo{LaTeX2e} kernel}
%
+% \changes{v0.3}{2011/08/07}{Patched math group allocation to gain access to
+% all families}
+% In \hologo{LuaTeX}, we have 256 math families at our disposal. Therefore we
+% modify the \hologo{LaTeX} allocation macros \cmd{\newfam} and
+% \cmd{\new@mathgroup} accordingly.
+%
+% First we test whether \cmd{\newfam} and \cmd{\new@mathgroup} are equal.
+% \begin{macrocode}
+\lltxmath_assert_eq:NN \newfam \new@mathgroup
+% \end{macrocode}
+%
+% \begin{macro}{\new@mathgroup}
+% It is enough to modify the maximum number of families known to the
+% allocation system; the macro \cmd{\alloc@} takes care of the rest. This
+% would work even if the \pkg{etex} package weren’t loaded.
+% \begin{macrocode}
+\lltxmath_patch:NNnnn \new@mathgroup \cs_set_nopar:Npn { } {
+ \alloc@ 8 \mathgroup \chardef \sixt@@n
+} {
+ \alloc@ 8 \mathgroup \chardef \c_two_hundred_fifty_six
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newfam}
+% We have to reset \cmd{\newfam} to equal \cmd{\new@mathgroup}.
+% \begin{macrocode}
+\cs_set_eq:NN \newfam \new@mathgroup
+% \end{macrocode}
+% \end{macro}
+%
% \Hologo{LuaTeX} enables access to the current mathematical style via the
% \cmd{\mathstyle} primitive. For this to work, fraction-like constructs (\eg,
% \meta{numerator} \cmd{\over} \meta{denominator}) have to be enclosed in a
@@ -333,16 +431,6 @@
% \cmd{\Ustack} primitive.
% \end{itemize}
%
-% \begin{macro}{\luatexUmathcodenum}
-% \begin{macro}{\luatexUmathchardef}
-% We need the extended versions of \cmd{\mathcode} and \cmd{\mathchardef}.
-% \begin{macrocode}
-\luatexbase@ensure@primitive { Umathcodenum }
-\luatexbase@ensure@primitive { Umathchardef }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
% \begin{macro}{\luatexalignmark}
% \begin{macro}{\luatexUstartmath}
% \begin{macro}{\luatexUstopmath}
@@ -384,24 +472,6 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\lltxmath_set_mathchar:NN}
-% The macro \cmd{\lltxmath_set_mathchar:NN}\meta{control
-% sequence}\meta{token} defines the \meta{control sequence} as an extended
-% mathematical character shorthand whose mathematical code is given by the
-% mathematical code of the character \texttt{\textasciigrave}\meta{token}.
-% Since there is no \cmd{\Umathcharnumdef} primitive, we have to extract the
-% class, family, and slot numbers separately.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \lltxmath_set_mathchar:NN #1 #2 {
- \luatexUmathchardef #1
- \lua_now:x {
- lualatex.math.print_class_fam_slot( \int_eval:n { `#2 } )
- }
- \scan_stop:
-}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\lltxmath_char_dim:NN}
% The macro \cmd{\lltxmath_char_dim:NN}\meta{primitive}\meta{token} expands
% to a \meta{dimen} whose value is the metric of the mathematical character
@@ -672,6 +742,30 @@
}
}
}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{\pkg{icomma}}
+%
+% \changes{v0.2}{2011/07/03}{Added patch for the \pkg{icomma} package}
+% The \pkg{icomma} package uses |\mathchardef| to save the mathematical code of
+% the comma character. This breaks for Unicode fonts. The incompatibility was
+% noticed by
+% \Breitfeld.\footnote{\url{https://groups.google.com/d/topic/de.comp.text.tex/Cputk-AJS5I/discussion}}
+%
+% \begin{macro}{\mathcomma}
+% \pkg{icomma} defines the mathemathical character shorthand \cmd{\icomma} at
+% the beginning of the document, therefore we again patch
+% \cmd{\@begindocumenthook}.
+% \begin{macrocode}
+\AtEndOfPackageFile * { icomma } {
+ \tl_replace_once:Nnn \@begindocumenthook {
+ \mathchardef \mathcomma \mathcode `\,
+ } {
+ \lltxmath_set_mathchar:NN \mathcomma \,
+ }
+}
%</package>
% \end{macrocode}
% \end{macro}
@@ -736,7 +830,7 @@ end
%
% \section{Test files}
%
-% Finally two small test files—but not a real test suite.
+% Finally six small test files—but not a real test suite.
%
%
% \subsection{Common definitions}
@@ -748,7 +842,9 @@ end
% Only \pkg{xparse} starting with 2008/08/03 has \cmd{\NewDocumentCommand}.
% \begin{macrocode}
\usepackage{xparse}[2008/08/03]
+\usepackage{luacode}
\ExplSyntaxOn
+\AtBeginDocument { \errorcontextlines = \c_fifteen }
% \end{macrocode}
%
% \begin{l3message}{pass}
@@ -908,7 +1004,7 @@ end
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\AssertIntEqual}
+% \begin{macro}{\AssertDimEqual}
% The command \cmd{\AssertDimEqual}\marg{first expression}\marg{second
% expression} asserts that the two dimension expressions are equal.
% \begin{macrocode}
@@ -979,18 +1075,181 @@ end
\NewDocumentCommand \AssertCrampedStyle { } {
\test_assert_cramped:Nx \int_if_odd_p:n { cramped }
}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l_test_tmpa_box}
+% \begin{macro}{\l_test_tmpb_box}
+% Scratch registers for box constructions.
+% \begin{macrocode}
+\box_new:N \l_test_tmpa_box
+\box_new:N \l_test_tmpb_box
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{function}{contains_space}
+% The function \func{contains_space}|(head, width)| returns |true| if the
+% node list starting at |head| or any of its sublists contain a glue or kern
+% node of width |width| (or any glue or kern node if |width| is |nil|).
+% \begin{macrocode}
+\begin{luacode*}
+function contains_space(head, width)
+ for n in node.traverse(head) do
+ local id = n.id
+ if id == 10 or id == 11 then
+ if width then
+ if (id == 10 and n.spec.width == width)
+ or (id == 11 and n.kern == width) then
+ return true
+ end
+ else
+ return true
+ end
+ elseif id == 0 or id == 1 then
+ if contains_space(n.head, width) then
+ return true
+ end
+ end
+ end
+ return false
+end
+\end{luacode*}
+% \end{macrocode}
+% \end{function}
+%
+% \begin{macro}{\AssertNoSpace}
+% The command \cmd{\AssertNoSpace}\marg{text} asserts that the node list that
+% is the result of typesetting \meta{text} contains no glue or kern nodes.
+% \begin{macrocode}
+\NewDocumentCommand \AssertNoSpace { m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ if~ contains_space(b.head) then~
+ tex.sprint("0")
+ else~
+ tex.sprint("1")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node
+ }
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AssertMuSpace}
+% The command \cmd{\AssertMuSpace}\marg{text}\marg{muskip} asserts that the
+% node list that is the result of typesetting \meta{text} contains at least
+% one glue or kern node of with \meta{muskip}.
+% \begin{macrocode}
+\makeatletter
+\NewDocumentCommand \AssertMuSpace { m m } {
+ \hbox_set:Nn \l_test_tmpa_box { #1 }
+ \hbox_set:Nn \l_test_tmpb_box { $ \mskip #2 \m@th $ }
+ \int_if_odd:nTF {
+ \lua_now:x {
+ local~ b = tex.getbox(\int_use:N \l_test_tmpa_box)
+ local~ s = tex.getbox(\int_use:N \l_test_tmpb_box)
+ if~ contains_space(b.head, s.width) then~
+ tex.sprint("1")
+ else~
+ tex.sprint("0")
+ end
+ }
+ } {
+ \test_pass:x {
+ \tl_to_str:n { #1 } ~
+ contains~ a~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ } {
+ \test_fail:x {
+ \tl_to_str:n { #1 } ~
+ contains~ no~ skip~ or~ kern~ node~ of~ width~
+ \tl_to_str:n { #2 }
+ }
+ }
+}
+\makeatother
\ExplSyntaxOff
%</test>
% \end{macrocode}
% \end{macro}
%
%
-% \subsection{\Hologo{LaTeX2e} kernel}
+% \subsection{\Hologo{LaTeX2e} kernel, allocation of math families}
+%
+% \changes{v0.3}{2011/08/07}{Added test file for modified family allocation
+% scheme}
+% The \hologo{LaTeX2e} kernel itself allocates four families (also known as
+% \enquote{math groups} in \hologo{LaTeX} parlance). Therefore we should still
+% be able to allocate 252 families. We do this alternately with \cmd{\newfam},
+% \cmd{\new@mathgroup} and \cmd{\DeclareSymbolFont}.
+% \begin{macrocode}
+%<*test-kernel-alloc>
+\usepackage{lualatex-math}
+\makeatletter
+\ExplSyntaxOn
+\prg_stepwise_inline:nnnn { \c_four } { \c_one } {
+ \c_two_hundred_fifty_five - \c_one
+} {
+ \prg_case_int:nnn { \int_mod:nn { #1 } { \c_three } } {
+ { \c_zero } {
+ \chk_if_free_cs:N \g_test_family_int
+ \newfam \g_test_family_int
+ \AssertIntEqual { \g_test_family_int } { #1 }
+ \cs_undefine:N \g_test_family_int
+ }
+ { \c_one } {
+ \chk_if_free_cs:N \g_test_mathgroup_int
+ \new@mathgroup \g_test_mathgroup_int
+ \AssertIntEqual { \g_test_mathgroup_int } { #1 }
+ \cs_undefine:N \g_test_mathgroup_int
+ }
+ { \c_two } {
+ \DeclareSymbolFont { Test #1 } { OT1 } { cmr } { m } { n }
+ \exp_args:Nc \AssertIntEqual { sym Test #1 } { #1 }
+ }
+ } {
+ \test_fail:x { This~ cannot~ happen }
+ }
+}
+\DeclareSymbolFont { Test 255 } { OT1 } { cmr } { bx } { it }
+\DeclareSymbolFontAlphabet { \TestAlphabet } { Test 255 }
+\exp_args:Nc \AssertIntEqual { sym Test 255 }
+ { \c_two_hundred_fifty_five }
+\ExplSyntaxOff
+\makeatother
+\begin{document}
+\[
+\TestAlphabet{
+ abc
+ \AssertIntEqual{\fam}{255}
+ \AssertIntEqual{\mathgroup}{255}
+}
+\]
+\end{document}
+%</test-kernel-alloc>
+% \end{macrocode}
+%
+%
+% \subsection{\Hologo{LaTeX2e} kernel, \cs{mathstyle} primitive}
%
% Here we only check whether different fractions and other style-changing
% commands result in the correct mathematical style.
% \begin{macrocode}
-%<*test-kernel>
+%<*test-kernel-style>
\usepackage{lualatex-math}
\begin{document}
\begin{displaymath}
@@ -1030,7 +1289,7 @@ end
\frac{\AssertMathStyle{7}}{\AssertMathStyle{7}}
\end{math}
\end{document}
-%</test-kernel>
+%</test-kernel-style>
% \end{macrocode}
%
%
@@ -1183,7 +1442,7 @@ end
%
% This test file loads both \pkg{amsmath} and \pkg{unicode-math}. The latter
% package contains fixes that somewhat overlap with ours. We have to take care
-% in all packages that no attempt is made to patch a sinlge macro twice.
+% in all packages that no attempt is made to patch a single macro twice.
% Therefore we treat warnings (that occur when trying to patch a macro with an
% unknown meaning) as errors here.
%
@@ -1208,6 +1467,50 @@ end
%</test-unicode>
% \end{macrocode}
%
+%
+% \subsection{\pkg{icomma} without \pkg{unicode-math}}
+%
+% \changes{v0.2}{2011/07/03}{Added test file for \pkg{icomma} without
+% \pkg{unicode-math}}
+% This test file loads only \pkg{icomma} to test whether our patch works for
+% Computer Modern.
+%
+% \begin{macrocode}
+%<*test-icomma>
+\usepackage{lualatex-math}
+\usepackage{icomma}
+\begin{document}
+$1,234 \; (x, y)$
+\AssertNoSpace{$1,234$}
+\AssertMuSpace{$(x, y)$}{\thinmuskip}
+\AssertIntEqual{\mathcomma}{"1C0003B}
+\end{document}
+%</test-icomma>
+% \end{macrocode}
+%
+%
+% \subsection{\pkg{icomma} with \pkg{unicode-math}}
+%
+% \changes{v0.2}{2011/07/03}{Added test file for \pkg{icomma} with
+% \pkg{unicode-math}}
+% This test file loads both \pkg{icomma} and \pkg{unicode-math} to test whether
+% they interact well.
+%
+% \begin{macrocode}
+%<*test-icomma-unicode>
+\usepackage{unicode-math}[2011/05/05]
+\setmathfont{XITS Math}
+\usepackage{lualatex-math}
+\usepackage{icomma}
+\begin{document}
+$1,234 \; (x, y)$
+\AssertNoSpace{$1,234$}
+\AssertMuSpace{$(x, y)$}{\thinmuskip}
+\AssertIntEqual{\mathcomma}{"0C0002C}
+\end{document}
+%</test-icomma-unicode>
+% \end{macrocode}
+%
% \Finale
\endinput
diff --git a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins b/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins
index c21c33cdf16..223f55d2d85 100644
--- a/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins
+++ b/Master/texmf-dist/source/lualatex/lualatex-math/lualatex-math.ins
@@ -42,9 +42,12 @@ LaTeX version 2009/09/24 or later.
\generate{
\file{lualatex-math.sty}{\from{lualatex-math.dtx}{package}}
- \file{test-kernel.tex}{\from{lualatex-math.dtx}{test,test-kernel}}
+ \file{test-kernel-alloc.tex}{\from{lualatex-math.dtx}{test,test-kernel-alloc}}
+ \file{test-kernel-style.tex}{\from{lualatex-math.dtx}{test,test-kernel-style}}
\file{test-amsmath.tex}{\from{lualatex-math.dtx}{test,test-amsmath}}
\file{test-unicode.tex}{\from{lualatex-math.dtx}{test,test-unicode}}
+ \file{test-icomma.tex}{\from{lualatex-math.dtx}{test,test-icomma}}
+ \file{test-icomma-unicode.tex}{\from{lualatex-math.dtx}{test,test-icomma-unicode}}
}
\def\MetaPrefix{--}
diff --git a/Master/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.sty b/Master/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.sty
index be8cbb84f34..3476474eaf3 100644
--- a/Master/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.sty
+++ b/Master/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.sty
@@ -21,8 +21,8 @@
%% LaTeX version 2009/09/24 or later.
%%
\NeedsTeXFormat{LaTeX2e}[2009/09/24]
-\RequirePackage{expl3}[2011/02/17]
-\ProvidesExplPackage{lualatex-math}{2011/05/05}{0.1}%
+\RequirePackage{expl3}[2011/09/05]
+\ProvidesExplPackage{lualatex-math}{2011/09/13}{0.3a}%
{Patches for mathematics typesetting with LuaLaTeX}
\RequirePackage { etoolbox } [ 2007/10/08 ]
\RequirePackage { luatexbase } [ 2010/05/27 ]
@@ -35,11 +35,21 @@
\exp_args:Nx \AtEndOfPackage {
\lltxmath_restore_catcode:N \$
}
-\char_make_math_shift:N \$
+\char_set_catcode_math_toggle:N \$
\msg_new:nnn { lualatex-math } { luatex-required } {
The~ lualatex-math~ package~ requires~ LuaTeX. \\
I~ will~ stop~ loading~ now.
}
+\msg_new:nnnn { lualatex-math } { different-meanings } {
+ I've~ expected~ the~ control~ sequences \\
+ #1~ and~ #3 \\
+ to~ have~ the~ same~ meaning,~ but~ their~ meanings~ are~ different.
+} {
+ The~ meaning~ of~ #1~ is: \\
+ #2 \\
+ The~ meaning~ of~ #3~ is: \\
+ #4
+}
\msg_new:nnn { lualatex-math } { macro-expected } {
I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't.
}
@@ -56,7 +66,17 @@
\msg_error:nn { lualatex-math } { luatex-required }
\endinput
}
-\chk_if_free_cs:N \lltxmath_temp:w
+\cs_new_eq:NN \lltxmath_temp:w \prg_do_nothing:
+\luatexbase@ensure@primitive { Umathcode }
+\luatexbase@ensure@primitive { Umathcodenum }
+\luatexbase@ensure@primitive { Umathchardef }
+\cs_new_protected_nopar:Npn \lltxmath_assert_eq:NN #1 #2 {
+ \cs_if_eq:NNF #1 #2 {
+ \msg_error:nnxxxx { lualatex-math } { different-meanings }
+ { \token_to_str:N #1 } { \token_to_meaning:N #1 }
+ { \token_to_str:N #2 } { \token_to_meaning:N #2 }
+ }
+}
\cs_new_protected_nopar:Npn \lltxmath_patch:NNnnn #1 #2 #3 #4 #5 {
\cs_if_exist:NT #1 {
\token_if_macro:NTF #1 {
@@ -80,6 +100,20 @@
}
}
\cs_generate_variant:Nn \lltxmath_patch:NNnnn { c }
+\cs_new_protected_nopar:Npn \lltxmath_set_mathchar:NN #1 #2 {
+ \luatexUmathchardef #1
+ \lua_now:x {
+ lualatex.math.print_class_fam_slot( \int_eval:n { `#2 } )
+ }
+ \scan_stop:
+}
+\lltxmath_assert_eq:NN \newfam \new@mathgroup
+\lltxmath_patch:NNnnn \new@mathgroup \cs_set_nopar:Npn { } {
+ \alloc@ 8 \mathgroup \chardef \sixt@@n
+} {
+ \alloc@ 8 \mathgroup \chardef \c_two_hundred_fifty_six
+}
+\cs_set_eq:NN \newfam \new@mathgroup
\luatexbase@ensure@primitive { Ustack }
\AtEndPreamble {
\@ifpackageloaded { amsmath } { } {
@@ -94,8 +128,6 @@
}
}
}
-\luatexbase@ensure@primitive { Umathcodenum }
-\luatexbase@ensure@primitive { Umathchardef }
\luatexbase@ensure@primitive { alignmark }
\luatexbase@ensure@primitive { Ustartmath }
\luatexbase@ensure@primitive { Ustopmath }
@@ -104,13 +136,6 @@
\luatexbase@ensure@primitive { Umathstackvgap }
\int_const:Nn \c_lltxmath_std_minus_mathcode_int { "2200 }
\int_const:Nn \c_lltxmath_std_equal_mathcode_int { "303D }
-\cs_new_protected_nopar:Npn \lltxmath_set_mathchar:NN #1 #2 {
- \luatexUmathchardef #1
- \lua_now:x {
- lualatex.math.print_class_fam_slot( \int_eval:n { `#2 } )
- }
- \scan_stop:
-}
\cs_new_nopar:Npn \lltxmath_char_dim:NN #1 #2 {
#1 \textfont
\lua_now:x {
@@ -259,6 +284,13 @@
}
}
}
+\AtEndOfPackageFile * { icomma } {
+ \tl_replace_once:Nnn \@begindocumenthook {
+ \mathchardef \mathcomma \mathcode `\,
+ } {
+ \lltxmath_set_mathchar:NN \mathcomma \,
+ }
+}
\endinput
%%
%% End of file `lualatex-math.sty'.
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 71fbc11a6d6..fc803a7c7b2 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1172,6 +1172,7 @@ $standardtex='\.(.bx|cfg|sty|clo|ldf|cls|def|fd|cmap|4ht)$';
'librarian', '(t-)?librarian.(tex|sty)',
'listings-ext','\.sty', # not .cfg
'logic', 'milstd\.tex|' . $standardtex,
+ 'lualatex-math', '\.sty', # not phst-doc.cls
'magyar', 'NULL', # do not install in runtime, conflicts with babel
'manjutex', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$|manju.tex',
'math-e', 'NULL',