diff options
Diffstat (limited to 'Master/texmf-dist/doc/lualatex')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/Makefile | 23 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/README | 19 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/lualatex-math.pdf | bin | 227656 -> 258450 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/phst-doc.cls | 556 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/test-amsmath.tex | 78 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma-unicode.tex | 209 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/test-icomma.tex | 207 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lualatex-math/test-kernel-alloc.tex | 241 | ||||
-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.tex | 78 |
10 files changed, 1482 insertions, 13 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 Binary files differindex 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 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 } |