diff options
Diffstat (limited to 'Master')
63 files changed, 2659 insertions, 480 deletions
diff --git a/Master/texmf-dist/doc/latex/unicode-math/README b/Master/texmf-dist/doc/latex/unicode-math/README index 6170fea0c45..3ce07a4504f 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/README +++ b/Master/texmf-dist/doc/latex/unicode-math/README @@ -2,16 +2,17 @@ The UNICODE-MATH package ======================== This package will provide a complete implementation of unicode maths for -XeTeX. While I do not encourage people to use this package for production -work, I understand that it has certain uses and am making it available for -distribution. Your testing and feedback is essential to fill in the many gaps -that I miss! +XeLaTeX and LuaLaTeX. -The package will soon also work under LuaTeX, but this is not yet supported. +While I am a little wary of encouraging people to use this package for +production work, I understand that it has certain uses and am making it +available for distribution. Your testing and feedback is essential to fill +in the many gaps that I miss! Please be aware that this package is undergoing continued development and the interface and functionality should not be considered completely stable. But -the more the package is used the more stable it will become. (Things are generally working now; it is only minutiae that may change in the future.) +the more the package is used the more stable it will become. (Things are +generally working now; it is only minutiae that may change in the future.) Unicode maths is currently supported to one degree or another by the fonts @@ -34,13 +35,14 @@ new releases. [XM]: http://github.com/khaledhosny/xits-math [OFL]: http://scripts.sil.org/OFL + PACKAGE USAGE ------------- Please see the PDF documentation for full details. A simple beginning is: \usepackage{unicode-math} - \setmathfont{Cambria Math} + \setmathfont{xits-math.otf} Most LaTeX math should still work after this. (Let me know if it doesn't.) Furthermore, it will be in a different font. @@ -49,9 +51,16 @@ Furthermore, it will be in a different font. REQUIREMENTS ------------ -As well as running XeTeX or LuaTeX this package requires recent versions -of the fontspec, expl3 and xpackages packages. If you're using TeX Live 2010 -then there'll be no problems. +As well as running XeTeX or LuaTeX this package requires recent versions of +the `fontspec`, `expl3`, `xpackages`, `catchfile`, and `filehook` packages. If +you're using an up-to-date TeX Live 2010 then there'll be no problems. “Up to +date” means the current state of TeX Live 2010, as obtained by running `tlmgr +update --all`; the DVD release of TeX Live 2010 is not recent enough. + +For some additional features you need LuaTeX 0.65 or later, which can be +updated using [TLContrib][TLC]. + +[TLC]: http://tlcontrib.metatex.org) MAINTENANCE @@ -91,6 +100,10 @@ To install it for all users in your system-wide local texmf tree: make install-sys +Afterward you may have to regenerate the TeX Live file databases: + + texhash + See `make help` for further information. @@ -138,6 +151,15 @@ changes have not affected the standard behaviour. CHANGE HISTORY -------------- +- v0.5d (2011/01/30) + + * Assorted improvements to LuaLaTeX support, including non-growing accents + available in LuaTeX v0.65 and later + * Improved behaviour with reading and using maths font dimensions + * Better compatibility with legacy maths packages and environments + (always more worked needed, though) + * Fix the default setting for "vargreek-shape" + - v0.5c (2010/09/27) * Fix a long-standing bug in XeLaTeX in which the "master" math diff --git a/Master/texmf-dist/doc/latex/unicode-math/unicode-math-testsuite.pdf b/Master/texmf-dist/doc/latex/unicode-math/unicode-math-testsuite.pdf Binary files differindex 9ab71e8b798..d073c602cce 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/unicode-math-testsuite.pdf +++ b/Master/texmf-dist/doc/latex/unicode-math/unicode-math-testsuite.pdf diff --git a/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf b/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf Binary files differindex f6d1936b8b6..49b1248c20c 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf +++ b/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf diff --git a/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf b/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf Binary files differindex 2688ab41e33..f66e048c697 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf +++ b/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf diff --git a/Master/texmf-dist/source/latex/unicode-math/Makefile b/Master/texmf-dist/source/latex/unicode-math/Makefile index 379dd680d70..c8c6e60b096 100644 --- a/Master/texmf-dist/source/latex/unicode-math/Makefile +++ b/Master/texmf-dist/source/latex/unicode-math/Makefile @@ -66,23 +66,10 @@ CTANFILES = $(PKGSOURCE) $(DOC) $(testdir) BUILDCTAN = $(addprefix $(builddir)/,$(CTANFILES)) BUILDDOC = $(addprefix $(builddir)/,$(DOC)) -# these are what's needed to compile and make stuff: +# LTXSOURCE = $(PKG).sty $(TBL) -SUITESOURCE = \ - umtest-preamble.tex \ - umtest-suite-X.tex \ - umtest-suite-L.tex - -TESTOUT = $(shell ls $(testdir)/*.safe.pdf) -BUILDTESTSRC = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.ltx,$(TESTOUT))) -BUILDTESTTARGET = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.diff.pdf,$(TESTOUT))) - -BUILDSOURCE = $(addprefix $(builddir)/,$(LTXSOURCE)) -BUILDSUITE = $(addprefix $(builddir)/,$(SUITESOURCE)) -BUILDFILES = $(BUILDSOURCE) $(BUILDSUITE) $(BUILDTESTSRC) - # and this is how the TDS zip file is produced: INSFILES = \ @@ -127,17 +114,17 @@ $(builddir)/$(PKG).dtx: $(PKG).dtx $(builddir)/$(PKG).sty: $(builddir)/$(PKG).dtx echo "Updating $@" - cd $(builddir); \ + cd $(builddir) && \ tex $(PKG).dtx > /dev/null ; $(builddir)/$(PKG).pdf: $(builddir)/$(PKG).dtx $(BUILDSOURCE) - cd $(builddir); \ + cd $(builddir) && \ xelatex $(PKG).dtx && \ makeindex -s gind.ist $(PKG) && \ xelatex $(PKG).dtx; $(builddir)/$(SYM).pdf: $(builddir)/$(SYM).ltx - cd $(builddir); \ + cd $(builddir) && \ xelatex $(SYM).ltx && \ xelatex $(SYM).ltx; @@ -160,7 +147,7 @@ $(builddir)/README: $(builddir)/README.markdown # Test suite PDF $(builddir)/$(SUITE).pdf: $(builddir)/$(SUITE).ltx $(BUILDSUITE) $(builddir)/$(testdir) - cd $(builddir); \ + cd $(builddir) && \ xelatex $(SUITE).ltx @@ -168,9 +155,11 @@ $(builddir)/$(SUITE).pdf: $(builddir)/$(SUITE).ltx $(BUILDSUITE) $(builddir)/$(t ##### CTAN INSTALLATION ##### -tds: $(builddir)/$(PKG).tds.zip +TDS = $(builddir)/$(PKG).tds.zip -$(builddir)/$(PKG).tds.zip: $(tds)/$(PKG).tds.zip +tds: $(TDS) + +$(TDS): $(tds)/$(PKG).tds.zip $(COPY) $< $@ $(tds)/$(PKG).tds.zip: $(TDSFILES) @@ -242,46 +231,271 @@ lfile: $(F) $(BUILDSOURCE) # TESTSUITE # ############# +#### Needed to compile and make stuff #### + +builddir=build +testdir=testfiles +lprefix=L +xprefix=X +both=F +NAME=unicode-math + +COPY = cp -a +MOVE = mv -f +COMPARE_OPTS = -density 300x300 -metric ae -fuzz 35% + +# Redefine this to print output if you need: +REDIRECT = > /dev/null + +LTXSOURCE = $(NAME).sty + +TESTLIST = umtest-suite-X.tex umtest-suite-L.tex umtest-suite-F.tex + +SUITESOURCE = \ + $(testdir)/umtest-preamble.tex \ + $(testdir)/$(TESTLIST) + +TESTOUT = $(wildcard $(testdir)/*.safe.pdf) +BUILDTESTSRC = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.ltx,$(TESTOUT))) + +BUILDTESTTARGET1 = $(TESTOUT) +BUILDTESTTARGET2 = $(subst $(testdir)/,$(builddir)/,$(BUILDTESTTARGET1)) +BUILDTESTTARGET3 = $(subst .Xsafe.pdf,-X.diff.pdf,$(BUILDTESTTARGET2)) +BUILDTESTTARGET4 = $(subst .Lsafe.pdf,-L.diff.pdf,$(BUILDTESTTARGET3)) +BUILDTESTTARGET5 = $(subst .safe.pdf,.diff.pdf,$(BUILDTESTTARGET4)) +BUILDTESTTARGET = $(BUILDTESTTARGET5) + +BUILDSOURCE = $(addprefix $(builddir)/,$(LTXSOURCE)) +BUILDSUITE = $(subst $(testdir)/,$(builddir)/,$(SUITESOURCE)) + +BUILDFILES = $(BUILDSOURCE) $(BUILDSUITE) $(BUILDTESTSRC) $(BUILDTESTTARGET) #### All tests #### -check: $(BUILDFILES) $(BUILDTESTTARGET) - cd $(testdir); \ - ls X*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-X.tex; \ - ls L*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-L.tex; +foo: + echo $(BUILDTESTTARGET) + +check: $(TESTLIST) + +$(TESTLIST): $(BUILDFILES) + cd $(testdir) && \ + ls X*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-X.tex && \ + ls L*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-L.tex && \ + ls F*.ltx | sed -e 's/\(.*\).ltx/\\inserttest{\1}/g' > umtest-suite-F.tex; + +$(builddir)/%: $(testdir)/% + @mkdir -p $(builddir); \ + $(COPY) $< $@ + +$(builddir)/%: % + @mkdir -p $(builddir); \ + $(COPY) -f $< $@ + + +#### Generating new tests #### + +lonelystub = $(shell cd $(testdir); ls | egrep '[XL].(.*\.ltx)|[XL].(.*\.safe\.pdf)' | cut -d . -f 1 | uniq -u ) +lonelyfile = $(addsuffix .safe.pdf,$(lonelystub)) +lonelypath = $(addprefix $(testdir)/,$(lonelyfile)) +lonelytest = $(addprefix $(builddir)/,$(addsuffix .pdf,$(lonelystub))) + +Xlonelystub = $(shell cd $(testdir); ls | egrep -o '(F.*\.ltx)|(F.*-X\.safe\.pdf)' | sed -e s/-X.safe.pdf// -e s/.ltx// | uniq -u | uniq ) +Xlonelyfile = $(addsuffix -X.safe.pdf,$(Xlonelystub)) +Xlonelypath = $(addprefix $(testdir)/,$(Xlonelyfile)) +Xlonelytest = $(addprefix $(builddir)/,$(addsuffix -X.pdf,$(Xlonelystub))) + +Llonelystub = $(shell cd $(testdir); ls | egrep -o '(F.*\.ltx)|(F.*-L\.safe\.pdf)' | sed -e s/-L.safe.pdf// -e s/.ltx// | uniq -u | uniq ) +Llonelyfile = $(addsuffix -L.safe.pdf,$(Llonelystub)) +Llonelypath = $(addprefix $(testdir)/,$(Llonelyfile)) +Llonelytest = $(addprefix $(builddir)/,$(addsuffix -L.pdf,$(Llonelystub))) + +initest: $(lonelypath) $(Xlonelypath) $(Llonelypath) + +$(lonelypath): $(lonelytest) + $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.pdf/.pdf/` $@ +$(Xlonelypath): $(Xlonelytest) + $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/-X.safe.pdf/-X.pdf/` $@ -#### Each step of the process #### +$(Llonelypath): $(Llonelytest) + $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/-L.safe.pdf/-L.pdf/` $@ -COMPARE_OPTS = -metric AE -density 300x300 -PIXEL_TOLERANCE = 1 -$(builddir)/%.diff.pdf: $(builddir)/%.pdf - echo '$*: Comparing with reference PDF.' - if [ ${shell compare $(COMPARE_OPTS) $(builddir)/$*.pdf $(testdir)/$*.safe.pdf $(builddir)/$*.diff.pdf 2>&1} -le $(PIXEL_TOLERANCE) ] ; then \ - echo '$*: Test passed.' ; \ +#### TESTS FOR BOTH ENGINES #### + +$(builddir)/F%-L.diff.pdf: $(builddir)/F%-L.pdf + @echo 'F$*: Comparing PDF from LuaLaTeX against reference output.' + if test $(shell compare \ + $(COMPARE_OPTS) \ + $(builddir)/F$*-L.pdf \ + $(testdir)/F$*-L.safe.pdf \ + $(builddir)/F$*-L.diff.pdf 2>&1) -le 1 ; then \ + echo 'F$*: Test passed.' ; \ + else \ + echo 'F$*: Test failed.' ; \ + false ; \ + fi + +$(builddir)/F%-X.diff.pdf: $(builddir)/F%-X.pdf + @echo 'F$*: Comparing PDF from XeLaTeX against reference output.' + if test $(shell compare \ + $(COMPARE_OPTS) \ + $(builddir)/F$*-X.pdf \ + $(testdir)/F$*-X.safe.pdf \ + $(builddir)/F$*-X.diff.pdf 2>&1) -le 1 ; then \ + echo 'F$*: Test passed.' ; \ else \ - echo '$*: Test failed.' ; \ + echo 'F$*: Test failed.' ; \ + false ; \ + fi + +$(builddir)/F%-L.pdf: $(BUILDSOURCE) $(builddir)/F%-L.ltx + @echo 'F$*: Generating PDF output with LuaLaTeX.' + @cd $(builddir); lualatex -interaction=nonstopmode F$*-L.ltx $(REDIRECT) + +$(builddir)/F%-X.pdf: $(BUILDSOURCE) $(builddir)/F%-X.ltx + @echo 'F$*: Generating PDF output with XeLaTeX.' + @cd $(builddir); xelatex -interaction=nonstopmode F$*-X.ltx $(REDIRECT) + +$(builddir)/F%-L.ltx: $(builddir)/F%.ltx + $(COPY) $< $@ + +$(builddir)/F%-X.ltx: $(builddir)/F%.ltx + $(COPY) $< $@ + + +#### TEST FOR EACH ENGINE INDIVIDUALLY #### + +$(builddir)/L%.diff.pdf: $(builddir)/L%.pdf + @echo 'L$*: Comparing PDF against reference output.' + if test $(shell compare $(COMPARE_OPTS) \ + $(builddir)/L$*.pdf $(testdir)/L$*.safe.pdf \ + $(builddir)/L$*.diff.pdf 2>&1) -le 1 ; then \ + echo 'L$*: Test passed.' ; \ + else \ + echo 'L$*: Test failed.' ; \ + false ; \ + fi + +$(builddir)/X%.diff.pdf: $(builddir)/X%.pdf + @echo 'X$*: Comparing PDF against reference output.' + if test $(shell compare \ + $(COMPARE_OPTS) \ + $(builddir)/X$*.pdf \ + $(testdir)/X$*.safe.pdf \ + $(builddir)/X$*.diff.pdf 2>&1) -le 1 ; then \ + echo 'X$*: Test passed.' ; \ + else \ + echo 'X$*: Test failed.' ; \ false ; \ fi $(builddir)/X%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/X%.ltx - echo 'X$*: Generating PDF output from XeLaTeX.' - cd $(builddir); xelatex -interaction=batchmode X$*.ltx > /dev/null + @echo 'X$*: Generating PDF output with XeLaTeX.' + @cd $(builddir); xelatex -interaction=nonstopmode X$*.ltx $(REDIRECT) $(builddir)/L%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/L%.ltx - echo 'L$*: Generating PDF output from LuaLaTeX.' - cd $(builddir); lualatex -interaction=batchmode L$*.ltx > /dev/null + @echo 'L$*: Generating PDF output with LuaLaTeX.' + @cd $(builddir); lualatex -interaction=nonstopmode L$*.ltx $(REDIRECT) +#### HACK: allow `make <foobar>` run that test. -#### Generating new tests #### +L%: build/L%.ltx + make build/L$*.diff.pdf -lonelystub = $(shell cd $(testdir); ls | egrep '(.*\.ltx)|(.*\.safe.pdf)' | cut -d . -f 1 | uniq -u) -lonelytest = $(addprefix $(testdir)/,$(addsuffix .safe.pdf,$(lonelystub))) -lonelytesttarget = $(addprefix $(builddir)/,$(addsuffix .pdf,$(lonelystub))) +X%: build/X%.ltx + make build/X$*.diff.pdf -initest: $(lonelytest) +F%: build/F%.ltx + make build/F$*-L.diff.pdf + make build/F$*-X.diff.pdf -$(lonelytest): $(lonelytesttarget) - $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.pdf/.pdf/` $@ + + + + + + +############################ +###### NIGHTLY BUILDS ###### +############################ + +UNAME_S := $(shell uname -s) + +# Mac OS X: +ifeq ($(UNAME_S),Darwin) + MD5 = md5 +endif + +# Linux: +ifeq ($(UNAME_S),Linux) + MD5 = md5sum +endif + +BRANCH = tdsbuild + +TMP = /tmp +LOG = $(TMP)/gitlog.tmp + + +checkbranch: + @if git branch | grep $(BRANCH) > /dev/null ; \ + then echo "TDS branch exists"; \ + else \ + echo "TDS branch does not exist; doing so will remove all untracked files from your working directory. Create the TDS branch with\n make createbranch"; \ + false; \ + fi; + +createbranch: $(TDS) + cp -f $(TDS) $(TMP)/ + git symbolic-ref HEAD refs/heads/$(BRANCH) + rm .git/index + git clean -fdx + unzip -o $(TMP)/$(TDS) -d . + rm $(TMP)/$(TDS) + git add --all + git commit -m "Initial TDS commit" + git checkout master + git push origin $(BRANCH) master + @echo "\nTDS branch creation was successful.\n" + @echo "Now create a new package at TLContrib: http://tlcontrib.metatex.org/" + @echo "Use the following metadata:" + @echo " Package ID: $(PKG)" + @echo " BRANCH: $(BRANCH)" + @echo "\nAfter this process, use \`make tdsbuild\` to" + @echo " (a) push your recent work on the master branch," + @echo " (b) automatically create a TDS snapshot," + @echo " (c) send the TDS snapshot to TLContrib." + + +ifeq ($(UNAME_S),Darwin) + tlclogin: USERNAME = $(shell security find-internet-password -s tlcontrib.metatex.org | grep "acct" | cut -f 4 -d \") + tlclogin: PASSWORD = $(shell security 2>&1 >/dev/null find-internet-password -gs tlcontrib.metatex.org | cut -f 2 -d ' ') +endif + +ifeq ($(UNAME_S),Linux) + tlclogin: USERNAME = "" + tlclogin: PASSWORD = "" +endif + +tlclogin: VERSION = $(shell date "+%Y-%m-%d@%H:%M") +tlclogin: ; + +tdsbuild: checkbranch tlclogin $(TDS) + cp -f $(TDS) $(TMP)/ + @echo "Constructing commit history for snapshot build" + date "+TDS snapshot %Y-%m-%d %H:%M" > $(LOG) + echo '\n\nApproximate commit history since last snapshot:\n' >> $(LOG) + git log --after="`git log -b $(BRANCH) -n 1 --pretty=format:"%aD"`" --pretty=format:"%+H%+s%+b" >> $(LOG) + @echo "Committing TDS snapshot to separate branch" + git checkout $(BRANCH) + unzip -o $(TMP)/$(TDS) -d . + rm $(TMP)/$(TDS) + git commit --all --file=$(LOG) + git clean -df + @echo "Pushing TDS and master branch" + git checkout master + git push origin $(BRANCH) master + @echo "Pinging TLContrib for automatic update" + curl http://tlcontrib.metatex.org/cgi-bin/package.cgi/action=notify/key=$(PKG)/check=$(shell echo $(USERNAME)/$(PASSWORD)/$(VERSION) | $(MD5) )?version=$(VERSION) > /dev/null 2>&1 diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/F-alph-spaces.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-alph-spaces.ltx new file mode 100644 index 00000000000..6fce64b0170 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-alph-spaces.ltx @@ -0,0 +1,10 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage[math-style=ISO]{unicode-math} +\setmathfont{xits-math.otf} +\setmathfont[range=\mathit/{latin, greek, Greek}]{Asana-Math.otf} +\begin{document} +$abc$ $ABC$ +$\alpha\beta\gamma$ +$\Alpha\Beta\Gamma$ +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001d.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-french.ltx index 2eb0fe47e45..2eb0fe47e45 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001d.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-french.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-iso.ltx index ac4562f82a4..ac4562f82a4 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001b.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-iso.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001c.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-literal.ltx index f1e18b59a53..f1e18b59a53 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001c.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-literal.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-tex.ltx index a77bb279136..a77bb279136 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001a.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-tex.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001e.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-upright.ltx index 97890262c8f..97890262c8f 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L001e.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-mathstyle-upright.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X200a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-1.ltx index a26791419ef..a26791419ef 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X200a.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-1.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-2.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-2.ltx new file mode 100644 index 00000000000..e246d34c021 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-2.ltx @@ -0,0 +1,23 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\setmathfont{Asana Math} +\begin{document} +[$x_{x}'$] +[$x_{x}′$] +[$x_{x}\prime$] +[$x_{x}`$] +[$x_{x}\backprime$] + +[$x'_x$] +[$x′_x$] +[$x\prime_x$] +[$x`_x$] +[$x\backprime_x$] + +[$x_{x'}$] +[$x_{x′}$] +[$x_{x\prime}$] +[$x_{x`}$] +[$x_{x\backprime}$] + +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X200b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-back.ltx index 60298e39d60..60298e39d60 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X200b.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-primes-back.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L102b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-slash-delim-2.ltx index 5d62e1a15ed..5d62e1a15ed 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L102b.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-slash-delim-2.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L201b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-sqrt-n.ltx index 344df2ba222..344df2ba222 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L201b.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-sqrt-n.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L201a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-sqrt.ltx index 84d41dd7598..84d41dd7598 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/L201a.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/F-sqrt.ltx diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L600a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600a.ltx new file mode 100644 index 00000000000..2fe3853b0a6 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600a.ltx @@ -0,0 +1,9 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L600b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600b.ltx new file mode 100644 index 00000000000..2ba34f67e1f --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600b.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L600c.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600c.ltx new file mode 100644 index 00000000000..fcd692a0bbe --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600c.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{Asana Math} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L600f.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600f.ltx new file mode 100644 index 00000000000..f98dfc61a3d --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L600f.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L601a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L601a.ltx new file mode 100644 index 00000000000..d7dbf3c5f6d --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L601a.ltx @@ -0,0 +1,26 @@ +\input{umtest-preamble} +\usepackage{mathtools} +\begin{document} +\[ +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +\] +\( +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} +} +a^{ + a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} + } +} +\) +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L601b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L601b.ltx new file mode 100644 index 00000000000..2d4983a8c59 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L601b.ltx @@ -0,0 +1,28 @@ +\input{umtest-preamble} +\usepackage{mathtools} +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +\] +\( +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} +} +a^{ + a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} + } +} +\) +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L601f.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L601f.ltx new file mode 100644 index 00000000000..4ecb9853cf1 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L601f.ltx @@ -0,0 +1,28 @@ +\input{umtest-preamble} +\usepackage{mathtools} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +\] +\( +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} +} +a^{ + a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} + } +} +\) +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L602b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L602b.ltx new file mode 100644 index 00000000000..15be38ca38e --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L602b.ltx @@ -0,0 +1,36 @@ +\input{umtest-preamble} + +\usepackage{unicode-math} + +\setmathfont{Cambria Math} + +\ExplSyntaxOn + +\NewDocumentCommand \mathstylename { } { + \mathtt { + \prg_case_int:nnn { \luatexmathstyle } { + { \displaystyle } { \token_to_str:N \displaystyle } + { \luatexcrampeddisplaystyle } { \token_to_str:N \crampeddisplaystyle } + { \textstyle } { \token_to_str:N \textstyle } + { \luatexcrampedtextstyle } { \token_to_str:N \crampedtextstyle } + { \scriptstyle } { \token_to_str:N \scriptstyle } + { \luatexcrampedscriptstyle } { \token_to_str:N \crampedscriptstyle } + { \scriptscriptstyle } { \token_to_str:N \scriptscriptstyle } + { \luatexcrampedscriptscriptstyle } { \token_to_str:N \crampedscriptscriptstyle } + } { + outside math + } + } +} + +\ExplSyntaxOff + +\begin{document} + +$\mathstylename \over \mathstylename$ + +$\luatexUstack{\mathstylename \over \mathstylename}$ + +$\frac{\mathstylename}{\mathstylename}$ + +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L603b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L603b.ltx new file mode 100644 index 00000000000..40f1aaa8606 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L603b.ltx @@ -0,0 +1,45 @@ +\input{umtest-preamble} + +\usepackage{amsmath} +\usepackage{unicode-math} + +\setmathfont{Cambria Math} + +\ExplSyntaxOn + +\NewDocumentCommand \mathstylename { } { + \mathtt { + \prg_case_int:nnn { \luatexmathstyle } { + { \displaystyle } { \token_to_str:N \displaystyle } + { \luatexcrampeddisplaystyle } { \token_to_str:N \crampeddisplaystyle } + { \textstyle } { \token_to_str:N \textstyle } + { \luatexcrampedtextstyle } { \token_to_str:N \crampedtextstyle } + { \scriptstyle } { \token_to_str:N \scriptstyle } + { \luatexcrampedscriptstyle } { \token_to_str:N \crampedscriptstyle } + { \scriptscriptstyle } { \token_to_str:N \scriptscriptstyle } + { \luatexcrampedscriptscriptstyle } { \token_to_str:N \crampedscriptscriptstyle } + } { + outside math + } + } +} + +\ExplSyntaxOff + +\begin{document} + +$\mathstylename \over \mathstylename$ + +$\luatexUstack{\mathstylename \over \mathstylename}$ + +$\frac{\mathstylename}{\mathstylename}$ + +$\dfrac{\mathstylename}{\mathstylename}$ + +$\tfrac{\mathstylename}{\mathstylename}$ + +$\binom{\mathstylename}{\mathstylename}$ + +$\genfrac{/}{)}{}{}{\mathstylename}{\mathstylename}$ + +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L604a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L604a.ltx new file mode 100644 index 00000000000..c43706cc298 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L604a.ltx @@ -0,0 +1,13 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{graphicx} +\newcommand*{\test}[1]{% + \parbox[b][50pt]{50pt}{\scalebox{3}{$#1$}}% +} +\begin{document} +\test{\sqrt[a]{b}} +\test{\sqrt[\uproot{10}a]{b}} + +\test{\sqrt[\leftroot{10}a]{b}} +\test{\sqrt[\leftroot{10}\uproot{10}a]{b}} +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L604b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L604b.ltx new file mode 100644 index 00000000000..235d51c6354 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L604b.ltx @@ -0,0 +1,15 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\usepackage{amsmath} +\usepackage{graphicx} +\setmathfont{Cambria Math} +\newcommand*{\test}[1]{% + \parbox[b][50pt]{50pt}{\scalebox{3}{$#1$}}% +} +\begin{document} +\test{\sqrt[a]{b}} +\test{\sqrt[\uproot{10}a]{b}} + +\test{\sqrt[\leftroot{10}a]{b}} +\test{\sqrt[\leftroot{10}\uproot{10}a]{b}} +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X201b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L650a.ltx index 344df2ba222..abaae93629a 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X201b.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L650a.ltx @@ -1,6 +1,12 @@ \input{umtest-preamble} \usepackage{unicode-math} +\usepackage{mathtools} \setmathfont{Cambria Math} \begin{document} -\[ \sqrt[n]{1+\sqrt[n]{1+\sqrt[n]{1+\sqrt[n]{1+\sqrt[n]{1+x}}}}}\] -\end{document}
\ No newline at end of file +\[ +\coloneq +\coloneqq +\eqcolon +\eqqcolon +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X201a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L650b.ltx index 84d41dd7598..4bda71a40f0 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X201a.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L650b.ltx @@ -1,7 +1,12 @@ \input{umtest-preamble} \usepackage{unicode-math} +\usepackage{colonequals} \setmathfont{Cambria Math} \begin{document} -\[ \sqrt{\sin^{2}x+\cos^{2}x}=1 \] -\[ \sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}\] -\end{document}
\ No newline at end of file +\[ +\coloneq +\colonequals +\eqcolon +\equalscolon +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L700a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700a.ltx new file mode 100644 index 00000000000..28868210678 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700a.ltx @@ -0,0 +1,10 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents=false} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L700b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700b.ltx new file mode 100644 index 00000000000..af89c35a6b1 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700b.ltx @@ -0,0 +1,10 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents=false} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L700c.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700c.ltx new file mode 100644 index 00000000000..af47d54e42a --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700c.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\let\luatexversion\relax +\newcount\luatexversion +\luatexversion=64 +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/L700d.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700d.ltx new file mode 100644 index 00000000000..6dfae728bbc --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/L700d.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\let\luatexversion\relax +\newcount\luatexversion +\luatexversion=64 +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X001a.ltx deleted file mode 100644 index a77bb279136..00000000000 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001a.ltx +++ /dev/null @@ -1,10 +0,0 @@ - -\input{umtest-preamble} -\usepackage[math-style=TeX]{unicode-math} -\setmathfont{Cambria Math} -\begin{document} -\[\LATINtext\] -\[\latintext\] -\[\LATINmath\] -\[\latinmath\] -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X001b.ltx deleted file mode 100644 index ac4562f82a4..00000000000 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001b.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\input{umtest-preamble} -\usepackage[math-style=ISO]{unicode-math} -\setmathfont{Cambria Math} -\begin{document} -\[\LATINtext\] -\[\latintext\] -\[\LATINmath\] -\[\latinmath\] -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001c.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X001c.ltx deleted file mode 100644 index f1e18b59a53..00000000000 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001c.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\input{umtest-preamble} -\usepackage[math-style=literal]{unicode-math} -\setmathfont{Cambria Math} -\begin{document} -\[\LATINtext\] -\[\latintext\] -\[\LATINmath\] -\[\latinmath\] -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001d.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X001d.ltx deleted file mode 100644 index 2eb0fe47e45..00000000000 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001d.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\input{umtest-preamble} -\usepackage[math-style=french]{unicode-math} -\setmathfont{Cambria Math} -\begin{document} -\[\LATINtext\] -\[\latintext\] -\[\LATINmath\] -\[\latinmath\] -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001e.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X001e.ltx deleted file mode 100644 index 97890262c8f..00000000000 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X001e.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\input{umtest-preamble} -\usepackage[math-style=upright]{unicode-math} -\setmathfont{Cambria Math} -\begin{document} -\[\LATINtext\] -\[\latintext\] -\[\LATINmath\] -\[\latinmath\] -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X102b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X102b.ltx deleted file mode 100644 index 5d62e1a15ed..00000000000 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/X102b.ltx +++ /dev/null @@ -1,26 +0,0 @@ -\documentclass{article} -\usepackage{unicode-math} -\begin{document} -\newcommand\ARRAY[4]{% - \begin{array}{cc} - #1 & #2 \\ #3 & #4 - \end{array}} -\def\test{\[ - \left.\left[\ARRAY a b c d\right] - \middle\slash - \left[\ARRAY 1 1 1 {\mathsf 0}\right] - \right. \]} -\setmathfont - [slash-delimiter=frac]{Cambria Math} -\setmathfont - [range={\mathsfup}, - Color=0000FF] - {STIXGeneral} -\test -\setmathfont - [slash-delimiter=frac, - range="2044, - Color=FF0000] - {Cambria Math} -\test -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X600a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600a.ltx new file mode 100644 index 00000000000..2fe3853b0a6 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600a.ltx @@ -0,0 +1,9 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X600b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600b.ltx new file mode 100644 index 00000000000..2ba34f67e1f --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600b.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X600c.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600c.ltx new file mode 100644 index 00000000000..fcd692a0bbe --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600c.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{Asana Math} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X600d.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600d.ltx new file mode 100644 index 00000000000..582b7b44683 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600d.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{Neo Euler} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X600f.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600f.ltx new file mode 100644 index 00000000000..f98dfc61a3d --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X600f.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ +\sum_{\substack{a \\ bbb}} +\sum_{\substack{\dfrac12 \\ \vec A'}} +\sum_{\begin{subarray}{l} a \\ bbb \end{subarray}} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X601a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X601a.ltx new file mode 100644 index 00000000000..d7dbf3c5f6d --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X601a.ltx @@ -0,0 +1,26 @@ +\input{umtest-preamble} +\usepackage{mathtools} +\begin{document} +\[ +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +\] +\( +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} +} +a^{ + a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} + } +} +\) +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X601b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X601b.ltx new file mode 100644 index 00000000000..2d4983a8c59 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X601b.ltx @@ -0,0 +1,28 @@ +\input{umtest-preamble} +\usepackage{mathtools} +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +\] +\( +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} +} +a^{ + a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} + } +} +\) +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X601f.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X601f.ltx new file mode 100644 index 00000000000..4ecb9853cf1 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X601f.ltx @@ -0,0 +1,28 @@ +\input{umtest-preamble} +\usepackage{mathtools} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +\] +\( +\frac{a^2 + b^2}{a^2 + b^2} +\frac{\cramped{a^2 + b^2}}{a^2 + b^2} +\frac{a^2 + b^2}{\cramped{a^2 + b^2}} +a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} +} +a^{ + a^{ + \frac{a^2 + b^2}{a^2 + b^2} + \frac{\cramped{a^2 + b^2}}{a^2 + b^2} + \frac{a^2 + b^2}{\cramped{a^2 + b^2}} + } +} +\) +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X604a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X604a.ltx new file mode 100644 index 00000000000..c43706cc298 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X604a.ltx @@ -0,0 +1,13 @@ +\input{umtest-preamble} +\usepackage{amsmath} +\usepackage{graphicx} +\newcommand*{\test}[1]{% + \parbox[b][50pt]{50pt}{\scalebox{3}{$#1$}}% +} +\begin{document} +\test{\sqrt[a]{b}} +\test{\sqrt[\uproot{10}a]{b}} + +\test{\sqrt[\leftroot{10}a]{b}} +\test{\sqrt[\leftroot{10}\uproot{10}a]{b}} +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X604b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X604b.ltx new file mode 100644 index 00000000000..235d51c6354 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X604b.ltx @@ -0,0 +1,15 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\usepackage{amsmath} +\usepackage{graphicx} +\setmathfont{Cambria Math} +\newcommand*{\test}[1]{% + \parbox[b][50pt]{50pt}{\scalebox{3}{$#1$}}% +} +\begin{document} +\test{\sqrt[a]{b}} +\test{\sqrt[\uproot{10}a]{b}} + +\test{\sqrt[\leftroot{10}a]{b}} +\test{\sqrt[\leftroot{10}\uproot{10}a]{b}} +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X610f.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X610f.ltx new file mode 100644 index 00000000000..f8055f46468 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X610f.ltx @@ -0,0 +1,9 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\usepackage[all,pdf]{xy} +\begin{document} +\[ +\xymatrix{a \ar[r] & b} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X620b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X620b.ltx new file mode 100644 index 00000000000..c8c15066083 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X620b.ltx @@ -0,0 +1,11 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\usepackage{delarray} +\setmathfont{Cambria Math} +\begin{document} +\[ +\begin{array}[t]({c}) 1\\2\\3 \end{array} +\begin{array}[c]({c}) 1\\2\\3 \end{array} +\begin{array}[b]({c}) 1\\2\\3 \end{array} +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X650a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X650a.ltx new file mode 100644 index 00000000000..abaae93629a --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X650a.ltx @@ -0,0 +1,12 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\usepackage{mathtools} +\setmathfont{Cambria Math} +\begin{document} +\[ +\coloneq +\coloneqq +\eqcolon +\eqqcolon +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X650b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X650b.ltx new file mode 100644 index 00000000000..4bda71a40f0 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X650b.ltx @@ -0,0 +1,12 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\usepackage{colonequals} +\setmathfont{Cambria Math} +\begin{document} +\[ +\coloneq +\colonequals +\eqcolon +\equalscolon +\] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X700a.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X700a.ltx new file mode 100644 index 00000000000..07da2c389bd --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X700a.ltx @@ -0,0 +1,8 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\setmathfont{Cambria Math} +\begin{document} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/X700b.ltx b/Master/texmf-dist/source/latex/unicode-math/testfiles/X700b.ltx new file mode 100644 index 00000000000..c87804947b0 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/X700b.ltx @@ -0,0 +1,8 @@ +\input{umtest-preamble} +\usepackage{unicode-math} +\setmathfont{XITS Math} +\begin{document} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\unimathsetup{growing-accents} +\[ \vec a \quad \vec{a} \quad \vec{abc} \quad \overrightarrow{abc} \quad \underrightarrow{abc} \] +\end{document} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-F.tex b/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-F.tex new file mode 100644 index 00000000000..d18da7aa8e6 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-F.tex @@ -0,0 +1,12 @@ +\inserttest{F-alph-spaces} +\inserttest{F-mathstyle-french} +\inserttest{F-mathstyle-iso} +\inserttest{F-mathstyle-literal} +\inserttest{F-mathstyle-tex} +\inserttest{F-mathstyle-upright} +\inserttest{F-primes-1} +\inserttest{F-primes-2} +\inserttest{F-primes-back} +\inserttest{F-slash-delim-2} +\inserttest{F-sqrt-n} +\inserttest{F-sqrt} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-L.tex b/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-L.tex index 79f447e1537..7ef82bff9b9 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-L.tex +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-L.tex @@ -1,8 +1,17 @@ -\inserttest{L001a} -\inserttest{L001b} -\inserttest{L001c} -\inserttest{L001d} -\inserttest{L001e} -\inserttest{L102b} -\inserttest{L201a} -\inserttest{L201b} +\inserttest{L600a} +\inserttest{L600b} +\inserttest{L600c} +\inserttest{L600f} +\inserttest{L601a} +\inserttest{L601b} +\inserttest{L601f} +\inserttest{L602b} +\inserttest{L603b} +\inserttest{L604a} +\inserttest{L604b} +\inserttest{L650a} +\inserttest{L650b} +\inserttest{L700a} +\inserttest{L700b} +\inserttest{L700c} +\inserttest{L700d} diff --git a/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-X.tex b/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-X.tex index d9400a017cc..e35257c0316 100644 --- a/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-X.tex +++ b/Master/texmf-dist/source/latex/unicode-math/testfiles/umtest-suite-X.tex @@ -1,8 +1,3 @@ -\inserttest{X001a} -\inserttest{X001b} -\inserttest{X001c} -\inserttest{X001d} -\inserttest{X001e} \inserttest{X002a} \inserttest{X002b} \inserttest{X002c} @@ -90,13 +85,8 @@ \inserttest{X100e} \inserttest{X101a} \inserttest{X102a} -\inserttest{X102b} \inserttest{X150a} \inserttest{X151a} -\inserttest{X200a} -\inserttest{X200b} -\inserttest{X201a} -\inserttest{X201b} \inserttest{X202a} \inserttest{X202b} \inserttest{X203a} @@ -117,3 +107,19 @@ \inserttest{X502a} \inserttest{X502b} \inserttest{X503a} +\inserttest{X600a} +\inserttest{X600b} +\inserttest{X600c} +\inserttest{X600d} +\inserttest{X600f} +\inserttest{X601a} +\inserttest{X601b} +\inserttest{X601f} +\inserttest{X604a} +\inserttest{X604b} +\inserttest{X610f} +\inserttest{X620b} +\inserttest{X650a} +\inserttest{X650b} +\inserttest{X700a} +\inserttest{X700b} diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math-testsuite.ltx b/Master/texmf-dist/source/latex/unicode-math/unicode-math-testsuite.ltx index bbee8ecfde1..4c3afd702cb 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unicode-math-testsuite.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math-testsuite.ltx @@ -1,9 +1,11 @@ \documentclass{article} \usepackage{xltxtra,fancyvrb,geometry,calc} +\usepackage[multidot]{grffile} \geometry{margin=2cm,a4paper} \setmainfont{TeX Gyre Pagella} \setmonofont{Consolas} +\def\prefix{} \newcommand\inserttest[1]{% \subsection{Test #1} \begin{minipage}{0.5\textwidth} @@ -13,7 +15,7 @@ \begin{minipage}{8cm+4pt} \fboxsep=1pt \fboxrule=1pt - \fbox{\includegraphics[width=8cm]{testfiles/#1.safe.pdf}} + \fbox{\includegraphics[width=8cm]{testfiles/#1\prefix.safe.pdf}} \end{minipage} } @@ -33,12 +35,18 @@ As well as being good minimal examples, these tests are useful to ensure that ne When the test suite is run, the new output is compared pixel by pixel with that shown here and warnings produced if the outputs are not identical. \end{minipage} -\section{\XeLaTeX\ test files} +\section{Test files for both engines} -\input{testfiles/umtest-suite-X.tex} +\def\prefix{-L} +\input{testfiles/umtest-suite-F.tex} +\def\prefix{} \section{Lua\LaTeX\ test files} \input{testfiles/umtest-suite-L.tex} +\section{\XeLaTeX\ test files} + +\input{testfiles/umtest-suite-X.tex} + \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx index 76fb00e32b6..fdaa2e6d29a 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx @@ -7,7 +7,8 @@ \input docstrip.tex \keepsilent \preamble -Copyright 2006-2010 by Will Robertson <will.robertson@latex-project.org> +Copyright 2006-2011 Will Robertson <will.robertson@latex-project.org> +Copyright 2010-2011 Philipp Stephani <st_philipp@yahoo.de> This package is free software and may be redistributed and/or modified under the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -31,10 +32,10 @@ This work is "author-maintained" by Will Robertson. %</internal> %<preamble>\ProvidesPackage{unicode-math} %<*preamble> - [2010/09/27 v0.5b Unicode maths in XeLaTeX and LuaLaTeX] + [2011/01/29 v0.5d Unicode maths in XeLaTeX and LuaLaTeX] %</preamble> %<*internal> -\documentclass{ltxdoc} +\documentclass[a4paper]{ltxdoc} \usepackage{dtx-style} \begin{document} \DocInput{\jobname.dtx} @@ -47,7 +48,8 @@ This work is "author-maintained" by Will Robertson. % ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \title{Experimental Unicode mathematical typesetting: The \pkg{unicode-math} package} -% \author{Will Robertson\\\texttt{will.robertson@latex-project.org}} +% \author{Will Robertson and Philipp Stephani\\ +% \texttt{will.robertson@latex-project.org}} % \date{\umfiledate \qquad \umfileversion} % % \maketitle @@ -72,8 +74,10 @@ This work is "author-maintained" by Will Robertson. % Maths input can also be simplified with Unicode since literal glyphs may be % entered instead of control sequences in your document source. % -% The package is fulled tested under \XeTeX, but Lua\TeX\ support is not -% yet complete. User beware, but let me know of any troubles. +% The package provides support for both \XeTeX\ and Lua\TeX. The different +% engines provide differing levels of support for Unicode maths, and +% support for Lua\TeX's features in this area is still incomplete. +% Please let us know of any troubles. % % Alongside this documentation file, you should be able to find a minimal % example demonstrating the use of the package, @@ -99,13 +103,12 @@ This work is "author-maintained" by Will Robertson. % % This document describes the \pkg{unicode-math} package, which is an % \emph{experimental} implementation of a macro to Unicode glyph encoding for -% mathematical characters. Its intended use is for \XeTeX, although it is -% conjectured that some effect could be spent to create a cross-format -% package that would also work with Lua\TeX. +% mathematical characters. % % Users who desire to specify maths alphabets only (Greek and Latin letters, % and Arabic numerals) % may wish to use Andrew Moschou's \pkg{mathspec} package instead. +% (\XeTeX-only at time of writing.) % % \section{Acknowledgements} % @@ -546,7 +549,6 @@ This work is "author-maintained" by Will Robertson. % % \subsection{Miscellanea} % -% % \subsubsection{Nabla} % \seclabel{nabla} % @@ -650,11 +652,13 @@ This work is "author-maintained" by Will Robertson. % \subsubsection{Primes} % % Primes ($x'$) may be input in several ways. You may use any combination -% of \ascii\ straight quote (\texttt{\char`\'}), Unicode prime \unichar{2032} -% ($'$), and \cs{prime}; when multiple primes occur next to each other, they chain +% the \ascii\ straight quote (\texttt{\char`\'}) or the Unicode prime \unichar{2032} +% ($'$); when multiple primes occur next to each other, they chain % together to form double, triple, or quadruple primes if the font contains -% pre-drawn glyphs. These may also be accessed with \cs{dprime}, -% \cs{trprime}, and \cs{qprime}, respectively. +% pre-drawn glyphs. The individual prime glyphs are accessed, as usual, +% with the \cs{prime} command, and the double-, triple-, and quadruple-prime +% glyphs are available with \cs{dprime}, \cs{trprime}, and \cs{qprime}, +% respectively. % % If the font does not contain the pre-drawn glyphs or more than four primes % are used, the single prime glyph is used multiple times with a negative @@ -667,12 +671,18 @@ This work is "author-maintained" by Will Robertson. % \ExplySyntaxOff % \end{verbatim} % -% Backwards or reverse primes behave in exactly the same way; use any of \ascii\ -% back tick (\texttt{\char`\`}), Unicode reverse prime \unichar{2035} -% ({\umfont\char"2035}), or \cs{backprime} to access it. -% Multiple backwards primes can also be called with \cs{backdprime}, +% Backwards or reverse primes behave in exactly the same way; use the \ascii\ +% back tick (\texttt{\char`\`}) or the Unicode reverse prime \unichar{2035} +% ({\umfont\char"2035}). +% The command to access the backprime is \cs{backprime}, and +% multiple backwards primes can accessed with \cs{backdprime}, % \cs{backtrprime}, and \cs{backqprime}. % +% In all cases above, no error checking is performed if you attempt to +% access a multi-prime glyph in a font that doesn't contain one. For this +% reason, it may be safer to write \verb|x''''| instead of \verb|x\qprime| +% in general. +% % If you ever need to enter the straight quote |'| or the backtick |`| in % maths mode, these glyphs can be accessed with \cs{mathstraightquote} and % \cs{mathbacktick}. @@ -878,6 +888,20 @@ This work is "author-maintained" by Will Robertson. % (This should be a font option rather than a package option, but % it will change soon.) % +% +% \subsubsection{Growing and non-growing accents} +% \seclabel{growing-accents} +% +% There are a few accents for which \TeX\ has both non-growing and growing +% versions. Among these are \cs{hat} and \cs{tilde}; the corresponding growing +% versions are called \cs{widehat} and \cs{widetilde}, respectively. +% +% \XeTeX\ and older versions of \LuaTeX\ do not support this distinction, however, +% and \emph{all} accents there will grow automatically. (I.e., \cs{hat} and \cs{widehat} +% are equivalent.) Unfortunately this is not always appropriate. As of \LuaTeX\ v0.65, +% these wide/non-wide commands will again behave in their expected manner. +% +% % \subsubsection{Pre-drawn fraction characters} % % Pre-drawn fractions \unichar{00BC}--\unichar{00BE}, \unichar{2150}--\unichar{215E} @@ -1022,19 +1046,16 @@ This work is "author-maintained" by Will Robertson. \RequirePackage{expl3}[2009/08/12] \RequirePackage{xparse}[2009/08/31] \RequirePackage{l3keys2e} -\RequirePackage{fontspec}[2010/05/18] +\RequirePackage{fontspec}[2010/10/25] \RequirePackage{catchfile} +\RequirePackage{trimspaces} +\RequirePackage{fix-cm} % avoid some warnings +\RequirePackage{filehook}[2011/01/03] % \end{macrocode} % % Start using \LaTeX3 --- finally! % \begin{macrocode} \ExplSyntaxOn -\@ifclassloaded{memoir}{ - \cs_set_eq:NN \um_after_pkg:nn \AtEndPackage -}{ - \RequirePackage{scrlfile} - \cs_set_eq:NN \um_after_pkg:nn \AfterPackage -} % \end{macrocode} % % \paragraph{Extra \pkg{expl3} variants} @@ -1056,12 +1077,18 @@ This work is "author-maintained" by Will Robertson. % % % \paragraph{Conditionals} +% Engine capabilities: +% \begin{macrocode} +\bool_new:N \c_um_have_fixed_accents_bool +\bool_set:Nn \c_um_have_fixed_accents_bool { + \c_luatex_is_engine_bool && \int_compare_p:n { \luatexversion > 64 } +} +% \end{macrocode} % \begin{macrocode} -\bool_new:N \l_um_fontspec_feature_bool \bool_new:N \l_um_ot_math_bool \bool_new:N \l_um_init_bool \bool_new:N \l_um_implicit_alph_bool -\bool_new:N \g_um_mainfont_set_bool +\bool_new:N \g_um_mainfont_already_set_bool % \end{macrocode} % For \opt{math-style}: % \begin{macrocode} @@ -1091,6 +1118,7 @@ This work is "author-maintained" by Will Robertson. \bool_new:N \g_um_literal_Nabla_bool \bool_new:N \g_um_literal_partial_bool \bool_new:N \g_um_texgreek_bool +\bool_gset_true:N \g_um_texgreek_bool \bool_new:N \l_um_smallfrac_bool \bool_new:N \g_um_literal_colon_bool % \end{macrocode} @@ -1112,10 +1140,10 @@ This work is "author-maintained" by Will Robertson. % \subsection{Extras} % % \begin{macro}{\um_glyph_if_exist:nTF} -%: TODO: Generalise for arbitrary fonts! \cs{\l_um_font} is not always the one used for a specific glyph!! +%: TODO: Generalise for arbitrary fonts! \cs{l_um_font} is not always the one used for a specific glyph!! % \begin{macrocode} \prg_new_conditional:Nnn \um_glyph_if_exist:n {p,TF,T,F} { - \etex_iffontchar:D \l_um_font #1 \scan_stop: + \iffontchar \l_um_font #1 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -1857,6 +1885,7 @@ This work is "author-maintained" by Will Robertson. } % \end{macrocode} % +% % \paragraph{Nabla and partial} % \begin{macrocode} \keys_define:nn {unicode-math} { @@ -2078,6 +2107,12 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \end{macro} % +% \begin{macrocode} +\edef\mathfence{\string\mathfence} +\edef\mathover{\string\mathover} +\edef\mathunder{\string\mathunder} +% \end{macrocode} +% % % \begin{macro}{\um_set_big_operator:nnn} % \darg{Symbol font name} @@ -2131,6 +2166,9 @@ This work is "author-maintained" by Will Robertson. % \begin{macro}{\um_radical:nn} % \begin{macro}{\um_delimiter:Nnn} % \begin{macro}{\um_accent:Nnn} +% \begin{macro}{\um_wide_top_accent:Nnn} +% \begin{macro}{\um_wide_bottom_accent:Nnn} +% \begin{macro}{\um_accent_keyword:} % These are all wrappers for the primitive commands that take numerical % input only. % \begin{macrocode} @@ -2155,8 +2193,25 @@ This work is "author-maintained" by Will Robertson. \cs_new:Npn \um_delimiter:Nnn #1#2#3 { \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } -\cs_new:Npn \um_accent:Nnn #1#2#3 { +\xetex_or_luatex:nnn { \cs_new:Npn \um_accent:Nnn #1#2#3 } { \Umathaccent \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: +} { + \Umathaccent \um_accent_keyword: \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: +} +\luatex_if_engine:T { + \cs_new_nopar:Npn \um_wide_top_accent:Nnn #1 #2 #3 { + \Umathaccent \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop: + } + \bool_if:NTF \c_um_have_fixed_accents_bool { + \cs_new_nopar:Npn \um_wide_bottom_accent:Nnn #1 #2 #3 { + \Umathaccent bottom~ \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop: + } + \cs_new_protected_nopar:Npn \um_accent_keyword: { + \bool_if:NF \l_um_growing_accents_bool { fixed~ } + } + } { + \cs_new_nopar:Npn \um_accent_keyword: { } + } } % \end{macrocode} % @@ -2171,6 +2226,9 @@ This work is "author-maintained" by Will Robertson. % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % % \begin{macro}{\um_overbrace:nnn} @@ -2299,14 +2357,60 @@ This work is "author-maintained" by Will Robertson. \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_parse:nn } % \end{macrocode} -% Now defined |\um_symfont_tl| as the \LaTeX\ math font to access everything: +% Now define |\um_symfont_tl| as the \LaTeX\ math font to access everything: % \begin{macrocode} \DeclareSymbolFont{\um_symfont_tl} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} - \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_set_bool} { - \bool_set_true:N \g_um_mainfont_set_bool + + \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_already_set_bool} { + \bool_set_true:N \g_um_mainfont_already_set_bool +% \end{macrocode} +% Set the math sizes according to the recommend font parameters: +% \begin{macrocode} + \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } { + \DeclareMathSizes { \f@size } { \f@size } + { \um_fontdimen_to_percent:nn{10}{\l_um_font}\dimexpr \f@size pt\relax } + { \um_fontdimen_to_percent:nn{11}{\l_um_font}\dimexpr \f@size pt\relax } + } +% \end{macrocode} +% Set defaults for fam2 for legacy compatibility: +% \begin{macrocode} + \fontspec_select:xn {\l_um_font_keyval_tl, + Scale=1.00001, + FontAdjustment={ + \fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax + \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax + \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax + \fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax + \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax + \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax + \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax + \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax + \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax + \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax + \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize + \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize + \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax + } + } {#2} \DeclareSymbolFont{symbols} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} +% \end{macrocode} +% Set defaults for fam3 for legacy compatibility: +% \begin{macrocode} + \fontspec_select:xn {\l_um_font_keyval_tl, + Scale=0.99999, + FontAdjustment={ + \fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax + \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax + \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax + \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax + \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax + \fontdimen13\font=0pt\relax + } + } {#2} \DeclareSymbolFont{largesymbols} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} } @@ -2319,12 +2423,14 @@ This work is "author-maintained" by Will Robertson. % \begin{itemize} % \item Remap symbols that don't take their natural mathcode % \item Activate any symbols that need to be math-active +% \item Enable wide/narrow accents % \item Assign delimiter codes for symbols that need to grow % \item Setup the maths alphabets (\cs{mathbf} etc.) % \end{itemize} % \begin{macrocode} \um_remap_symbols: \um_setup_mathactives: + \um_setup_accents: \um_setup_delcodes: \um_setup_alphabets: % \end{macrocode} @@ -2336,10 +2442,18 @@ This work is "author-maintained" by Will Robertson. % \end{macro} % % +% \begin{macrocode} +\xetex_or_luatex:nnn { \cs_new:Nn \um_get_fontparam:nn } { + \the\fontdimen#1\zf@basefont\relax +}{ + \directlua{fontspec.mathfontdimen("zf@basefont","#2")} +} +% \end{macrocode} +% % \begin{macro}{\resetmathfont} % \begin{macrocode} \DeclareDocumentCommand \resetmathfont { O{} m } { - \bool_set_false:N \g_um_mainfont_set_bool + \bool_set_false:N \g_um_mainfont_already_set_bool \setmathfont[#1]{#2} } % \end{macrocode} @@ -2350,28 +2464,25 @@ This work is "author-maintained" by Will Robertson. % Select the font with \cs{fontspec} and define \cs{l_um_font} from it. % \begin{macrocode} \cs_new:Npn \um_fontspec_select_font:n #1 { - \bool_set_true:N \l_um_fontspec_feature_bool - \fontspec_select:xn - { - \luatex_if_engine:T { Renderer = Basic, } - BoldFont = {}, ItalicFont = {}, - Script = Math, - SizeFeatures = { - {Size = \tf@size-} , - {Size = \sf@size-\tf@size , - Font = \l_um_script_font_tl , - \l_um_script_features_tl - } , - {Size = -\sf@size , - Font = \l_um_sscript_font_tl , - \l_um_sscript_features_tl - } - }, - \l_um_unknown_keys_clist - } - {#1} + \tl_set:Nx \l_um_font_keyval_tl { + \luatex_if_engine:T { Renderer = Basic, } + BoldFont = {}, ItalicFont = {}, + Script = Math, + SizeFeatures = { + {Size = \tf@size-} , + {Size = \sf@size-\tf@size , + Font = \l_um_script_font_tl , + \l_um_script_features_tl + } , + {Size = -\sf@size , + Font = \l_um_sscript_font_tl , + \l_um_sscript_features_tl + } + }, + \l_um_unknown_keys_clist + } + \fontspec_select:xn {\l_um_font_keyval_tl} {#1} \tl_set_eq:NN \l_um_font \zf@basefont - \bool_set_false:N \l_um_fontspec_feature_bool } % \end{macrocode} % \end{macro} @@ -2603,7 +2714,7 @@ This work is "author-maintained" by Will Robertson. % % Also, what about right-to-left square roots? % -% \begin{macro}{\um@radicals} +% \begin{macro}{\l_um_radicals_tl} % We organise radicals in the same way as nolimits-operators; that is, % in a comma-list. % \begin{macrocode} @@ -2611,53 +2722,272 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \end{macro} % -% \subsection{Delimiters} -% \begin{macro}{\left} -% We redefine the primitive to be preceded by \cmd\mathopen; -% this gives much better spacing in cases such as \cmd\sin\cmd\left\dots. -% Courtesy of Frank Mittelbach:\par -% {\small\url{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/3853&prlatex/3754}} +% \subsection{Maths accents} +% +% Maths accents should just work \emph{if they are available in the font}. +% +% \subsection{Common interface for font parameters} +% +% \XeTeX\ and \LuaTeX\ have different interfaces for math font parameters. +% We use \LuaTeX’s interface because it’s much better, but rename the primitives to be more \LaTeX3-like. +% There are getter and setter commands for each font parameter. +% The names of the parameters is derived from the \LuaTeX\ names, with underscores inserted between words. +% For every parameter \cs{Umath\meta{\LuaTeX\ name}}, we define an expandable getter command \cs{um_\meta{\LaTeX3 name}:N} and a protected setter command \cs{um_set_\meta{\LaTeX3 name}:Nn}. +% The getter command takes one of the style primitives (\cs{displaystyle} etc.)\ and expands to the font parameter, which is a \meta{dimension}. +% The setter command takes a style primitive and a dimension expression, which is parsed with \cs{dim_eval:n}. +% +% Often, the mapping between font dimensions and font parameters is bijective, but there are cases which require special attention: +% \begin{itemize} +% \item Some parameters map to different dimensions in display and non-display styles. +% \item Likewise, one parameter maps to different dimensions in non-cramped and cramped styles. +% \item There are a few parameters for which \XeTeX\ doesn’t seem to provide \cs{fontdimen}s; in this case the getter and setter commands are left undefined. +% \end{itemize} +% +% \paragraph{Cramped style tokens} +% \LuaTeX\ has \cs{crampeddisplaystyle} etc.,\ but they are loaded as \cs{luatexcrampeddisplaystyle} etc.\ by the \pkg{luatextra} package. +% \XeTeX, however, doesn’t have these primitives, and their syntax cannot really be emulated. +% Nevertheless, we define these commands as quarks, so they can be used as arguments to the font parameter commands (but nowhere else). +% Making these commands available is necessary because we need to make a distinction between cramped and non-cramped styles for one font parameter. +% +% \begin{macro}{\um_new_cramped_style:N} +% \darg{command} +% Define \meta{command} as a new cramped style switch. +% For \LuaTeX, simply rename the correspronding primitive. +% For \XeTeX, define \meta{command} as a new quark. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \um_new_cramped_style:N #1 { + \xetex_or_luatex:nn { + \quark_new:N #1 + } { + \cs_new_eq:Nc #1 { luatex \cs_to_str:N #1 } + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\crampeddisplaystyle} +% \begin{macro}{\crampedtextstyle} +% \begin{macro}{\crampedscriptstyle} +% \begin{macro}{\crampedscriptscriptstyle} +% The cramped style commands. % \begin{macrocode} -\let\left@primitive\left -\def\left{\mathopen{}\left@primitive} +\um_new_cramped_style:N \crampeddisplaystyle +\um_new_cramped_style:N \crampedtextstyle +\um_new_cramped_style:N \crampedscriptstyle +\um_new_cramped_style:N \crampedscriptscriptstyle % \end{macrocode} % \end{macro} -% No re-definition is made for \cmd\right\ because it's not -% necessary. +% \end{macro} +% \end{macro} +% \end{macro} % -% \subsection{Maths accents} +% \paragraph{Font dimension mapping} +% Font parameters may differ between the styles. +% \LuaTeX\ accounts for this by having the parameter primitives take a style token argument. +% To replicate this behavior in \XeTeX, we have to map style tokens to specific combinations of font dimension numbers and math fonts (\cs{textfont} etc.). +% +% \begin{macro}{\um_font_dimen:Nnnnn} +% \darg{style token} +% \darg{font dimen for display style} +% \darg{font dimen for cramped display style} +% \darg{font dimen for non-display styles} +% \darg{font dimen for cramped non-display styles} +% Map math style to \XeTeX\ math font dimension. +% \meta{style token} must be one of the style switches (\cs{displaystyle}, \cs{crampeddisplaystyle}, \dots). +% The other parameters are integer constants referring to font dimension numbers. +% The macro expands to a dimension which contains the appropriate font dimension. +% \begin{macrocode} +\xetex_if_engine:T { + \cs_new_nopar:Npn \um_font_dimen:Nnnnn #1 #2 #3 #4 #5 { + \fontdimen + \cs_if_eq:NNTF #1 \displaystyle { + #2 \textfont + } { + \cs_if_eq:NNTF #1 \crampeddisplaystyle { + #3 \textfont + } { + \cs_if_eq:NNTF #1 \textstyle { + #4 \textfont + } { + \cs_if_eq:NNTF #1 \crampedtextstyle { + #5 \textfont + } { + \cs_if_eq:NNTF #1 \scriptstyle { + #4 \scriptfont + } { + \cs_if_eq:NNTF #1 \crampedscriptstyle { + #5 \scriptfont + } { + \cs_if_eq:NNTF #1 \scriptscriptstyle { + #4 \scriptscriptfont + } { +% \end{macrocode} +% Should we check here if the style is invalid? +% \begin{macrocode} + #5 \scriptscriptfont + } + } + } + } + } + } + } +% \end{macrocode} +% Which family to use? +% \begin{macrocode} + \c_two + } +} +% \end{macrocode} +% \end{macro} % -% Maths accents should just work \emph{if they are available in the font}. +% \paragraph{Font parameters} +% This paragraph contains macros for defining the font parameter interface, as well as the definition for all font parameters known to \LuaTeX. +% +% \begin{macro}{\um_font_param:nnnnn} +% \darg{name} +% \darg{font dimension for non-cramped display style} +% \darg{font dimension for cramped display style} +% \darg{font dimension for non-cramped non-display styles} +% \darg{font dimension for cramped non-display styles} +% This macro defines getter and setter functions for the font parameter \meta{name}. +% The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. +% The \XeTeX\ font dimension numbers must be integer constants. +% \begin{macrocode} +\xetex_or_luatex:nnn { + \cs_new_protected_nopar:Npn \um_font_param:nnnnn #1 #2 #3 #4 #5 +} { + \um_font_param_aux:ccnnnn { um_ #1 :N } { um_set_ #1 :N } + { #2 } { #3 } { #4 } { #5 } +} { + \tl_set:Nn \l_um_tmpa_tl { #1 } + \tl_remove_all_in:Nn \l_um_tmpa_tl { _ } + \um_font_param_aux:ccc { um_ #1 :N } { um_set_ #1 :N } + { luatexUmath \l_um_tmpa_tl } +} +% \end{macrocode} +% \end{macro} % -% \section{Font features} +% \begin{macro}{\um_font_param:nnn} +% \darg{name} +% \darg{font dimension for display style} +% \darg{font dimension for non-display styles} +% This macro defines getter and setter functions for the font parameter \meta{name}. +% The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. +% The \XeTeX\ font dimension numbers must be integer constants. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \um_font_param:nnn #1 #2 #3 { + \um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } +} +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\um@zf@feature} -% Use the same method as \pkg{fontspec} for feature definition -% (\ie, using \pkg{xkeyval}) but with a conditional to restrict -% the scope of these features to \pkg{unicode-math} commands. +% \begin{macro}{\um_font_param:nn} +% \darg{name} +% \darg{font dimension} +% This macro defines getter and setter functions for the font parameter \meta{name}. +% The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. +% The \XeTeX\ font dimension number must be an integer constant. % \begin{macrocode} -\newcommand\um@zf@feature[2]{ - \define@key[zf]{options}{#1}[]{ - \bool_if:NTF \l_um_fontspec_feature_bool { - #2 - }{ - \um_warning:n {maths-feature-only} +\cs_new_protected_nopar:Npn \um_font_param:nn #1 #2 { + \um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\um_font_param:n} +% \darg{name} +% This macro defines getter and setter functions for the font parameter \meta{name}, which is considered unavailable in \XeTeX\@. +% The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. +% \begin{macrocode} +\xetex_or_luatex:nnn { + \cs_new_protected_nopar:Npn \um_font_param:n #1 +} { } { + \um_font_param:nnnnn { #1 } { 0 } { 0 } { 0 } { 0 } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\um_font_param_aux:NNnnnn} +% \begin{macro}{\um_font_param_aux:NNN} +% Auxiliary macros for generating font parameter accessor macros. +% \begin{macrocode} +\xetex_or_luatex:nn { + \cs_new_protected_nopar:Npn \um_font_param_aux:NNnnnn #1 #2 #3 #4 #5 #6 { + \cs_new_nopar:Npn #1 ##1 { + \um_font_dimen:Nnnnn ##1 { #3 } { #4 } { #5 } { #6 } + } + \cs_new_protected_nopar:Npn #2 ##1 ##2 { + #1 ##1 \dim_eval:n { ##2 } } } + \cs_generate_variant:Nn \um_font_param_aux:NNnnnn { cc } +} { + \cs_new_protected_nopar:Npn \um_font_param_aux:NNN #1 #2 #3 { + \cs_new_nopar:Npn #1 ##1 { + #3 ##1 + } + \cs_new_protected_nopar:Npn #2 ##1 ##2 { + #3 ##1 \dim_eval:n { ##2 } + } + } + \cs_generate_variant:Nn \um_font_param_aux:NNN { ccc } } % \end{macrocode} % \end{macro} +% \end{macro} % -% \subsection{OpenType maths font features} -% \begin{macrocode} -\xetex_or_luatex:nnn { \um@zf@feature {ScriptStyle} } - { \fontspec_update_featstr:n {+ssty=0} } - { \fontspec_update_featstr:n {+ssty=1} } -\xetex_or_luatex:nnn { \um@zf@feature {ScriptScriptStyle} } - { \fontspec_update_featstr:n {+ssty=1} } - { \fontspec_update_featstr:n {+ssty=2} } +% Now all font parameters that are listed in the \LuaTeX\ reference follow. +% \begin{macrocode} +\um_font_param:nn { axis } { 15 } +\um_font_param:nn { operator_size } { 13 } +\um_font_param:n { fraction_del_size } +\um_font_param:nnn { fraction_denom_down } { 45 } { 44 } +\um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } +\um_font_param:nnn { fraction_num_up } { 43 } { 42 } +\um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } +\um_font_param:nn { fraction_rule } { 48 } +\um_font_param:nn { limit_above_bgap } { 29 } +\um_font_param:n { limit_above_kern } +\um_font_param:nn { limit_above_vgap } { 28 } +\um_font_param:nn { limit_below_bgap } { 31 } +\um_font_param:n { limit_below_kern } +\um_font_param:nn { limit_below_vgap } { 30 } +\um_font_param:nn { over_delimiter_vgap } { 41 } +\um_font_param:nn { over_delimiter_bgap } { 38 } +\um_font_param:nn { under_delimiter_vgap } { 40 } +\um_font_param:nn { under_delimiter_bgap } { 39 } +\um_font_param:nn { overbar_kern } { 55 } +\um_font_param:nn { overbar_rule } { 54 } +\um_font_param:nn { overbar_vgap } { 53 } +\um_font_param:n { quad } +\um_font_param:nn { radical_kern } { 62 } +\um_font_param:nn { radical_rule } { 61 } +\um_font_param:nnn { radical_vgap } { 60 } { 59 } +\um_font_param:nn { radical_degree_before } { 63 } +\um_font_param:nn { radical_degree_after } { 64 } +\um_font_param:nn { radical_degree_raise } { 65 } +\um_font_param:nn { space_after_script } { 27 } +\um_font_param:nnn { stack_denom_down } { 35 } { 34 } +\um_font_param:nnn { stack_num_up } { 33 } { 32 } +\um_font_param:nnn { stack_vgap } { 37 } { 36 } +\um_font_param:nn { sub_shift_down } { 18 } +\um_font_param:nn { sub_shift_drop } { 20 } +\um_font_param:n { subsup_shift_down } +\um_font_param:nn { sub_top_max } { 19 } +\um_font_param:nn { subsup_vgap } { 25 } +\um_font_param:nn { sup_bottom_min } { 23 } +\um_font_param:nn { sup_shift_drop } { 24 } +\um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } +\um_font_param:nn { supsub_bottom_max } { 26 } +\um_font_param:nn { underbar_kern } { 58 } +\um_font_param:nn { underbar_rule } { 57 } +\um_font_param:nn { underbar_vgap } { 56 } +\um_font_param:n { connector_overlap_min } % \end{macrocode} % +% \section{Font features} +% % \subsection{Script and scriptscript font options} % \begin{macrocode} \keys_define:nn {unicode-math} @@ -3150,12 +3480,13 @@ This work is "author-maintained" by Will Robertson. % First check that at least one of the alphabets for the font shape is defined\dots % \begin{macrocode} \clist_map_inline:nn {#2} { - \cs_if_exist:cT {um_config_ \l_um_style_tl _##1:n} { - \str_if_eq:nnTF {##1}{misc} { + \tl_set:Nx \l_um_tmpa_tl { \trim@spaces {##1} } + \cs_if_exist:cT {um_config_ \l_um_style_tl _\l_um_tmpa_tl :n} { + \str_if_eq:xxTF {\l_um_tmpa_tl}{misc} { \um_maybe_init_alphabet:V \l_um_style_tl \clist_map_break: }{ - \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{##1} }{ + \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{\l_um_tmpa_tl} }{ \um_maybe_init_alphabet:V \l_um_style_tl \clist_map_break: } @@ -3166,22 +3497,23 @@ This work is "author-maintained" by Will Robertson. % \dots and then loop through them defining the individual ranges: % \begin{macrocode} \clist_map_inline:nn {#2} { - \cs_if_exist:cT {um_config_ \l_um_style_tl _##1:n} { - \str_if_eq:nnTF {##1}{misc} { - \um_trace:nx {setup-alph} {math \l_um_style_tl~(##1)} - \use:c {um_config_ \l_um_style_tl _##1:n} {#3} + \tl_set:Nx \l_um_tmpa_tl { \trim@spaces {##1} } + \cs_if_exist:cT {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} { + \str_if_eq:xxTF {\l_um_tmpa_tl}{misc} { + \um_trace:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} + \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} }{ - \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{##1} } { - \um_trace:nx {setup-alph} {math \l_um_style_tl~(##1)} - \use:c {um_config_ \l_um_style_tl _##1:n} {#3} + \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } { + \um_trace:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} + \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} }{ \bool_if:NTF \l_um_implicit_alph_bool { \seq_put_right:Nx \l_um_missing_alph_seq { \@backslashchar math \l_um_style_tl \space - (\tl_use:c{g_um_math_alphabet_name_##1_tl}) + (\tl_use:c{g_um_math_alphabet_name_ \l_um_tmpa_tl _tl}) } }{ - \use:c {um_config_ \l_um_style_tl _##1:n} {up} + \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {up} } } } @@ -4166,9 +4498,6 @@ This work is "author-maintained" by Will Robertson. % \begin{macrocode} \xetex_or_luatex:nnn { \cs_set:Npn \um_symbol_setup: } { - \def\mathfence{\mathfence} - \def\mathover{\mathover} - \def\mathunder{\mathunder} \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { \prg_case_tl:Nnn ##3 { \mathover {} \mathunder {} } { @@ -4254,16 +4583,17 @@ This work is "author-maintained" by Will Robertson. % Ensure catcodes are appropriate; % make sure |#| is an `other' so that we don't get confused with \cs{mathoctothorpe}. % \begin{macrocode} -\AtBeginDocument{ +\AtBeginDocument{\um_define_math_chars:} +\cs_set:Nn \um_define_math_chars: { \group_begin: \char_make_math_superscript:N \^ - \cs_set:Npn \_um_sym:nnn #1#2#3 { - \bool_if:nF { \cs_if_eq_p:NN #3 \mathaccent || - \cs_if_eq_p:NN #3 \mathopen || - \cs_if_eq_p:NN #3 \mathclose || - \cs_if_eq_p:NN #3 \mathover || - \cs_if_eq_p:NN #3 \mathunder } { - \um_cs_set_eq_active_char:Nw #2 = #1 \q_nil \ignorespaces + \cs_set:Npn \_um_sym:nnn ##1##2##3 { + \bool_if:nF { \cs_if_eq_p:NN ##3 \mathaccent || + \cs_if_eq_p:NN ##3 \mathopen || + \cs_if_eq_p:NN ##3 \mathclose || + \cs_if_eq_p:NN ##3 \mathover || + \cs_if_eq_p:NN ##3 \mathunder } { + \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } \char_make_other:N \# @@ -4285,7 +4615,7 @@ This work is "author-maintained" by Will Robertson. } |group_end: % \end{macrocode} -% Fix \cs{backslash}: +% Fix \cs{backslash}: ^^A | % \begin{macrocode} % \end{macrocode} % @@ -4409,18 +4739,38 @@ This work is "author-maintained" by Will Robertson. % % \begin{macrocode} \cs_new:Npn \um_scan_prime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_zero:N \l_um_primecount_int \um_scanprime_collect:N \um_prime_single_mchar } \cs_new:Npn \um_scan_dprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_set:Nn \l_um_primecount_int {1} \um_scanprime_collect:N \um_prime_single_mchar } \cs_new:Npn \um_scan_trprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_set:Nn \l_um_primecount_int {2} \um_scanprime_collect:N \um_prime_single_mchar } \cs_new:Npn \um_scan_qprime: { + \cs_set_eq:NN \um_superscript:n \use:n + \int_set:Nn \l_um_primecount_int {3} + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_prime: { + \int_zero:N \l_um_primecount_int + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_dprime: { + \int_set:Nn \l_um_primecount_int {1} + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_trprime: { + \int_set:Nn \l_um_primecount_int {2} + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_qprime: { \int_set:Nn \l_um_primecount_int {3} \um_scanprime_collect:N \um_prime_single_mchar } @@ -4471,14 +4821,29 @@ This work is "author-maintained" by Will Robertson. } } \cs_new:Npn \um_scan_backprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_zero:N \l_um_primecount_int \um_scanbackprime_collect:N \um_backprime_single_mchar } \cs_new:Npn \um_scan_backdprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_set:Nn \l_um_primecount_int {1} \um_scanbackprime_collect:N \um_backprime_single_mchar } \cs_new:Npn \um_scan_backtrprime: { + \cs_set_eq:NN \um_superscript:n \use:n + \int_set:Nn \l_um_primecount_int {2} + \um_scanbackprime_collect:N \um_backprime_single_mchar +} +\cs_new:Npn \um_scan_sup_backprime: { + \int_zero:N \l_um_primecount_int + \um_scanbackprime_collect:N \um_backprime_single_mchar +} +\cs_new:Npn \um_scan_sup_backdprime: { + \int_set:Nn \l_um_primecount_int {1} + \um_scanbackprime_collect:N \um_backprime_single_mchar +} +\cs_new:Npn \um_scan_sup_backtrprime: { \int_set:Nn \l_um_primecount_int {2} \um_scanbackprime_collect:N \um_backprime_single_mchar } @@ -4521,14 +4886,15 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % % \begin{macrocode} -\AtBeginDocument { - \cs_set_eq:NN \prime \um_scan_prime: - \cs_set_eq:NN \drime \um_scan_dprime: - \cs_set_eq:NN \trprime \um_scan_trprime: - \cs_set_eq:NN \qprime \um_scan_qprime: - \cs_set_eq:NN \backprime \um_scan_backprime: - \cs_set_eq:NN \backdprime \um_scan_backdprime: - \cs_set_eq:NN \backtrprime \um_scan_backtrprime: +\AtBeginDocument{\um_define_prime_commands: \um_define_prime_chars:} +\cs_set:Nn \um_define_prime_commands: { + \cs_set_eq:NN \prime \um_prime_single_mchar + \cs_set_eq:NN \drime \um_prime_double_mchar + \cs_set_eq:NN \trprime \um_prime_triple_mchar + \cs_set_eq:NN \qprime \um_prime_quad_mchar + \cs_set_eq:NN \backprime \um_backprime_single_mchar + \cs_set_eq:NN \backdprime \um_backprime_double_mchar + \cs_set_eq:NN \backtrprime \um_backprime_triple_mchar } \group_begin: \char_make_active:N \' @@ -4540,56 +4906,73 @@ This work is "author-maintained" by Will Robertson. \char_make_active:n {"2035} \char_make_active:n {"2036} \char_make_active:n {"2037} - \AtBeginDocument{ - \cs_set_eq:NN ' \um_scan_prime: - \cs_set_eq:NN ^^^^2032 \um_scan_prime: - \cs_set_eq:NN ^^^^2033 \um_scan_dprime: - \cs_set_eq:NN ^^^^2034 \um_scan_trprime: - \cs_set_eq:NN ^^^^2057 \um_scan_qprime: - \cs_set_eq:NN ` \um_scan_backprime: - \cs_set_eq:NN ^^^^2035 \um_scan_backprime: - \cs_set_eq:NN ^^^^2036 \um_scan_backdprime: - \cs_set_eq:NN ^^^^2037 \um_scan_backtrprime: + \cs_gset:Nn \um_define_prime_chars: { + \cs_set_eq:NN ' \um_scan_sup_prime: + \cs_set_eq:NN ^^^^2032 \um_scan_sup_prime: + \cs_set_eq:NN ^^^^2033 \um_scan_sup_dprime: + \cs_set_eq:NN ^^^^2034 \um_scan_sup_trprime: + \cs_set_eq:NN ^^^^2057 \um_scan_sup_qprime: + \cs_set_eq:NN ` \um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2035 \um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2036 \um_scan_sup_backdprime: + \cs_set_eq:NN ^^^^2037 \um_scan_sup_backtrprime: } \group_end: % \end{macrocode} % % \subsection{Unicode radicals} % -% -% \begin{macro}{\sqrt} -% Redefine this macro for \LuaTeX, which provides us a nice primitive to use. % \begin{macrocode} -\luatex_if_engine:T { - \RenewDocumentCommand \sqrt { O{} m } { - \luatexUroot \l_um_radical_sqrt_tl {#1} {#2} - } - \cs_set:Npn \root #1 \of #2 { - \luatexUroot \l_um_radical_sqrt_tl {#1} {#2} - } -} +\AtBeginDocument{\um_redefine_radical:} +\xetex_or_luatex:nnn { \cs_set:Nn \um_redefine_radical: } { + \@ifpackageloaded { amsmath } { } { % \end{macrocode} -% \end{macro} -% -% % \begin{macro}{\r@@t} % \darg{A mathstyle (for \cmd\mathpalette)} % \darg{Leading superscript for the sqrt sign} % A re-implementation of \LaTeX's hard-coded n-root sign using the appropriate \cmd\fontdimen s. % \begin{macrocode} -\cs_set_nopar:Npn \r@@t #1#2 { - \setbox\z@\hbox{$\m@th #1\sqrtsign{#2}$} - \um_mathstyle_scale:Nnn{#1}{\kern}{\fontdimen63\l_um_font} - \raise \dimexpr( - \um_fontdimen_to_percent:nn{65}{\l_um_font}\ht\z@- - \um_fontdimen_to_percent:nn{65}{\l_um_font}\dp\z@ - )\relax - \copy \rootbox - \um_mathstyle_scale:Nnn{#1}{\kern}{\fontdimen64\l_um_font} - \box \z@ -} + \cs_set_nopar:Npn \r@@t ##1 ##2 { + \hbox_set:Nn \l_tmpa_box { + \c_math_shift_token + \m@th + ##1 + \sqrtsign { ##2 } + \c_math_shift_token + } + \um_mathstyle_scale:Nnn ##1 { \kern } { + \fontdimen 63 \l_um_font + } + \box_move_up:nn { + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box) + * \number \fontdimen 65 \l_um_font / 100 + } { + \box_use:N \rootbox + } + \um_mathstyle_scale:Nnn ##1 { \kern } { + \fontdimen 64 \l_um_font + } + \box_use_clear:N \l_tmpa_box + } % \end{macrocode} % \end{macro} +% \begin{macrocode} + } +} { + \@ifpackageloaded { amsmath } { } { +% \end{macrocode} +% \begin{macro}{\root} +% Redefine this macro for \LuaTeX, which provides us a nice primitive to use. +% \begin{macrocode} + \cs_set:Npn \root ##1 \of ##2 { + \luatexUroot \l_um_radical_sqrt_tl { ##1 } { ##2 } + } +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + } +} +% \end{macrocode} % % % \begin{macro}{\um_fontdimen_to_percent:nn} @@ -4598,7 +4981,7 @@ This work is "author-maintained" by Will Robertson. % \cmd\fontdimen s |10|, |11|, and |65| aren't actually dimensions, they're percentage values given in units of |sp|. This macro takes a font dimension number and outputs the decimal value of the associated parameter. % \begin{macrocode} \cs_new:Npn \um_fontdimen_to_percent:nn #1#2 { - 0.\strip@pt\dimexpr\fontdimen#1#2 *65536\relax + \strip@pt\dimexpr\fontdimen#1#2*65536/100\relax } % \end{macrocode} % \end{macro} @@ -4851,7 +5234,6 @@ This work is "author-maintained" by Will Robertson. % automatically by the maths characters database. % \begin{macrocode} \def\to{\rightarrow} -\def\overrightarrow{\vec} \def\le{\leq} \def\ge{\geq} \def\neq{\ne} @@ -4864,6 +5246,10 @@ This work is "author-maintained" by Will Robertson. \def\diamond{\smwhtdiamond} \def\emptyset{\varnothing} \def\hbar{\hslash} +\def\land{\wedge} +\def\lor{\vee} +\def\owns{\ni} +\def\gets{\leftarrow} % \end{macrocode} % These are somewhat odd: (and their usual Unicode uprightness does not match their amssymb glyphs) % \begin{macrocode} @@ -4900,13 +5286,6 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \end{macro} % -% \verb|\overline| is a \LuaTeX\ primitive: -% \begin{macrocode} -\luatex_if_engine:T { - \cs_set:Npn \overline {\pdfprimitive\overline} -} -% \end{macrocode} -% % \begin{macro}{\digamma} % \begin{macro}{\Digamma} % I might end up just changing these in the table. @@ -4926,22 +5305,113 @@ This work is "author-maintained" by Will Robertson. \def\operator@font{\um_switchto_mathup:} % \end{macrocode} % -% \begin{macro}{\um_patch_pkg:nn} -% \darg{package} -% \darg{code} -% If \meta{package} is loaded either already or later in the preamble, \meta{code} -% is executed (after the package is loaded in the latter case). +% \begin{macro}{\um_tmpa:w} +% A scratch macro. % \begin{macrocode} -\cs_new:Npn \um_patch_pkg:nn #1#2 { - \@ifpackageloaded {#1} { - #2 - }{ - \um_after_pkg:nn {#1} {#2} +\chk_if_free_cs:N \um_tmpa:w +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\um_check_and_fix:NNnnnn} +% \darg{command} +% \darg{factory command} +% \darg{parameter text} +% \darg{expected replacement text} +% \darg{new replacement text for \LuaTeX} +% \darg{new replacement text for \XeTeX} +% Tries to patch \meta{command}. +% If \meta{command} is undefined, do nothing. +% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. +% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text for \LuaTeX} or the \meta{new replacement text for \XeTeX}, depending on the engine. +% Otherwise issue a warning and don’t overwrite. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \um_check_and_fix:NNnnnn #1 #2 #3 #4 #5 #6 { + \cs_if_exist:NT #1 { + \token_if_macro:NTF #1 { + \group_begin: + #2 \um_tmpa:w #3 { #4 } + \cs_if_eq:NNTF #1 \um_tmpa:w { + \msg_info:nnx { unicode-math } { patch-macro } + { \token_to_str:N #1 } + \group_end: + \xetex_or_luatex:nnn { #2 #1 #3 } { #6 } { #5 } + } { + \msg_warning:nnxxx { unicode-math } { wrong-meaning } + { \token_to_str:N #1 } { \token_to_meaning:N #1 } + { \token_to_meaning:N \um_tmpa:w } + \group_end: + } + } { + \msg_warning:nnx { unicode-math } { macro-expected } + { \token_to_str:N #1 } + } } } % \end{macrocode} % \end{macro} % +% \begin{macro}{\um_check_and_fix:NNnnn} +% \darg{command} +% \darg{factory command} +% \darg{parameter text} +% \darg{expected replacement text} +% \darg{new replacement text} +% Tries to patch \meta{command}. +% If \meta{command} is undefined, do nothing. +% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. +% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text}. +% Otherwise issue a warning and don’t overwrite. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \um_check_and_fix:NNnnn #1 #2 #3 #4 #5 { + \um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\um_check_and_fix_luatex:NNnnn} +% \begin{macro}{\um_check_and_fix_luatex:cNnnn} +% \darg{command} +% \darg{factory command} +% \darg{parameter text} +% \darg{expected replacement text} +% \darg{new replacement text} +% Tries to patch \meta{command}. +% If \XeTeX\ is the current engine or \meta{command} is undefined, do nothing. +% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. +% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text}. +% Otherwise issue a warning and don’t overwrite. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \um_check_and_fix_luatex:NNnnn #1 #2 #3 #4 #5 { + \luatex_if_engine:T { + \um_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } + } +} +\cs_generate_variant:Nn \um_check_and_fix_luatex:NNnnn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \paragraph{\LaTeXe\ kernel} +% \cs{frac} can be patched for \LuaTeX, but \cs{choose}, \cs{brack} and \cs{brace} should be discouraged. +% Probably these fixes (and the analogous \pkg{amsmath} fixes below) should go into \pkg{luatextra} or a similar \LuaLaTeX\ package. +% \begin{macrocode} +\luatex_if_engine:T { + \AtBeginDocument{\um_patch_amsmath:} + \cs_set:Nn \um_patch_amsmath: { + \@ifpackageloaded { amsmath } { } { + \um_check_and_fix:NNnnn \frac \cs_set_nopar:Npn { ##1 ##2 } { + { + \begingroup ##1 \endgroup \over ##2 + } + } { + { + \luatexUstack { \group_begin: ##1 \group_end: \over ##2 } + } + } + } + } +} +% \end{macrocode} % % \paragraph{\pkg{url}} % Simply need to get \pkg{url} in a state such that @@ -4953,7 +5423,7 @@ This work is "author-maintained" by Will Robertson. % but activates automatically so old documents that might change the \cs{url} % font still work correctly. % \begin{macrocode} -\um_patch_pkg:nn {url} { +\AtEndOfPackageFile * {url} { \tl_put_left:Nn \Url@FormatString { \um_switchto_mathup: } \tl_put_right:Nn \UrlSpecials { \do\`{\mathchar`\`} @@ -4967,7 +5437,7 @@ This work is "author-maintained" by Will Robertson. % \paragraph{\pkg{amsmath}} % Since the mathcode of |`\-| is greater than eight bits, this piece of |\AtBeginDocument| code from \pkg{amsmath} dies if we try and set the maths font in the preamble: % \begin{macrocode} -\um_patch_pkg:nn {amsmath} { +\AtEndOfPackageFile * {amsmath} { \tl_remove_in:Nn \@begindocumenthook { \mathchardef\std@minus\mathcode`\-\relax \mathchardef\std@equal\mathcode`\=\relax @@ -4983,15 +5453,191 @@ This work is "author-maintained" by Will Robertson. % This isn't as clever as the \pkg{amsmath} definition but I think it works: % \begin{macrocode} \def \resetMathstrut@ {% - \setbox\z@\hbox{$($}% + \setbox\z@\hbox{$($}%) \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ } +% \end{macrocode} +% The |subarray| environment uses inappropriate font dimensions. +% \begin{macrocode} + \um_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } { + \vcenter + \bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip \fontdimen 10~ \scriptfont \tw@ + \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ + \lineskip \thr@@ \fontdimen 8~ \scriptfont \thr@@ + \lineskiplimit \lineskip + \ialign + \bgroup + \ifx c #1 \hfil \fi + $ \m@th \scriptstyle ## $ + \hfil + \crcr + } { + \vcenter + \c_group_begin_token + \Let@ + \restore@math@cr + \default@tag + \skip_set:Nn \baselineskip { +% \end{macrocode} +% Here we use stack top shift + stack bottom shift, which sounds reasonable. +% \begin{macrocode} + \um_stack_num_up:N \scriptstyle + + \um_stack_denom_down:N \scriptstyle + } +% \end{macrocode} +% Here we use the minimum stack gap. +% \begin{macrocode} + \lineskip \um_stack_vgap:N \scriptstyle + \lineskiplimit \lineskip + \ialign + \c_group_begin_token + \token_if_eq_meaning:NNT c #1 { \hfil } + \c_math_shift_token + \m@th + \scriptstyle + \c_parameter_token \c_parameter_token + \c_math_shift_token + \hfil + \crcr + } +% \end{macrocode} +% For \LuaTeX, \cs{frac} and \cs{genfrac} should use \cs{Ustack} for correct math style selection. +% \begin{macrocode} + \um_check_and_fix_luatex:cNnnn { frac~ } \cs_set:Npn { #1 #2 } { + { + \begingroup #1 \endgroup \@@over #2 + } + } { + { + \luatexUstack { \group_begin: #1 \group_end: \@@over #2 } + } + } + \um_check_and_fix_luatex:NNnnn \@genfrac \cs_set_nopar:Npn { + #1 #2 #3 #4 #5 + } { + { + #1 { \begingroup #4 \endgroup #2 #3 \relax #5 } + } + } { + { + #1 { + \luatexUstack { + \group_begin: #4 \group_end: #2 #3 \scan_stop: #5 + } + } + } + } +% \end{macrocode} +% The roots need a complete rework. +% \begin{macrocode} + \um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } { + \setbox \rootbox \hbox { + $ \m@th \scriptscriptstyle { #1 } $ + } + \mathchoice + { \r@@t \displaystyle { #2 } } + { \r@@t \textstyle { #2 } }~ + { \r@@t \scriptstyle { #2 } } + { \r@@t \scriptscriptstyle { #2 } } + \egroup + } { + \bool_if:nTF { + \int_compare_p:nNn { \uproot@ } = { \c_zero } + && \int_compare_p:nNn { \leftroot@ } = { \c_zero } + } { + \luatexUroot \l_um_radical_sqrt_tl { #1 } { #2 } + } { + \hbox_set:Nn \rootbox { + \c_math_shift_token + \m@th + \scriptscriptstyle { #1 } + \c_math_shift_token + } + \mathchoice + { \r@@t \displaystyle { #2 } } + { \r@@t \textstyle { #2 } } + { \r@@t \scriptstyle { #2 } } + { \r@@t \scriptscriptstyle { #2 } } + } + \c_group_end_token + } + \um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } { + \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } + \dimen@ \ht\z@ + \advance \dimen@ -\dp\z@ + \setbox\@ne \hbox { $ \m@th #1 \mskip \uproot@ mu $ } + \advance \dimen@ by 1.667 \wd\@ne + \mkern -\leftroot@ mu + \mkern 5mu + \raise .6\dimen@ \copy\rootbox + \mkern -10mu + \mkern \leftroot@ mu + \boxz@ + } { + \hbox_set:Nn \l_tmpa_box { + \c_math_shift_token + \m@th + #1 + \mskip \uproot@ mu + \c_math_shift_token + } + \luatexUroot \l_um_radical_sqrt_tl { + \box_move_up:nn { \box_wd:N \l_tmpa_box } { + \hbox:n { + \c_math_shift_token + \m@th + \mkern -\leftroot@ mu + \box_use:N \rootbox + \mkern \leftroot@ mu + \c_math_shift_token + } + } + } { + #2 + } + } { + \hbox_set:Nn \l_tmpa_box { + \c_math_shift_token + \m@th + #1 + \sqrtsign { #2 } + \c_math_shift_token + } + \hbox_set:Nn \l_tmpb_box { + \c_math_shift_token + \m@th + #1 + \mskip \uproot@ mu + \c_math_shift_token + } + \mkern -\leftroot@ mu + \um_mathstyle_scale:Nnn #1 { \kern } { + \fontdimen 63 \l_um_font + } + \box_move_up:nn { + \box_wd:N \l_tmpb_box + + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box) + * \number \fontdimen 65 \l_um_font / 100 + } { + \box_use:N \rootbox + } + \um_mathstyle_scale:Nnn #1 { \kern } { + \fontdimen 64 \l_um_font + } + \mkern \leftroot@ mu + \box_use_clear:N \l_tmpa_box + } } % \end{macrocode} +% % \paragraph{\pkg{amsopn}} % This code is to improve the output of analphabetic symbols in text of operator names (\cs{sin}, \cs{cos}, etc.). Just comment out the offending lines for now: % \begin{macrocode} -\um_patch_pkg:nn {amsopn} { +\AtEndOfPackageFile * {amsopn} { \cs_set:Npn \newmcodes@ { \mathcode`\'39\scan_stop: \mathcode`\*42\scan_stop: @@ -5016,9 +5662,40 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \paragraph{Accents} % \begin{macrocode} -\AtBeginDocument{ +\xetex_or_luatex:nnn { \cs_new_protected_nopar:Npn \um_setup_accents: } { \def\widehat{\hat} \def\widetilde{\tilde} + \def\overrightarrow{\vec} +} { + \cs_gset_protected_nopar:Npx \widehat { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0302 } + } + \cs_gset_protected_nopar:Npx \widetilde { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0303 } + } + \cs_gset_protected_nopar:Npx \overleftarrow { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D6 } + } + \cs_gset_protected_nopar:Npx \overrightarrow { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D7 } + } + \cs_gset_protected_nopar:Npx \overleftrightarrow { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20E1 } + } + \bool_if:NT \c_um_have_fixed_accents_bool { + \cs_gset_protected_nopar:Npx \underrightharpoondown { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EC } + } + \cs_gset_protected_nopar:Npx \underleftharpoondown { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20ED } + } + \cs_gset_protected_nopar:Npx \underleftarrow { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EE } + } + \cs_gset_protected_nopar:Npx \underrightarrow { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EF } + } + } } % \end{macrocode} % @@ -5029,18 +5706,130 @@ This work is "author-maintained" by Will Robertson. } % \end{macrocode} % -% \paragraph{\pkg{beamer}} -% At end of the package so the warnings are defined. +% \paragraph{\pkg{mathtools}} +% \pkg{mathtools}’s |\cramped| command and others that make use of its internal version use an incorrect font dimension. +% % \begin{macrocode} -\AtEndOfPackage{ - \@ifclassloaded{beamer}{ - \ifbeamer@suppressreplacements\else - \um_warning:n {disable-beamer} - \beamer@suppressreplacementstrue +\AtEndOfPackageFile * { mathtools } { + \um_check_and_fix:NNnnnn \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } { + \sbox \z@ { + $ + \m@th + #1 + \nulldelimiterspace = \z@ + \radical \z@ { #2 } + $ + } + \ifx #1 \displaystyle + \dimen@ = \fontdimen 8 \textfont 3 + \advance \dimen@ .25 \fontdimen 5 \textfont 2 + \else + \dimen@ = 1.25 \fontdimen 8 + \ifx #1 \textstyle + \textfont + \else + \ifx #1 \scriptstyle + \scriptfont + \else + \scriptscriptfont + \fi + \fi + 3 \fi - }{} + \advance \dimen@ -\ht\z@ + \ht\z@ = -\dimen@ + \box\z@ + } { +% \end{macrocode} +% \LuaTeX\ has primitives for setting material in cramped mode (thanks to Khaled Hosny for pointing this out). +% Note we don’t use \cs{mathstyle} since we want to patch only a single command. +% \begin{macrocode} + \use:c { luatexcramped \cs_to_str:N #1 } #2 + } { +% \end{macrocode} +% The \XeTeX\ version is pretty similar to the legacy version, only using the correct font dimensions. +% \begin{macrocode} + \hbox_set:Nn \l_tmpa_box { + \color@setgroup + \c_math_shift_token + \m@th + #1 + \dim_zero:N \nulldelimiterspace + \radical \c_zero { #2 } + \c_math_shift_token + \color@endgroup + } + \box_set_ht:Nn \l_tmpa_box { + \box_ht:N \l_tmpa_box +% \end{macrocode} +% Here we use the radical vertical gap. +% \begin{macrocode} + - \um_radical_vgap:N #1 + } + \box_use_clear:N \l_tmpa_box + } +% \end{macrocode} +% +% \begin{macro}{\dblcolon} +% \begin{macro}{\coloneqq} +% \begin{macro}{\Coloneqq} +% \begin{macro}{\eqqcolon} +% \pkg{mathtools} defines several commands as combinations of colons and +% other characters, but with meanings incompatible to \pkg{unicode-math}. +% Thus we issue a warning. Because \pkg{mathtools} uses +% \cmd{\providecommand} \cmd{\AtBeginDocument}, we can just define the +% offending commands here. +% \begin{macrocode} + \msg_warning:nn { unicode-math } { mathtools } + \NewDocumentCommand \dblcolon { } { \Colon } + \NewDocumentCommand \coloneqq { } { \coloneq } + \NewDocumentCommand \Coloneqq { } { \Coloneq } + \NewDocumentCommand \eqqcolon { } { \eqcolon } +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \paragraph{\pkg{colonequals}} +% +% \begin{macro}{\ratio} +% \begin{macro}{\coloncolon} +% \begin{macro}{\minuscolon} +% \begin{macro}{\colonequals} +% \begin{macro}{\equalscolon} +% \begin{macro}{\coloncolonequals} +% Similarly to \pkg{mathtools}, the \pkg{colonequals} defines several colon +% combinations. Fortunately there are no name clashes, so we can just +% overwrite their definitions. +% \begin{macrocode} +\AtEndOfPackageFile * { colonequals } { + \msg_warning:nn { unicode-math } { colonequals } + \RenewDocumentCommand \ratio { } { \mathratio } + \RenewDocumentCommand \coloncolon { } { \Colon } + \RenewDocumentCommand \minuscolon { } { \dashcolon } + \RenewDocumentCommand \colonequals { } { \coloneq } + \RenewDocumentCommand \equalscolon { } { \eqcolon } + \RenewDocumentCommand \coloncolonequals { } { \Coloneq } } % \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \paragraph{\pkg{beamer}} +% \begin{macrocode} +\@ifclassloaded{beamer}{ + \ifbeamer@suppressreplacements\else + \um_warning:n {disable-beamer} + \beamer@suppressreplacementstrue + \fi +}{} +% \end{macrocode} % % \begin{macrocode} \ExplSyntaxOff @@ -5068,10 +5857,6 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % % \begin{macrocode} -\msg_new:nnn {unicode-math} {maths-feature-only} -{ - The~ '#1'~ font~ feature~ can~ only~ be~ used~ for~ maths~ fonts. -} \msg_new:nnn {unicode-math} {disable-beamer} { Disabling~ beamer's~ math~ setup.\\ @@ -5102,6 +5887,43 @@ This work is "author-maintained" by Will Robertson. { Setup~ alphabet:~ #1. } +\msg_new:nnn {unicode-math} {macro-expected} +{ + I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't. +} +\msg_new:nnn {unicode-math} {wrong-meaning} +{ + I've~ expected~ #1~ to~ have~ the~ meaning~ #3,~ but~ it~ has~ the~ meaning~ #2. +} +\msg_new:nnn {unicode-math} {patch-macro} +{ + I'm~ going~ to~ patch~ macro~ #1. +} +\msg_new:nnn { unicode-math } { mathtools } { + I'm~ going~ to~ overwrite~ the~ following~ commands~ from \\ + the~ `mathtools'~ package: \\ + \token_to_str:N \dblcolon,~ + \token_to_str:N \coloneqq,~ + \token_to_str:N \Coloneqq,~ + \token_to_str:N \eqqcolon. \\ + Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like \\ + commands,~ using~ them~ will~ lead~ to~ inconsistencies. +} +\msg_new:nnn { unicode-math } { colonequals } { + I'm~ going~ to~ overwrite~ the~ following~ commands~ from \\ + the~ `colonequals'~ package: \\ + \token_to_str:N \ratio,~ + \token_to_str:N \coloncolon,~ + \token_to_str:N \minuscolon, \\ + \token_to_str:N \colonequals,~ + \token_to_str:N \equalscolon,~ + \token_to_str:N \coloncolonequals. \\ + Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like \\ + commands,~ using~ them~ will~ lead~ to~ inconsistencies. \\ + Furthermore,~ changing~ \token_to_str:N \colonsep \c_space_tl + or~ \token_to_str:N \doublecolonsep \c_space_tl won't~ have \\ + any~ effect~ on~ the~ re-defined~ commands. +} % \end{macrocode} % % \begin{macrocode} @@ -5206,8 +6028,64 @@ This work is "author-maintained" by Will Robertson. % {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}} % \end{verbatim} % +% \section{Legacy \TeX\ font dimensions} +% +% \centerline{% +% \begin{tabular}[t]{@{}lp{4cm}@{}} +% \toprule +% \multicolumn{2}{@{}c@{}}{Text fonts} \\ +% \midrule +% $\phi_1$ & slant per pt \\ +% $\phi_2$ & interword space \\ +% $\phi_3$ & interword stretch \\ +% $\phi_4$ & interword shrink \\ +% $\phi_5$ & x-height \\ +% $\phi_6$ & quad width \\ +% $\phi_7$ & extra space \\ +% $\phi_8$ & cap height (\XeTeX\ only) \\ +% \bottomrule +% \end{tabular} +% \quad +% \begin{tabular}[t]{@{}lp{4cm}@{}} +% \toprule +% \multicolumn{2}{@{}c@{}}{Maths font, \cs{fam}2} \\ +% \midrule +% $\sigma_5$ & x height \\ +% $\sigma_6$ & quad \\ +% $\sigma_8$ & num1 \\ +% $\sigma_9$ & num2 \\ +% $\sigma_{10}$ & num3 \\ +% $\sigma_{11}$ & denom1 \\ +% $\sigma_{12}$ & denom2 \\ +% $\sigma_{13}$ & sup1 \\ +% $\sigma_{14}$ & sup2 \\ +% $\sigma_{15}$ & sup3 \\ +% $\sigma_{16}$ & sub1 \\ +% $\sigma_{17}$ & sub2 \\ +% $\sigma_{18}$ & sup drop \\ +% $\sigma_{19}$ & sub drop \\ +% $\sigma_{20}$ & delim1 \\ +% $\sigma_{21}$ & delim2 \\ +% $\sigma_{22}$ & axis height \\ +% \bottomrule +% \end{tabular} +% \quad +% \begin{tabular}[t]{@{}lp{4cm}@{}} +% \toprule +% \multicolumn{2}{@{}c@{}}{Maths font, \cs{fam}3} \\ +% \midrule +% $\xi_8$ & default rule thickness \\ +% $\xi_9$ & big op spacing1 \\ +% $\xi_{10}$ & big op spacing2 \\ +% $\xi_{11}$ & big op spacing3 \\ +% $\xi_{12}$ & big op spacing4 \\ +% $\xi_{13}$ & big op spacing5 \\ +% \bottomrule +% \end{tabular} +% } +% % -% \section{\XeTeX\ math font dimensions} +% \section{\Hologo{XeTeX} math font dimensions} % % These are the extended \cmd\fontdimen s available for suitable fonts % in \XeTeX. Note that Lua\TeX\ takes an alternative route, and this package @@ -5377,7 +6255,11 @@ This work is "author-maintained" by Will Robertson. \usepackage{array,booktabs,calc,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,subfig,topcapt,url,varioref,underscore} \setcounter{LTchunksize}{100} \usepackage[slash-delimiter=frac,nabla=literal]{unicode-math} -\usepackage{metalogo} +\usepackage{metalogo,hologo} + +\@ifundefined{HOLOGO@ReflectBox@\hologodriver}{% + \@namedef{HOLOGO@ReflectBox@\hologodriver}{}% +}{} %\usepackage[rm,small]{titlesec} @@ -5388,6 +6270,7 @@ This work is "author-maintained" by Will Robertson. \newfontface\umfont{STIXGeneral} \usepackage{hypdoc} +\hypersetup{linktocpage} \linespread{1.069} % A bit more space between lines \frenchspacing % Remove ugly extra space after punctuation diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex index 9f2f6c75cd5..32177250977 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex @@ -255,7 +255,7 @@ \UnicodeMathSymbol{"021B6}{\curvearrowleft }{\mathrel}{left curved arrow}% \UnicodeMathSymbol{"021B7}{\curvearrowright }{\mathrel}{right curved arrow}% \UnicodeMathSymbol{"021B8}{\barovernorthwestarrow }{\mathord}{north west arrow to long bar}% -\UnicodeMathSymbol{"021B9}{\barleftarrowrightarrowba}{\mathord}{leftwards arrow to bar over rightwards arrow to bar}% +\UnicodeMathSymbol{"021B9}{\barleftarrowrightarrowbar}{\mathord}{leftwards arrow to bar over rightwards arrow to bar}% \UnicodeMathSymbol{"021BA}{\acwopencirclearrow }{\mathord}{anticlockwise open circle arrow}% \UnicodeMathSymbol{"021BB}{\cwopencirclearrow }{\mathord}{clockwise open circle arrow}% \UnicodeMathSymbol{"021BC}{\leftharpoonup }{\mathrel}{left harpoon-up}% diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty index 00941ab020c..f282fb48645 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty @@ -7,7 +7,8 @@ %% unicode-math.dtx (with options: `preamble') %% unicode-math.dtx (with options: `msg') %% unicode-math.dtx (with options: `package,stix') -%% Copyright 2006-2010 by Will Robertson <will.robertson@latex-project.org> +%% Copyright 2006-2011 Will Robertson <will.robertson@latex-project.org> +%% Copyright 2010-2011 Philipp Stephani <st_philipp@yahoo.de> %% %% This package is free software and may be redistributed and/or modified under %% the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -15,7 +16,7 @@ %% %% This work is "author-maintained" by Will Robertson. \ProvidesPackage{unicode-math} - [2010/09/27 v0.5b Unicode maths in XeLaTeX and LuaLaTeX] + [2011/01/29 v0.5d Unicode maths in XeLaTeX and LuaLaTeX] \usepackage{ifxetex,ifluatex} \ifxetex\else\ifluatex\else \PackageError{unicode-math}{% @@ -26,15 +27,12 @@ \RequirePackage{expl3}[2009/08/12] \RequirePackage{xparse}[2009/08/31] \RequirePackage{l3keys2e} -\RequirePackage{fontspec}[2010/05/18] +\RequirePackage{fontspec}[2010/10/25] \RequirePackage{catchfile} +\RequirePackage{trimspaces} +\RequirePackage{fix-cm} % avoid some warnings +\RequirePackage{filehook}[2011/01/03] \ExplSyntaxOn -\@ifclassloaded{memoir}{ - \cs_set_eq:NN \um_after_pkg:nn \AtEndPackage -}{ - \RequirePackage{scrlfile} - \cs_set_eq:NN \um_after_pkg:nn \AfterPackage -} \cs_generate_variant:Nn \tl_put_right:Nn {cx} \cs_generate_variant:Nn \seq_if_in:NnTF {NV} \cs_generate_variant:Nn \prop_gput:Nnn {Nxn} @@ -45,11 +43,14 @@ \cs:w #3 \exp_after:wN \cs_end: \cs:w #4 \cs_end: } -\bool_new:N \l_um_fontspec_feature_bool +\bool_new:N \c_um_have_fixed_accents_bool +\bool_set:Nn \c_um_have_fixed_accents_bool { + \c_luatex_is_engine_bool && \int_compare_p:n { \luatexversion > 64 } +} \bool_new:N \l_um_ot_math_bool \bool_new:N \l_um_init_bool \bool_new:N \l_um_implicit_alph_bool -\bool_new:N \g_um_mainfont_set_bool +\bool_new:N \g_um_mainfont_already_set_bool \bool_new:N \g_um_literal_bool \bool_new:N \g_um_upLatin_bool \bool_new:N \g_um_uplatin_bool @@ -67,6 +68,7 @@ \bool_new:N \g_um_literal_Nabla_bool \bool_new:N \g_um_literal_partial_bool \bool_new:N \g_um_texgreek_bool +\bool_gset_true:N \g_um_texgreek_bool \bool_new:N \l_um_smallfrac_bool \bool_new:N \g_um_literal_colon_bool \int_new:N \g_um_fam_int @@ -77,7 +79,7 @@ \tl_set:Nn \g_um_math_alphabet_name_num_tl {Numerals} \tl_set:Nn \g_um_math_alphabet_name_misc_tl {Misc.} \prg_new_conditional:Nnn \um_glyph_if_exist:n {p,TF,T,F} { - \etex_iffontchar:D \l_um_font #1 \scan_stop: + \iffontchar \l_um_font #1 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -102,10 +104,6 @@ \cs_new:Npn \um_warning:n { \msg_warning:nn {unicode-math} } \cs_new:Npn \um_trace:n { \msg_trace:nn {unicode-math} } \cs_new:Npn \um_trace:nx { \msg_trace:nnx {unicode-math} } -\msg_new:nnn {unicode-math} {maths-feature-only} -{ - The~ '#1'~ font~ feature~ can~ only~ be~ used~ for~ maths~ fonts. -} \msg_new:nnn {unicode-math} {disable-beamer} { Disabling~ beamer's~ math~ setup.\\ @@ -136,6 +134,43 @@ { Setup~ alphabet:~ #1. } +\msg_new:nnn {unicode-math} {macro-expected} +{ + I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't. +} +\msg_new:nnn {unicode-math} {wrong-meaning} +{ + I've~ expected~ #1~ to~ have~ the~ meaning~ #3,~ but~ it~ has~ the~ meaning~ #2. +} +\msg_new:nnn {unicode-math} {patch-macro} +{ + I'm~ going~ to~ patch~ macro~ #1. +} +\msg_new:nnn { unicode-math } { mathtools } { + I'm~ going~ to~ overwrite~ the~ following~ commands~ from \\ + the~ `mathtools'~ package: \\ + \token_to_str:N \dblcolon,~ + \token_to_str:N \coloneqq,~ + \token_to_str:N \Coloneqq,~ + \token_to_str:N \eqqcolon. \\ + Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like \\ + commands,~ using~ them~ will~ lead~ to~ inconsistencies. +} +\msg_new:nnn { unicode-math } { colonequals } { + I'm~ going~ to~ overwrite~ the~ following~ commands~ from \\ + the~ `colonequals'~ package: \\ + \token_to_str:N \ratio,~ + \token_to_str:N \coloncolon,~ + \token_to_str:N \minuscolon, \\ + \token_to_str:N \colonequals,~ + \token_to_str:N \equalscolon,~ + \token_to_str:N \coloncolonequals. \\ + Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like \\ + commands,~ using~ them~ will~ lead~ to~ inconsistencies. \\ + Furthermore,~ changing~ \token_to_str:N \colonsep \c_space_tl + or~ \token_to_str:N \doublecolonsep \c_space_tl won't~ have \\ + any~ effect~ on~ the~ re-defined~ commands. +} \cs_new:Npn \usv_set:nnn #1#2#3 { \tl_set:cn { \um_to_usv:nn {#1}{#2} } {#3} } @@ -817,6 +852,9 @@ \um_set_mathcode:nnn {#4} {#3} {#1} } } +\edef\mathfence{\string\mathfence} +\edef\mathover{\string\mathover} +\edef\mathunder{\string\mathunder} \cs_new:Npn \um_set_big_operator:nnn #1#2#3 { \group_begin: \char_make_active:n {#3} @@ -850,8 +888,25 @@ \cs_new:Npn \um_delimiter:Nnn #1#2#3 { \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } -\cs_new:Npn \um_accent:Nnn #1#2#3 { +\xetex_or_luatex:nnn { \cs_new:Npn \um_accent:Nnn #1#2#3 } { \Umathaccent \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: +} { + \Umathaccent \um_accent_keyword: \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: +} +\luatex_if_engine:T { + \cs_new_nopar:Npn \um_wide_top_accent:Nnn #1 #2 #3 { + \Umathaccent \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop: + } + \bool_if:NTF \c_um_have_fixed_accents_bool { + \cs_new_nopar:Npn \um_wide_bottom_accent:Nnn #1 #2 #3 { + \Umathaccent bottom~ \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop: + } + \cs_new_protected_nopar:Npn \um_accent_keyword: { + \bool_if:NF \l_um_growing_accents_bool { fixed~ } + } + } { + \cs_new_nopar:Npn \um_accent_keyword: { } + } } \cs_generate_variant:Nn \um_set_mathchar:NNnn {c} \cs_set:Npn \um_overbrace:nnn #1#2#3 { @@ -913,47 +968,87 @@ } \DeclareSymbolFont{\um_symfont_tl} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} - \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_set_bool} { - \bool_set_true:N \g_um_mainfont_set_bool + + \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_already_set_bool} { + \bool_set_true:N \g_um_mainfont_already_set_bool + \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } { + \DeclareMathSizes { \f@size } { \f@size } + { \um_fontdimen_to_percent:nn{10}{\l_um_font}\dimexpr \f@size pt\relax } + { \um_fontdimen_to_percent:nn{11}{\l_um_font}\dimexpr \f@size pt\relax } + } + \fontspec_select:xn {\l_um_font_keyval_tl, + Scale=1.00001, + FontAdjustment={ + \fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax + \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax + \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax + \fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax + \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax + \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax + \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax + \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax + \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax + \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax + \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize + \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize + \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax + } + } {#2} \DeclareSymbolFont{symbols} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} + \fontspec_select:xn {\l_um_font_keyval_tl, + Scale=0.99999, + FontAdjustment={ + \fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax + \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax + \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax + \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax + \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax + \fontdimen13\font=0pt\relax + } + } {#2} \DeclareSymbolFont{largesymbols} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} } \um_input_math_symbol_table: \um_remap_symbols: \um_setup_mathactives: + \um_setup_accents: \um_setup_delcodes: \um_setup_alphabets: \ignorespaces } +\xetex_or_luatex:nnn { \cs_new:Nn \um_get_fontparam:nn } { + \the\fontdimen#1\zf@basefont\relax +}{ + \directlua{fontspec.mathfontdimen("zf@basefont","#2")} +} \DeclareDocumentCommand \resetmathfont { O{} m } { - \bool_set_false:N \g_um_mainfont_set_bool + \bool_set_false:N \g_um_mainfont_already_set_bool \setmathfont[#1]{#2} } \cs_new:Npn \um_fontspec_select_font:n #1 { - \bool_set_true:N \l_um_fontspec_feature_bool - \fontspec_select:xn - { - \luatex_if_engine:T { Renderer = Basic, } - BoldFont = {}, ItalicFont = {}, - Script = Math, - SizeFeatures = { - {Size = \tf@size-} , - {Size = \sf@size-\tf@size , - Font = \l_um_script_font_tl , - \l_um_script_features_tl - } , - {Size = -\sf@size , - Font = \l_um_sscript_font_tl , - \l_um_sscript_features_tl - } - }, - \l_um_unknown_keys_clist - } - {#1} + \tl_set:Nx \l_um_font_keyval_tl { + \luatex_if_engine:T { Renderer = Basic, } + BoldFont = {}, ItalicFont = {}, + Script = Math, + SizeFeatures = { + {Size = \tf@size-} , + {Size = \sf@size-\tf@size , + Font = \l_um_script_font_tl , + \l_um_script_features_tl + } , + {Size = -\sf@size , + Font = \l_um_sscript_font_tl , + \l_um_sscript_features_tl + } + }, + \l_um_unknown_keys_clist + } + \fontspec_select:xn {\l_um_font_keyval_tl} {#1} \tl_set_eq:NN \l_um_font \zf@basefont - \bool_set_false:N \l_um_fontspec_feature_bool } \cs_set:Npn \um_process_symbol_noparse:nnn #1#2#3 { \um_set_mathsymbol:nNNn {\um_symfont_tl} #2#3{#1} @@ -1055,23 +1150,140 @@ \tl_remove_all_in:Nn \l_um_nolimits_tl {#1} } \tl_new:Nn \l_um_radicals_tl {\sqrt} -\let\left@primitive\left -\def\left{\mathopen{}\left@primitive} -\newcommand\um@zf@feature[2]{ - \define@key[zf]{options}{#1}[]{ - \bool_if:NTF \l_um_fontspec_feature_bool { - #2 - }{ - \um_warning:n {maths-feature-only} +\cs_new_protected_nopar:Npn \um_new_cramped_style:N #1 { + \xetex_or_luatex:nn { + \quark_new:N #1 + } { + \cs_new_eq:Nc #1 { luatex \cs_to_str:N #1 } + } +} +\um_new_cramped_style:N \crampeddisplaystyle +\um_new_cramped_style:N \crampedtextstyle +\um_new_cramped_style:N \crampedscriptstyle +\um_new_cramped_style:N \crampedscriptscriptstyle +\xetex_if_engine:T { + \cs_new_nopar:Npn \um_font_dimen:Nnnnn #1 #2 #3 #4 #5 { + \fontdimen + \cs_if_eq:NNTF #1 \displaystyle { + #2 \textfont + } { + \cs_if_eq:NNTF #1 \crampeddisplaystyle { + #3 \textfont + } { + \cs_if_eq:NNTF #1 \textstyle { + #4 \textfont + } { + \cs_if_eq:NNTF #1 \crampedtextstyle { + #5 \textfont + } { + \cs_if_eq:NNTF #1 \scriptstyle { + #4 \scriptfont + } { + \cs_if_eq:NNTF #1 \crampedscriptstyle { + #5 \scriptfont + } { + \cs_if_eq:NNTF #1 \scriptscriptstyle { + #4 \scriptscriptfont + } { + #5 \scriptscriptfont + } + } + } + } + } + } } - } -} -\xetex_or_luatex:nnn { \um@zf@feature {ScriptStyle} } - { \fontspec_update_featstr:n {+ssty=0} } - { \fontspec_update_featstr:n {+ssty=1} } -\xetex_or_luatex:nnn { \um@zf@feature {ScriptScriptStyle} } - { \fontspec_update_featstr:n {+ssty=1} } - { \fontspec_update_featstr:n {+ssty=2} } + \c_two + } +} +\xetex_or_luatex:nnn { + \cs_new_protected_nopar:Npn \um_font_param:nnnnn #1 #2 #3 #4 #5 +} { + \um_font_param_aux:ccnnnn { um_ #1 :N } { um_set_ #1 :N } + { #2 } { #3 } { #4 } { #5 } +} { + \tl_set:Nn \l_um_tmpa_tl { #1 } + \tl_remove_all_in:Nn \l_um_tmpa_tl { _ } + \um_font_param_aux:ccc { um_ #1 :N } { um_set_ #1 :N } + { luatexUmath \l_um_tmpa_tl } +} +\cs_new_protected_nopar:Npn \um_font_param:nnn #1 #2 #3 { + \um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } +} +\cs_new_protected_nopar:Npn \um_font_param:nn #1 #2 { + \um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } +} +\xetex_or_luatex:nnn { + \cs_new_protected_nopar:Npn \um_font_param:n #1 +} { } { + \um_font_param:nnnnn { #1 } { 0 } { 0 } { 0 } { 0 } +} +\xetex_or_luatex:nn { + \cs_new_protected_nopar:Npn \um_font_param_aux:NNnnnn #1 #2 #3 #4 #5 #6 { + \cs_new_nopar:Npn #1 ##1 { + \um_font_dimen:Nnnnn ##1 { #3 } { #4 } { #5 } { #6 } + } + \cs_new_protected_nopar:Npn #2 ##1 ##2 { + #1 ##1 \dim_eval:n { ##2 } + } + } + \cs_generate_variant:Nn \um_font_param_aux:NNnnnn { cc } +} { + \cs_new_protected_nopar:Npn \um_font_param_aux:NNN #1 #2 #3 { + \cs_new_nopar:Npn #1 ##1 { + #3 ##1 + } + \cs_new_protected_nopar:Npn #2 ##1 ##2 { + #3 ##1 \dim_eval:n { ##2 } + } + } + \cs_generate_variant:Nn \um_font_param_aux:NNN { ccc } +} +\um_font_param:nn { axis } { 15 } +\um_font_param:nn { operator_size } { 13 } +\um_font_param:n { fraction_del_size } +\um_font_param:nnn { fraction_denom_down } { 45 } { 44 } +\um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } +\um_font_param:nnn { fraction_num_up } { 43 } { 42 } +\um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } +\um_font_param:nn { fraction_rule } { 48 } +\um_font_param:nn { limit_above_bgap } { 29 } +\um_font_param:n { limit_above_kern } +\um_font_param:nn { limit_above_vgap } { 28 } +\um_font_param:nn { limit_below_bgap } { 31 } +\um_font_param:n { limit_below_kern } +\um_font_param:nn { limit_below_vgap } { 30 } +\um_font_param:nn { over_delimiter_vgap } { 41 } +\um_font_param:nn { over_delimiter_bgap } { 38 } +\um_font_param:nn { under_delimiter_vgap } { 40 } +\um_font_param:nn { under_delimiter_bgap } { 39 } +\um_font_param:nn { overbar_kern } { 55 } +\um_font_param:nn { overbar_rule } { 54 } +\um_font_param:nn { overbar_vgap } { 53 } +\um_font_param:n { quad } +\um_font_param:nn { radical_kern } { 62 } +\um_font_param:nn { radical_rule } { 61 } +\um_font_param:nnn { radical_vgap } { 60 } { 59 } +\um_font_param:nn { radical_degree_before } { 63 } +\um_font_param:nn { radical_degree_after } { 64 } +\um_font_param:nn { radical_degree_raise } { 65 } +\um_font_param:nn { space_after_script } { 27 } +\um_font_param:nnn { stack_denom_down } { 35 } { 34 } +\um_font_param:nnn { stack_num_up } { 33 } { 32 } +\um_font_param:nnn { stack_vgap } { 37 } { 36 } +\um_font_param:nn { sub_shift_down } { 18 } +\um_font_param:nn { sub_shift_drop } { 20 } +\um_font_param:n { subsup_shift_down } +\um_font_param:nn { sub_top_max } { 19 } +\um_font_param:nn { subsup_vgap } { 25 } +\um_font_param:nn { sup_bottom_min } { 23 } +\um_font_param:nn { sup_shift_drop } { 24 } +\um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } +\um_font_param:nn { supsub_bottom_max } { 26 } +\um_font_param:nn { underbar_kern } { 58 } +\um_font_param:nn { underbar_rule } { 57 } +\um_font_param:nn { underbar_vgap } { 56 } +\um_font_param:n { connector_overlap_min } \keys_define:nn {unicode-math} { script-features .tl_set:N = \l_um_script_features_tl , @@ -1303,12 +1515,13 @@ \exp_after:wN \use_none:nnnnn \token_to_str:N #1 } \clist_map_inline:nn {#2} { - \cs_if_exist:cT {um_config_ \l_um_style_tl _##1:n} { - \str_if_eq:nnTF {##1}{misc} { + \tl_set:Nx \l_um_tmpa_tl { \trim@spaces {##1} } + \cs_if_exist:cT {um_config_ \l_um_style_tl _\l_um_tmpa_tl :n} { + \str_if_eq:xxTF {\l_um_tmpa_tl}{misc} { \um_maybe_init_alphabet:V \l_um_style_tl \clist_map_break: }{ - \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{##1} }{ + \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{\l_um_tmpa_tl} }{ \um_maybe_init_alphabet:V \l_um_style_tl \clist_map_break: } @@ -1316,22 +1529,23 @@ } } \clist_map_inline:nn {#2} { - \cs_if_exist:cT {um_config_ \l_um_style_tl _##1:n} { - \str_if_eq:nnTF {##1}{misc} { - \um_trace:nx {setup-alph} {math \l_um_style_tl~(##1)} - \use:c {um_config_ \l_um_style_tl _##1:n} {#3} + \tl_set:Nx \l_um_tmpa_tl { \trim@spaces {##1} } + \cs_if_exist:cT {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} { + \str_if_eq:xxTF {\l_um_tmpa_tl}{misc} { + \um_trace:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} + \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} }{ - \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{##1} } { - \um_trace:nx {setup-alph} {math \l_um_style_tl~(##1)} - \use:c {um_config_ \l_um_style_tl _##1:n} {#3} + \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } { + \um_trace:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} + \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} }{ \bool_if:NTF \l_um_implicit_alph_bool { \seq_put_right:Nx \l_um_missing_alph_seq { \@backslashchar math \l_um_style_tl \space - (\tl_use:c{g_um_math_alphabet_name_##1_tl}) + (\tl_use:c{g_um_math_alphabet_name_ \l_um_tmpa_tl _tl}) } }{ - \use:c {um_config_ \l_um_style_tl _##1:n} {up} + \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {up} } } } @@ -2091,9 +2305,6 @@ } \xetex_or_luatex:nnn { \cs_set:Npn \um_symbol_setup: } { - \def\mathfence{\mathfence} - \def\mathover{\mathover} - \def\mathunder{\mathunder} \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { \prg_case_tl:Nnn ##3 { \mathover {} \mathunder {} } { @@ -2135,16 +2346,17 @@ } } \endgroup -\AtBeginDocument{ +\AtBeginDocument{\um_define_math_chars:} +\cs_set:Nn \um_define_math_chars: { \group_begin: \char_make_math_superscript:N \^ - \cs_set:Npn \_um_sym:nnn #1#2#3 { - \bool_if:nF { \cs_if_eq_p:NN #3 \mathaccent || - \cs_if_eq_p:NN #3 \mathopen || - \cs_if_eq_p:NN #3 \mathclose || - \cs_if_eq_p:NN #3 \mathover || - \cs_if_eq_p:NN #3 \mathunder } { - \um_cs_set_eq_active_char:Nw #2 = #1 \q_nil \ignorespaces + \cs_set:Npn \_um_sym:nnn ##1##2##3 { + \bool_if:nF { \cs_if_eq_p:NN ##3 \mathaccent || + \cs_if_eq_p:NN ##3 \mathopen || + \cs_if_eq_p:NN ##3 \mathclose || + \cs_if_eq_p:NN ##3 \mathover || + \cs_if_eq_p:NN ##3 \mathunder } { + \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } \char_make_other:N \# @@ -2216,18 +2428,38 @@ } } \cs_new:Npn \um_scan_prime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_zero:N \l_um_primecount_int \um_scanprime_collect:N \um_prime_single_mchar } \cs_new:Npn \um_scan_dprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_set:Nn \l_um_primecount_int {1} \um_scanprime_collect:N \um_prime_single_mchar } \cs_new:Npn \um_scan_trprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_set:Nn \l_um_primecount_int {2} \um_scanprime_collect:N \um_prime_single_mchar } \cs_new:Npn \um_scan_qprime: { + \cs_set_eq:NN \um_superscript:n \use:n + \int_set:Nn \l_um_primecount_int {3} + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_prime: { + \int_zero:N \l_um_primecount_int + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_dprime: { + \int_set:Nn \l_um_primecount_int {1} + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_trprime: { + \int_set:Nn \l_um_primecount_int {2} + \um_scanprime_collect:N \um_prime_single_mchar +} +\cs_new:Npn \um_scan_sup_qprime: { \int_set:Nn \l_um_primecount_int {3} \um_scanprime_collect:N \um_prime_single_mchar } @@ -2278,14 +2510,29 @@ } } \cs_new:Npn \um_scan_backprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_zero:N \l_um_primecount_int \um_scanbackprime_collect:N \um_backprime_single_mchar } \cs_new:Npn \um_scan_backdprime: { + \cs_set_eq:NN \um_superscript:n \use:n \int_set:Nn \l_um_primecount_int {1} \um_scanbackprime_collect:N \um_backprime_single_mchar } \cs_new:Npn \um_scan_backtrprime: { + \cs_set_eq:NN \um_superscript:n \use:n + \int_set:Nn \l_um_primecount_int {2} + \um_scanbackprime_collect:N \um_backprime_single_mchar +} +\cs_new:Npn \um_scan_sup_backprime: { + \int_zero:N \l_um_primecount_int + \um_scanbackprime_collect:N \um_backprime_single_mchar +} +\cs_new:Npn \um_scan_sup_backdprime: { + \int_set:Nn \l_um_primecount_int {1} + \um_scanbackprime_collect:N \um_backprime_single_mchar +} +\cs_new:Npn \um_scan_sup_backtrprime: { \int_set:Nn \l_um_primecount_int {2} \um_scanbackprime_collect:N \um_backprime_single_mchar } @@ -2325,14 +2572,15 @@ } } } -\AtBeginDocument { - \cs_set_eq:NN \prime \um_scan_prime: - \cs_set_eq:NN \drime \um_scan_dprime: - \cs_set_eq:NN \trprime \um_scan_trprime: - \cs_set_eq:NN \qprime \um_scan_qprime: - \cs_set_eq:NN \backprime \um_scan_backprime: - \cs_set_eq:NN \backdprime \um_scan_backdprime: - \cs_set_eq:NN \backtrprime \um_scan_backtrprime: +\AtBeginDocument{\um_define_prime_commands: \um_define_prime_chars:} +\cs_set:Nn \um_define_prime_commands: { + \cs_set_eq:NN \prime \um_prime_single_mchar + \cs_set_eq:NN \drime \um_prime_double_mchar + \cs_set_eq:NN \trprime \um_prime_triple_mchar + \cs_set_eq:NN \qprime \um_prime_quad_mchar + \cs_set_eq:NN \backprime \um_backprime_single_mchar + \cs_set_eq:NN \backdprime \um_backprime_double_mchar + \cs_set_eq:NN \backtrprime \um_backprime_triple_mchar } \group_begin: \char_make_active:N \' @@ -2344,39 +2592,53 @@ \char_make_active:n {"2035} \char_make_active:n {"2036} \char_make_active:n {"2037} - \AtBeginDocument{ - \cs_set_eq:NN ' \um_scan_prime: - \cs_set_eq:NN ^^^^2032 \um_scan_prime: - \cs_set_eq:NN ^^^^2033 \um_scan_dprime: - \cs_set_eq:NN ^^^^2034 \um_scan_trprime: - \cs_set_eq:NN ^^^^2057 \um_scan_qprime: - \cs_set_eq:NN ` \um_scan_backprime: - \cs_set_eq:NN ^^^^2035 \um_scan_backprime: - \cs_set_eq:NN ^^^^2036 \um_scan_backdprime: - \cs_set_eq:NN ^^^^2037 \um_scan_backtrprime: + \cs_gset:Nn \um_define_prime_chars: { + \cs_set_eq:NN ' \um_scan_sup_prime: + \cs_set_eq:NN ^^^^2032 \um_scan_sup_prime: + \cs_set_eq:NN ^^^^2033 \um_scan_sup_dprime: + \cs_set_eq:NN ^^^^2034 \um_scan_sup_trprime: + \cs_set_eq:NN ^^^^2057 \um_scan_sup_qprime: + \cs_set_eq:NN ` \um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2035 \um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2036 \um_scan_sup_backdprime: + \cs_set_eq:NN ^^^^2037 \um_scan_sup_backtrprime: } \group_end: -\luatex_if_engine:T { - \RenewDocumentCommand \sqrt { O{} m } { - \luatexUroot \l_um_radical_sqrt_tl {#1} {#2} +\AtBeginDocument{\um_redefine_radical:} +\xetex_or_luatex:nnn { \cs_set:Nn \um_redefine_radical: } { + \@ifpackageloaded { amsmath } { } { + \cs_set_nopar:Npn \r@@t ##1 ##2 { + \hbox_set:Nn \l_tmpa_box { + \c_math_shift_token + \m@th + ##1 + \sqrtsign { ##2 } + \c_math_shift_token + } + \um_mathstyle_scale:Nnn ##1 { \kern } { + \fontdimen 63 \l_um_font + } + \box_move_up:nn { + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box) + * \number \fontdimen 65 \l_um_font / 100 + } { + \box_use:N \rootbox + } + \um_mathstyle_scale:Nnn ##1 { \kern } { + \fontdimen 64 \l_um_font + } + \box_use_clear:N \l_tmpa_box + } } - \cs_set:Npn \root #1 \of #2 { - \luatexUroot \l_um_radical_sqrt_tl {#1} {#2} +} { + \@ifpackageloaded { amsmath } { } { + \cs_set:Npn \root ##1 \of ##2 { + \luatexUroot \l_um_radical_sqrt_tl { ##1 } { ##2 } + } } } -\cs_set_nopar:Npn \r@@t #1#2 { - \setbox\z@\hbox{$\m@th #1\sqrtsign{#2}$} - \um_mathstyle_scale:Nnn{#1}{\kern}{\fontdimen63\l_um_font} - \raise \dimexpr( - \um_fontdimen_to_percent:nn{65}{\l_um_font}\ht\z@- - \um_fontdimen_to_percent:nn{65}{\l_um_font}\dp\z@ - )\relax - \copy \rootbox - \um_mathstyle_scale:Nnn{#1}{\kern}{\fontdimen64\l_um_font} - \box \z@ -} \cs_new:Npn \um_fontdimen_to_percent:nn #1#2 { - 0.\strip@pt\dimexpr\fontdimen#1#2 *65536\relax + \strip@pt\dimexpr\fontdimen#1#2*65536/100\relax } \cs_new:Npn \um_mathstyle_scale:Nnn #1#2#3 { \ifx#1\scriptstyle @@ -2539,7 +2801,6 @@ } \um_setup_active_frac: \def\to{\rightarrow} -\def\overrightarrow{\vec} \def\le{\leq} \def\ge{\geq} \def\neq{\ne} @@ -2552,6 +2813,10 @@ \def\diamond{\smwhtdiamond} \def\emptyset{\varnothing} \def\hbar{\hslash} +\def\land{\wedge} +\def\lor{\vee} +\def\owns{\ni} +\def\gets{\leftarrow} \def\backepsilon{\upbackepsilon} \def\eth{\matheth} \def\smallint{{\textstyle\int}\limits} @@ -2564,20 +2829,58 @@ } \def\mathrm{\mathup} \let\mathfence\mathord -\luatex_if_engine:T { - \cs_set:Npn \overline {\pdfprimitive\overline} -} \def\digamma{\updigamma} \def\Digamma{\upDigamma} \def\operator@font{\um_switchto_mathup:} -\cs_new:Npn \um_patch_pkg:nn #1#2 { - \@ifpackageloaded {#1} { - #2 - }{ - \um_after_pkg:nn {#1} {#2} +\chk_if_free_cs:N \um_tmpa:w +\cs_new_protected_nopar:Npn \um_check_and_fix:NNnnnn #1 #2 #3 #4 #5 #6 { + \cs_if_exist:NT #1 { + \token_if_macro:NTF #1 { + \group_begin: + #2 \um_tmpa:w #3 { #4 } + \cs_if_eq:NNTF #1 \um_tmpa:w { + \msg_info:nnx { unicode-math } { patch-macro } + { \token_to_str:N #1 } + \group_end: + \xetex_or_luatex:nnn { #2 #1 #3 } { #6 } { #5 } + } { + \msg_warning:nnxxx { unicode-math } { wrong-meaning } + { \token_to_str:N #1 } { \token_to_meaning:N #1 } + { \token_to_meaning:N \um_tmpa:w } + \group_end: + } + } { + \msg_warning:nnx { unicode-math } { macro-expected } + { \token_to_str:N #1 } + } } } -\um_patch_pkg:nn {url} { +\cs_new_protected_nopar:Npn \um_check_and_fix:NNnnn #1 #2 #3 #4 #5 { + \um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } +} +\cs_new_protected_nopar:Npn \um_check_and_fix_luatex:NNnnn #1 #2 #3 #4 #5 { + \luatex_if_engine:T { + \um_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } + } +} +\cs_generate_variant:Nn \um_check_and_fix_luatex:NNnnn { c } +\luatex_if_engine:T { + \AtBeginDocument{\um_patch_amsmath:} + \cs_set:Nn \um_patch_amsmath: { + \@ifpackageloaded { amsmath } { } { + \um_check_and_fix:NNnnn \frac \cs_set_nopar:Npn { ##1 ##2 } { + { + \begingroup ##1 \endgroup \over ##2 + } + } { + { + \luatexUstack { \group_begin: ##1 \group_end: \over ##2 } + } + } + } + } +} +\AtEndOfPackageFile * {url} { \tl_put_left:Nn \Url@FormatString { \um_switchto_mathup: } \tl_put_right:Nn \UrlSpecials { \do\`{\mathchar`\`} @@ -2586,7 +2889,7 @@ \do\&{\mathchar`\&} } } -\um_patch_pkg:nn {amsmath} { +\AtEndOfPackageFile * {amsmath} { \tl_remove_in:Nn \@begindocumenthook { \mathchardef\std@minus\mathcode`\-\relax \mathchardef\std@equal\mathcode`\=\relax @@ -2596,11 +2899,171 @@ \cs_set:Npn \@cdots {\mathinner{\cdots}} \cs_set_eq:NN \dotsb@ \cdots \def \resetMathstrut@ {% - \setbox\z@\hbox{$($}% + \setbox\z@\hbox{$($}%) \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ } + \um_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } { + \vcenter + \bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip \fontdimen 10~ \scriptfont \tw@ + \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ + \lineskip \thr@@ \fontdimen 8~ \scriptfont \thr@@ + \lineskiplimit \lineskip + \ialign + \bgroup + \ifx c #1 \hfil \fi + $ \m@th \scriptstyle ## $ + \hfil + \crcr + } { + \vcenter + \c_group_begin_token + \Let@ + \restore@math@cr + \default@tag + \skip_set:Nn \baselineskip { + \um_stack_num_up:N \scriptstyle + + \um_stack_denom_down:N \scriptstyle + } + \lineskip \um_stack_vgap:N \scriptstyle + \lineskiplimit \lineskip + \ialign + \c_group_begin_token + \token_if_eq_meaning:NNT c #1 { \hfil } + \c_math_shift_token + \m@th + \scriptstyle + \c_parameter_token \c_parameter_token + \c_math_shift_token + \hfil + \crcr + } + \um_check_and_fix_luatex:cNnnn { frac~ } \cs_set:Npn { #1 #2 } { + { + \begingroup #1 \endgroup \@@over #2 + } + } { + { + \luatexUstack { \group_begin: #1 \group_end: \@@over #2 } + } + } + \um_check_and_fix_luatex:NNnnn \@genfrac \cs_set_nopar:Npn { + #1 #2 #3 #4 #5 + } { + { + #1 { \begingroup #4 \endgroup #2 #3 \relax #5 } + } + } { + { + #1 { + \luatexUstack { + \group_begin: #4 \group_end: #2 #3 \scan_stop: #5 + } + } + } + } + \um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } { + \setbox \rootbox \hbox { + $ \m@th \scriptscriptstyle { #1 } $ + } + \mathchoice + { \r@@t \displaystyle { #2 } } + { \r@@t \textstyle { #2 } }~ + { \r@@t \scriptstyle { #2 } } + { \r@@t \scriptscriptstyle { #2 } } + \egroup + } { + \bool_if:nTF { + \int_compare_p:nNn { \uproot@ } = { \c_zero } + && \int_compare_p:nNn { \leftroot@ } = { \c_zero } + } { + \luatexUroot \l_um_radical_sqrt_tl { #1 } { #2 } + } { + \hbox_set:Nn \rootbox { + \c_math_shift_token + \m@th + \scriptscriptstyle { #1 } + \c_math_shift_token + } + \mathchoice + { \r@@t \displaystyle { #2 } } + { \r@@t \textstyle { #2 } } + { \r@@t \scriptstyle { #2 } } + { \r@@t \scriptscriptstyle { #2 } } + } + \c_group_end_token + } + \um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } { + \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } + \dimen@ \ht\z@ + \advance \dimen@ -\dp\z@ + \setbox\@ne \hbox { $ \m@th #1 \mskip \uproot@ mu $ } + \advance \dimen@ by 1.667 \wd\@ne + \mkern -\leftroot@ mu + \mkern 5mu + \raise .6\dimen@ \copy\rootbox + \mkern -10mu + \mkern \leftroot@ mu + \boxz@ + } { + \hbox_set:Nn \l_tmpa_box { + \c_math_shift_token + \m@th + #1 + \mskip \uproot@ mu + \c_math_shift_token + } + \luatexUroot \l_um_radical_sqrt_tl { + \box_move_up:nn { \box_wd:N \l_tmpa_box } { + \hbox:n { + \c_math_shift_token + \m@th + \mkern -\leftroot@ mu + \box_use:N \rootbox + \mkern \leftroot@ mu + \c_math_shift_token + } + } + } { + #2 + } + } { + \hbox_set:Nn \l_tmpa_box { + \c_math_shift_token + \m@th + #1 + \sqrtsign { #2 } + \c_math_shift_token + } + \hbox_set:Nn \l_tmpb_box { + \c_math_shift_token + \m@th + #1 + \mskip \uproot@ mu + \c_math_shift_token + } + \mkern -\leftroot@ mu + \um_mathstyle_scale:Nnn #1 { \kern } { + \fontdimen 63 \l_um_font + } + \box_move_up:nn { + \box_wd:N \l_tmpb_box + + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box) + * \number \fontdimen 65 \l_um_font / 100 + } { + \box_use:N \rootbox + } + \um_mathstyle_scale:Nnn #1 { \kern } { + \fontdimen 64 \l_um_font + } + \mkern \leftroot@ mu + \box_use_clear:N \l_tmpa_box + } } -\um_patch_pkg:nn {amsopn} { +\AtEndOfPackageFile * {amsopn} { \cs_set:Npn \newmcodes@ { \mathcode`\'39\scan_stop: \mathcode`\*42\scan_stop: @@ -2616,20 +3079,112 @@ \cs_set:Npn \| {\Vert} \cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} \cs_set:Npn \cdots {\mathinner{\unicodecdots}} -\AtBeginDocument{ +\xetex_or_luatex:nnn { \cs_new_protected_nopar:Npn \um_setup_accents: } { \def\widehat{\hat} \def\widetilde{\tilde} + \def\overrightarrow{\vec} +} { + \cs_gset_protected_nopar:Npx \widehat { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0302 } + } + \cs_gset_protected_nopar:Npx \widetilde { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0303 } + } + \cs_gset_protected_nopar:Npx \overleftarrow { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D6 } + } + \cs_gset_protected_nopar:Npx \overrightarrow { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D7 } + } + \cs_gset_protected_nopar:Npx \overleftrightarrow { + \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20E1 } + } + \bool_if:NT \c_um_have_fixed_accents_bool { + \cs_gset_protected_nopar:Npx \underrightharpoondown { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EC } + } + \cs_gset_protected_nopar:Npx \underleftharpoondown { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20ED } + } + \cs_gset_protected_nopar:Npx \underleftarrow { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EE } + } + \cs_gset_protected_nopar:Npx \underrightarrow { + \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EF } + } + } } \cs_set_eq:NN \um_text_slash: \slash \cs_set:Npn \slash { \mode_if_math:TF {\mathslash} {\um_text_slash:} } -\AtEndOfPackage{ - \@ifclassloaded{beamer}{ - \ifbeamer@suppressreplacements\else - \um_warning:n {disable-beamer} - \beamer@suppressreplacementstrue +\AtEndOfPackageFile * { mathtools } { + \um_check_and_fix:NNnnnn \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } { + \sbox \z@ { + $ + \m@th + #1 + \nulldelimiterspace = \z@ + \radical \z@ { #2 } + $ + } + \ifx #1 \displaystyle + \dimen@ = \fontdimen 8 \textfont 3 + \advance \dimen@ .25 \fontdimen 5 \textfont 2 + \else + \dimen@ = 1.25 \fontdimen 8 + \ifx #1 \textstyle + \textfont + \else + \ifx #1 \scriptstyle + \scriptfont + \else + \scriptscriptfont + \fi + \fi + 3 \fi - }{} -} + \advance \dimen@ -\ht\z@ + \ht\z@ = -\dimen@ + \box\z@ + } { + \use:c { luatexcramped \cs_to_str:N #1 } #2 + } { + \hbox_set:Nn \l_tmpa_box { + \color@setgroup + \c_math_shift_token + \m@th + #1 + \dim_zero:N \nulldelimiterspace + \radical \c_zero { #2 } + \c_math_shift_token + \color@endgroup + } + \box_set_ht:Nn \l_tmpa_box { + \box_ht:N \l_tmpa_box + - \um_radical_vgap:N #1 + } + \box_use_clear:N \l_tmpa_box + } + \msg_warning:nn { unicode-math } { mathtools } + \NewDocumentCommand \dblcolon { } { \Colon } + \NewDocumentCommand \coloneqq { } { \coloneq } + \NewDocumentCommand \Coloneqq { } { \Coloneq } + \NewDocumentCommand \eqqcolon { } { \eqcolon } +} +\AtEndOfPackageFile * { colonequals } { + \msg_warning:nn { unicode-math } { colonequals } + \RenewDocumentCommand \ratio { } { \mathratio } + \RenewDocumentCommand \coloncolon { } { \Colon } + \RenewDocumentCommand \minuscolon { } { \dashcolon } + \RenewDocumentCommand \colonequals { } { \coloneq } + \RenewDocumentCommand \equalscolon { } { \eqcolon } + \RenewDocumentCommand \coloncolonequals { } { \Coloneq } +} +\@ifclassloaded{beamer}{ + \ifbeamer@suppressreplacements\else + \um_warning:n {disable-beamer} + \beamer@suppressreplacementstrue + \fi +}{} \ExplSyntaxOff |