summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/kdpcover/DEPENDS.txt3
-rw-r--r--macros/latex/contrib/kdpcover/README.md3
-rw-r--r--macros/latex/contrib/kdpcover/kdpcover.dtx65
-rw-r--r--macros/latex/contrib/kdpcover/kdpcover.ins8
-rw-r--r--macros/latex/contrib/kdpcover/kdpcover.pdfbin260022 -> 368603 bytes
-rw-r--r--macros/latex/contrib/kdpcover/yb-book-logo.pdfbin0 -> 5216 bytes
-rw-r--r--macros/latex/contrib/mathfont/README.txt78
-rw-r--r--macros/latex/contrib/mathfont/mathfont_code.dtx1803
-rw-r--r--macros/latex/contrib/mathfont/mathfont_code.pdfbin381683 -> 371018 bytes
-rw-r--r--macros/latex/contrib/mathfont/mathfont_example_cormorant.pdfbin48599 -> 51264 bytes
-rw-r--r--macros/latex/contrib/mathfont/mathfont_example_kelvinch.pdfbin70870 -> 84913 bytes
-rw-r--r--macros/latex/contrib/mathfont/mathfont_example_roboto.pdfbin47734 -> 54246 bytes
-rw-r--r--macros/latex/contrib/mathfont/mathfont_example_typey.pdfbin39136 -> 38746 bytes
-rw-r--r--macros/latex/contrib/mathfont/mathfont_symbol_list.pdfbin185186 -> 232449 bytes
-rw-r--r--macros/latex/contrib/mathfont/mathfont_user_guide.pdfbin114809 -> 115029 bytes
-rw-r--r--macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdfbin738301 -> 744621 bytes
-rw-r--r--macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex60
-rw-r--r--macros/latex/contrib/proflycee/tex/ProfLycee.sty25
-rw-r--r--macros/latex/required/babel/base/README.md26
-rw-r--r--macros/latex/required/babel/base/babel.dtx249
-rw-r--r--macros/latex/required/babel/base/babel.ins2
-rw-r--r--macros/latex/required/babel/base/babel.pdfbin885304 -> 897584 bytes
-rw-r--r--macros/latex/required/babel/base/bbcompat.dtx2
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.lua336
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.pdfbin114054 -> 116020 bytes
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.sty63
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.tex204
27 files changed, 1503 insertions, 1424 deletions
diff --git a/macros/latex/contrib/kdpcover/DEPENDS.txt b/macros/latex/contrib/kdpcover/DEPENDS.txt
index c4c670d01b..e07680365e 100644
--- a/macros/latex/contrib/kdpcover/DEPENDS.txt
+++ b/macros/latex/contrib/kdpcover/DEPENDS.txt
@@ -6,4 +6,5 @@ hard microtype
hard xcolor
hard setspace
hard geometry
-hard textpos \ No newline at end of file
+hard textpos
+hard etoolbox \ No newline at end of file
diff --git a/macros/latex/contrib/kdpcover/README.md b/macros/latex/contrib/kdpcover/README.md
index a50e85a40a..6563185c6e 100644
--- a/macros/latex/contrib/kdpcover/README.md
+++ b/macros/latex/contrib/kdpcover/README.md
@@ -26,9 +26,6 @@ and then use in the preamble:
\end{document}
```
-The full example and all commands are available in the
-[`kdpcover.tex`](https://github.com/yegor256/kdpcover/blob/master/kdpcover.tex) file.
-
If you want to contribute yourself, make a fork, then create a branch,
then run `make` in the root directory.
It should compile everything without errors. If not, submit an issue and wait.
diff --git a/macros/latex/contrib/kdpcover/kdpcover.dtx b/macros/latex/contrib/kdpcover/kdpcover.dtx
index 0d3fc2b2b0..da1ab39d4d 100644
--- a/macros/latex/contrib/kdpcover/kdpcover.dtx
+++ b/macros/latex/contrib/kdpcover/kdpcover.dtx
@@ -50,13 +50,16 @@
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesClass{kdpcover}
%<*class>
-[02.10.2022 0.4.0 Cover for Kindle Direct Publishing books]
+[2022.11.30 0.5.1 Cover for Kindle Direct Publishing books]
%</class>
%<*driver>
\documentclass{ltxdoc}
\usepackage[tt=false, type1=true]{libertine}
+\usepackage{microtype}
+\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}}
\usepackage{href-ul}
-\raggedbottom
+\usepackage[dtx,margin=0,small]{docshots}
+\usepackage{graphicx}
\PageIndex
\EnableCrossrefs
\CodelineIndex
@@ -69,7 +72,7 @@
%</driver>
% \fi
-% \title{|kdpcover|: \LaTeX{} Package \\ for Amazon Book Covers\thanks{The sources are in GitHub at \href{https://github.com/yegor256/kdpcover}{yegor256/kdpcover}}}
+% \title{\includegraphics[width=0.75in]{yb-book-logo.pdf} \\ |kdpcover|: \LaTeX{} Package \\ for Amazon Book Covers\thanks{The sources are in GitHub at \href{https://github.com/yegor256/kdpcover}{yegor256/kdpcover}}}
% \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}}
% \date{\filedate, \fileversion}
%
@@ -78,29 +81,26 @@
% \section{Introduction}
%
+% \changes{v0.5.0}{2022/11/29}{The \texttt{docshots} package is used to render the documentation.}
% This class will render you a book cover, suitable for Kindle Direct Publishing (KDP).
% I use it for \href{https://amzn.to/2WMTXWF}{all my books}.
% This is how you make your \LaTeX{} document look like:
-%\iffalse
-%<*verb>
-%\fi
-\begin{verbatim}
-\documentclass[pages=200,6x9]{kdpcover}
-\begin{document}
-\putSpine{kdpcover, a LaTeX class for KDP books}
-\putVolume{1}
-\putVersion{0.4.0}
-\putPrice{\$0.00}
-\putCopyright{\the\year}{Yegor Bugayenko}
-\putTitle{kdpcover}
-\putAuthor{Yegor Bugayenko}
-\putTLDR{This book will tell you an interesting story!}
-\putPicture{cactus.pdf}
-\end{document}
-\end{verbatim}
-%\iffalse
-%</verb>
-%\fi
+% \docshotPrerequisite{cactus.pdf}
+% \begin{docshot}
+% \documentclass[pages=200,6x9]{kdpcover}
+% \begin{document}
+% \putSpine{kdpcover, a LaTeX class for KDP books}
+% \putVolume{1}
+% \putVersion{0.5.1}
+% \putPrice{\$0.00}
+% \putCopyright{\the\year}{Yegor Bugayenko}
+% \putTitle{kdpcover}
+% \putAuthor{Yegor Bugayenko}
+% \putTLDR{This book will tell you
+% an interesting story!}
+% \putPicture{cactus.pdf}
+% \end{document}
+% \end{docshot}
% The problem this class solves is the necessity to change the size of the
% cover PDF according to the number of pages in the book --- the bigger the book,
@@ -143,7 +143,7 @@
%\fi
% \end{macro}
-% \begin{macro}{9x6}
+% \begin{macro}{6x9}
% With this option you can set the size of the page to 6x9 inches.
% You can also set your own size like this:
%\iffalse
@@ -208,7 +208,7 @@
% name of the author.
% \end{macro}
-% \begin{macro}{\putCopyright}
+% \begin{macro}{\putTitle}
% This one prints the title of the book
% \end{macro}
@@ -221,7 +221,7 @@
% of the entire book.
% \end{macro}
-% \begin{macro}{\putTLDR}
+% \begin{macro}{\putPicture}
% This one prints the front picture. You can use |cactus.pdf|.
% \end{macro}
@@ -236,7 +236,13 @@
% \changes{v0.2.0}{2021/07/14}{Initial version}
-% First, we define a few internal commands:
+% First, we load our parent class:
+% \changes{v0.5.0}{2022/11/29}{The base class is now \texttt{article}.}
+% \begin{macrocode}
+\LoadClass{article}
+% \end{macrocode}
+
+% Then, we define a few internal commands:
% \begin{macrocode}
\makeatletter
\newcommand*\kdp@pages{100}
@@ -436,8 +442,9 @@
\newcommand\putVersion[1]{%
\begin{textblock}{4}[0,1](10,14)%
#1
- \quad
- \iexec{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}
+ \IfFileExists{.git}
+ {\quad\iexec{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}}
+ {}
\end{textblock}%
}
% \end{macrocode}
diff --git a/macros/latex/contrib/kdpcover/kdpcover.ins b/macros/latex/contrib/kdpcover/kdpcover.ins
index e5b5eccbd5..64a5d01106 100644
--- a/macros/latex/contrib/kdpcover/kdpcover.ins
+++ b/macros/latex/contrib/kdpcover/kdpcover.ins
@@ -48,8 +48,8 @@ SOFTWARE.
\endpreamble
\generate{\file{kdpcover.cls}{\from{kdpcover.dtx}{class}}}
\obeyspaces
-\Msg{*** To finish the installation you have to move the ".cls"}
-\Msg{*** file into a directory searched by TeX. To produce the}
-\Msg{*** documentation run the file ".dtx" through LaTeX. If any}
-\Msg{*** questions, submit a new GitHub issue.}
+\Msg{To finish the installation you have to move the ".cls"}
+\Msg{file into a directory searched by TeX. To produce the}
+\Msg{documentation run the file ".dtx" through LaTeX. If any}
+\Msg{questions, submit a new GitHub issue.}
\endbatchfile
diff --git a/macros/latex/contrib/kdpcover/kdpcover.pdf b/macros/latex/contrib/kdpcover/kdpcover.pdf
index a59838ee2a..6280c2cb4e 100644
--- a/macros/latex/contrib/kdpcover/kdpcover.pdf
+++ b/macros/latex/contrib/kdpcover/kdpcover.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpcover/yb-book-logo.pdf b/macros/latex/contrib/kdpcover/yb-book-logo.pdf
new file mode 100644
index 0000000000..5d49cb9daa
--- /dev/null
+++ b/macros/latex/contrib/kdpcover/yb-book-logo.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/README.txt b/macros/latex/contrib/mathfont/README.txt
index b5a8f78c16..9cffe034ce 100644
--- a/macros/latex/contrib/mathfont/README.txt
+++ b/macros/latex/contrib/mathfont/README.txt
@@ -1,6 +1,6 @@
-LaTeX package mathfont version 2.0 installation information.
+LaTeX package mathfont version 2.1 installation information.
-This file is README.txt from version 2.0 of the free and
+This file is README.txt from version 2.1 of the free and
open-source LaTeX package "mathfont," to be used with the
XeTeX or LuaTeX engines. The package is designed to adapt
text fonts for use in math mode, and if you typeset your
@@ -27,21 +27,22 @@ items:
To install mathfont automatically, update your TeXLive or
MacTeX distribution or use a package manager such as tlmgr.
To install mathfont manually, run mathfont_code.dtx through
-LaTeX and move the derived file mathfont.sty to a directory
-searchable by TeX.
+LaTeX. Doing so will create the file mathfont.sty, and you
+should then move mathfont.sty into a directory searchable
+by TeX.
-Copyright 2018-2021 by Conrad Kosowsky
+Copyright 2018-2022 by Conrad Kosowsky
-This file may be distributed and modified under the terms
-of the LaTeX Public Project License, version 1.3c or any
-later version. The most recent version of this license is
-available online at
+This Work may be used, distributed, and modified under the
+terms of the LaTeX Public Project License, version 1.3c or
+any later version. The most recent version of this license
+is available online at
https://www.latex-project.org/lppl/.
This Work has the LPPL status "maintained," and the current
-maintainer is the package author, Conrad Kosowsky. He can
-be reached at kosowsky.latex@gmail.com. The Work consists
+maintainer is the package author, Conrad Kosowsky. He can
+be reached at kosowsky.latex@gmail.com. The Work consists
of the following items:
(1) the base file:
@@ -73,29 +74,42 @@ of the following items:
(5) all other files created through the configuration
process
+ and
+
(6) the associated README.txt file
-THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS
-OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES
-OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-IF THE SOFTWARE IS DEFECTIVE, YOU AGREE TO ASSUME THE
-COST FOR ANY REPAIR OR CORRECTION.
-
-BY USING OR DISTRIBUTING THIS SOFTWARE, YOU AGREE
-TO RELEASE THE PACKAGE AUTHOR FROM ANY LIABILITY FOR
-DAMAGES ARISING OUT OF YOUR USE OF THE SOFTWARE. YOU
-AGREE TO DO SO TO THE MAXIMUM EXTENT ALLOWED UNDER
-APPLICABLE LAW AND EVEN IF THE PACKAGE AUTHOR HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-See also the "No Warranty" section of the LaTeX Project
-Public License. In releasing the package author from
-liability, you also release from liability any third
-parties who distribute the software under the terms
-of the LaTeX Project Public License. Derivative works
-based on this package may come with their own license or
-terms of use, and the package author is not responsible
-for any third-party software.
+PLEASE KNOW THAT THIS FREE SOFTWARE IS PROVIDED WITHOUT
+ANY WARRANTY. SPECIFICALLY, THE "NO WARRANTY" SECTION OF
+THE LATEX PROJECT PUBLIC LICENSE STATES THE FOLLOWING:
+
+THERE IS NO WARRANTY FOR THE WORK. EXCEPT WHEN OTHERWISE
+STATED IN WRITING, THE COPYRIGHT HOLDER PROVIDES THE WORK
+`AS IS’, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
+OF THE WORK IS WITH YOU. SHOULD THE WORK PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
+CORRECTION.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
+TO IN WRITING WILL THE COPYRIGHT HOLDER, OR ANY AUTHOR
+NAMED IN THE COMPONENTS OF THE WORK, OR ANY OTHER PARTY
+WHO MAY DISTRIBUTE AND/OR MODIFY THE WORK AS PERMITTED
+ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
+SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
+OF ANY USE OF THE WORK OR OUT OF INABILITY TO USE THE WORK
+(INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA, DATA BEING
+RENDERED INACCURATE, OR LOSSES SUSTAINED BY ANYONE AS A
+RESULT OF ANY FAILURE OF THE WORK TO OPERATE WITH ANY
+OTHER PROGRAMS), EVEN IF THE COPYRIGHT HOLDER OR SAID
+AUTHOR OR SAID OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+For more information, see the LaTeX Project Public License.
+Derivative works based on this package may come with their
+own license or terms of use, and the package author is not
+responsible for any third-party software.
The Work does not include any fonts, and the installation
does not contain any font files. The fonts Bona Nova,
diff --git a/macros/latex/contrib/mathfont/mathfont_code.dtx b/macros/latex/contrib/mathfont/mathfont_code.dtx
index 4c2ec76877..cb579ee77c 100644
--- a/macros/latex/contrib/mathfont/mathfont_code.dtx
+++ b/macros/latex/contrib/mathfont/mathfont_code.dtx
@@ -1,7 +1,7 @@
% \iffalse ---!!! FIRST META-COMMENT !!!---
%
%
-% This file is mathfont_code.dtx from version 2.0 of the
+% This file is mathfont_code.dtx from version 2.1 of the
% free and open-source LaTeX package "mathfont," to be
% used with the XeTeX or LuaTeX engines. Running LaTeX on
% mathfont_code.dtx will produce the following files:
@@ -18,7 +18,9 @@
%
% (4) the stand-alone derived files mathfont_doc_patch.tex,
% mathfont_equations.tex, and mathfont_heading.tex,
-% which are used to produce documentation; and
+% which are used to produce documentation;
+%
+% and
%
% (5) a number of other derived files.
%
@@ -31,22 +33,22 @@
% \iffalse ---!!! SECOND META-COMMENT !!!---
%
%
-% This file is from version 2.0 of the free and open-source
+% This file is from version 2.1 of the free and open-source
% LaTeX package "mathfont," to be used with the XeTeX or
% LuaTeX engines. (As of version 2.0, LuaTeX is recommended.)
%
-% Copyright 2018-2021 by Conrad Kosowsky
+% Copyright 2018-2022 by Conrad Kosowsky
%
-% This file may be distributed and modified under the terms
-% of the LaTeX Public Project License, version 1.3c or any
-% later version. The most recent version of this license is
-% available online at
+% This Work may be used, distributed, and modified under the
+% terms of the LaTeX Public Project License, version 1.3c or
+% any later version. The most recent version of this license
+% is available online at
%
% https://www.latex-project.org/lppl/.
%
% This Work has the LPPL status "maintained," and the current
-% maintainer is the package author, Conrad Kosowsky. He can
-% be reached at kosowsky.latex@gmail.com. The Work consists
+% maintainer is the package author, Conrad Kosowsky. He can
+% be reached at kosowsky.latex@gmail.com. The Work consists
% of the following items:
%
% (1) the base file:
@@ -78,37 +80,50 @@
% (5) all other files created through the configuration
% process
%
+% and
+%
% (6) the associated README.txt file
%
-% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS
-% OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES
-% OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-% IF THE SOFTWARE IS DEFECTIVE, YOU AGREE TO ASSUME THE
-% COST FOR ANY REPAIR OR CORRECTION.
+% PLEASE KNOW THAT THIS FREE SOFTWARE IS PROVIDED WITHOUT
+% ANY WARRANTY. SPECIFICALLY, THE "NO WARRANTY" SECTION OF
+% THE LATEX PROJECT PUBLIC LICENSE STATES THE FOLLOWING:
+%
+% THERE IS NO WARRANTY FOR THE WORK. EXCEPT WHEN OTHERWISE
+% STATED IN WRITING, THE COPYRIGHT HOLDER PROVIDES THE WORK
+% `AS IS’, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+% PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
+% OF THE WORK IS WITH YOU. SHOULD THE WORK PROVE DEFECTIVE,
+% YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
+% CORRECTION.
%
-% BY USING OR DISTRIBUTING THIS SOFTWARE, YOU AGREE
-% TO RELEASE THE PACKAGE AUTHOR FROM ANY LIABILITY FOR
-% DAMAGES ARISING OUT OF YOUR USE OF THE SOFTWARE. YOU
-% AGREE TO DO SO TO THE MAXIMUM EXTENT ALLOWED UNDER
-% APPLICABLE LAW AND EVEN IF THE PACKAGE AUTHOR HAS
-% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
+% TO IN WRITING WILL THE COPYRIGHT HOLDER, OR ANY AUTHOR
+% NAMED IN THE COMPONENTS OF THE WORK, OR ANY OTHER PARTY
+% WHO MAY DISTRIBUTE AND/OR MODIFY THE WORK AS PERMITTED
+% ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
+% SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
+% OF ANY USE OF THE WORK OR OUT OF INABILITY TO USE THE WORK
+% (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA, DATA BEING
+% RENDERED INACCURATE, OR LOSSES SUSTAINED BY ANYONE AS A
+% RESULT OF ANY FAILURE OF THE WORK TO OPERATE WITH ANY
+% OTHER PROGRAMS), EVEN IF THE COPYRIGHT HOLDER OR SAID
+% AUTHOR OR SAID OTHER PARTY HAS BEEN ADVISED OF THE
+% POSSIBILITY OF SUCH DAMAGES.
%
-% See also the "No Warranty" section of the LaTeX Project
-% Public License. In releasing the package author from
-% liability, you also release from liability any third
-% parties who distribute the software under the terms
-% of the LaTeX Project Public License. Derivative works
-% based on this package may come with their own license or
-% terms of use, and the package author is not responsible
-% for any third-party software.
+% For more information, see the Latex Project Public License.
+% Derivative works based on this package may come with their
+% own license or terms of use, and the package author is not
+% responsible for any third-party software.
%
% The Work does not include any fonts, and the installation
-% does not contain any font files. The fonts Bona Nova,
-% Cormorant, Crimson, Kelvinch, Overpass, STIXGeneral, and
-% Typey McTypeface have released under the SIL Open Font
-% License and are used pursuant to that license. The font
-% Roboto has been released under the Apache License and is
-% used pursuant to that license.
+% does not contain any font files. The fonts Bona Nova,
+% Cormorant, Crimson, Kelvinch, Overpass, STIXGeneral, and
+% Typey McTypeface have been released under the SIL Open
+% Font License and are used pursuant to that license. The
+% font Roboto has been released under the Apache License
+% and is used pursuant to that license.
%
% Happy TeXing!
%
@@ -117,7 +132,7 @@
% \iffalse
%
% The installation and driver files are incorporated into
-% mathfont_code.dtx, so we do not need to generate them
+% mathfont_code.dtx, so we do not need to generate them
% separately. The <batchfile> and <driver> tags are for
% reference.
%
@@ -128,16 +143,16 @@
\askforoverwritefalse
\preamble
-This file is from version 2.0 of the free and open-source
+This file is from version 2.1 of the free and open-source
LaTeX package "mathfont," to be used with the XeTeX or
LuaTeX engines. (As of version 2.0, LuaTeX is recommended.)
-Copyright 2018-2021 by Conrad Kosowsky
+Copyright 2018-2022 by Conrad Kosowsky
-This file may be distributed and modified under the terms
-of the LaTeX Public Project License, version 1.3c or any
-later version. The most recent version of this license is
-available online at
+This Work may be used, distributed, and modified under the
+terms of the LaTeX Public Project License, version 1.3c or
+any later version. The most recent version of this license
+is available online at
https://www.latex-project.org/lppl/.
@@ -145,29 +160,40 @@ This Work has the LPPL status "maintained," and the current
maintainer is the package author, Conrad Kosowsky. He can
be reached at kosowsky.latex@gmail.com.
-THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS
-OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES
-OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-IF THE SOFTWARE IS DEFECTIVE, YOU AGREE TO ASSUME THE
-COST FOR ANY REPAIR OR CORRECTION.
-
-BY USING OR DISTRIBUTING THIS SOFTWARE, YOU AGREE
-TO RELEASE THE PACKAGE AUTHOR FROM ANY LIABILITY FOR
-DAMAGES ARISING OUT OF YOUR USE OF THE SOFTWARE. YOU
-AGREE TO DO SO TO THE MAXIMUM EXTENT ALLOWED UNDER
-APPLICABLE LAW AND EVEN IF THE PACKAGE AUTHOR HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-See also the "No Warranty" section of the LaTeX Project
-Public License. In releasing the package author from
-liability, you also release from liability any third
-parties who distribute the software under the terms
-of the LaTeX Project Public License. Derivative works
-based on this package may come with their own license or
-terms of use, and the package author is not responsible
-for any third-party software.
-
-For more information, see the mathfont_code.dtx.
+PLEASE KNOW THAT THIS FREE SOFTWARE IS PROVIDED WITHOUT
+ANY WARRANTY. SPECIFICALLY, THE "NO WARRANTY" SECTION OF
+THE LATEX PROJECT PUBLIC LICENSE STATES THE FOLLOWING:
+
+THERE IS NO WARRANTY FOR THE WORK. EXCEPT WHEN OTHERWISE
+STATED IN WRITING, THE COPYRIGHT HOLDER PROVIDES THE WORK
+`AS IS’, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
+OF THE WORK IS WITH YOU. SHOULD THE WORK PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
+CORRECTION.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
+TO IN WRITING WILL THE COPYRIGHT HOLDER, OR ANY AUTHOR
+NAMED IN THE COMPONENTS OF THE WORK, OR ANY OTHER PARTY
+WHO MAY DISTRIBUTE AND/OR MODIFY THE WORK AS PERMITTED
+ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
+SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
+OF ANY USE OF THE WORK OR OUT OF INABILITY TO USE THE WORK
+(INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA, DATA BEING
+RENDERED INACCURATE, OR LOSSES SUSTAINED BY ANYONE AS A
+RESULT OF ANY FAILURE OF THE WORK TO OPERATE WITH ANY
+OTHER PROGRAMS), EVEN IF THE COPYRIGHT HOLDER OR SAID
+AUTHOR OR SAID OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+For more information, see the LaTeX Project Public License.
+Derivative works based on this package may come with their
+own license or terms of use, and the package author is not
+responsible for any third-party software.
+
+For more information, see mathfont_code.dtx.
Happy TeXing!
@@ -210,6 +236,8 @@ Happy TeXing!
\c@topnumber\@ne
\columnsep=20pt
\MacroIndent=1.32em
+\AtBeginDocument{%
+ \baselineskip=\the\baselineskip plus 0.3pt minus 0.3pt\relax}
\let\index@prologue\relax
\EnableCrossrefs\CodelineIndex
\begin{document}
@@ -242,12 +270,12 @@ Happy TeXing!
% \fi
%
%
-% \CheckSum{6965}
+% \CheckSum{6609}
% \init@checksum
%
%
% \makeatother\CharacterTable
-% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
@@ -293,13 +321,20 @@ Happy TeXing!
% \M@Decl@reF@milytrue,\M@Decl@reF@milyfalse,\itdefault,\shapedefault,%
% \mddefault,\bfdefault,\E@sterEggDecl@redtrue,\detokenize,\@ifnextchar,%
% \@next,\@suboptionpresenttrue,\@suboptionpresentfalse,\@break@tfor,%
-% \M@adjust@fonttrue,\M@adjust@fontfalse,\M@fromCharmFiletrue,\M@fromCharmFilefalse,%
-% \M@arg@goodtrue,\M@arg@goodfalse,\M@Noluaotfloadtrue,\M@Noluaotfloadfalse,%
-% \M@XeTeXLuaTeXtrue,\ifcsname,\ifdefined,\TU,\",\@@DeclareSymbolFont,%
-% \@@set@mathaccent,\@@set@mathchar,\@@set@mathsymbol,\@expandedtwoargs,%
-% \@spaces,\@tempswatrue,\@tempswafalse,\@iftempswa,\@tempbase,\@tempfeatures,
-% \copy,\e@mathgroup@top,\endlinechar,\everyeof,\globaldefs,\m@th,\newbox,\newread,%
-% \newmuskip,\number,\setmainfont,\zap@space,\setbox,\clap,\hss,\ht,\wd,\dp,\raise}
+% \M@adjust@fonttrue,\M@adjust@fontfalse,\M@fromCharmFiletrue,%
+% \M@fromCharmFilefalse,\M@arg@goodtrue,\M@arg@goodfalse,\M@Noluaotfloadtrue,%
+% \M@Noluaotfloadfalse,\M@XeTeXLuaTeXtrue,\ifcsname,\ifdefined,\TU,\",%
+% \@@DeclareSymbolFont,\@@set@mathaccent,\@@set@mathchar,\@@set@mathsymbol,%
+% \@expandedtwoargs,\@spaces,\@tempswatrue,\@tempswafalse,\@iftempswa,%
+% \@tempbase,\@tempfeatures,\copy,\e@mathgroup@top,\endlinechar,\everyeof,%
+% \globaldefs,\m@th,\newbox,\newread,\newmuskip,\number,\setmainfont,%
+% \zap@space,\setbox,\clap,\hss,\ht,\wd,\dp,\raise,\M@arrows@font,%
+% \M@delimiters@font,\M@extbigops@font,\M@extsymbols@font,\M@symbols@font,%
+% \M@greekupper@font,\M@greeklower@font,\M@agreekupper@font,%
+% \M@agreeklower@font,\M@bigops@font,\M@upper@font,\M@lower@font,%
+% \M@radical@font,\M@diacritics@font,\M@cyrillicupper@font,%
+% \M@cyrilliclower@font,\M@hebrew@font,\Umathcode,\EasterEggUpdate,%
+% \@firstofone,\if@arg@good,\M@f@ntn@me,\M@f@ntn@meb@se,\dimen@}
% \DoNotIndex{\cyrA,\cyrBe,\cyrVe,\cyrGhe,\cyrDe,%
% \cyrIe,\cyrZhe,\cyrZe,\cyrI,\cyrKa,\cyrEl,%
% \cyrEm,\cyrEn,\cyrO,\cyrPe,\cyrEr,\cyrEs,%
@@ -312,53 +347,6 @@ Happy TeXing!
% \cyrha,\cyrtse,\cyrche,\cyrsha,\cyrshcha,%
% \cyrhard,\cyryeru,\cyrsoft,\cyre,\cyryu,%
% \cyrya,\cyrvari}
-% \DoNotIndex{\M@bb@A,\M@bb@B,\M@bb@C,\M@bb@D,\M@bb@E,%
-% \M@bb@F,\M@bb@G,\M@bb@H,\M@bb@I,\M@bb@J,\M@bb@K,%
-% \M@bb@L,\M@bb@M,\M@bb@N,\M@bb@O,\M@bb@P,\M@bb@Q,%
-% \M@bb@R,\M@bb@S,\M@bb@T,\M@bb@U,\M@bb@V,\M@bb@W,%
-% \M@bb@X,\M@bb@Y,\M@bb@Z,\M@bb@a,\M@bb@b,\M@bb@c,%
-% \M@bb@d,\M@bb@e,\M@bb@f,\M@bb@g,\M@bb@h,\M@bb@i,%
-% \M@bb@j,\M@bb@k,\M@bb@l,\M@bb@m,\M@bb@n,\M@bb@o,%
-% \M@bb@p,\M@bb@q,\M@bb@r,\M@bb@s,\M@bb@t,\M@bb@u,%
-% \M@bb@v,\M@bb@w,\M@bb@x,\M@bb@y,\M@bb@z}
-% \DoNotIndex{\M@cal@A,\M@cal@B,\M@cal@C,\M@cal@D,\M@cal@E,%
-% \M@cal@F,\M@cal@G,\M@cal@H,\M@cal@I,\M@cal@J,\M@cal@K,%
-% \M@cal@L,\M@cal@M,\M@cal@N,\M@cal@O,\M@cal@P,\M@cal@Q,%
-% \M@cal@R,\M@cal@S,\M@cal@T,\M@cal@U,\M@cal@V,\M@cal@W,%
-% \M@cal@X,\M@cal@Y,\M@cal@Z,\M@cal@a,\M@cal@b,\M@cal@c,%
-% \M@cal@d,\M@cal@e,\M@cal@f,\M@cal@g,\M@cal@h,\M@cal@i,%
-% \M@cal@j,\M@cal@k,\M@cal@l,\M@cal@m,\M@cal@n,\M@cal@o,%
-% \M@cal@p,\M@cal@q,\M@cal@r,\M@cal@s,\M@cal@t,\M@cal@u,%
-% \M@cal@v,\M@cal@w,\M@cal@x,\M@cal@y,\M@cal@z}
-% \DoNotIndex{\M@frak@A,\M@frak@B,\M@frak@C,\M@frak@D,\M@frak@E,%
-% \M@frak@F,\M@frak@G,\M@frak@H,\M@frak@I,\M@frak@J,\M@frak@K,%
-% \M@frak@L,\M@frak@M,\M@frak@N,\M@frak@O,\M@frak@P,\M@frak@Q,%
-% \M@frak@R,\M@frak@S,\M@frak@T,\M@frak@U,\M@frak@V,\M@frak@W,%
-% \M@frak@X,\M@frak@Y,\M@frak@Z,\M@frak@a,\M@frak@b,\M@frak@c,%
-% \M@frak@d,\M@frak@e,\M@frak@f,\M@frak@g,\M@frak@h,\M@frak@i,%
-% \M@frak@j,\M@frak@k,\M@frak@l,\M@frak@m,\M@frak@n,\M@frak@o,%
-% \M@frak@p,\M@frak@q,\M@frak@r,\M@frak@s,\M@frak@t,\M@frak@u,%
-% \M@frak@v,\M@frak@w,\M@frak@x,\M@frak@y,\M@frak@z}
-% \DoNotIndex{\M@bcal@A,\M@bcal@B,\M@bcal@C,\M@bcal@D,\M@bcal@E,%
-% \M@bcal@F\M@bcal@G,\M@bcal@H,\M@bcal@I,\M@bcal@J,\M@bcal@K,%
-% \M@bcal@L\M@bcal@M,\M@bcal@N,\M@bcal@O,\M@bcal@P,\M@bcal@Q,%
-% \M@bcal@R,\M@bcal@S,\M@bcal@T,\M@bcal@U,\M@bcal@V,\M@bcal@W,%
-% \M@bcal@X,\M@bcal@Y,\M@bcal@Z,\M@bcal@a,\M@bcal@b,\M@bcal@c,%
-% \M@bcal@d,\M@bcal@e,\M@bcal@f,\M@bcal@g,\M@bcal@h,\M@bcal@i,%
-% \M@bcal@j,\M@bcal@k,\M@bcal@l,\M@bcal@m,\M@bcal@n,\M@bcal@o,%
-% \M@bcal@p,\M@bcal@q,\M@bcal@r,\M@bcal@s,\M@bcal@t,\M@bcal@u,%
-% \M@bcal@v,\M@bcal@w,\M@bcal@x,\M@bcal@y,\M@bcal@z}
-% \DoNotIndex{\M@bfrak@A,\M@bfrak@B,\M@bfrak@C,\M@bfrak@D,%
-% \M@bfrak@E,\M@bfrak@F,\M@bfrak@G,\M@bfrak@H,\M@bfrak@I,%
-% \M@bfrak@J,\M@bfrak@K,\M@bfrak@L,\M@bfrak@M,\M@bfrak@N,%
-% \M@bfrak@O,\M@bfrak@P,\M@bfrak@Q,\M@bfrak@R,\M@bfrak@S,%
-% \M@bfrak@T,\M@bfrak@U,\M@bfrak@V,\M@bfrak@W,\M@bfrak@X,%
-% \M@bfrak@Y,\M@bfrak@Z,\M@bfrak@a,\M@bfrak@b,\M@bfrak@c,%
-% \M@bfrak@d,\M@bfrak@e,\M@bfrak@f,\M@bfrak@g,\M@bfrak@h,%
-% \M@bfrak@i,\M@bfrak@j,\M@bfrak@k,\M@bfrak@l,\M@bfrak@m,%
-% \M@bfrak@n,\M@bfrak@o,\M@bfrak@p,\M@bfrak@q,\M@bfrak@r,%
-% \M@bfrak@s,\M@bfrak@t,\M@bfrak@u,\M@bfrak@v,\M@bfrak@w,%
-% \M@bfrak@x,\M@bfrak@y,\M@bfrak@z}
%
%
% \DoNotIndexMain{\@@set@mathchar,\@@set@mathsymbol,%
@@ -384,14 +372,14 @@ Happy TeXing!
% \@frakshape,\@bcalshape,\@bfrakshape}
%
%
-% \noindent This file documents the code for the \textsf{mathfont} package. It is not a user guide! If you are looking for instructions on how to use \textsf{mathfont} in your document, see |mathfont_user_guide.pdf|, which is included with the \textsf{mathfont} installation and is available on \textsc{ctan}. See also the other |pdf| documentation files for \textsf{mathfont}. Section~1 of this document begins with the implementation basics, including package declaration and package options. Section~2 deals with errors and messaging, and section~3 provides package default settings. Section~4 contains the optional-argument parser for |\mathfont|, and section~5 contains the fontloader. Section 6 documents the code for the |\mathfont| command itself. In section~7, the package initializes the commands for letterlike symbols, and section~8 contains the code for local font changes. Section~9 contains miscellaneous material. Sections~10--12 contain the Lua code to modify font objects at loading, and section~13 lists the unicode hex values used in symbol declaration. Version history and code index appear at the end of the document.
+% \noindent This file documents the code for the \textsf{mathfont} package. It is not a user guide! If you are looking for instructions on how to use \textsf{mathfont} in your document, see |mathfont_user_guide.pdf|, which is included with the \textsf{mathfont} installation and is available on \textsc{ctan}. See also the other |pdf| documentation files for \textsf{mathfont}. Section~1 of this document begins with the implementation basics, including package declaration and package options. Section~2 deals with errors and messaging, and section~3 provides package default settings. Section~4 contains fontloader, and section~5 contains the optional-argument parser for |\mathfont|. Section 6 documents the code for the |\mathfont| command itself. Section~7 contains the code for local font changes. Section~8 contains miscellaneous material. Sections~9--11 contain the Lua code to modify font objects at loading, and section~12 lists the unicode hex values used in symbol declaration. Version history and code index appear at the end of the document.
%
% \section{Implementation Basics}
%
% First and foremost, the package needs to declare itself.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mathfont}[2021/12/28 v. 2.0 Package mathfont]
+\ProvidesPackage{mathfont}[2022/11/30 v. 2.1 Package mathfont]
% \end{macrocode}
% We specify conditionals that we will use later in handling options and setup.
% \begin{macrocode}
@@ -401,7 +389,7 @@ Happy TeXing!
\newif\ifM@font@loaded % load mathfont with font specified?
\newif\ifE@sterEggDecl@red % already did easter egg?
% \end{macrocode}
-% We disable the eighteen user-level commands. If \textsf{mathfont} runs normally, it will overwrite these ``bad'' definitions later, but if it throws one of its two fatal errors, it will |\endinput| while the user-level commands are error messages. That way the commands don't do anything in the user's document, and the user gets information on why not. The bad definitions gobble their original arguments to avoid a ``missing |\begin{document}|'' error.\indexpage{invalid command error}
+% We disable the twenty user-level commands. If \textsf{mathfont} runs normally, it will overwrite these ``bad'' definitions later, but if it throws one of its two fatal errors, it will |\endinput| while the user-level commands are error messages. That way the commands don't do anything in the user's document, and the user gets information on why not. The bad definitions gobble their original arguments to avoid a ``missing |\begin{document}|'' error.\indexpage{invalid command}
% \begin{macrocode}
\long\def\@gobbletwo@brackets[#1]#2{}
\def\M@NoMathfontError#1{\PackageError{mathfont}
@@ -410,25 +398,33 @@ Happy TeXing!
{Your command was ignored. I couldn't\MessageBreak
load mathfont, so I never defined this\MessageBreak
control sequence.}}
-\def\mathfont{\M@NoMathfontError\mathfont
+\protected\def\mathfont{\M@NoMathfontError\mathfont
+ \@ifnextchar[\@gobbletwo@brackets\@gobble}
+\protected\def\setfont{\M@NoMathfontError\setfont\@gobble}
+\protected\def\mathconstantsfont{\M@NoMathfontError\mathconstantsfont
\@ifnextchar[\@gobbletwo@brackets\@gobble}
-\def\mathconstantsfont{\M@NoMathfontError\mathconstantsfont\@gobble}
-\def\setfont{\M@NoMathfontError\setfont\@gobble}
-\def\newmathrm{\M@NoMathfontError\newmathrm\@gobbletwo}
-\def\newmathit{\M@NoMathfontError\newmathit\@gobbletwo}
-\def\newmathbf{\M@NoMathfontError\newmathbf\@gobbletwo}
-\def\newmathbfit{\M@NoMathfontError\newmathbf\@gobbletwo}
-\def\newmathsc{\M@NoMathfontError\newmathsc\@gobbletwo}
-\def\newmathscit{\M@NoMathfontError\newmathscit\@gobbletwo}
-\def\newmathbfsc{\M@NoMathfontError\newmathbfsc\@gobbletwo}
-\def\newmathbfscit{\M@NoMathfontError\newmathbfscit\@gobbletwo}
-\def\newmathfontcommand{\M@NoMathfontError\newmathfontcommand\@gobblefour}
-\def\RuleThicknessFactor{\M@NoMathfontError\RuleThicknessFactor\@gobble}
-\def\IntegralItalicFactor{\M@NoMathfontError\IntegralItalicFactor\@gobble}
-\def\SurdVerticalFactor{\M@NoMathfontError\SurdVerticalFactor\@gobble}
-\def\SurdHorizontalFactor{\M@NoMathfontError\SurdHorizontalFactor\@gobble}
-\def\CharmLine{\M@NoMathfontError\CharmLine\@gobble}
-\def\CharmFile{\M@NoMathfontError\CharmFile\@gobble}
+\protected\def\newmathrm{\M@NoMathfontError\newmathrm\@gobbletwo}
+\protected\def\newmathit{\M@NoMathfontError\newmathit\@gobbletwo}
+\protected\def\newmathbf{\M@NoMathfontError\newmathbf\@gobbletwo}
+\protected\def\newmathbfit{\M@NoMathfontError\newmathbf\@gobbletwo}
+\protected\def\newmathbold{\M@NoMathfontError\newmathbold\@gobbletwo}
+\protected\def\newmathboldit{\M@NoMathfontError\newmathbold\@gobbletwo}
+\protected\def\newmathsc{\M@NoMathfontError\newmathsc\@gobbletwo}
+\protected\def\newmathscit{\M@NoMathfontError\newmathscit\@gobbletwo}
+\protected\def\newmathbfsc{\M@NoMathfontError\newmathbfsc\@gobbletwo}
+\protected\def\newmathbfscit{\M@NoMathfontError\newmathbfscit\@gobbletwo}
+\protected\def\newmathfontcommand{\M@NoMathfontError\newmathfontcommand
+ \@gobblefour}
+\protected\def\RuleThicknessFactor{\M@NoMathfontError\RuleThicknessFactor
+ \@gobble}
+\protected\def\IntegralItalicFactor{\M@NoMathfontError\IntegralItalicFactor
+ \@gobble}
+\protected\def\SurdVerticalFactor{\M@NoMathfontError\SurdVerticalFactor
+ \@gobble}
+\protected\def\SurdHorizontalFactor{\M@NoMathfontError\SurdHorizontalFactor
+ \@gobble}
+\protected\def\CharmLine{\M@NoMathfontError\CharmLine\@gobble}
+\protected\def\CharmFile{\M@NoMathfontError\CharmFile\@gobble}
% \end{macrocode}
% Check that the engine is \XeTeX\ or Lua\TeX. If yes, set |\ifM@XeTeXLuaTeX| to true. (Otherwise the conditional will be false by default.)
% \begin{macrocode}
@@ -439,7 +435,7 @@ Happy TeXing!
\M@XeTeXLuaTeXtrue
\fi
% \end{macrocode}
-% The package can raise two fatal errors: one if the engine is not \XeTeX\ or Lua\TeX (and cannot load OpenType fonts) and one if \TeX\ cannot find the \textsf{luaotfload} package. In this case, the package will stop loading, so we want a particularly conspicuous error message.
+% The package can raise two fatal errors: one if the engine is not \XeTeX\ or Lua\TeX\ (and cannot load OpenType fonts) and one if \TeX\ cannot find the \textsf{luaotfload} package. In this case, the package will stop loading, so we want a particularly conspicuous error message.
%
% The error message itself is organized as follows. For each message, we check the appropriate conditional to determine if we need to raise the error. If yes, we change |+| to active and define it to be equal to a space character. We use |+| to print multiple spaces inside the error message, and we put the catcode change inside a group to keep it local.\indexpage{catcode changes} We define a |\GenericError| inside a macro and then call the macro for a cleaner error message. The |\@gobbletwo| eats the extra period and return that \LaTeX\ adds to the error message. Notice that we |\endgroup| immediately after issuing the error\textemdash this is because we need |\M@NoFontspecError| to both tokenize its definition and then evaluate while |+| has catcode 13. Otherwise, \TeX\ will issue an |\inaccessible| error. However, we want |\AtBeginDocument| and |\endinput| outside the group. The |\expandafter| means that we expand the final |\fi| before |\endinput|, which balances the original conditional.\indexpage{unable to load}\indexpage{missing xetex or luatex=missing \XeTeX\ or Lua\TeX}
% \begin{macrocode}
@@ -471,7 +467,7 @@ Happy TeXing!
with one of those two engines.^^J}}
\M@XeTeXLuaTeXError
\endgroup
- \AtEndOfPackage{\typeout{Package mathfont failed to load\on@line.}}
+ \AtEndOfPackage{\typeout{:: mathfont :: Failed to load\on@line.}}
\expandafter\endinput % we should \endinput with a balanced conditional
\fi
% \end{macrocode}
@@ -489,7 +485,7 @@ Happy TeXing!
work with XeTeX}
\fi
% \end{macrocode}
-% If the engine is Lua\TeX, we absolutely must have \textsf{luaotfload} because Lua\TeX\ needs this package to load OpenType fonts. Before anything else, \TeX\ should check whether it can find |luaotfload.sty| and stop reading in \textsf{mathfont} if it cannot. Same command structure as before. Newer \LaTeX\ installations try to load \textsf{luaotfload} as part of the format, but it never hurts to double check.\indexpage{could not load}\indexpage{cannot not find the file luaotfloadsty=cannot find the file \texttt{luaotfload}}
+% If the engine is Lua\TeX, we absolutely must have \textsf{luaotfload} because Lua\TeX\ needs this package to load OpenType fonts. Before anything else, \TeX\ should check whether it can find |luaotfload.sty| and stop reading in \textsf{mathfont} if it cannot. Same command structure as before. Newer \LaTeX\ installations try to load \textsf{luaotfload} as part of the format, but it never hurts to double check.\indexpage{unable to load}\indexpage{cannot not find the file luaotfloadsty=cannot find the file \texttt{luaotfload}}
% \begin{macrocode}
\ifM@Noluaotfload % false by default; true if LuaTeX AND no luaotfload.sty
\begingroup
@@ -523,11 +519,11 @@ Happy TeXing!
XeLaTeX.^^J}}
\M@NoluaotfloadError
\endgroup
- \AtEndOfPackage{\typeout{Package mathfont failed to load\on@line.}}
+ \AtEndOfPackage{\typeout{:: mathfont :: Failed to load\on@line.}}
\expandafter\endinput % we should \endinput with a balanced conditional
\fi
% \end{macrocode}
-% Some package options are now deprecated, specifically |packages|, |operators|, and |no-operators|. In the case of these options, the command |\M@Optiondeprecated| issues an error and tells the user the appropriate alternative.\indexpage{deprecated} We check for \textsf{atveryend} to use with the easter egg.
+% Some package options are now deprecated, specifically |packages|, |operators|, and |no-|\penalty0|operators|. In the case of these options, the command |\M@Optiondeprecated| issues an error and tells the user the appropriate alternative.\indexpage{deprecated} We check for \textsf{atveryend} to use with the easter egg.
% \begin{macrocode}
\def\M@Optiondeprecated#1#2{\PackageError{mathfont}
{Option "#1" deprecated}
@@ -574,7 +570,7 @@ Happy TeXing!
happy day! Clap your hands,^^J%
and be glad your hovercraft^^J%
isn't full of eels!^^J}
- \def\E@sterEggUpd@te{Got it :) }
+ \def\E@sterEggUpd@te{Got it :)\@gobble}
\EasterEggUpdate}
\fi}% my easter egg :)
% \end{macrocode}
@@ -583,7 +579,7 @@ Happy TeXing!
\DeclareOption{adjust}{\M@adjust@fonttrue}
\DeclareOption{no-adjust}{\M@adjust@fontfalse}
% \end{macrocode}
-% Interpret an unknown option as a font name and save it for loading. In this case, the package sets |\ifM@font@loaded| to true and stores the font name in |\M@font@load|.\?\ifM@font@loaded
+% Interpret an unknown option as a font name and save it for loading. In this case, the package sets |\ifM@font@loaded| to true and stores the font name in |\M@font@load|.
% \begin{macrocode}
\DeclareOption*{\M@font@loadedtrue\edef\M@font@load{\CurrentOption}}
\ProcessOptions*
@@ -620,31 +616,30 @@ Happy TeXing!
%
% \section{Errors and Messaging}
%
-% Some error and informational messages. Table~1 lists all macros defined in this section along with a brief description of their use. We begin with general informational messages.\indexpage{log file=\texttt{log} file}\indexpage{Package mathfont Info}\indexpage{I already set the font}
+% Some error and informational messages. Table~1 lists all macros defined in this section along with a brief description of their use. We begin with general informational messages.\indexpage{Package mathfont Info}
%
% \begin{figure}[b]
% \def\vrb#1{\texttt{\string#1}}
-% \centerline{\bfseries Table 1: Different Warnings and Errors and Their Uses\strut}
+% \centerline{\bfseries Table 1: Various Messages and Errors and Their Uses\strut}
% \begin{tabularx}\textwidth{lX}
% \toprule
% Command & Use\\\midrule
-% \vrb\M@CommandInitializeInfo & Initialize alphanumeric font-change commands\\
-% \vrb\M@FontChangeInfo & NFSS font information\\
-% \vrb\M@NewFontCommandInfo & Initialize local font-change commands\\\midrule
-% \vrb\M@CharacterArgWarning & Bad characters for alphanumeric font changes\\
+% \vrb\M@FontChangeInfo & Use a symbol font for some characters\\
+% \vrb\M@NewFontCommandInfo & Declare new alphanumeric font-change command\\
+% \vrb\M@SymbolFontInfo & Declare new symbol font\\\midrule
% \vrb\M@CharsSetWarning & Warning when calling \vrb\mathfont\ multiple times for same keyword\\
-% \vrb\M@CSArgWarning & Bad characters for alphanumeric font changes\\
-% \vrb\M@DeprecatedWarning & Warning for certain deprecated macros\\
-% \vrb\M@DoubleArgWarning & Bad characters for alphanumeric font changes\\
-% \vrb\M@NesgedArgWarning & Bad characters for alphanumeric font changes\\\midrule
-% \vrb\M@DoubleArgError & Bad argument provided to be font-change macro\\
-% \vrb\M@HModeError & Alphanumeric font-change command used outside math mode\\
-% \vrb\M@InternalsRestoredError & Called by \vrb\mathfont\ after restoring kernel\\
+% \vrb\M@InternalsRestoredError & User called \vrb\mathfont\ after restoring kernel\\
% \vrb\M@InvalidOptionError & Bad option for \vrb\mathfont\\
% \vrb\M@InvalidSupoptionError & Bad suboption for \vrb\mathfont\\
-% \vrb\M@MissingControlSequenceError & No macro provided to be font-change command\\
% \vrb\M@MissingOptionError & Missing an option for \vrb\mathfont\\
-% \vrb\M@MissingSuboptionError & Missing suboption for \vrb\mathfont\\
+% \vrb\M@MissingSuboptionError & Missing suboption for \vrb\mathfont\\\midrule
+% \vrb\M@BadMathConstantsFontError & Argument not previously fed to \vrb\mathfont\\
+% \vrb\M@BadMathConstantsFontTypeError & Argument not ``upright'' or ``italic''\\
+% \vrb\M@LuaTeXOnlyWarning & User called \vrb\mathcontsantsfont\ in \XeTeX\\\midrule
+% \vrb\M@DeprecatedWarning & Warning for certain deprecated macros\\
+% \vrb\M@DoubleArgError & Gave multiple tokens to be the font-change macro\\
+% \vrb\M@HModeError & Font-change command used outside math mode\\
+% \vrb\M@MissingControlSequenceError & No macro provided to be font-change command\\
% \vrb\M@NoFontspecFamilyError & Improper option \texttt{fontspec} for \vrb\mathfont\\
% \vrb\M@NoFontspecError & Option \texttt{fontspec} for \vrb\mathfont\ declared without having loaded \textsf{fontspec}\\\midrule
% \vrb\M@BadIntegerError & Font metric adjustment value was not an integer\\
@@ -656,17 +651,16 @@ Happy TeXing!
% \end{figure}
%
% \begin{macrocode}
-\def\M@FontChangeInfo#1#2#3#4#5{\wlog{Package mathfont Info:
- Setting #1 chars to #2!^^J%
- NFSS Family Name: #3^^J%
- Series/Shape Info: #4^^J%
- Symbol Font Name: #5^^J}}
-\def\M@CommandInitializeInfo#1{\wlog{Package mathfont Info: Initializing
- \noexpand#1 font-change command on line \the\inputlineno.}}
-\def\M@NewFontCommandInfo#1#2#3#4#5{\wlog{Package mathfont Info: Creating
- math-alphabet command^^J%
- \string#1 using #2 on line \the\inputlineno!^^J%
- NFSS Family Name: #3^^J%
+\def\M@SymbolFontInfo#1#2#3#4{\wlog{^^JPackage mathfont Info:
+ Declaring new symbol font from #1!^^J%
+ NFSS Family Name: \space#2^^J%
+ Series/Shape Info: #3^^J%
+ Symbol Font Name: \space#4^^J}}
+\def\M@FontChangeInfo#1#2{\wlog{Package mathfont Info:
+ Setting #1 chars to #2!}}
+\def\M@NewFontCommandInfo#1#2#3#4#5{\wlog{^^JPackage mathfont Info:
+ Creating \string#1 using #2!^^J%
+ NFSS Family Name: \space#3^^J%
Series/Shape Info: #4/#5^^J}}
\def\M@CharsSetWarning#1{\PackageWarning{mathfont}
{I already set the font for\MessageBreak
@@ -674,30 +668,9 @@ Happy TeXing!
this option for \string\mathfont\space
on line \the\inputlineno\@gobble}}
% \end{macrocode}
+% \indexpage{I already set the font}
% Warnings for the |\mathbb|, etc.\ commands.
-% \indexpage{Im ignoring the multiple characters=I'm ignoring the multiple characters}
-% \indexpage{Im ingoring the nested argument=I'm ignoring the nested argument}
-% \indexpage{Im ignoring the unexpandable=I'm ignoring the unexpandable}
-% \begin{macrocode}
-\def\M@DoubleArgWarning#1#2{\PackageWarning{mathfont}
- {I'm ignoring the multiple characters\MessageBreak
- "#2" that are grouped together in\MessageBreak
- the argument of your \string#1\space command\MessageBreak}}
-\def\M@NestedArgWarning#1#2{\PackageWarning{mathfont}
- {I'm ignoring the nested argument\MessageBreak
- "#2" from your \string#1\MessageBreak
- command}}
-\def\M@CSArgWarning#1#2{\PackageWarning{mathfont}
- {I'm ignoring the unexpandable control\MessageBreak
- sequence \string#2\space that appears in the\MessageBreak
- argument of your \string#1\space command\MessageBreak}}
-\def\M@CharacterArgWarning#1#2{\PackageWarning{mathfont}
- {I'm ignoring the "#2" in the\MessageBreak
- argument of your \string#1\MessageBreak
- command because it isn't a\MessageBreak
- letter or digit}}
-% \end{macrocode}
-% Warning for deprecated commands.\indexpage{Your command is deprecated}
+% Warning for deprecated commands.\indexpage{deprecated}
% \begin{macrocode}
\def\M@DeprecatedWarning#1#2{\PackageWarning{mathfont}
{Your \string#1\space command on\MessageBreak
@@ -705,11 +678,12 @@ Happy TeXing!
replaced it with \string#2\@gobble}}
% \end{macrocode}
% Error messages associated with |\mathfont|.
-% \indexpage{Invalid option for mathfont=Invalid Option for \texttt{\char`\\mathfont}}
-% \indexpage{Invalid suboption for mathfont=Invalid Suboption for \texttt{\char`\\mathfont}}
-% \indexpage{Missing option for mathfont=Missing Option for \texttt{\char`\\mathfont}}
-% \indexpage{Missing suboption for mathfont=Missing Suboption for \texttt{\char`\\mathfont}}
-% \indexpage{No previous font}\indexpage{Missing package fontspec=Missing package \texttt{fontspec}}
+% \indexpage{invalid option for mathfont=Invalid Option for \texttt{\char`\\mathfont}}
+% \indexpage{invalid suboption for mathfont=Invalid Suboption for \texttt{\char`\\mathfont}}
+% \indexpage{missing option for mathfont=Missing Option for \texttt{\char`\\mathfont}}
+% \indexpage{missing suboption for mathfont=Missing Suboption for \texttt{\char`\\mathfont}}
+% \indexpage{Internal commands restored}
+% \indexpage{no previous font}\indexpage{missing package fontspec=Missing package \texttt{fontspec}}
% \begin{macrocode}
\def\M@InvalidOptionError#1{\PackageError{mathfont}
{Invalid^^Joption "#1" for \string\mathfont\on@line}
@@ -774,6 +748,26 @@ Happy TeXing!
to get messed up. To resolve this error, load\MessageBreak
fontspec before calling \string\mathfont.^^J}}
% \end{macrocode}
+% Error messages for |\mathconstantsfont|.
+% \indexpage{Invalid font specifier}
+% \indexpage{your mathconstants on line=Your \texttt{\char`\\mathconstants} on line}
+% \begin{macrocode}
+\def\M@BadMathConstantsFontError#1{\PackageError{mathfont}
+ {Invalid font specifier for \string\mathconstantsfont:\MessageBreak"#1"}
+ {Your command was ignored--I can't parse your argument.\MessageBreak
+ Please make sure to use text that you have previously\MessageBreak
+ fed to \string\mathfont\space for the argument of
+ \string\mathconstantsfont.^^J}}
+\def\M@BadMathConstantsFontTypeError#1{\PackageError{mathfont}
+ {Invalid font specifier for \string\mathconstantsfont:\MessageBreak"#1"}
+ {The optional argument of \string\mathconstantsfont\MessageBreak
+ should be "upright" or "italic." Right now,\MessageBreak
+ it's neither.^^J}}
+\def\M@LuaTeXOnlyWarning{\PackageWarning{mathfont}
+ {Your \string\mathconstantsfont\space
+ on line \the\inputlineno\space is\MessageBreak
+ for LuaTeX only, and I'm ignoring it\@gobble}}
+% \end{macrocode}
% Error messages for the |\newmathrm|, etc.\ commands.
% \indexpage{Missing control sequence}
% \indexpage{Multiple characters in argument}
@@ -795,13 +789,12 @@ Happy TeXing!
a single character instead.^^J}}
\def\M@HModeError#1{\PackageError{mathfont}
{Missing \string$ inserted\MessageBreak
- inserted\on@line. Command\MessageBreak
- \string#1\space is for math mode only\MessageBreak}
+ on input line line \the\inputlineno}
{I generated an error because
you used \string#1\space outside of\MessageBreak
- math mode. I've inserted a \string$
- just before your \string#1, so\MessageBreak
- we should be all good now.^^J}}
+ math mode. I inserted a \string$
+ before your \string#1, so we\MessageBreak
+ should be all good now.^^J}}
% \end{macrocode}
% We need error messages related to Lua-based font adjustments.
% \indexpage{Forbidden charm info}
@@ -847,11 +840,17 @@ Happy TeXing!
% We do not want \textsf{fontspec} making changes to mathematics. If the user has loaded the package, we set |\g__fontspec_math_bool| to false. Otherwise, we pass the |no-math| option to the package in case the user loads it later.
% \begin{macrocode}
\@ifpackageloaded{fontspec}
- {\csname bool_set_false:N\expandafter\endcsname
+ {\wlog{Package mathfont Info: Package fontspec detected.}
+ \wlog{Package mathfont Info: Setting \string\g__fontspec_math_bool
+ to false.}
+ \csname bool_set_false:N\expandafter\endcsname
\csname g__fontspec_math_bool\endcsname}
- {\PassOptionsToPackage{no-math}{fontspec}}
+ {\wlog{Package mathfont Info: Package fontspec not detected.}
+ \wlog{Package mathfont Info: Will pass no-math option to fontspec
+ if it gets loaded.}
+ \PassOptionsToPackage{no-math}{fontspec}}
% \end{macrocode}
-% We save four macros from the \LaTeX\ kernel so we can change their definitions. To adapt the symbol declaration macros for use with unicode fonts, we reverse the conversion to hexadecimal in |\count0| and change the |\math|\dots\ primitive to |\Umath|. Unlike the traditional primitives, the |\Umath| primitives accept decimal input with a |+| sign.\indexpage{LaTeX kernel=\LaTeX\ kernel}
+% We save four macros from the \LaTeX\ kernel so we can change their definitions. To adapt the symbol declaration macros for use with unicode fonts, we reverse the conversion to hexadecimal in |\count0| and change the |\math| primitive to |\Umath|. Whereas the traditional primitives accept hexadecimal input, |\Umath| primitives accept decimal input with a |+| sign.\indexpage{LaTeX kernel=\LaTeX\ kernel}
% \begin{macrocode}
\let\@@set@mathchar\set@mathchar
\let\@@set@mathsymbol\set@mathsymbol
@@ -901,7 +900,7 @@ Happy TeXing!
\ifdefined\directlua
\expandafter\@tempa\expandafter{\scantextokens\expandafter{\M@DecSymDef}}
% \end{macrocode}
-% Unfortunately, while |\scantextokens| is straightforward, |\scantokens| is a menace. The problem is that when it expands, the primitive inserts an end-of-file token (because |\scantokens| mimics writing to a file and |\input|ing what it just wrote) after the retokenized code, and this is why |\scantokens| often produces an error about prematurely ending a file. The easiest way to make the command useable is to put a |\noexpand| before the end-of-file token with |\everyeof|, and at the same time, this needs to happen inside an |\edef| so that \TeX\ handles the |\noexpand| as it is first seeing the end-of-file token. In order to prevent the |\edef| from also expanding our retokenized definition of |\DeclareSymbolFont|, we put the definition inside an |\unexpanded|.
+% Unfortunately, while |\scantextokens| is straightforward, |\scantokens| is a menace. The problem is that when it expands, the primitive inserts an end-of-file token (because |\scantokens| mimics writing to a file and |\input|ing what it just wrote) after the retokenized code, and this is why |\scantokens| can produce an end-of-file error. The easiest way to make the command useable is to put a |\noexpand| before the end-of-file token with |\everyeof|, and at the same time, this needs to happen inside an |\edef| so that \TeX\ handles the |\noexpand| as it is first seeing the end-of-file token. In order to prevent the |\edef| from also expanding our retokenized definition of |\DeclareSymbolFont|, we put the definition inside an |\unexpanded|.
% \begin{macrocode}
\else
\begingroup
@@ -915,13 +914,11 @@ Happy TeXing!
\expandafter\endgroup
\expandafter\@tempa\expandafter{\M@retokenize}
\fi
-\@onlypreamble\@@DeclareSymbolFont
% \end{macrocode}
-% We need to keep track of the number of times we have loaded fonts, and the count |\M@count| fulfills this role. We use |\M@errcode| in the alphanumeric commands, and the other counts come up in Lua-based font adjustments. The |\M@toks| object will record a message that displays in the |log| file when the user calls |\mathfont|. The |\newread| is for Lua-based font adjustments.
+% We need to keep track of the number of times we have loaded fonts, and |\M@count| fulfills this role. The |\M@toks| object will record a message that displays in the |log| file when the user calls |\mathfont|. The |\newread| is for Lua-based font adjustments.
% \begin{macrocode}
\newbox\surdbox
\newcount\M@count
-\newcount\M@errcode
\newcount\M@rule@thickness@factor
\newcount\M@integral@italic@factor
\newcount\M@surd@vertical@factor
@@ -936,7 +933,7 @@ Happy TeXing!
\M@surd@vertical@factor\@m
\radicandoffset=3mu\relax
% \end{macrocode}
-% We create necessary booleans and the default math font shapes.
+% Necessary booleans and default math font shapes.
% \begin{macrocode}
\newif\ifM@upper
\newif\ifM@lower
@@ -966,6 +963,7 @@ Happy TeXing!
\newif\if@suboptionpresent
\newif\ifM@arg@good
\newif\ifM@Decl@reF@mily
+\newif\ifM@Decl@reF@milyB@se
\newif\ifM@fromCharmFile
% \end{macrocode}
% Default shapes.
@@ -996,9 +994,14 @@ Happy TeXing!
\def\M@bcalshape{upright} % bold caligraphic
\def\M@bfrakshape{upright} % bold fraktur
% \end{macrocode}
-% We use |\M@normalkeys| and |\M@letterlikekeys| for error checking, and |\M@defaultkeys| stores the character classes that |\mathfont| acts on by default.
+% The |\M@keys| list stores all the possible keyword options, and |\M@defaultkeys| stores the character classes that |\mathfont| acts on by default.
% \indexpage{keyword options=keyword options for \texttt{\char`\\mathfont}}
% \begin{macrocode}
+\def\M@keys{upper,lower,diacritics,greekupper,%
+ greeklower,agreekupper,agreeklower,cyrillicupper,%
+ cyrilliclower,hebrew,digits,operator,delimiters,%
+ radical,bigops,extbigops,symbols,extsymbols,arrows,%
+ bb,cal,frak,bcal,bfrak}
\def\M@defaultkeys{upper,lower,diacritics,greekupper,%
greeklower,digits,operator,symbols}
% \end{macrocode}
@@ -1007,24 +1010,181 @@ Happy TeXing!
\ifM@adjust@font
\edef\M@defaultkeys{\M@defaultkeys,delimiters,radical,bigops}
\fi
-\def\M@normalkeys{upper,lower,diacritics,greekupper,%
- greeklower,agreekupper,agreeklower,cyrillicupper,%
- cyrilliclower,hebrew,digits,operator,delimiters,%
- radical,bigops,extbigops,symbols,extsymbols,arrows}
-\def\M@letterlikekeys{bb,cal,frak,bcal,bfrak}
% \end{macrocode}
-% Default OpenType features to use for loading fonts. If using Lua\TeX, we need to add |mode=base| to the list of default features; otherwise \textsf{luaotfload} will load fonts with |node| mode, which prevents OpenType features for math mode.
+% Default OpenType features for loading fonts.
% \begin{macrocode}
-\def\M@default@otf@features{script=latin;language=DFLT;%
+\def\M@otf@features{script=latin;language=DFLT;%
tlig=true;liga=true;smcp=false;lnum=true}
-\def\M@default@otf@features@sc{script=latin;language=DFLT;%
+\def\M@otf@features@sc{script=latin;language=DFLT;%
tlig=true;liga=true;smcp=true;lnum=true}
-\ifdefined\directlua
- \edef\M@default@otf@features{mode=base;\M@default@otf@features}
- \edef\M@default@otf@features@sc{mode=base;\M@default@otf@features@sc}
-\fi
% \end{macrocode}
-% Using |base| mode limits access to certain OpenType features for the font as a whole, but it allows us to use OpenType features in math mode, which I think is a worthwhile trade. In future versions of \textsf{mathfont}, I may implement a dual fontloader that loads the same font twice in both |base| and |node| modes. Then we could use the |base| mode for math and the |node| mode for text.
+%
+% \section{Fontloader}
+%
+% We come to the fontloader. The main font-loading macro is |\M@newfont|, and it is basically a wrapper around code we would expect to see in a typical |fd| file. Advanced users: please do not call |\M@newfont| directly because it may change without warning. Instead call |\mathfont| with the |empty| keyword and extract the \textsc{nfss} family name from |\M@f@ntn@me| or |\M@f@ntn@meb@se|. Our general approach is to feed the mandatory argument of |\mathfont| to |\M@newfont|, check if we have reason to believe that the font corresponds to a entry already in the \textsc{nfss}, and declare the font family and font shapes as necessary. If \textsf{fontspec} is loaded, we pass the entire argument to \textsf{fontspec}. If not, \textsf{mathfont} handles the font declaration internally. When \textsf{mathfont} declares a font family in the \textsc{nfss}, it does so twice, once using the information provided (which typically results in a font in node mode) and once using the information provided with |mode=base| (which results in a font in base mode). The first declaration uses the entire mandatory argument of |\mathfont| with spaces removed as the family name, and the second declaration uses this name with |-base| tacked onto the end. However the font gets loaded, we store the \textsc{nfss} family names in |\M@f@ntn@me| and |\M@f@nt@n@me@base|.
+%
+%
+% We use |\M@split@colon| and |\M@strip@colon| for parsing the argument of |\mathfont|. If the user calls |\mathfont{|\meta{name}|:|\meta{features}|}|, we store the name in |\@tempbase| and the features in |\@tempfeatures|. If the user specifies a name only, then |\@tempfeatures| will be empty. Syntactically, we use |\M@strip@colon| to remove a final |:| the same way we removed a final |=| when we parsed the optional argument in the previous section.
+% \?\@tempfeatures\?\@tempbase
+% \begin{macrocode}
+\def\M@split@colon#1:#2\@nil{%
+ \def\@tempbase{#1}
+ \def\@tempfeatures{#2}}
+\def\M@strip@colon#1:{#1}
+% \end{macrocode}
+% The macro |\M@fill@nfss@shapes| accepts two arguments and does the actual work of ensuring that the \textsc{nfss} contains the appropriate series and shapes. The first argument should the name of a font family in the \textsc{nfss}, and the second should be a list of OpenType features. We check whether combinations of bold series and italic shape exist for that font in the \textsc{nfss}, and if not, we add them with |\DeclareFontShape|.
+% \begin{macrocode}
+\def\M@fill@nfss@shapes#1#2{%
+% \end{macrocode}
+% Upright shape.
+% \begin{macrocode}
+ \ifcsname TU/#1/\mddefault/\shapedefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\mddefault}{\shapedefault}
+ {<->"\@tempbase:\M@otf@features;#2"}{}
+ \fi
+% \end{macrocode}
+% Italic shape.
+% \begin{macrocode}
+ \ifcsname TU/#1/\mddefault/\itdefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\mddefault}{\itdefault}
+ {<->"\@tempbase/I:\M@otf@features;#2"}{}
+ \fi
+% \end{macrocode}
+% Bold series with upright shape.
+% \begin{macrocode}
+ \ifcsname TU/#1/\bfdefault/\shapedefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\bfdefault}{\shapedefault}
+ {<->"\@tempbase/B:\M@otf@features;#2"}{}
+ \fi
+% \end{macrocode}
+% Bold series with italic shape.
+% \begin{macrocode}
+ \ifcsname TU/#1/\bfdefault/\itdefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\bfdefault}{\itdefault}
+ {<->"\@tempbase/BI:\M@otf@features;#2"}{}
+ \fi
+% \end{macrocode}
+% Now do the same thing for the small caps variants. I make no promises that this will work. If a small caps font faces is separate from the main font file, \TeX\ won't be able to find it automatically. In that case, you will have to write your own |fd| file or |\DeclareFontShape| commands.
+% \begin{macrocode}
+ \ifcsname TU/#1/\mddefault/\scdefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\mddefault}{\scdefault}
+ {<->"\@tempbase:\M@otf@features@sc;#2"}{}
+ \fi
+ \ifcsname TU/#1/\mddefault/\scdefault\itdefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\mddefault}{\scdefault\itdefault}
+ {<->"\@tempbase/I:\M@otf@features@sc;#2"}{}
+ \fi
+ \ifcsname TU/#1/\bfdefault/\scdefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\bfdefault}{\scdefault}
+ {<->"\@tempbase/B:\M@otf@features@sc;#2"}{}
+ \fi
+ \ifcsname TU/#1/\bfdefault/\scdefault\itdefault\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{\bfdefault}{\scdefault\itdefault}
+ {<->"\@tempbase/BI:\M@otf@features@sc;#2"}{}
+ \fi}
+% \end{macrocode}
+% The main font-loading macro. This macro takes a single argument, which should have the form \meta{font name}|:|\meta{optional features}, and \textsf{mathfont} handles the information in one of three ways if all goes well: interface with \textsf{fontspec}, possibly declare a few extra shapes for a font already in the \textsc{nfss}, or declare and load the whole font. At a minimum, \textsf{mathfont} ensures that we have access to medium upright, medium italic, bold upright, and bold italic fonts after calling |\M@newfont|. If \textsf{mathfont} decides to declare a font itself, it will also try to load small caps versions. We begin by splitting the argument into |\@tempbase| and |\@tempfeatures|.
+% \begin{macrocode}
+\def\M@newfont#1{%
+ \edef\@tempa{#1}
+ \expandafter\M@split@colon\@tempa:\@nil
+ \def\@tempb{fontspec}
+% \end{macrocode}
+% If the argument is ``|fontspec|,'' we want to use the last font loaded by \textsf{fontspec}, which is stored in |\l_fontspec_family_tl|. If this macro is not empty, we store its contents in |\M@f@ntn@me| and skip loading entirely because \textsf{fontspec} already took care of it. We issue an error if |\l_fontspec_family_tl| is empty or if the user has not loaded \textsf{fontspec}. If we use \textsf{fontspec} to laod the font, we don't get a separate font in base mode.
+% \begin{macrocode}
+ \ifx\@tempa\@tempb
+ \@ifpackageloaded{fontspec}{%
+ \expandafter\ifx\csname l_fontspec_family_tl\endcsname\@empty
+ \M@NoFontspecFamilyError
+ \else
+ \expandafter
+ \let\expandafter\M@f@ntn@me\csname l_fontspec_family_tl\encsname
+ \def\@tempbase{\M@f@ntn@me\space(from fontspec)}
+ \let\M@f@ntn@meb@se\M@f@ntn@me % no separate font in base mode
+ \fi}{\M@NoFontspecError}
+% \end{macrocode}
+% If the argument is something other than ``|fontspec|,'' we need to parse it. If the user loaded \textsf{fontspec}, we pass the entire argument to |\fontspec_set_family:Nnn| for loading and store the \textsc{nfss} family name in |\M@f@ntn@me|. For Lua\TeX, this is not recommended\textemdash\textsf{fontspec} is designed to work with text, not math, fonts and typically loads fonts in |node| mode, which makes their OpenType features unusable in math mode.
+% \begin{macrocode}
+ \else
+ \@ifpackageloaded{fontspec}
+ {\csname fontspec_set_family:Nnn\endcsname\M@f@ntn@me{}{\@tempa}
+ % no separate font in base mode
+ \let\M@f@ntn@meb@se\M@f@ntn@me}
+% \end{macrocode}
+% If the user has not loaded \textsf{fontspec}, we split the argument into a name and features using |\M@split@colon|. The name goes in |\@tempbase|, and the features go in |\@tempfeatures|. We store the OpenType features for loading in base mode inside |\@basefeatures|. If we are typesetting in Lua\TeX, |\@basefeatures| will be the same as |\@tempfeatures| except with |mode=base| at the end, and if we are using \XeTeX, it will be exactly the same.
+% \begin{macrocode}
+ {\M@Decl@reF@milytrue
+ \M@Decl@reF@milyB@setrue
+ \ifx\@tempfeatures\@empty
+ \ifdefined\directlua
+ \edef\@basefeatures{mode=base}
+ \else
+ \let\@basefeatures\@tempfeatures
+ \fi
+ \else
+ \edef\@tempfeatures{\expandafter\M@strip@colon\@tempfeatures}
+ \ifdefined\directlua
+ \edef\@basefeatures{\@tempfeatures;mode=base}
+ \else
+ \let\@basefeatures\@tempfeatures
+ \fi
+ \fi
+% \end{macrocode}
+% We remove the spaces from |#1| and store it in |\@tempa| and from the human-readable font name contained in |#1| and store it in |\@tempb|. We check whether either already exists as a family name in the \textsc{nfss}, and if we do, we call |\M@fill@nfss@shapes| to ensure that we have declared all the shapes. In this case, we set |\ifM@Decl@reF@mily| to false and break out of the |\@tfor| loop.
+% \begin{macrocode}
+ \edef@nospace\@tempa{\@tempa}
+ \edef@nospace\@tempb{\@tempbase}
+ \M@Decl@reF@milytrue
+ \@tfor\@i:=\@tempa\@tempb\@tempbase\do{%
+ \ifcsname TU+\@i\endcsname
+ \expandafter\let\expandafter\M@f@ntn@me\@i
+ \M@Decl@reF@milyfalse
+ \M@fill@nfss@shapes\M@f@ntn@me\@tempfeatures
+ \@break@tfor
+ \fi}
+% \end{macrocode}
+% If |\M@newfont| didn't find anything in the \textsc{nfss}, we need to load the font. The name for the font family will be |#1| with spaces removed, which we previously stored in |\@tempa|.
+% \indexpage{log file=\texttt{log} file}
+% \begin{macrocode}
+ \ifM@Decl@reF@mily
+ \let\M@f@ntn@me\@tempa
+ \wlog{Package mathfont Info: Adding \M@f@ntn@me\space to the nfss!}
+ \DeclareFontFamily{TU}{\M@f@ntn@me}{}
+% \end{macrocode}
+% Now load the four most common font faces with |\M@fill@nfss@shapes|.
+% \begin{macrocode}
+ \M@fill@nfss@shapes\M@f@ntn@me\@tempfeatures
+ \fi
+% \end{macrocode}
+% At this point, there is an entry for the font in the \textsc{nfss}, and we stored the family name in |\M@f@ntn@me|. Now we check if the \textsc{nfss} contains a base-mode version with the family name ending in |-base|.
+% \begin{macrocode}
+ \ifdefined\directlua
+ \edef\M@f@ntn@meb@se{\M@f@ntn@me-base}
+ \else
+ \let\M@f@ntn@meb@se\M@f@ntn@me
+ \fi
+ \ifcsname TU+\M@f@ntn@meb@se\endcsname\else
+ \wlog{Package mathfont Info: Adding \M@f@ntn@meb@se\space
+ to the nfss!}
+ \DeclareFontFamily{TU}{\M@f@ntn@meb@se}{}
+ \fi
+ \M@fill@nfss@shapes\M@f@ntn@meb@se\@basefeatures}
+ \fi}
+% \end{macrocode}
+% Finally, the font-loading commands should appear only in the preamble.
+% \begin{macrocode}
+\@onlypreamble\M@fill@nfss@shapes
+\@onlypreamble\M@newfont
+% \end{macrocode}
+% At this point, the font information is stored in the \textsc{nfss}, but nothing has been loaded. For text fonts, that happens during a call to |\selectfont|, and for math fonts, that happens the first time entering math mode. I've played with the idea of forcing some fonts to load now, but I'm hesitant to change \LaTeX's standard font-loading behavior. I may address this issue further in future versions of \textsf{mathfont}.
%
%
%
@@ -1034,22 +1194,17 @@ Happy TeXing!
% \begin{macrocode}
\def\M@check@option@valid#1{%
\let\@temperror\M@InvalidOptionError % error by default
- \@for\@j:=\M@normalkeys\do{%
- \ifx\@j#1
- \let\@temperror\@gobble % eliminate error
- \@optionpresenttrue % set switch to true
- \fi}
-% \end{macrocode}
-% We have to initialize the blackboard, calligraphic, and fraktur commands separately because these characters don't use the same encoding slots as the regular letters and digits and are produced differently from regular characters.\indexpage{keyword options=keyword options for \texttt{\char`\\mathfont}}
-% \begin{macrocode}
- \@for\@j:=\M@letterlikekeys\do{%
+ \@for\@j:=\M@keys\do{%
\ifx\@j#1
- \expandafter\M@CommandInitializeInfo\csname math#1\endcsname
- \csname define@#1\endcsname % initialize command
\let\@temperror\@gobble % eliminate error
\@optionpresenttrue % set switch to true
\fi}
- \@temperror{#1}}
+ \def\@j{empty} % if option is "empty," we do nothing
+ \ifx\@j#1
+ \let\@temperror\@gobble
+ \@optionpresentfalse
+ \fi
+ \@temperror{#1}}
% \end{macrocode}
% Do the same thing for the suboption.
% \indexpage{suboption roman=suboption \texttt{roman}}%
@@ -1119,191 +1274,35 @@ Happy TeXing!
% \end{macrocode}
% Perhaps something that sets spaces to |\catcode9| and then retokenizes |#2| would be better, but I don't think it matters very much.
%
-% \section{Fontloader}
-%
-% We come to the fontloader. The main font-loading macro is |\M@newfont|, and it is basically a wrapper around code we would expect to see in a typical |fd| file. Advanced users: please do not call |\M@newfont| directly because I may change it without warning! Instead, please use |\mathfont[]| and extract the \textsc{nfss} family name from |\M@f@ntn@me|. Our general approach is to feed the mandatory argument of |\mathfont| to |\M@newfont|, check if we have reason to believe that the font corresponds to a entry already in the \textsc{nfss}, and declare the font family and font shapes as necessary. First, |\M@newfont| checks if \textsf{fontspec} is loaded, and if yes, we pass the entire mandatory argument of |\mathfont| to \textsf{fontspec}. If not, \textsf{mathfont} handles the font declaration internally. When \textsf{mathfont} declares a font family in the \textsc{nfss}, it uses the entire mandatory argument of |\mathfont| with spaces removed as the family name, and regardless of whether \textsf{mathfont} |\M@newfont| feeds the font name to \textsf{fontspec}, finds it already in the \textsc{nfss}, or performs the entire font declaration, we store the \textsc{nfss} family name in |\M@f@ntn@me|. This allows for easy access later and is how you should access the \textsc{nfss} information if you call |\mathfont[]|.
-%
-%
-% We use |\M@split@colon| and |\M@strip@colon| for parsing the argument of |\mathfont|. If the user calls |\mathfont{|\meta{name}|:|\meta{features}|}|, we store the name in |\@tempbase| and the features in |\@tempfeatures|. If the user specifies a name only, then |\@tempfeatures| will be empty. Syntactically, we use |\M@strip@colon| to remove a final |:| the same way we removed a final |=| when we parsed the optional argument in the previous section.
-% \?\@tempfeatures\?\@tempbase
-% \begin{macrocode}
-\def\M@split@colon#1:#2\@nil{%
- \def\@tempbase{#1}
- \def\@tempfeatures{#2}}
-\def\M@strip@colon#1:{#1}
-% \end{macrocode}
-% The macro |\M@check@in@nfss| accepts a single argument and checks whether that argument is the name of a font family in the \textsc{nfss}, i.e.\ whether |\TU+|\meta{argument} is defined. If yes, we set |\M@f@ntn@me| to |#1| and for the four basic shapes, check that the \textsc{nfss} contains those shapes. If not, call |\DeclareFontShape|. We assume that |\@tempbase| is the human-readable name of the font and feed that directly to \textsf{luaotfload} or \XeTeX. By default, we enable the OpenType features |tlig| and |liga|, but the user can override these settings by manually declaring them to be false.
-% \begin{macrocode}
-\def\M@check@in@nfss#1{%
- \ifcsname TU+#1\endcsname
- \let\M@f@ntn@me#1
-% \end{macrocode}
-% Upright shape.
-% \begin{macrocode}
- \ifcsname TU/#1/\mddefault/\shapedefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\shapedefault}
- {<->"\@tempbase:\M@default@otf@features;\@tempfeatures"}{}
- \fi
-% \end{macrocode}
-% Italic shape.
-% \begin{macrocode}
- \ifcsname TU/#1/\mddefault/\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\itdefault}
- {<->"\@tempbase/I:\M@default@otf@features;\@tempfeatures"}{}
- \fi
-% \end{macrocode}
-% Bold series with upright shape.
-% \begin{macrocode}
- \ifcsname TU/#1/\bfdefault/\shapedefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\shapedefault}
- {<->"\@tempbase/B:\M@default@otf@features;\@tempfeatures"}{}
- \fi
-% \end{macrocode}
-% Bold series with italic shape.
-% \begin{macrocode}
- \ifcsname TU/#1/\bfdefault/\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\itdefault}
- {<->"\@tempbase/BI:\M@default@otf@features;\@tempfeatures"}{}
- \fi
-% \end{macrocode}
-% Now do the same thing for the small caps variants. I make no promises that this will work. If a small caps font faces is separate from the main font file, \TeX\ won't be able to find it automatically. In that case, you will have to write your own |fd| file or font-loading commands.
-% \begin{macrocode}
- \ifcsname TU/#1/\mddefault/\scdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\scdefault}
- {<->"\@tempbase:\M@default@otf@features@sc;\@tempfeatures"}{}
- \fi
- \ifcsname TU/#1/\mddefault/\scdefault\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\scdefault\itdefault}
- {<->"\@tempbase/I:\M@default@otf@features@sc;\@tempfeatures"}{}
- \fi
- \ifcsname TU/#1/\bfdefault/\scdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\scdefault}
- {<->"\@tempbase/B:\M@default@otf@features@sc;\@tempfeatures"}{}
- \fi
- \ifcsname TU/#1/\bfdefault/\scdefault\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\scdefault\itdefault}
- {<->"\@tempbase/BI:\M@default@otf@features@sc;\@tempfeatures"}{}
- \fi
-% \end{macrocode}
-% Finally, set the boolean to false and break out of the |\@tfor| loop from |\M@newfont|.
-% \begin{macrocode}
- \M@Decl@reF@milyfalse
- \@break@tfor
- \fi}
-% \end{macrocode}
-% The main font-loading macro. This macro takes a single argument, which should have the form \meta{font name}|:|\meta{optional features}, and \textsf{mathfont} handles the information in one of three ways if all goes well: interface with \textsf{fontspec}, possibly declare a few extra shapes for a font already in the \textsc{nfss}, or declare and load the whole font. At a minimum, \textsf{mathfont} ensures that we have access to medium upright, medium italic, bold upright, and bold italic fonts after calling |\M@newfont|. If \textsf{mathfont} decides to declare a font itself, it will also try to load small caps versions. We begin by splitting the argument into |\@tempbase| and |\@tempfeatures|.
-% \begin{macrocode}
-\def\M@newfont#1{%
- \edef\@tempa{#1}
- \expandafter\M@split@colon\@tempa:\@nil
- \def\@tempb{fontspec}
-% \end{macrocode}
-% If the argument is ``|fontspec|,'' we want to use the last font loaded by \textsf{fontspec}, which is stored in |\l_fontspec_family_tl|. If this macro is not empty, we store its contents in |\M@f@ntn@me| and skip loading entirely because \textsf{fontspec} already took care of it. We issue an error if |\l_fontspec_family_tl| is empty or if the user has not loaded \textsf{fontspec}.
-% \begin{macrocode}
- \ifx\@tempa\@tempb
- \@ifpackageloaded{fontspec}{%
- \expandafter\ifx\csname l_fontspec_family_tl\endcsname\@empty
- \M@NoFontspecFamilyError
- \else
- \expandafter
- \let\expandafter\M@f@ntn@me\csname l_fontspec_family_tl\encsname
- \def\@tempbase{\M@f@ntn@me\space(from fontspec)}
- \fi}{\M@NoFontspecError}
-% \end{macrocode}
-% If the argument is something other than ``|fontspec|,'' we need to parse it. If the user loaded \textsf{fontspec}, we pass the entire argument to |\fontspec_set_family:Nnn| for loading and store the \textsc{nfss} family name in |\M@f@ntn@me|. For Lua\TeX, this is not recommended\textemdash\textsf{fontspec} is designed to work with text, not math, fonts and typically loads fonts in |node| mode, which makes their OpenType features unusable in math mode.
-% \begin{macrocode}
- \else
- \@ifpackageloaded{fontspec}
- {\csname fontspec_set_family:Nnn\endcsname\M@f@ntn@me{}{\@tempa}}
-% \end{macrocode}
-% If the user has not loaded \textsf{fontspec}, we split the argument into a name and features using |\M@split@colon|. The name goes in |\@tempbase|, and the features go in |\@tempfeatures|. The boolean |\ifM@Decl@reF@mily| keeps track of whether we need to manually declare a font family and shapes in the \textsc{nfss}. By default, we set it to true, and if \textsf{mathfont} finds a match to |#1| in the \textsc{nfss} already, |\M@check@in@nfss| will set it to false.
-% \begin{macrocode}
- {\M@Decl@reF@milytrue
- \ifx\@tempfeatures\@empty\else
- \edef\@tempfeatures{\expandafter\M@strip@colon\@tempfeatures}
- \fi
-% \end{macrocode}
-% We remove the spaces from |#1| and from the human-readable font name contained in |#1| and check whether either already exists as a family name in the \textsc{nfss}.
-% \begin{macrocode}
- \edef@nospace\@tempa{\@tempa}
- \edef@nospace\@tempb{\@tempbase}
- \@tfor\@i:=\@tempa\@tempb\@tempbase\do{\expandafter\M@check@in@nfss\@i}
-% \end{macrocode}
-% If |\M@newfont| didn't find anything in the \textsc{nfss}, we need to load the font. We declare the font family in the \textsc{nfss} to have the name given by |#1| with spaces removed.
-% \indexpage{log file=\texttt{log} file}
-% \begin{macrocode}
- \ifM@Decl@reF@mily
- \wlog{^^JPackage mathfont Info:
- Adding the font family \@tempa\space to the nfss.}
- \DeclareFontFamily{TU}{\@tempa}{}
- \let\M@f@ntn@me\@tempa
-% \end{macrocode}
-% Now load the four most common font faces. We are relying on the ``|/I|,'' etc.\ feature of \XeTeX\ and \textsf{luaotfolad} to correctly find the bold, italic, and bold italic fonts corresponding to the family named |\@tempbase|.
-% \begin{macrocode}
- \DeclareFontShape{TU}{\@tempa}{\mddefault}{\shapedefault}
- {<->"\@tempbase:\M@default@otf@features;\@tempfeatures"}{}
- \DeclareFontShape{TU}{\@tempa}{\mddefault}{\itdefault}
- {<->"\@tempbase/I:\M@default@otf@features;\@tempfeatures"}{}
- \DeclareFontShape{TU}{\@tempa}{\bfdefault}{\shapedefault}
- {<->"\@tempbase/B:\M@default@otf@features;\@tempfeatures"}{}
- \DeclareFontShape{TU}{\@tempa}{\bfdefault}{\itdefault}
- {<->"\@tempbase/BI:\M@default@otf@features;\@tempfeatures"}{}
-% \end{macrocode}
-% Attempt to load small caps. The font may or may not have a small caps feature, but we will request it anyway. See the portion of |\M@check@in@nfss| for disclaimers on loading small caps fonts.
-% \begin{macrocode}
- \DeclareFontShape{TU}{\@tempa}{\mddefault}{\scdefault}
- {<->"\@tempbase:\M@default@otf@features@sc;\@tempfeatures"}{}
- \DeclareFontShape{TU}{\@tempa}{\mddefault}{\scdefault\itdefault}
- {<->"\@tempbase/I:\M@default@otf@features@sc;\@tempfeatures"}{}
- \DeclareFontShape{TU}{\@tempa}{\bfdefault}{\scdefault}
- {<->"\@tempbase/B:\M@default@otf@features@sc;\@tempfeatures"}{}
- \DeclareFontShape{TU}{\@tempa}{\bfdefault}{\scdefault\itdefault}
- {<->"\@tempbase/BI:\M@default@otf@features@sc;\@tempfeatures"}{}
- \fi}
- \fi}
-% \end{macrocode}
-% Finally, both font-loading commands should appear only in the preamble.
-% \begin{macrocode}
-\@onlypreamble\M@check@in@nfss
-\@onlypreamble\M@newfont
-% \end{macrocode}
-% At this point, the font information is stored in the \textsc{nfss}, but nothing has been loaded. I've played with the idea of loading certain fonts now to check whether they have been defined correctly, but I'm hesitant to force loading in a way that isn't systematic and could change \LaTeX's standard font-loading behavior. This issue may be addressed in future versions of \textsf{mathfont}.
-%
%
% \section{Default Font Changes}
%
% This section documents default math font changes. The user-level font-changing command is |\mathfont|, and it feeds the font information to |\@mathfont|, the internal command that does the actual font changing. This macro is basically a wrapper around |\DeclareSymbolFont| and a bunch of calls to |\DeclareMathSymbol|, and when the user calls |\@mathfont|, the command declares the user's font in the \textsc{nfss} with |\M@newfont| and loops through the optional argument. On each iteration, |\@mathfont| validates the option and suboption, calls |\DeclareSymbolFont| if necessary, and sets the math codes with |\M@|\meta{keyword}|@set|.
% \indexpage{keyword options=keyword options for \texttt{\char`\\mathfont}}
% \begin{macrocode}
-\protected\def\mathfont{\@ifnextchar[{\m@thf@nt}{\@mathfont[\M@defaultkeys]}}
-\def\m@thf@nt[#1]{\@mathfont[#1]}
+\protected\def\mathfont{\@ifnextchar[{\@mathfont}{\@mathfont[\M@defaultkeys]}}
% \end{macrocode}
-% The internal default-font-changing command.
+% The internal font-changing command.
% \begin{macrocode}
\def\@mathfont[#1]#2{%
\ifx\set@mathchar\@@set@mathchar
\M@InternalsRestoredError
% \end{macrocode}
-% If the kernel commands have not been reset, we can do fun stuff. As of version 2.0, I'm removing the documentation for |\restoremathinternals| in the user guide, but the code is going to stay in for backwards compatibility.
+% If the kernel commands have not been reset, we can do fun stuff. As of version 2.0, I'm removing the documentation for |\restoremathinternals| in the user guide, but the code will stay in for backwards compatibility.
% \begin{macrocode}
\else
\M@toks{}
% \end{macrocode}
-% We immediately call |\M@newfont| on the mandatory argument of |\mathfont|. We store the \textsc{nfss} family name in |\M@fontfamily@|\meta{argument}. If we need a new value of |\M@count|, we store it in |\M@fontid@|\meta{\textsc{nfss} family name}. We will not need a new value of |\M@count| if the user asks for the same \textsc{nfss} font family twice. Throughout the definition of |\mathfont|, |\@tempa| stores the value of |\M@count| that corresponds to the current font.
+% We immediately call |\M@newfont| on the mandatory argument of |\mathfont|. We store the \textsc{nfss} family name in |\M@fontfamily@|\meta{argument} and |M@fontfamily@base@|\meta{argument}. If we need a new value of |\M@count|, we store it in |\M@fontid@|\meta{\textsc{nfss} family name}. We will not need a new value of |\M@count| if the user asks for the same \textsc{nfss} font family twice. Throughout the definition of |\mathfont|, |\@tempa| stores the value of |\M@count| that corresponds to the current font.
% \indexpage{keyword options=keyword options for \texttt{\char`\\mathfont}}
% \begin{macrocode}
\M@newfont{#2}
\expandafter\edef\csname M@fontfamily@#2\endcsname{\M@f@ntn@me}
+ \expandafter\edef\csname M@fontfamily@base@#2\endcsname{\M@f@ntn@meb@se}
\ifcsname M@fontid@\M@f@ntn@me\endcsname\else % need new \M@count value?
\expandafter\edef\csname M@fontid@\M@f@ntn@me\endcsname{\the\M@count}
+ \expandafter\let\csname M@fontid@\M@f@ntn@meb@se\expandafter\endcsname
+ \csname M@fontid@\M@f@ntn@me\endcsname
\advance\M@count\@ne
\fi
\edef\@tempa{\csname M@fontid@\M@f@ntn@me\endcsname}
@@ -1315,7 +1314,7 @@ Happy TeXing!
\if@optionpresent
% \end{macrocode}
% If the user calls |\mathfont| and tries multiple times to set the font for a certain class of characters, \textsf{mathfont} will issue a warning, and the package will not adjust the font for those characters. Notice the particularly awkward syntax with the |\csname|-|\endcsname| pairs. Without this construct, \TeX\ won't realize that |\csname if@\@tempa\endcsname| matches the eventual |\fi|, and the |\@for| loop will break. (\TeX\ does not have a smart if-parser!)
-% \indexpage{parse conditionals}
+% \indexpage{I already set the font}
% \indexpage{if-parser}
% \indexpage{keyword options=keyword options for \texttt{\char`\\mathfont}}
% \begin{macrocode}
@@ -1353,16 +1352,17 @@ Happy TeXing!
% At this point we have the information we need to declare the symbol font: the \textsc{nfss} family (|\M@f@ntn@me|), series (|\mddefault|), and shape (|\@tempb|) information. The symbol font name will be |M|\meta{suboption}\meta{value of {\fontshape\shapedefault\fontfamily\ttdefault\selectfont\string\M@count}}. We check if the symbol font we need for the current set of characters is defined, and if not, we define it using this information.
% \begin{macrocode}
\ifcsname symM\@tempc\@tempa\endcsname\else
+ \M@SymbolFontInfo{\@tempbase}{\M@f@ntn@meb@se}
+ {\mddefault/\@tempb}{M\@tempc\@tempa}
\DeclareSymbolFont
- {M\@tempc\@tempa}{TU}{\M@f@ntn@me}{\mddefault}{\@tempb}
+ {M\@tempc\@tempa}{TU}{\M@f@ntn@meb@se}{\mddefault}{\@tempb}
\fi
% \end{macrocode}
% We store the new font information so we can write it to the |log| file |\AtBeginDocument| and send an informational message to the user.\indexpage{log file=\texttt{log} file}
% \begin{macrocode}
\expandafter
\edef\csname M@\@temp@opt @fontinfo\endcsname{\@tempbase}
- \M@FontChangeInfo{\@temp@opt}{\@tempbase}{\M@f@ntn@me}
- {\mddefault/\@tempb}{M\@tempc\@tempa}
+ \M@FontChangeInfo{\@temp@opt}{\@tempbase}
% \end{macrocode}
% And now the magic happens!
% \indexpage{keyword options=keyword options for \texttt{\char`\\mathfont}}
@@ -1405,9 +1405,10 @@ Happy TeXing!
\wlog{The \string\mathfont\space command on line \the\inputlineno\space
did not change the font for any characters!}
\else
+ \wlog{}
\typeout{:: mathfont :: Using font \@tempbase\space
on line \the\inputlineno.}
- \wlog{Character classes changed:\the\M@toks^^J}
+ \wlog{Character classes changed:\the\M@toks}
\fi
\fi}
\@onlypreamble\mathfont
@@ -1423,195 +1424,80 @@ Happy TeXing!
\let\rmdefault\M@f@ntn@me}
\@onlypreamble\setfont
% \end{macrocode}
-% We come to the tricky problem of making sure to use the correct MathConstants table. Lua\TeX\ automatically initializes all math parameters based on the most recent |\textfont|, etc.\ assignment, so we want to tell \LaTeX\ to reassign whatever default font we're using to the correct math family whenever we load new math fonts. This is possible, but the implementation is super hacky. When \LaTeX\ enters math mode, it checks whether it needs to redo any math family assignments, typically because of a change in font size, and if so, it calls |\getanddefine@fonts| repeatedly to append |\textfont|, etc.\ assignments onto the macro |\math@fonts|. Usually |\math@fonts| is empty because this process always happens inside a group, so we can hook into the code by defining |\math@code| to be |\aftergroup|\meta{extra code}. In this case, the \textit{extra code} will be another call to |\getanddefine@fonts|. The macro |\mathconstantsfont| handles choosing the font for setting math parameters in Lua\TeX. It checks if the argument was previously fed to |\mathfont| by seeing whether |\M@fontfamily@|\meta{|\string#1|} is equal to |\relax|. If yes, |#1| was never an argument of |\mathfont|, and we raise an error.
+% The macro |\mathconstantsfont| handles choosing the font for setting math parameters in Lua\TeX. It issues a warning if called in \XeTeX. First, it checks if the argument was previously fed to |\mathfont| by seeing whether |\M@fontfamily@|\meta{|\string#1|} is equal to |\relax|. If yes, |#1| was never an argument of |\mathfont|, and we raise an error.
% \begin{macrocode}
-\ifM@adjust@font
- \protected\def\mathconstantsfont#1{%
- \edef\@tempa{\csname M@fontfamily@#1\endcsname}
- \ifx\@tempa\relax
- \PackageError{mathfont}{Invalid font specifier}
- {Your command was ignored--I can't parse your argument.\MessageBreak
- Please make sure to use text that you have previously\MessageBreak
- fed to \string\mathfont\space for the argument of
- \string\mathconstantsfont.^^J}
+\ifdefined\directlua
+ \let\M@SetMathConstants\relax
+ \protected\def\mathconstantsfont{\@ifnextchar[{\@mathconstantsfont}
+ {\@mathconstantsfont[upright]}}
+ \def\@mathconstantsfont[#1]#2{%
+ \edef\@tempa{\csname M@fontfamily@base@#2\endcsname}
+ \def\@tempb{\relax}
+ \ifx\@tempa\@tempb
+ \M@BadMathConstantsFontError{#2}
\else
% \end{macrocode}
-% We initialize |\M@SetMathConstants| to be |\relax|, so we define it the first time the user calls |\mathconstantsfont|. The command calls |\getanddefine@fonts| inside a group and uses as arguments the upright face of the font corresponding to |#1|. Then we call |\math@fonts|, and to avoid an infinite loop, we gobble the |\aftergroup||\M@SetMathConstants| macros that \textsf{mathfont} has inserted at the start of |\math@fonts|. Setting |\globaldefs| to 1 makes the |\textfont|, etc.\ assignments from |\getanddefine@fonts| global when we call |\math@fonts|.
-% \indexpage{LaTeX kernel=\LaTeX\ kernel}
+% Some error checking. If |#1| isn't ``upright'' or ``italic,'' we should raise an error. If the |\@tempa| font doesn't correspond to a symbol font, we declare it. Before defining |\M@SetMathConstants| if necessary, we store the \textsc{nfss} family name in |\m@th@const@nts@font|.
% \begin{macrocode}
- \ifx\M@SetMathConstants\relax
- \protected\def\M@SetMathConstants{%
- \begingroup
- \escapechar\m@ne
- \expandafter\getanddefine@fonts
- \csname symMupright\csname M@fontid@\m@th@const@nts@font\endcsname
- \expandafter\endcsname % expands to \symMupright<id>
- \csname TU/\m@th@const@nts@font/\seriesdefault/\shapedefault
- \endcsname % expands to \TU/<nfss family name>/m/n
- \globaldefs\@ne
- \expandafter\@gobbletwo\math@fonts % gobble to avoid infinite loop
- \endgroup}
+ \def\@tempb{#1}
+ \def\@tempc{upright}
+ \ifx\@tempb\@tempc
+ \let\@tempc\shapedefault
+ \else
+ \def\@tempc{italic}
+ \ifx\@tempb\@tempc
+ \let\@tempc\itdefault
+ \else
+ \M@BadMathConstantsFontTypeError{#2}
+ \fi
+ \fi
+ \ifcsname symM#1\csname M@fontid@\@tempa\endcsname\endcsname\else
+ \DeclareSymbolFont{M#1\csname M@fontid@\@tempa\endcsname}
+ {TU}{\@tempa}{\mddefault}{\@tempc}
\fi
-% \end{macrocode}
-% After initializing |\M@SetMathConstants| if necessary, we store the \textsc{nfss} family name in |\m@th@const@nts@font|.
-% \begin{macrocode}
\let\m@th@const@nts@font\@tempa
- \fi}
- \let\M@SetMathConstants\relax
+% \end{macrocode}
+% We come to the tricky problem of making sure to use the correct MathConstants table. Lua\TeX\ automatically initializes all math parameters based on the most recent |\textfont|, etc.\ assignment, so we want to tell \LaTeX\ to reassign whatever default font we're using to the correct math family whenever we load new math fonts. This is possible, but the implementation is super hacky. When \LaTeX\ enters math mode, it checks whether it needs to redo any math family assignments, typically because of a change in font size, and if so, it calls |\getanddefine@fonts| repeatedly to append |\textfont|, etc.\ assignments onto the macro |\math@fonts|. Usually |\math@fonts| is empty because this process always happens inside a group, so we can hook into the code by defining |\math@font| to be |\aftergroup|\meta{extra code}. In this case, the \textit{extra code} will be another call to |\getanddefine@fonts|.
+%
+% We initialize |\M@SetMathConstants| to be |\relax|, so we define it the first time the user calls |\mathconstantsfont|. The command calls |\getanddefine@fonts| inside a group and uses as arguments the upright face of the font corresponding to |#1|. Then we call |\math@fonts|, and to avoid an infinite loop, we gobble the |\aftergroup||\M@SetMathConstants| macros that \textsf{mathfont} has inserted at the start of |\math@fonts|. Setting |\globaldefs| to 1 makes the |\textfont|, etc.\ assignments from |\getanddefine@fonts| global when we call |\math@fonts|.\indexpage{LaTeX kernel=\LaTeX\ kernel}^^A
+% \begin{macrocode}
+ \protected\def\M@SetMathConstants{%
+ \begingroup
+ \escapechar\m@ne
+ \expandafter\getanddefine@fonts
+ \csname symM#1\csname M@fontid@\m@th@const@nts@font\endcsname
+ \expandafter
+ \endcsname % expands to \symMupright<id>
+ \csname TU/\m@th@const@nts@font/\seriesdefault/\@tempc
+ \endcsname % expands to \TU/<nfss family name>/m/<shape>
+ \globaldefs\@ne
+ \expandafter\@gobbletwo\math@fonts % gobble to avoid infinite loop
+ \endgroup}
+ \fi}
\def\math@fonts{\aftergroup\M@SetMathConstants}
- \@onlypreamble\mathconstantsfont
+\else
+ \protected\def\mathconstantsfont{\M@LuaTeXOnlyWarning
+ \@ifnextchar[\@gobbletwo@brackets\@gobble}
\fi
+\@onlypreamble\mathconstantsfont
% \end{macrocode}
% If the user has not enabled Lua font adjustments, then |\mathconstantsfont| will generate an error message and gobble its argument. This definition happens later in |mathfont.sty| when we define other Lua-related macros such as |\IntegralItalicFactor| to do the same thing absent font adjustments.
%
%
%
-% \section{Letterlike Symbols}
-%
-% This section documents the implementation of the |\math|\meta{keyword} commands for blackboard bold, caligraphic, and fraktur characters. These commands work differently from other local font-changing commands. Unlike with the macros in the next section, we can't just change the |\fam| number because in unicode, the letterlike characters have different encoding slots from the regular Latin letters, so we need to somehow get different math codes as well as a different font. Future versions of \textsf{mathfont} will change the math codes of letters directly. For now though, we keep the old implementation where each |\math|\meta{keyword} macro inserts each token from its argument into an appropriate |\csname||\endcsname| construction. The first thing we have to do is check if \TeX\ is in math mode using |\M@check@mode|, and the argument of |\M@check@mode| should be one of the macros |\@math|\meta{keyword}. If yes, we call |#1|, and if no, we issue a ``missing |$|'' error.
-% \begin{macrocode}
-\def\M@check@mode#1{%
- \let\@tempa#1%
- \ifmmode
- \expandafter\@tempa
- \else
-% \end{macrocode}
-% Temporarily set the escape character code to $-1$ so we can gobble the |@| in |\@math|\meta{keyword} without worrying about the escape character. We need to do this for error messaging purposes, so |\M@HModeError| displays the user-level command that caused the error. Finally, the package adds the missing |$| to enter math mode before calling |#1|.
-% \indexpage{Missing \$ inserted=Missing \texttt\$ inserted}
-% \begin{macrocode}
- \bgroup
- \escapechar\m@ne
- \expandafter
- \egroup
- \expandafter\M@HModeError\csname\expandafter\@gobble\string#1\endcsname
- \expandafter$\expandafter\@tempa
- \fi}
-% \end{macrocode}
-% The |\M@process@tokens| macro turns the letters into letterlike symbols. The first argument should be the user's original argument of |\math|\meta{keyword}, and the second argument will be the keyword-option for |\mathfont| corresponding to this set of letterlike symbols. The macro loops through |#1| with |\@tfor| and calls |\M@check@token|, which sets the count variable |\M@errcode| as part of validating the token, on each |\@k|. If |\M@errcode| is 0, the \textit{token} is valid, and \TeX\ calls |\M@|\meta{keyword}|@|\meta{token} to typeset the letterlike character. If |\M@errcode| is anything else, |\M@check@token| will issue an error.
-% \begin{macrocode}
-\def\M@process@tokens#1#2{%
- \edef\@tempa{#1}%
- \expandafter\@tfor\expandafter\@k\expandafter:\expandafter=\@tempa\do{%
- \expandafter\M@check@token\expandafter{\@k}%
-% \end{macrocode}
-% Now that |\M@check@token| has set |\M@errcode|, we either typeset |\@k| or raise an error.
-% \begin{macrocode}
- \ifcase\M@errcode
- \csname M@#2@\@k\endcsname
- \or\expandafter\M@NestedArgWarning\csname math#2\endcsname{\@k}%
- \or\expandafter\M@CSArgWarning\csname math#2\endcsname{\@k}%
- \or\expandafter\M@CharacterArgWarning\csname math#2\endcsname{\@k}%
- \or\expandafter\M@DoubleArgWarning\csname math#2\endcsname{\@k}%
- \fi}}
-% \end{macrocode}
-% We check for errors with |\M@check@token|. The argument |#1| is the argument to be checked, and we are expecting |#1| to be a single letter or digit. Checking happens in five steps: (1) verify \TeX\ cannot split the contents of |#1| (which in |\M@process@tokens| is |\@k|) into multiple arguments; (2) verify that the argument does not begin with a character of catcode 1, i.e.\ |{|; (3) verify that the token is not a control sequence; (4) check whether the character is a letter; and (5) if the argument does not have catcode 11, check that it's a number. If any of these checks fail, \textsf{mathfont} sets |\M@errcode| to the corresponding error code and skips the remaining steps.\indexpage{multiple characters warning}\indexpage{error checking}
-% \begin{macrocode}
-\def\M@check@token#1{%
- \M@errcode\z@
- \expandafter\ifx\expandafter\@nnil\@gobble#1\@nnil% good
-% \end{macrocode}
-% Checking for a nested argument involves what I think of as catcode jujitsu and inevitably feels super hacky. We use |\ifcat\bgroup| to check whether the first token of |#1| has catcode 1, and we take care to avoid unbalanced braces because |\ifcat| will eat the first token in the |#1| argument when it expands. If the comparison succeeds, the first token had catcode 1, and we are now missing a |{|. We place one before |\ifcat|, and we |\@gobble| the argument to prevent \TeX\ from typesetting it. The extra left brace balances the final right brace in |#1|, and both tokens delimit the argument of |\@gobble|. If the comparison fails, \TeX\ eliminates everything in the first branch, and we need to balance the |{| from before |\ifcat|. Thus we add a right brace immediately after |\else|, and the argument of |\@gobble| ends up being empty.%
-% \indexpage{nested argument warning}
-% \begin{macrocode}
- \expandafter\@gobble\expandafter{\ifcat\bgroup#1% bad
- \M@errcode\@ne
- \else}%
-% \end{macrocode}
-% Check whether |#1| is a control sequence.\indexpage{control sequence warning}
-% \begin{macrocode}
- \ifcat\relax\noexpand#1% bad
- \M@errcode\tw@
- \else
-% \end{macrocode}
-% Check that |#1| is a letter.
-% \begin{macrocode}
- \ifnum\catcode`#1=11\relax% good
- \else
-% \end{macrocode}
-% Finally, check that |#1| is a digit.
-% \begin{macrocode}
- \if 0#1% good
- \else
- \if 1#1% good
- \else
- \if 2#1% good
- \else
- \if 3#1% good
- \else
- \if 4#1% good
- \else
- \if 5#1% good
- \else
- \if 6#1% good
- \else
- \if 7#1% good
- \else
- \if 8#1% good
- \else
- \if 9#1% good
- \else
- \M@errcode\thr@@
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \else% matches the original \ifx\@nnil, etc.
- \M@errcode=4\relax
- \fi}
-% \end{macrocode}
-% Now initialize the five commands. The |\define@|\meta{keyword} initializes each user-level macro |\math|\meta{keyword}, which checks the mode and calls |\@math|\meta{keyword}. The |@| versions actually do the work by calling |\M@process@tokens| on the user's input. We start with the blackboard-bold font-changing command.\indexpage{keywordbb=keyword \texttt{bb}}
-% \begin{macrocode}
-\def\define@bb{%
- \protected\def\mathbb{\M@check@mode\@mathbb}%
- \def\@mathbb##1{\M@process@tokens{##1}{bb}}}
-% \end{macrocode}
-% Calligraphic characters.\indexpage{keywordcal=keyword \texttt{cal}}
-% \begin{macrocode}
-\def\define@cal{%
- \protected\def\mathcal{\M@check@mode\@mathcal}%
- \def\@mathcal##1{\M@process@tokens{##1}{cal}}}
-% \end{macrocode}
-% Fraktur characters.\indexpage{keywordfrak=keyword \texttt{frak}}
-% \begin{macrocode}
-\def\define@frak{%
- \protected\def\mathfrak{\M@check@mode\@mathfrak}%
- \def\@mathfrak##1{\M@process@tokens{##1}{frak}}}
-% \end{macrocode}
-% Bold calligraphic characters.\indexpage{keywordbcal=keyword \texttt{bcal}}
-% \begin{macrocode}
-\def\define@bcal{%
- \protected\def\mathbcal{\M@check@mode\@mathbcal}%
- \def\@mathbcal##1{\M@process@tokens{##1}{bcal}}}
-% \end{macrocode}
-% Bold fraktur characters.\indexpage{keywordbfrak=keyword \texttt{bfrak}}
-% \begin{macrocode}
-\def\define@bfrak{%
- \protected\def\mathbfrak{\M@check@mode\@mathbfrak}%
- \def\@mathbfrak##1{\M@process@tokens{##1}{bfrak}}}
-% \end{macrocode}
-%
% \section{Local Font Changes}\indexpage{local font changes}
%
% This section deals with local font changes. The |\newmathfontcommand| creates macros that change the font for math alphabet characters and is basically a wrapper around |\DeclareMathAlphabet|. First we code |\M@check@csarg|, which accepts two arguments. The |#1| argument is the user-level command that called |\M@check@csarg|, which we use for error messaging, and |#2| should be a single control sequence. The way |\M@check@csarg| scans the following tokens is a bit tricky: (1) check the length of the argument using |\M@check@arglength|; and (2) check that the argument is a control sequence. If the user specifies an argument of the form |{..}|, i.e.\ extra text inside braces, the |\ifcat| will catch it and issue an error. If |\M@check@csarg| likes the input, it sets |\ifM@good@arg| to true, and otherwise, it sets |\ifM@arg@good| to false.
% \begin{macrocode}
\def\M@check@csarg#1#2{%
- \expandafter\ifx\expandafter\@nnil\@gobble#2\@nnil% good
- \ifcat\relax\noexpand#2% good
+ \expandafter\ifx\expandafter\@nnil\@gobble#2\@nnil % good
+ \ifcat\relax\noexpand#2 % good
\M@arg@goodtrue
- \else
+ \else % if #2 not a control sequence
\M@MissingControlSequenceError#1{#2}
\M@arg@goodfalse
\fi
- \else
+ \else % if #2 is multiple tokens
\M@DoubleArgError#1{#2}
\M@arg@goodfalse
\fi}
@@ -1622,8 +1508,8 @@ Happy TeXing!
\M@check@csarg\newmathfontcommand{#1}
\ifM@arg@good
\M@newfont{#2}
- \M@NewFontCommandInfo{#1}{\@tempbase}{\M@f@ntn@me}{#3}{#4}
- \DeclareMathAlphabet{#1}{TU}{\M@f@ntn@me}{#3}{#4}
+ \M@NewFontCommandInfo{#1}{\@tempbase}{\M@f@ntn@meb@se}{#3}{#4}
+ \DeclareMathAlphabet{#1}{TU}{\M@f@ntn@meb@se}{#3}{#4}
\fi}
\@onlypreamble\newmathfontcommand
% \end{macrocode}
@@ -1670,11 +1556,9 @@ Happy TeXing!
% We provide |\newmathbold| and |\newmathboldit| for backwards compatibility but issue a warning.
% \begin{macrocode}
\protected\def\newmathbold{%
- \M@DeprecatedWarning\newmathbold\newmathbf
- \newmathbf}
+ \M@DeprecatedWarning\newmathbold\newmathbf\newmathbf}
\protected\def\newmathboldit{%
- \M@DeprecatedWarning\newmathboldit\newmathbfit
- \newmathbfit}
+ \M@DeprecatedWarning\newmathboldit\newmathbfit\newmathbfit}
% \end{macrocode}
%
% \section{Miscellaneous Material}
@@ -1715,7 +1599,7 @@ Happy TeXing!
% \end{macrocode}
% Define |\RuleThicknessFactor|.
% \begin{macrocode}
- \def\RuleThicknessFactor#1{%
+ \protected\def\RuleThicknessFactor#1{%
\M@check@int{#1}
\ifM@arg@good
\global\M@rule@thickness@factor=#1\relax
@@ -1725,7 +1609,7 @@ Happy TeXing!
% \end{macrocode}
% Define |\IntegralItalicFactor|.
% \begin{macrocode}
- \def\IntegralItalicFactor#1{%
+ \protected\def\IntegralItalicFactor#1{%
\M@check@int{#1}
\ifM@arg@good
\global\M@integral@italic@factor=#1\relax
@@ -1735,7 +1619,7 @@ Happy TeXing!
% \end{macrocode}
% Define |\SurdHorizontalFactor|.
% \begin{macrocode}
- \def\SurdHorizontalFactor#1{%
+ \protected\def\SurdHorizontalFactor#1{%
\M@check@int{#1}
\ifM@arg@good
\global\M@surd@horizontal@factor=#1\relax
@@ -1745,7 +1629,7 @@ Happy TeXing!
% \end{macrocode}
% Define |\SurdVerticalFactor|.
% \begin{macrocode}
- \def\SurdVerticalFactor#1{%
+ \protected\def\SurdVerticalFactor#1{%
\M@check@int{#1}
\ifM@arg@good
\global\M@surd@vertical@factor=#1\relax
@@ -1759,7 +1643,7 @@ Happy TeXing!
\@tfor\@i:=\RuleThicknessFactor\IntegralItalicFactor\SurdHorizontalFactor
\SurdVerticalFactor\CharmLine\CharmFile\mathconstantsfont
\do{%
- \expandafter\edef\@i{\noexpand\M@NoFontAdjustError
+ \protected\expandafter\edef\@i{\noexpand\M@NoFontAdjustError
\expandafter\noexpand\@i
\noexpand\@gobble}}
\fi
@@ -1774,6 +1658,7 @@ Happy TeXing!
\@onlypreamble\CharmFile
% \end{macrocode}
% Provide the command to reset the kernel. I am not sure that we need this macro, but it will stay in the package for backwards compatibility.
+% \indexpage{Internal commands restored}
% \begin{macrocode}
\def\restoremathinternals{%
\ifx\set@mathchar\@@set@mathchar
@@ -1830,30 +1715,7 @@ Happy TeXing!
\fi
\fi
% \end{macrocode}
-% Warn the user about a possible cosmetic issue arising from a clash with the |align| environment from \textsf{amsmath}. Inside a group, we use |\@tempswa| to check whether the user declared one of the letterlike symbol keywords. If yes, we test whether the user loaded \textsf{amsmath} and if so issue a warning.\indexpage{amsmath=\textsf{amsmath}}
-% \begin{macrocode}
-\AtBeginDocument{%
- \bgroup\@tempswafalse
- \ifM@bb
- \@tempswatrue
- \else\ifM@cal
- \@tempswatrue
- \else\ifM@frak
- \@tempawatrue
- \else\ifM@bfrak
- \@tempswatrue
- \fi
- \fi
- \fi
- \fi
- \expandafter\egroup\if@tempswa
- \@ifpackageloaded{amsmath}{\PackageWarningNoLine{mathfont}
- {\MessageBreak Package amsmath detected. Some warning\MessageBreak
- messages for letterlike characters may be\MessageBreak
- duplicated inside the align environment}}{}
- \fi}
-% \end{macrocode}
-% Write to the |log| file |\AtBeginDocument| all font changes carried out by \textsf{mathfont}. The command |\keyword@info@begindocument| accepts two arguments. One is a keyword-argument from |\mathfont|, and the other is a number of spaces. The spaces make the messages line up with each other in the log file.\indexpage{log file=\texttt{log} file}
+% Write to the |log| file |\AtBeginDocument| all font changes carried out by \textsf{mathfont}. The command |\keyword@info@begindocument| accepts two arguments and is what acutally prints the informational message after the preamble. One argument is a keyword-argument from |\mathfont|, and the other is a number of spaces. The spaces make the messages line up with each other in the log file.\indexpage{log file=\texttt{log} file}
% \begin{macrocode}
\def\keyword@info@begindocument#1:#2\@nil{%
\expandafter\ifx % next line is two cs to be compared
@@ -1868,7 +1730,7 @@ Happy TeXing!
% Now print the messages.
% \begin{macrocode}
\AtBeginDocument{%
- \def\@tempa{% <---- everything should be 13 characters long plus :
+ \def\@tempa{% <-- everything should be 14 characters long
upper:\@spaces\@spaces,%
lower:\@spaces\@spaces,%
diacritics:\space\space\space,%
@@ -1893,7 +1755,7 @@ Happy TeXing!
frak:\@spaces\@spaces\space,%
bcal:\@spaces\@spaces\space,%
bfrak:\@spaces\@spaces}
- \wlog{^^JPackage mathfont Info: List of changes made in the preamble---}
+ \wlog{^^JPackage mathfont Info: List of changes made in the preamble.}
\@for\@i:=\@tempa\do{%
\expandafter\keyword@info@begindocument\@i\@nil}
\wlog{}}
@@ -1940,7 +1802,7 @@ Happy TeXing!
%
%
%
-% The next three sections implement Lua-based font adjustments and apply only if the user has enabled font adjustment. Most of the implementation happens through Lua code, but we need some \TeX\ code in case the user wants to adjust character metric information. Here is a rough outline of what needs to happen in the next three sections:
+% The next three sections implement Lua-based font adjustments and apply only if the user has enabled font adjustment. Most of the implementation happens through Lua code, but we need some \TeX\ code in case the user wants to adjust character metric information. Here is a rough outline of what happens in the next three sections:
% \begin{enumerate}\itemsep\z@
% \item Initialize a Lua table that contains new metrics for certain characters specific to math mode, such as letters with wider bounding boxes and large operator symbols.
% \item Provide an interface for the user to change this metric information.
@@ -2353,7 +2215,7 @@ end
%
%
% \begin{figure}[t]
-% \centerline{\bfseries Table 3: Callbacks Created by \textsf{mathfont}\strut}
+% \centerline{\bfseries Table 4: Callbacks Created by \textsf{mathfont}\strut}
% \begin{tabularx}\textwidth{lXl}\toprule
% Callback Name & Called? & Default Behavior\\\midrule
% |"mathfont.inspect_font"| & Always & none\\\midrule
@@ -2369,7 +2231,7 @@ end
%
%
%
-% This section contains the Lua functions that actually modify the font during loading. The three functions |set_nomath_true|, |math_constants|, and |apply_charm_info| do most of the heavy lifting, and we set them as the default behavior for three callbacks. In total, \textsf{mathfont} defines six different callbacks and calls them inside the function |adjust_font|---see table~3 for a list. Each callback accepts a fontdata object as an argument and returns nothing. You can use these callbacks to change \textsf{mathfont}'s default modifications or to modify a fontdata object before or after \textsf{mathfont} looks at it. Be aware that if you add a function to any of the |disable_nomath|, |add_math_constants|, or |fix_character_metrics| callbacks, Lua\TeX\ will not call the default |mathfont| function associated with the callback anymore. In other words, do not mess with these three callbacks unless you are duplicating the functionality of the corresponding ``Default Behavior'' function from table~3.
+% This section contains the Lua functions that actually modify the font during loading. The three functions |set_nomath_true|, |math_constants|, and |apply_charm_info| do most of the heavy lifting, and we set them as the default behavior for three callbacks. In total, \textsf{mathfont} defines six different callbacks and calls them inside the function |adjust_font|---see table~4 for a list. Each callback accepts a fontdata object as an argument and returns nothing. You can use these callbacks to change \textsf{mathfont}'s default modifications or to modify a fontdata object before or after \textsf{mathfont} looks at it. Be aware that if you add a function to any of the |disable_nomath|, |add_math_constants|, or |fix_character_metrics| callbacks, Lua\TeX\ will not call the default |mathfont| function associated with the callback anymore. In other words, do not mess with these three callbacks unless you are duplicating the functionality of the corresponding ``Default Behavior'' function from table~4.
%
% We begin with the functions that modify character subtables in the font table, and in all cases, we return a new character table (or set of character tables in the case of type |e|) that we insert into the font object. For types |a| and |e|, we code the table from scratch, and for type |u|, we add information to the character tables that already exist in the font object. The three functions for assembling character tables take three arguments. The |index| argument is the unicode index of the base character that the function is modifying. The |charm_data| argument is the subtable in |mathfont| of charm information that corresponds to |index|, and the |fontdata| argument is a font object. We will pull information from |charm_data| and |fontdata| to assemble the new table.
%
@@ -2686,7 +2548,7 @@ end
function mathfont.math_constants(fontdata)
fontdata.MathConstants = fontdata.MathConstants or {}
% \end{macrocode}
-% First evaluate the dimensions from the font object that we will use in determining other math parameter values. The |A_height| is the height of the capital ``A'' character, and the |y_depth| is the depth of the minuscule ``y'' character. Both will be 0 if the font does not have the correct character.
+% First evaluate the dimensions from the font object that we will use in determining other math parameter values. The |A_height| is the height of the capital ``A'' character, and the |y_depth| is the depth of the lower-case ``y'' character. Both will be 0 if the font does not have the correct character.
% \begin{macrocode}
local size = fontdata.size or 0
local ex = fontdata.parameters.x_height or 0
@@ -3113,7 +2975,7 @@ mathfont:new_type_a(122, 1044505, {100, 50, -100, 0}) % z
mathfont:new_type_a(305, 1044506, {100, 100, -150, 0}) % \imath
mathfont:new_type_a(567, 1044507, {700, 50, -150, 0}) % \jmath
% \end{macrocode}
-% Capital Latin letters will fill unicode slots U+FF020 through U+FF039.
+% Upper-case Latin letters will fill unicode slots U+FF020 through U+FF039.
% \begin{macrocode}
mathfont:new_type_a(65, 1044512, {50, 0, 150, 0}) % A
mathfont:new_type_a(66, 1044513, {50, 0, 0, 0}) % B
@@ -3175,7 +3037,7 @@ mathfont:new_type_u(1009, {-50, 0}) % \varrho
mathfont:new_type_u(962, {-50, 0}) % \varsigma
mathfont:new_type_u(966, {0, 0}) % \varphi
% \end{macrocode}
-% Capital Greek characters. Same as previously.
+% Upper-case Greek characters. Same as previously.
% \begin{macrocode}
mathfont:new_type_u(913, {0, 0}) % \Alpha
mathfont:new_type_u(914, {0, 0}) % \Beta
@@ -3719,7 +3581,7 @@ mathfont:add_extensible_variants(smash, int_glyphs, int_scale)
\def\M@operator@set{%
\ifM@adjust@font
\edef\M@operator@num{\number\csname symM\M@operatorshape\@tempa\endcsname}
- \def\M@default@latin@operator{%
+ \protected\edef\M@operator@mathcodes{%
\Umathcode`A=7+\M@operator@num+`A\relax
\Umathcode`B=7+\M@operator@num+`B\relax
\Umathcode`C=7+\M@operator@num+`C\relax
@@ -3775,13 +3637,13 @@ mathfont:add_extensible_variants(smash, int_glyphs, int_scale)
\Umathchardef\imath=7+\M@operator@num+1044506\relax
\Umathchardef\jmath=7+\M@operator@num+1044500\relax}
\else
- \let\M@default@latin@operator\@empty
+ \let\M@operator@mathcodes\@empty
\fi
% \end{macrocode}
% Then we change the |\operator@font| definition and if necessary change the math codes.
% \begin{macrocode}
\xdef\operator@font{\noexpand\mathgroup
- \csname symM\M@operatorshape\@tempa\endcsname\M@default@latin@operator}}
+ \csname symM\M@operatorshape\@tempa\endcsname\M@operator@mathcodes}}
% \end{macrocode}
% Set delimiters.\indexpage{keyworddelimiters=keyword \texttt{delimiters}}
% \begin{macrocode}
@@ -4346,311 +4208,352 @@ mathfont:add_extensible_variants(smash, int_glyphs, int_scale)
\DeclareMathSymbol{\lcirclearrow}{\mathrel}{\M@arrows@font}{"27F2}
\DeclareMathSymbol{\rcirclearrow}{\mathrel}{\M@arrows@font}{"27F3}}
% \end{macrocode}
-% Set blackboard bold letters and numbers.\indexpage{keywordbb=keyword \texttt{bb}}
+% Set blackboard bold letters and numbers. The alphanumeric keywords work a bit differently from the other font-setting commands. We define |\mathbb| here, which takes a single argument and is essentially a wrapper around |\M@bb@mathcodes|. That command changes the |\Umathcode|s of letters to the unicode hex values of corresponding blackboard-bold characters, and throughout, |\M@bb@num| stores the family number of the sumbol font for the |bb| character class. In the definition of |\mathbb|, we use |\begingroup| and |\endgroup| to avoid creating unexpected atoms. The other alphanumeric keywords work similarly.\indexpage{keywordbb=keyword \texttt{bb}}
% \begin{macrocode}
\def\M@bb@set{%
- \edef\M@bb@font{M\M@bbshape\@tempa}
- \DeclareMathSymbol{\M@bb@A}{\mathord}{\M@bb@font}{"1D538}
- \DeclareMathSymbol{\M@bb@B}{\mathord}{\M@bb@font}{"1D539}
- \DeclareMathSymbol{\M@bb@C}{\mathord}{\M@bb@font}{"2102}
- \DeclareMathSymbol{\M@bb@D}{\mathord}{\M@bb@font}{"1D53B}
- \DeclareMathSymbol{\M@bb@E}{\mathord}{\M@bb@font}{"1D53C}
- \DeclareMathSymbol{\M@bb@F}{\mathord}{\M@bb@font}{"1D53D}
- \DeclareMathSymbol{\M@bb@G}{\mathord}{\M@bb@font}{"1D53E}
- \DeclareMathSymbol{\M@bb@H}{\mathord}{\M@bb@font}{"210D}
- \DeclareMathSymbol{\M@bb@I}{\mathord}{\M@bb@font}{"1D540}
- \DeclareMathSymbol{\M@bb@J}{\mathord}{\M@bb@font}{"1D541}
- \DeclareMathSymbol{\M@bb@K}{\mathord}{\M@bb@font}{"1D542}
- \DeclareMathSymbol{\M@bb@L}{\mathord}{\M@bb@font}{"1D543}
- \DeclareMathSymbol{\M@bb@M}{\mathord}{\M@bb@font}{"1D544}
- \DeclareMathSymbol{\M@bb@N}{\mathord}{\M@bb@font}{"2115}
- \DeclareMathSymbol{\M@bb@O}{\mathord}{\M@bb@font}{"1D546}
- \DeclareMathSymbol{\M@bb@P}{\mathord}{\M@bb@font}{"2119}
- \DeclareMathSymbol{\M@bb@Q}{\mathord}{\M@bb@font}{"211A}
- \DeclareMathSymbol{\M@bb@R}{\mathord}{\M@bb@font}{"211D}
- \DeclareMathSymbol{\M@bb@S}{\mathord}{\M@bb@font}{"1D54A}
- \DeclareMathSymbol{\M@bb@T}{\mathord}{\M@bb@font}{"1D54B}
- \DeclareMathSymbol{\M@bb@U}{\mathord}{\M@bb@font}{"1D54C}
- \DeclareMathSymbol{\M@bb@V}{\mathord}{\M@bb@font}{"1D54D}
- \DeclareMathSymbol{\M@bb@W}{\mathord}{\M@bb@font}{"1D54E}
- \DeclareMathSymbol{\M@bb@X}{\mathord}{\M@bb@font}{"1D54F}
- \DeclareMathSymbol{\M@bb@Y}{\mathord}{\M@bb@font}{"1D550}
- \DeclareMathSymbol{\M@bb@Z}{\mathord}{\M@bb@font}{"2124}
- \DeclareMathSymbol{\M@bb@a}{\mathord}{\M@bb@font}{"1D552}
- \DeclareMathSymbol{\M@bb@b}{\mathord}{\M@bb@font}{"1D553}
- \DeclareMathSymbol{\M@bb@c}{\mathord}{\M@bb@font}{"1D554}
- \DeclareMathSymbol{\M@bb@d}{\mathord}{\M@bb@font}{"1D555}
- \DeclareMathSymbol{\M@bb@e}{\mathord}{\M@bb@font}{"1D556}
- \DeclareMathSymbol{\M@bb@f}{\mathord}{\M@bb@font}{"1D557}
- \DeclareMathSymbol{\M@bb@g}{\mathord}{\M@bb@font}{"1D558}
- \DeclareMathSymbol{\M@bb@h}{\mathord}{\M@bb@font}{"1D559}
- \DeclareMathSymbol{\M@bb@i}{\mathord}{\M@bb@font}{"1D55A}
- \DeclareMathSymbol{\M@bb@j}{\mathord}{\M@bb@font}{"1D55B}
- \DeclareMathSymbol{\M@bb@k}{\mathord}{\M@bb@font}{"1D55C}
- \DeclareMathSymbol{\M@bb@l}{\mathord}{\M@bb@font}{"1D55D}
- \DeclareMathSymbol{\M@bb@m}{\mathord}{\M@bb@font}{"1D55E}
- \DeclareMathSymbol{\M@bb@n}{\mathord}{\M@bb@font}{"1D55F}
- \DeclareMathSymbol{\M@bb@o}{\mathord}{\M@bb@font}{"1D560}
- \DeclareMathSymbol{\M@bb@p}{\mathord}{\M@bb@font}{"1D561}
- \DeclareMathSymbol{\M@bb@q}{\mathord}{\M@bb@font}{"1D562}
- \DeclareMathSymbol{\M@bb@r}{\mathord}{\M@bb@font}{"1D563}
- \DeclareMathSymbol{\M@bb@s}{\mathord}{\M@bb@font}{"1D564}
- \DeclareMathSymbol{\M@bb@t}{\mathord}{\M@bb@font}{"1D565}
- \DeclareMathSymbol{\M@bb@u}{\mathord}{\M@bb@font}{"1D566}
- \DeclareMathSymbol{\M@bb@v}{\mathord}{\M@bb@font}{"1D567}
- \DeclareMathSymbol{\M@bb@w}{\mathord}{\M@bb@font}{"1D568}
- \DeclareMathSymbol{\M@bb@x}{\mathord}{\M@bb@font}{"1D569}
- \DeclareMathSymbol{\M@bb@y}{\mathord}{\M@bb@font}{"1D56A}
- \DeclareMathSymbol{\M@bb@z}{\mathord}{\M@bb@font}{"1D56B}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@0\endcsname}{\mathord}{\M@bb@font}{"1D7D8}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@1\endcsname}{\mathord}{\M@bb@font}{"1D7D9}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@2\endcsname}{\mathord}{\M@bb@font}{"1D7DA}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@3\endcsname}{\mathord}{\M@bb@font}{"1D7DB}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@4\endcsname}{\mathord}{\M@bb@font}{"1D7DC}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@5\endcsname}{\mathord}{\M@bb@font}{"1D7DD}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@6\endcsname}{\mathord}{\M@bb@font}{"1D7DE}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@7\endcsname}{\mathord}{\M@bb@font}{"1D7DF}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@8\endcsname}{\mathord}{\M@bb@font}{"1D7E0}
- \expandafter\DeclareMathSymbol\expandafter
- {\csname M@bb@9\endcsname}{\mathord}{\M@bb@font}{"1D7E1}}
+ \protected\def\mathbb##1{\relax
+ \ifmmode\else
+ \M@HModeError\mathbb
+ $%
+ \fi
+ \begingroup
+ \M@bb@mathcodes
+ ##1%
+ \endgroup}
+ \edef\M@bb@num{\number\csname symM\M@bbshape\@tempa\endcsname}
+ \protected\edef\M@bb@mathcodes{%
+ \Umathcode`A=0+\M@bb@num"1D538\relax
+ \Umathcode`B=0+\M@bb@num"1D539\relax
+ \Umathcode`C=0+\M@bb@num"2102\relax
+ \Umathcode`D=0+\M@bb@num"1D53B\relax
+ \Umathcode`E=0+\M@bb@num"1D53C\relax
+ \Umathcode`F=0+\M@bb@num"1D53D\relax
+ \Umathcode`G=0+\M@bb@num"1D53E\relax
+ \Umathcode`H=0+\M@bb@num"210D\relax
+ \Umathcode`I=0+\M@bb@num"1D540\relax
+ \Umathcode`J=0+\M@bb@num"1D541\relax
+ \Umathcode`K=0+\M@bb@num"1D542\relax
+ \Umathcode`L=0+\M@bb@num"1D543\relax
+ \Umathcode`M=0+\M@bb@num"1D544\relax
+ \Umathcode`N=0+\M@bb@num"2115\relax
+ \Umathcode`O=0+\M@bb@num"1D546\relax
+ \Umathcode`P=0+\M@bb@num"2119\relax
+ \Umathcode`Q=0+\M@bb@num"211A\relax
+ \Umathcode`R=0+\M@bb@num"211D\relax
+ \Umathcode`S=0+\M@bb@num"1D54A\relax
+ \Umathcode`T=0+\M@bb@num"1D54B\relax
+ \Umathcode`U=0+\M@bb@num"1D54C\relax
+ \Umathcode`V=0+\M@bb@num"1D54D\relax
+ \Umathcode`W=0+\M@bb@num"1D54E\relax
+ \Umathcode`X=0+\M@bb@num"1D54F\relax
+ \Umathcode`Y=0+\M@bb@num"1D550\relax
+ \Umathcode`Z=0+\M@bb@num"2124\relax
+ \Umathcode`a=0+\M@bb@num"1D552\relax
+ \Umathcode`b=0+\M@bb@num"1D553\relax
+ \Umathcode`c=0+\M@bb@num"1D554\relax
+ \Umathcode`d=0+\M@bb@num"1D555\relax
+ \Umathcode`e=0+\M@bb@num"1D556\relax
+ \Umathcode`f=0+\M@bb@num"1D557\relax
+ \Umathcode`g=0+\M@bb@num"1D558\relax
+ \Umathcode`h=0+\M@bb@num"1D559\relax
+ \Umathcode`i=0+\M@bb@num"1D55A\relax
+ \Umathcode`j=0+\M@bb@num"1D55B\relax
+ \Umathcode`k=0+\M@bb@num"1D55C\relax
+ \Umathcode`l=0+\M@bb@num"1D55D\relax
+ \Umathcode`m=0+\M@bb@num"1D55E\relax
+ \Umathcode`n=0+\M@bb@num"1D55F\relax
+ \Umathcode`o=0+\M@bb@num"1D560\relax
+ \Umathcode`p=0+\M@bb@num"1D561\relax
+ \Umathcode`q=0+\M@bb@num"1D562\relax
+ \Umathcode`r=0+\M@bb@num"1D563\relax
+ \Umathcode`s=0+\M@bb@num"1D564\relax
+ \Umathcode`t=0+\M@bb@num"1D565\relax
+ \Umathcode`u=0+\M@bb@num"1D566\relax
+ \Umathcode`v=0+\M@bb@num"1D567\relax
+ \Umathcode`w=0+\M@bb@num"1D568\relax
+ \Umathcode`x=0+\M@bb@num"1D569\relax
+ \Umathcode`y=0+\M@bb@num"1D56A\relax
+ \Umathcode`z=0+\M@bb@num"1D56B\relax
+ \Umathcode`0=0+\M@bb@num"1D7D8\relax
+ \Umathcode`1=0+\M@bb@num"1D7D9\relax
+ \Umathcode`2=0+\M@bb@num"1D7DA\relax
+ \Umathcode`3=0+\M@bb@num"1D7DB\relax
+ \Umathcode`4=0+\M@bb@num"1D7DC\relax
+ \Umathcode`5=0+\M@bb@num"1D7DD\relax
+ \Umathcode`6=0+\M@bb@num"1D7DE\relax
+ \Umathcode`7=0+\M@bb@num"1D7DF\relax
+ \Umathcode`8=0+\M@bb@num"1D7E0\relax
+ \Umathcode`9=0+\M@bb@num"1D7E1\relax}}
% \end{macrocode}
% Set caligraphic letters.\indexpage{keywordcal=keyword \texttt{cal}}
% \begin{macrocode}
\def\M@cal@set{%
- \edef\M@cal@font{M\M@calshape\@tempa}
- \DeclareMathSymbol{\M@cal@A}{\mathord}{\M@cal@font}{"1D49C}
- \DeclareMathSymbol{\M@cal@B}{\mathord}{\M@cal@font}{"212C}
- \DeclareMathSymbol{\M@cal@C}{\mathord}{\M@cal@font}{"1D49E}
- \DeclareMathSymbol{\M@cal@D}{\mathord}{\M@cal@font}{"1D49F}
- \DeclareMathSymbol{\M@cal@E}{\mathord}{\M@cal@font}{"2130}
- \DeclareMathSymbol{\M@cal@F}{\mathord}{\M@cal@font}{"2131}
- \DeclareMathSymbol{\M@cal@G}{\mathord}{\M@cal@font}{"1D4A2}
- \DeclareMathSymbol{\M@cal@H}{\mathord}{\M@cal@font}{"210B}
- \DeclareMathSymbol{\M@cal@I}{\mathord}{\M@cal@font}{"2110}
- \DeclareMathSymbol{\M@cal@J}{\mathord}{\M@cal@font}{"1D4A5}
- \DeclareMathSymbol{\M@cal@K}{\mathord}{\M@cal@font}{"1D4A6}
- \DeclareMathSymbol{\M@cal@L}{\mathord}{\M@cal@font}{"2112}
- \DeclareMathSymbol{\M@cal@M}{\mathord}{\M@cal@font}{"2133}
- \DeclareMathSymbol{\M@cal@N}{\mathord}{\M@cal@font}{"1D4A9}
- \DeclareMathSymbol{\M@cal@O}{\mathord}{\M@cal@font}{"1D4AA}
- \DeclareMathSymbol{\M@cal@P}{\mathord}{\M@cal@font}{"1D4AB}
- \DeclareMathSymbol{\M@cal@Q}{\mathord}{\M@cal@font}{"1D4AC}
- \DeclareMathSymbol{\M@cal@R}{\mathord}{\M@cal@font}{"211B}
- \DeclareMathSymbol{\M@cal@S}{\mathord}{\M@cal@font}{"1D4AE}
- \DeclareMathSymbol{\M@cal@T}{\mathord}{\M@cal@font}{"1D4AF}
- \DeclareMathSymbol{\M@cal@U}{\mathord}{\M@cal@font}{"1D4B0}
- \DeclareMathSymbol{\M@cal@V}{\mathord}{\M@cal@font}{"1D4B1}
- \DeclareMathSymbol{\M@cal@W}{\mathord}{\M@cal@font}{"1D4B2}
- \DeclareMathSymbol{\M@cal@X}{\mathord}{\M@cal@font}{"1D4B3}
- \DeclareMathSymbol{\M@cal@Y}{\mathord}{\M@cal@font}{"1D4B4}
- \DeclareMathSymbol{\M@cal@Z}{\mathord}{\M@cal@font}{"1D4B5}
- \DeclareMathSymbol{\M@cal@a}{\mathord}{\M@cal@font}{"1D4B6}
- \DeclareMathSymbol{\M@cal@b}{\mathord}{\M@cal@font}{"1D4B7}
- \DeclareMathSymbol{\M@cal@c}{\mathord}{\M@cal@font}{"1D4B8}
- \DeclareMathSymbol{\M@cal@d}{\mathord}{\M@cal@font}{"1D4B9}
- \DeclareMathSymbol{\M@cal@e}{\mathord}{\M@cal@font}{"212F}
- \DeclareMathSymbol{\M@cal@f}{\mathord}{\M@cal@font}{"1D4BB}
- \DeclareMathSymbol{\M@cal@g}{\mathord}{\M@cal@font}{"210A}
- \DeclareMathSymbol{\M@cal@h}{\mathord}{\M@cal@font}{"1D4BD}
- \DeclareMathSymbol{\M@cal@i}{\mathord}{\M@cal@font}{"1D4BE}
- \DeclareMathSymbol{\M@cal@j}{\mathord}{\M@cal@font}{"1D4BF}
- \DeclareMathSymbol{\M@cal@k}{\mathord}{\M@cal@font}{"1D4C0}
- \DeclareMathSymbol{\M@cal@l}{\mathord}{\M@cal@font}{"1D4C1}
- \DeclareMathSymbol{\M@cal@m}{\mathord}{\M@cal@font}{"1D4C2}
- \DeclareMathSymbol{\M@cal@n}{\mathord}{\M@cal@font}{"1D4C3}
- \DeclareMathSymbol{\M@cal@o}{\mathord}{\M@cal@font}{"2134}
- \DeclareMathSymbol{\M@cal@p}{\mathord}{\M@cal@font}{"1D4C5}
- \DeclareMathSymbol{\M@cal@q}{\mathord}{\M@cal@font}{"1D4C6}
- \DeclareMathSymbol{\M@cal@r}{\mathord}{\M@cal@font}{"1D4C7}
- \DeclareMathSymbol{\M@cal@s}{\mathord}{\M@cal@font}{"1D4C8}
- \DeclareMathSymbol{\M@cal@t}{\mathord}{\M@cal@font}{"1D4C9}
- \DeclareMathSymbol{\M@cal@u}{\mathord}{\M@cal@font}{"1D4CA}
- \DeclareMathSymbol{\M@cal@v}{\mathord}{\M@cal@font}{"1D4CB}
- \DeclareMathSymbol{\M@cal@w}{\mathord}{\M@cal@font}{"1D4CC}
- \DeclareMathSymbol{\M@cal@x}{\mathord}{\M@cal@font}{"1D4CD}
- \DeclareMathSymbol{\M@cal@y}{\mathord}{\M@cal@font}{"1D4CE}
- \DeclareMathSymbol{\M@cal@z}{\mathord}{\M@cal@font}{"1D4CF}}
+ \protected\def\mathcal##1{\relax
+ \ifmmode\else
+ \M@HModeError\mathcal
+ $%
+ \fi
+ \begingroup
+ \M@cal@mathcodes
+ ##1%
+ \endgroup}
+ \edef\M@cal@num{\number\csname symM\M@calshape\@tempa\endcsname}
+ \protected\edef\M@cal@mathcodes{%
+ \Umathcode`A=0+\M@cal@num"1D49C\relax
+ \Umathcode`B=0+\M@cal@num"212C\relax
+ \Umathcode`C=0+\M@cal@num"1D49E\relax
+ \Umathcode`D=0+\M@cal@num"1D49F\relax
+ \Umathcode`E=0+\M@cal@num"2130\relax
+ \Umathcode`F=0+\M@cal@num"2131\relax
+ \Umathcode`G=0+\M@cal@num"1D4A2\relax
+ \Umathcode`H=0+\M@cal@num"210B\relax
+ \Umathcode`I=0+\M@cal@num"2110\relax
+ \Umathcode`J=0+\M@cal@num"1D4A5\relax
+ \Umathcode`K=0+\M@cal@num"1D4A6\relax
+ \Umathcode`L=0+\M@cal@num"2112\relax
+ \Umathcode`M=0+\M@cal@num"2133\relax
+ \Umathcode`N=0+\M@cal@num"1D4A9\relax
+ \Umathcode`O=0+\M@cal@num"1D4AA\relax
+ \Umathcode`P=0+\M@cal@num"1D4AB\relax
+ \Umathcode`Q=0+\M@cal@num"1D4AC\relax
+ \Umathcode`R=0+\M@cal@num"211B\relax
+ \Umathcode`S=0+\M@cal@num"1D4AE\relax
+ \Umathcode`T=0+\M@cal@num"1D4AF\relax
+ \Umathcode`U=0+\M@cal@num"1D4B0\relax
+ \Umathcode`V=0+\M@cal@num"1D4B1\relax
+ \Umathcode`W=0+\M@cal@num"1D4B2\relax
+ \Umathcode`X=0+\M@cal@num"1D4B3\relax
+ \Umathcode`Y=0+\M@cal@num"1D4B4\relax
+ \Umathcode`Z=0+\M@cal@num"1D4B5\relax
+ \Umathcode`a=0+\M@cal@num"1D4B6\relax
+ \Umathcode`b=0+\M@cal@num"1D4B7\relax
+ \Umathcode`c=0+\M@cal@num"1D4B8\relax
+ \Umathcode`d=0+\M@cal@num"1D4B9\relax
+ \Umathcode`e=0+\M@cal@num"212F\relax
+ \Umathcode`f=0+\M@cal@num"1D4BB\relax
+ \Umathcode`g=0+\M@cal@num"210A\relax
+ \Umathcode`h=0+\M@cal@num"1D4BD\relax
+ \Umathcode`i=0+\M@cal@num"1D4BE\relax
+ \Umathcode`j=0+\M@cal@num"1D4BF\relax
+ \Umathcode`k=0+\M@cal@num"1D4C0\relax
+ \Umathcode`l=0+\M@cal@num"1D4C1\relax
+ \Umathcode`m=0+\M@cal@num"1D4C2\relax
+ \Umathcode`n=0+\M@cal@num"1D4C3\relax
+ \Umathcode`o=0+\M@cal@num"2134\relax
+ \Umathcode`p=0+\M@cal@num"1D4C5\relax
+ \Umathcode`q=0+\M@cal@num"1D4C6\relax
+ \Umathcode`r=0+\M@cal@num"1D4C7\relax
+ \Umathcode`s=0+\M@cal@num"1D4C8\relax
+ \Umathcode`t=0+\M@cal@num"1D4C9\relax
+ \Umathcode`u=0+\M@cal@num"1D4CA\relax
+ \Umathcode`v=0+\M@cal@num"1D4CB\relax
+ \Umathcode`w=0+\M@cal@num"1D4CC\relax
+ \Umathcode`x=0+\M@cal@num"1D4CD\relax
+ \Umathcode`y=0+\M@cal@num"1D4CE\relax
+ \Umathcode`z=0+\M@cal@num"1D4CF\relax}}
% \end{macrocode}
% Set fraktur letters.\indexpage{keywordfrak=keyword \texttt{frak}}
% \begin{macrocode}
\def\M@frak@set{%
- \edef\M@frak@font{M\M@frakshape\@tempa}
- \DeclareMathSymbol{\M@frak@A}{\mathord}{\M@frak@font}{"1D504}
- \DeclareMathSymbol{\M@frak@B}{\mathord}{\M@frak@font}{"1D505}
- \DeclareMathSymbol{\M@frak@C}{\mathord}{\M@frak@font}{"212D}
- \DeclareMathSymbol{\M@frak@D}{\mathord}{\M@frak@font}{"1D507}
- \DeclareMathSymbol{\M@frak@E}{\mathord}{\M@frak@font}{"1D508}
- \DeclareMathSymbol{\M@frak@F}{\mathord}{\M@frak@font}{"1D509}
- \DeclareMathSymbol{\M@frak@G}{\mathord}{\M@frak@font}{"1D50A}
- \DeclareMathSymbol{\M@frak@H}{\mathord}{\M@frak@font}{"210C}
- \DeclareMathSymbol{\M@frak@I}{\mathord}{\M@frak@font}{"2111}
- \DeclareMathSymbol{\M@frak@J}{\mathord}{\M@frak@font}{"1D50D}
- \DeclareMathSymbol{\M@frak@K}{\mathord}{\M@frak@font}{"1D50E}
- \DeclareMathSymbol{\M@frak@L}{\mathord}{\M@frak@font}{"1D50F}
- \DeclareMathSymbol{\M@frak@M}{\mathord}{\M@frak@font}{"1D510}
- \DeclareMathSymbol{\M@frak@N}{\mathord}{\M@frak@font}{"1D511}
- \DeclareMathSymbol{\M@frak@O}{\mathord}{\M@frak@font}{"1D512}
- \DeclareMathSymbol{\M@frak@P}{\mathord}{\M@frak@font}{"1D513}
- \DeclareMathSymbol{\M@frak@Q}{\mathord}{\M@frak@font}{"1D514}
- \DeclareMathSymbol{\M@frak@R}{\mathord}{\M@frak@font}{"211C}
- \DeclareMathSymbol{\M@frak@S}{\mathord}{\M@frak@font}{"1D516}
- \DeclareMathSymbol{\M@frak@T}{\mathord}{\M@frak@font}{"1D517}
- \DeclareMathSymbol{\M@frak@U}{\mathord}{\M@frak@font}{"1D518}
- \DeclareMathSymbol{\M@frak@V}{\mathord}{\M@frak@font}{"1D519}
- \DeclareMathSymbol{\M@frak@W}{\mathord}{\M@frak@font}{"1D51A}
- \DeclareMathSymbol{\M@frak@X}{\mathord}{\M@frak@font}{"1D51B}
- \DeclareMathSymbol{\M@frak@Y}{\mathord}{\M@frak@font}{"1D51C}
- \DeclareMathSymbol{\M@frak@Z}{\mathord}{\M@frak@font}{"2128}
- \DeclareMathSymbol{\M@frak@a}{\mathord}{\M@frak@font}{"1D51E}
- \DeclareMathSymbol{\M@frak@b}{\mathord}{\M@frak@font}{"1D51F}
- \DeclareMathSymbol{\M@frak@c}{\mathord}{\M@frak@font}{"1D520}
- \DeclareMathSymbol{\M@frak@d}{\mathord}{\M@frak@font}{"1D521}
- \DeclareMathSymbol{\M@frak@e}{\mathord}{\M@frak@font}{"1D522}
- \DeclareMathSymbol{\M@frak@f}{\mathord}{\M@frak@font}{"1D523}
- \DeclareMathSymbol{\M@frak@g}{\mathord}{\M@frak@font}{"1D524}
- \DeclareMathSymbol{\M@frak@h}{\mathord}{\M@frak@font}{"1D525}
- \DeclareMathSymbol{\M@frak@i}{\mathord}{\M@frak@font}{"1D526}
- \DeclareMathSymbol{\M@frak@j}{\mathord}{\M@frak@font}{"1D527}
- \DeclareMathSymbol{\M@frak@k}{\mathord}{\M@frak@font}{"1D528}
- \DeclareMathSymbol{\M@frak@l}{\mathord}{\M@frak@font}{"1D529}
- \DeclareMathSymbol{\M@frak@m}{\mathord}{\M@frak@font}{"1D52A}
- \DeclareMathSymbol{\M@frak@n}{\mathord}{\M@frak@font}{"1D52B}
- \DeclareMathSymbol{\M@frak@o}{\mathord}{\M@frak@font}{"1D52C}
- \DeclareMathSymbol{\M@frak@p}{\mathord}{\M@frak@font}{"1D52D}
- \DeclareMathSymbol{\M@frak@q}{\mathord}{\M@frak@font}{"1D52E}
- \DeclareMathSymbol{\M@frak@r}{\mathord}{\M@frak@font}{"1D52F}
- \DeclareMathSymbol{\M@frak@s}{\mathord}{\M@frak@font}{"1D530}
- \DeclareMathSymbol{\M@frak@t}{\mathord}{\M@frak@font}{"1D531}
- \DeclareMathSymbol{\M@frak@u}{\mathord}{\M@frak@font}{"1D532}
- \DeclareMathSymbol{\M@frak@v}{\mathord}{\M@frak@font}{"1D533}
- \DeclareMathSymbol{\M@frak@w}{\mathord}{\M@frak@font}{"1D534}
- \DeclareMathSymbol{\M@frak@x}{\mathord}{\M@frak@font}{"1D535}
- \DeclareMathSymbol{\M@frak@y}{\mathord}{\M@frak@font}{"1D536}
- \DeclareMathSymbol{\M@frak@z}{\mathord}{\M@frak@font}{"1D537}}
+ \protected\def\mathfrak##1{\relax
+ \ifmmode\else
+ \M@HModeError\mathfrak
+ $%
+ \fi
+ \begingroup
+ \M@frak@mathcodes
+ ##1%
+ \endgroup}
+ \edef\M@frak@num{\number\csname symM\M@frakshape\@tempa\endcsname}
+ \protected\edef\M@frak@mathcodes{%
+ \Umathcode`A=0+\M@frak@num"1D504\relax
+ \Umathcode`B=0+\M@frak@num"1D505\relax
+ \Umathcode`C=0+\M@frak@num"212D\relax
+ \Umathcode`D=0+\M@frak@num"1D507\relax
+ \Umathcode`E=0+\M@frak@num"1D508\relax
+ \Umathcode`F=0+\M@frak@num"1D509\relax
+ \Umathcode`G=0+\M@frak@num"1D50A\relax
+ \Umathcode`H=0+\M@frak@num"210C\relax
+ \Umathcode`I=0+\M@frak@num"2111\relax
+ \Umathcode`J=0+\M@frak@num"1D50D\relax
+ \Umathcode`K=0+\M@frak@num"1D50E\relax
+ \Umathcode`L=0+\M@frak@num"1D50F\relax
+ \Umathcode`M=0+\M@frak@num"1D510\relax
+ \Umathcode`N=0+\M@frak@num"1D511\relax
+ \Umathcode`O=0+\M@frak@num"1D512\relax
+ \Umathcode`P=0+\M@frak@num"1D513\relax
+ \Umathcode`Q=0+\M@frak@num"1D514\relax
+ \Umathcode`R=0+\M@frak@num"211C\relax
+ \Umathcode`S=0+\M@frak@num"1D516\relax
+ \Umathcode`T=0+\M@frak@num"1D517\relax
+ \Umathcode`U=0+\M@frak@num"1D518\relax
+ \Umathcode`V=0+\M@frak@num"1D519\relax
+ \Umathcode`W=0+\M@frak@num"1D51A\relax
+ \Umathcode`X=0+\M@frak@num"1D51B\relax
+ \Umathcode`Y=0+\M@frak@num"1D51C\relax
+ \Umathcode`Z=0+\M@frak@num"2128\relax
+ \Umathcode`a=0+\M@frak@num"1D51E\relax
+ \Umathcode`b=0+\M@frak@num"1D51F\relax
+ \Umathcode`c=0+\M@frak@num"1D520\relax
+ \Umathcode`d=0+\M@frak@num"1D521\relax
+ \Umathcode`e=0+\M@frak@num"1D522\relax
+ \Umathcode`f=0+\M@frak@num"1D523\relax
+ \Umathcode`g=0+\M@frak@num"1D524\relax
+ \Umathcode`h=0+\M@frak@num"1D525\relax
+ \Umathcode`i=0+\M@frak@num"1D526\relax
+ \Umathcode`j=0+\M@frak@num"1D527\relax
+ \Umathcode`k=0+\M@frak@num"1D528\relax
+ \Umathcode`l=0+\M@frak@num"1D529\relax
+ \Umathcode`m=0+\M@frak@num"1D52A\relax
+ \Umathcode`n=0+\M@frak@num"1D52B\relax
+ \Umathcode`o=0+\M@frak@num"1D52C\relax
+ \Umathcode`p=0+\M@frak@num"1D52D\relax
+ \Umathcode`q=0+\M@frak@num"1D52E\relax
+ \Umathcode`r=0+\M@frak@num"1D52F\relax
+ \Umathcode`s=0+\M@frak@num"1D530\relax
+ \Umathcode`t=0+\M@frak@num"1D531\relax
+ \Umathcode`u=0+\M@frak@num"1D532\relax
+ \Umathcode`v=0+\M@frak@num"1D533\relax
+ \Umathcode`w=0+\M@frak@num"1D534\relax
+ \Umathcode`x=0+\M@frak@num"1D535\relax
+ \Umathcode`y=0+\M@frak@num"1D536\relax
+ \Umathcode`z=0+\M@frak@num"1D537\relax}}
% \end{macrocode}
% Set bold caligraphic letters.\indexpage{keywordbcal=keyword \texttt{bcal}}
% \begin{macrocode}
\def\M@bcal@set{%
- \edef\M@bcal@font{M\M@bcalshape\@tempa}
- \DeclareMathSymbol{\M@bcal@A}{\mathord}{\M@bcal@font}{"1D4D0}
- \DeclareMathSymbol{\M@bcal@B}{\mathord}{\M@bcal@font}{"1D4D1}
- \DeclareMathSymbol{\M@bcal@C}{\mathord}{\M@bcal@font}{"1D4D2}
- \DeclareMathSymbol{\M@bcal@D}{\mathord}{\M@bcal@font}{"1D4D3}
- \DeclareMathSymbol{\M@bcal@E}{\mathord}{\M@bcal@font}{"1D4D4}
- \DeclareMathSymbol{\M@bcal@F}{\mathord}{\M@bcal@font}{"1D4D5}
- \DeclareMathSymbol{\M@bcal@G}{\mathord}{\M@bcal@font}{"1D4D6}
- \DeclareMathSymbol{\M@bcal@H}{\mathord}{\M@bcal@font}{"1D4D7}
- \DeclareMathSymbol{\M@bcal@I}{\mathord}{\M@bcal@font}{"1D4D8}
- \DeclareMathSymbol{\M@bcal@J}{\mathord}{\M@bcal@font}{"1D4D9}
- \DeclareMathSymbol{\M@bcal@K}{\mathord}{\M@bcal@font}{"1D4DA}
- \DeclareMathSymbol{\M@bcal@L}{\mathord}{\M@bcal@font}{"1D4DB}
- \DeclareMathSymbol{\M@bcal@M}{\mathord}{\M@bcal@font}{"1D4DC}
- \DeclareMathSymbol{\M@bcal@N}{\mathord}{\M@bcal@font}{"1D4DD}
- \DeclareMathSymbol{\M@bcal@O}{\mathord}{\M@bcal@font}{"1D4DE}
- \DeclareMathSymbol{\M@bcal@P}{\mathord}{\M@bcal@font}{"1D4DF}
- \DeclareMathSymbol{\M@bcal@Q}{\mathord}{\M@bcal@font}{"1D4E0}
- \DeclareMathSymbol{\M@bcal@R}{\mathord}{\M@bcal@font}{"1D4E1}
- \DeclareMathSymbol{\M@bcal@S}{\mathord}{\M@bcal@font}{"1D4E2}
- \DeclareMathSymbol{\M@bcal@T}{\mathord}{\M@bcal@font}{"1D4E3}
- \DeclareMathSymbol{\M@bcal@U}{\mathord}{\M@bcal@font}{"1D4E4}
- \DeclareMathSymbol{\M@bcal@V}{\mathord}{\M@bcal@font}{"1D4E5}
- \DeclareMathSymbol{\M@bcal@W}{\mathord}{\M@bcal@font}{"1D4E6}
- \DeclareMathSymbol{\M@bcal@X}{\mathord}{\M@bcal@font}{"1D4E7}
- \DeclareMathSymbol{\M@bcal@Y}{\mathord}{\M@bcal@font}{"1D4E8}
- \DeclareMathSymbol{\M@bcal@Z}{\mathord}{\M@bcal@font}{"1D4E9}
- \DeclareMathSymbol{\M@bcal@a}{\mathord}{\M@bcal@font}{"1D4EA}
- \DeclareMathSymbol{\M@bcal@b}{\mathord}{\M@bcal@font}{"1D4EB}
- \DeclareMathSymbol{\M@bcal@c}{\mathord}{\M@bcal@font}{"1D4EC}
- \DeclareMathSymbol{\M@bcal@d}{\mathord}{\M@bcal@font}{"1D4ED}
- \DeclareMathSymbol{\M@bcal@e}{\mathord}{\M@bcal@font}{"1D4EE}
- \DeclareMathSymbol{\M@bcal@f}{\mathord}{\M@bcal@font}{"1D4EF}
- \DeclareMathSymbol{\M@bcal@g}{\mathord}{\M@bcal@font}{"1D4F0}
- \DeclareMathSymbol{\M@bcal@h}{\mathord}{\M@bcal@font}{"1D4F1}
- \DeclareMathSymbol{\M@bcal@i}{\mathord}{\M@bcal@font}{"1D4F2}
- \DeclareMathSymbol{\M@bcal@j}{\mathord}{\M@bcal@font}{"1D4F3}
- \DeclareMathSymbol{\M@bcal@k}{\mathord}{\M@bcal@font}{"1D4F4}
- \DeclareMathSymbol{\M@bcal@l}{\mathord}{\M@bcal@font}{"1D4F5}
- \DeclareMathSymbol{\M@bcal@m}{\mathord}{\M@bcal@font}{"1D4F6}
- \DeclareMathSymbol{\M@bcal@n}{\mathord}{\M@bcal@font}{"1D4F7}
- \DeclareMathSymbol{\M@bcal@o}{\mathord}{\M@bcal@font}{"1D4F8}
- \DeclareMathSymbol{\M@bcal@p}{\mathord}{\M@bcal@font}{"1D4F9}
- \DeclareMathSymbol{\M@bcal@q}{\mathord}{\M@bcal@font}{"1D4FA}
- \DeclareMathSymbol{\M@bcal@r}{\mathord}{\M@bcal@font}{"1D4FB}
- \DeclareMathSymbol{\M@bcal@s}{\mathord}{\M@bcal@font}{"1D4FC}
- \DeclareMathSymbol{\M@bcal@t}{\mathord}{\M@bcal@font}{"1D4FD}
- \DeclareMathSymbol{\M@bcal@u}{\mathord}{\M@bcal@font}{"1D4FE}
- \DeclareMathSymbol{\M@bcal@v}{\mathord}{\M@bcal@font}{"1D4FF}
- \DeclareMathSymbol{\M@bcal@w}{\mathord}{\M@bcal@font}{"1D500}
- \DeclareMathSymbol{\M@bcal@x}{\mathord}{\M@bcal@font}{"1D501}
- \DeclareMathSymbol{\M@bcal@y}{\mathord}{\M@bcal@font}{"1D502}
- \DeclareMathSymbol{\M@bcal@z}{\mathord}{\M@bcal@font}{"1D503}}
+ \protected\def\mathbcal##1{\relax
+ \ifmmode\else
+ \M@HModeError\mathbcal
+ $%
+ \fi
+ \begingroup
+ \M@bcal@mathcodes
+ ##1%
+ \endgroup}
+ \edef\M@bcal@num{\number\csname symM\M@bcalshape\@tempa\endcsname}
+ \protected\edef\M@bcal@mathcodes{%
+ \Umathcode`A=0+\M@bcal@num"1D4D0\relax
+ \Umathcode`B=0+\M@bcal@num"1D4D1\relax
+ \Umathcode`C=0+\M@bcal@num"1D4D2\relax
+ \Umathcode`D=0+\M@bcal@num"1D4D3\relax
+ \Umathcode`E=0+\M@bcal@num"1D4D4\relax
+ \Umathcode`F=0+\M@bcal@num"1D4D5\relax
+ \Umathcode`G=0+\M@bcal@num"1D4D6\relax
+ \Umathcode`H=0+\M@bcal@num"1D4D7\relax
+ \Umathcode`I=0+\M@bcal@num"1D4D8\relax
+ \Umathcode`J=0+\M@bcal@num"1D4D9\relax
+ \Umathcode`K=0+\M@bcal@num"1D4DA\relax
+ \Umathcode`L=0+\M@bcal@num"1D4DB\relax
+ \Umathcode`M=0+\M@bcal@num"1D4DC\relax
+ \Umathcode`N=0+\M@bcal@num"1D4DD\relax
+ \Umathcode`O=0+\M@bcal@num"1D4DE\relax
+ \Umathcode`P=0+\M@bcal@num"1D4DF\relax
+ \Umathcode`Q=0+\M@bcal@num"1D4E0\relax
+ \Umathcode`R=0+\M@bcal@num"1D4E1\relax
+ \Umathcode`S=0+\M@bcal@num"1D4E2\relax
+ \Umathcode`T=0+\M@bcal@num"1D4E3\relax
+ \Umathcode`U=0+\M@bcal@num"1D4E4\relax
+ \Umathcode`V=0+\M@bcal@num"1D4E5\relax
+ \Umathcode`W=0+\M@bcal@num"1D4E6\relax
+ \Umathcode`X=0+\M@bcal@num"1D4E7\relax
+ \Umathcode`Y=0+\M@bcal@num"1D4E8\relax
+ \Umathcode`Z=0+\M@bcal@num"1D4E9\relax
+ \Umathcode`a=0+\M@bcal@num"1D4EA\relax
+ \Umathcode`b=0+\M@bcal@num"1D4EB\relax
+ \Umathcode`c=0+\M@bcal@num"1D4EC\relax
+ \Umathcode`d=0+\M@bcal@num"1D4ED\relax
+ \Umathcode`e=0+\M@bcal@num"1D4EE\relax
+ \Umathcode`f=0+\M@bcal@num"1D4EF\relax
+ \Umathcode`g=0+\M@bcal@num"1D4F0\relax
+ \Umathcode`h=0+\M@bcal@num"1D4F1\relax
+ \Umathcode`i=0+\M@bcal@num"1D4F2\relax
+ \Umathcode`j=0+\M@bcal@num"1D4F3\relax
+ \Umathcode`k=0+\M@bcal@num"1D4F4\relax
+ \Umathcode`l=0+\M@bcal@num"1D4F5\relax
+ \Umathcode`m=0+\M@bcal@num"1D4F6\relax
+ \Umathcode`n=0+\M@bcal@num"1D4F7\relax
+ \Umathcode`o=0+\M@bcal@num"1D4F8\relax
+ \Umathcode`p=0+\M@bcal@num"1D4F9\relax
+ \Umathcode`q=0+\M@bcal@num"1D4FA\relax
+ \Umathcode`r=0+\M@bcal@num"1D4FB\relax
+ \Umathcode`s=0+\M@bcal@num"1D4FC\relax
+ \Umathcode`t=0+\M@bcal@num"1D4FD\relax
+ \Umathcode`u=0+\M@bcal@num"1D4FE\relax
+ \Umathcode`v=0+\M@bcal@num"1D4FF\relax
+ \Umathcode`w=0+\M@bcal@num"1D500\relax
+ \Umathcode`x=0+\M@bcal@num"1D501\relax
+ \Umathcode`y=0+\M@bcal@num"1D502\relax
+ \Umathcode`z=0+\M@bcal@num"1D503\relax}}
% \end{macrocode}
% Set bold fraktur letters.\indexpage{keywordbfrak=keyword \texttt{bfrak}}
% \begin{macrocode}
\def\M@bfrak@set{%
- \edef\M@bfrak@font{M\M@bfrakshape\@tempa}
- \DeclareMathSymbol{\M@bfrak@A}{\mathord}{\M@bfrak@font}{"1D56C}
- \DeclareMathSymbol{\M@bfrak@B}{\mathord}{\M@bfrak@font}{"1D56D}
- \DeclareMathSymbol{\M@bfrak@C}{\mathord}{\M@bfrak@font}{"1D56E}
- \DeclareMathSymbol{\M@bfrak@D}{\mathord}{\M@bfrak@font}{"1D56F}
- \DeclareMathSymbol{\M@bfrak@E}{\mathord}{\M@bfrak@font}{"1D570}
- \DeclareMathSymbol{\M@bfrak@F}{\mathord}{\M@bfrak@font}{"1D571}
- \DeclareMathSymbol{\M@bfrak@G}{\mathord}{\M@bfrak@font}{"1D572}
- \DeclareMathSymbol{\M@bfrak@H}{\mathord}{\M@bfrak@font}{"1D573}
- \DeclareMathSymbol{\M@bfrak@I}{\mathord}{\M@bfrak@font}{"1D574}
- \DeclareMathSymbol{\M@bfrak@J}{\mathord}{\M@bfrak@font}{"1D575}
- \DeclareMathSymbol{\M@bfrak@K}{\mathord}{\M@bfrak@font}{"1D576}
- \DeclareMathSymbol{\M@bfrak@L}{\mathord}{\M@bfrak@font}{"1D577}
- \DeclareMathSymbol{\M@bfrak@M}{\mathord}{\M@bfrak@font}{"1D578}
- \DeclareMathSymbol{\M@bfrak@N}{\mathord}{\M@bfrak@font}{"1D579}
- \DeclareMathSymbol{\M@bfrak@O}{\mathord}{\M@bfrak@font}{"1D57A}
- \DeclareMathSymbol{\M@bfrak@P}{\mathord}{\M@bfrak@font}{"1D57B}
- \DeclareMathSymbol{\M@bfrak@Q}{\mathord}{\M@bfrak@font}{"1D57C}
- \DeclareMathSymbol{\M@bfrak@R}{\mathord}{\M@bfrak@font}{"1D57D}
- \DeclareMathSymbol{\M@bfrak@S}{\mathord}{\M@bfrak@font}{"1D57E}
- \DeclareMathSymbol{\M@bfrak@T}{\mathord}{\M@bfrak@font}{"1D57F}
- \DeclareMathSymbol{\M@bfrak@U}{\mathord}{\M@bfrak@font}{"1D580}
- \DeclareMathSymbol{\M@bfrak@V}{\mathord}{\M@bfrak@font}{"1D581}
- \DeclareMathSymbol{\M@bfrak@W}{\mathord}{\M@bfrak@font}{"1D582}
- \DeclareMathSymbol{\M@bfrak@X}{\mathord}{\M@bfrak@font}{"1D583}
- \DeclareMathSymbol{\M@bfrak@Y}{\mathord}{\M@bfrak@font}{"1D584}
- \DeclareMathSymbol{\M@bfrak@Z}{\mathord}{\M@bfrak@font}{"1D585}
- \DeclareMathSymbol{\M@bfrak@a}{\mathord}{\M@bfrak@font}{"1D586}
- \DeclareMathSymbol{\M@bfrak@b}{\mathord}{\M@bfrak@font}{"1D587}
- \DeclareMathSymbol{\M@bfrak@c}{\mathord}{\M@bfrak@font}{"1D588}
- \DeclareMathSymbol{\M@bfrak@d}{\mathord}{\M@bfrak@font}{"1D589}
- \DeclareMathSymbol{\M@bfrak@e}{\mathord}{\M@bfrak@font}{"1D58A}
- \DeclareMathSymbol{\M@bfrak@f}{\mathord}{\M@bfrak@font}{"1D58B}
- \DeclareMathSymbol{\M@bfrak@g}{\mathord}{\M@bfrak@font}{"1D58C}
- \DeclareMathSymbol{\M@bfrak@h}{\mathord}{\M@bfrak@font}{"1D58D}
- \DeclareMathSymbol{\M@bfrak@i}{\mathord}{\M@bfrak@font}{"1D58E}
- \DeclareMathSymbol{\M@bfrak@j}{\mathord}{\M@bfrak@font}{"1D58F}
- \DeclareMathSymbol{\M@bfrak@k}{\mathord}{\M@bfrak@font}{"1D590}
- \DeclareMathSymbol{\M@bfrak@l}{\mathord}{\M@bfrak@font}{"1D591}
- \DeclareMathSymbol{\M@bfrak@m}{\mathord}{\M@bfrak@font}{"1D592}
- \DeclareMathSymbol{\M@bfrak@n}{\mathord}{\M@bfrak@font}{"1D593}
- \DeclareMathSymbol{\M@bfrak@o}{\mathord}{\M@bfrak@font}{"1D594}
- \DeclareMathSymbol{\M@bfrak@p}{\mathord}{\M@bfrak@font}{"1D595}
- \DeclareMathSymbol{\M@bfrak@q}{\mathord}{\M@bfrak@font}{"1D596}
- \DeclareMathSymbol{\M@bfrak@r}{\mathord}{\M@bfrak@font}{"1D597}
- \DeclareMathSymbol{\M@bfrak@s}{\mathord}{\M@bfrak@font}{"1D598}
- \DeclareMathSymbol{\M@bfrak@t}{\mathord}{\M@bfrak@font}{"1D599}
- \DeclareMathSymbol{\M@bfrak@u}{\mathord}{\M@bfrak@font}{"1D59A}
- \DeclareMathSymbol{\M@bfrak@v}{\mathord}{\M@bfrak@font}{"1D59B}
- \DeclareMathSymbol{\M@bfrak@w}{\mathord}{\M@bfrak@font}{"1D59C}
- \DeclareMathSymbol{\M@bfrak@x}{\mathord}{\M@bfrak@font}{"1D59D}
- \DeclareMathSymbol{\M@bfrak@y}{\mathord}{\M@bfrak@font}{"1D59E}
- \DeclareMathSymbol{\M@bfrak@z}{\mathord}{\M@bfrak@font}{"1D59F}}
-% \end{macrocode}
+ \protected\def\mathbfrak##1{\relax
+ \ifmmode\else
+ \M@HModeError\mathbfrak
+ $%
+ \fi
+ \begingroup
+ \M@bfrak@mathcodes
+ ##1%
+ \endgroup}
+ \edef\M@bfrak@num{\number\csname symM\M@bfrakshape\@tempa\endcsname}
+ \protected\edef\M@bfrak@mathcodes{%
+ \Umathcode`A=0+\M@bfrak@num"1D56C\relax
+ \Umathcode`B=0+\M@bfrak@num"1D56D\relax
+ \Umathcode`C=0+\M@bfrak@num"1D56E\relax
+ \Umathcode`D=0+\M@bfrak@num"1D56F\relax
+ \Umathcode`E=0+\M@bfrak@num"1D570\relax
+ \Umathcode`F=0+\M@bfrak@num"1D571\relax
+ \Umathcode`G=0+\M@bfrak@num"1D572\relax
+ \Umathcode`H=0+\M@bfrak@num"1D573\relax
+ \Umathcode`I=0+\M@bfrak@num"1D574\relax
+ \Umathcode`J=0+\M@bfrak@num"1D575\relax
+ \Umathcode`K=0+\M@bfrak@num"1D576\relax
+ \Umathcode`L=0+\M@bfrak@num"1D577\relax
+ \Umathcode`M=0+\M@bfrak@num"1D578\relax
+ \Umathcode`N=0+\M@bfrak@num"1D579\relax
+ \Umathcode`O=0+\M@bfrak@num"1D57A\relax
+ \Umathcode`P=0+\M@bfrak@num"1D57B\relax
+ \Umathcode`Q=0+\M@bfrak@num"1D57C\relax
+ \Umathcode`R=0+\M@bfrak@num"1D57D\relax
+ \Umathcode`S=0+\M@bfrak@num"1D57E\relax
+ \Umathcode`T=0+\M@bfrak@num"1D57F\relax
+ \Umathcode`U=0+\M@bfrak@num"1D580\relax
+ \Umathcode`V=0+\M@bfrak@num"1D581\relax
+ \Umathcode`W=0+\M@bfrak@num"1D582\relax
+ \Umathcode`X=0+\M@bfrak@num"1D583\relax
+ \Umathcode`Y=0+\M@bfrak@num"1D584\relax
+ \Umathcode`Z=0+\M@bfrak@num"1D585\relax
+ \Umathcode`a=0+\M@bfrak@num"1D586\relax
+ \Umathcode`b=0+\M@bfrak@num"1D587\relax
+ \Umathcode`c=0+\M@bfrak@num"1D588\relax
+ \Umathcode`d=0+\M@bfrak@num"1D589\relax
+ \Umathcode`e=0+\M@bfrak@num"1D58A\relax
+ \Umathcode`f=0+\M@bfrak@num"1D58B\relax
+ \Umathcode`g=0+\M@bfrak@num"1D58C\relax
+ \Umathcode`h=0+\M@bfrak@num"1D58D\relax
+ \Umathcode`i=0+\M@bfrak@num"1D58E\relax
+ \Umathcode`j=0+\M@bfrak@num"1D58F\relax
+ \Umathcode`k=0+\M@bfrak@num"1D590\relax
+ \Umathcode`l=0+\M@bfrak@num"1D591\relax
+ \Umathcode`m=0+\M@bfrak@num"1D592\relax
+ \Umathcode`n=0+\M@bfrak@num"1D593\relax
+ \Umathcode`o=0+\M@bfrak@num"1D594\relax
+ \Umathcode`p=0+\M@bfrak@num"1D595\relax
+ \Umathcode`q=0+\M@bfrak@num"1D596\relax
+ \Umathcode`r=0+\M@bfrak@num"1D597\relax
+ \Umathcode`s=0+\M@bfrak@num"1D598\relax
+ \Umathcode`t=0+\M@bfrak@num"1D599\relax
+ \Umathcode`u=0+\M@bfrak@num"1D59A\relax
+ \Umathcode`v=0+\M@bfrak@num"1D59B\relax
+ \Umathcode`w=0+\M@bfrak@num"1D59C\relax
+ \Umathcode`x=0+\M@bfrak@num"1D59D\relax
+ \Umathcode`y=0+\M@bfrak@num"1D59E\relax
+ \Umathcode`z=0+\M@bfrak@num"1D59F\relax}}
+% \end{macrocode}
+% And that's everything!
%
% \vfill\eject
%
@@ -4728,7 +4631,7 @@ mathfont:add_extensible_variants(smash, int_glyphs, int_scale)
% \advance\dimen@ by -2\fboxrule
% \advance\dimen@ by -2\fboxsep
% \fbox{\vbox{\hsize\dimen@
-% \textbf{Big Change:} Font adjustments for Lua\TeX: new glyph boundaries for Latin letters in math mode, resizable delimiters, actual big operators, MathConstants table based on font metrics}}
+% \strut\textbf{Big Change:} Font adjustments for Lua\TeX: new glyph boundaries for Latin letters in math mode, resizable delimiters, actual big operators, MathConstants table based on font metrics.\vphantom{y}}}
% \par\smallskip}
% \item added |\CharmLine| and |\CharmFile|
% \item added |\mathconstantsfont|
@@ -4755,6 +4658,11 @@ mathfont:add_extensible_variants(smash, int_glyphs, int_scale)
% \item |\setfont| now sets |\mathrm|, etc.
% \item added |\newmathsc|, other math alphabet commands for small caps
%
+% \version{2.1}{December 2022\strut}
+% \item |\mathbb|, etc.\ commands change |\Umathcode|s of letters instead of |\M@|\meta{bb,etc.}|@|\meta{letter} commands
+% \item removed warnings about non-letter contents of |\mathbb|, etc.
+% \item fonts loaded twice, once with default settings (for text) and once in base mode (for math)
+% \item |mathconstantsfont| accepts ``upright'' or ``italic'' as optional argument
%
% \egroup
% \end{multicols*}
@@ -4855,7 +4763,7 @@ and \textsf{mathfont} sets the default font face for every character in those ke
\begin{code}
|\mathfont[lower=upright, upper=upright]{Times New Roman}|
\end{code}
-changes all Latin letters to upright Times New Roman. Know that once \textsf{mathfont} has set the default font for a keyword in Table~1, it will ignore any future instructions to do so and prints a warning to the terminal instead.
+changes all Latin letters to upright Times New Roman. Once \textsf{mathfont} has set the default font for a keyword in Table~1, it will ignore any future instructions to do so and prints a warning to the terminal instead.
\begin{figure}[t]
@@ -4876,14 +4784,14 @@ Command & Series & Shape\\\midrule
\end{figure}
-If you want to change the font for your entire document at once, you should use |\setfont| instead of |\mathfont|. This command accepts a single mandatory argument:
+If you want to change the font for both text and math, you should use |\setfont| instead of |\mathfont|. This command accepts a single mandatory argument:
\begin{code}
|\setfont{|\meta{font name}|}|.
\end{code}
It calls |\mathfont| without an optional argument---i.e.\ for the default keywords---on your \meta{font name} and sets your document's default text font to be the \meta{font name}. The command also defines the eight commands in Table~\ref{SetFont} using the \meta{font name} and the |\new| macros in the next section. Both |\mathfont| and |\setfont| should appear in the preamble only.
-To select OpenType features, you should put a colon after the font name and follow it with appropriate OpenType tags. For example adding ``|onum=true|'' tells \TeX\ to load your font with oldstyle numbering, assuming that feature is present in the font.\footnote{By default, \textsf{mathfont} enables standard ligatures, traditional \TeX\ ligatures, and lining numbers. The package sets |smcp| to |true| or |false| depending on whether it is attempting to load a small-caps font. For the full list of OpenType features, see \link{https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist}.} Whenever you declare any font setting, such as calling |\mathfont|, the package uses its own fontloader unless you have loaded \textsf{fontspec}. In that case, \textsf{mathfont} feeds your argument directly to \textsf{fontspec}, and if you previously set any font with \textsf{fontspec}, you can say |\mathfont{fontspec}| to call |\mathfont| with the most recent font used by \textsf{fontspec}. I don't recommend using \textsf{fontspec} indirectly like this unless you know what you're doing because Lua\TeX's default font-loading settings are optimized for text fonts, and you may not see any OpenType font features in math mode as a result.\footnote{The default \textsf{luaotfload} (and \textsf{fontspec}) setting is |mode=node|, but \textsf{mathfont} uses |mode=base|. The |node| setting allows users to enable more OpenType font features in text but prevents any OpenType features from showing up in math mode. On the other hand, |base| supports fewer OpenType features but enables them in math mode. This point may seem technical, but it can be very relevant. For example, Cormorant, used in one of the \textsf{mathfont} example pdf files, uses oldstyle numbers by default but includes lining numbers as a separate OpenType feature. (Oldstyle numbers can work well in text, but lining numbers are a much better default for math.) Loading Cormorant with |mode=node| means that the numbers in math mode will be oldstyle, even if you say |lnum=true|, so |base| mode is necessary here. Like I said, fonts are complicated.}
+To select OpenType features, you should put a colon after the font name and follow it with appropriate OpenType tags. For example adding ``|onum=true|'' tells \TeX\ to load your font with oldstyle numbering, assuming that feature is present in the font.\footnote{By default, \textsf{mathfont} enables standard ligatures, traditional \TeX\ ligatures, and lining numbers. The package sets |smcp| to |true| or |false| depending on whether it is attempting to load a small-caps font. For the full list of OpenType features, see \link{https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist}.} Whenever you select a font, \textsf{mathfont} first checks whether you previously loaded \textsf{fontspec}, and if so, the package feeds your entire \meta{font name} argument to \textsf{fontspec}. (You can also say ``|fontspec|'' as the \meta{font name} to select the most recent font used by \textsf{fontspec}.) If you have not loaded \textsf{fontspec}, the package uses its own fontloader. I recommend letting \textsf{mathfont} handle font-loading because when using Lua\TeX, \textsf{mathfont} takes care to load fonts in such a way that full OpenType features are accessible in text and limited OpenType features are accessible in math. While it is also possible to do this in \textsf{fontspec}, it takes some doing.\footnote{The \textsf{luaotfload} package supports two main modes for loading fonts: |node| mode is the default setting, and it supports full OpenType features in text but no OpenType features in math. The |base| mode supports limited OpenType features, but the features will work for both text and math. When \textsf{mathfont} loads a font, it does so twice, once in |node| mode, which is primarily for setting the text font with \vrb\setfont, and once in |base| mode, which is for the package's other font declarations. This way you will be able to use OpenType features throughout your document.}
The last five keywords in Table~\ref{Keywords} are a bit different. If you call |\mathfont| on a \meta{keyword} from the last five rows in Table~\ref{Keywords}, the package defines the macro
@@ -4894,7 +4802,7 @@ to typeset them. For example,
\begin{code}
|\mathfont[bb]{STIXGeneral}|
\end{code}
-sets STIXGeneral as the font for bold calligraphic characters and defines |\mathbb| to access them. The argument of |\mathbb| should contain only digits and Latin letters, and for the other four keywords, the argument of |\math|\meta{keyword} should contain only Latin letters. \TeX\ will ignore and issue a warning in response to any other characters in the argument of these macros.
+sets STIXGeneral as the font for bold calligraphic characters and defines |\mathbb| to access them. These are not for use with any double-struck, caligraphic, or fraktur font. Rather, they access Unicode's math alphanumeric symbols block. If you want to use a font where the regular letters appear double-struck, caligraphic, or fraktur, consider the font-changing control sequences in the next section.
\section{Local Font Changes}
@@ -4933,12 +4841,22 @@ Together these eight commands will provide users with tools for most local font
\begin{code}
|\newmathfontcommand{|\meta{control sequence}|}{|\meta{font name}|}{|\meta{series}|}{|\meta{shape}|}|,
\end{code}
-where the \meta{control sequence} in the first argument again becomes the macro that changes characters to the \meta{font name}. You are welcome to use a system font name with |\newmathfontcommand|, but the intention behind this command is that you can use an \textsc{nfss} family name for the \meta{font name}. The series and shape values will then correspond to more obscure font faces from the \textsc{nfss} family that you would be otherwise unable to access. The commands from Table~\ref{MathAlpha} as well as |\newmathfontcommand| should appear in the preamble only.
+where the \meta{control sequence} in the first argument again becomes the macro that changes characters to the \meta{font name}. You are welcome to use a system font name with |\newmathfontcommand|, but the intention behind this command is that you can use an \textsc{nfss} family name for the \meta{font name}. Then the series and shape values can correspond to more obscure font faces from the \textsc{nfss} family that you would be otherwise unable to access. The commands from Table~\ref{MathAlpha} as well as |\newmathfontcommand| should appear in the preamble only.
+
+
+\section{Default Math Parameters}
+
+Lua\TeX\ uses the MathConstants table from the most recent font assigned for use in math mode, and this means that in a document with multiple math fonts, the choice of MathConstants table can depend on the order of font declaration and be unpredictable. To avoid potential problems from using the wrong MathConstants table, \textsf{mathfont} provides the command
+\begin{code}
+|\mathconstantsfont[|\meta{shape}|]{|\meta{prev arg}|}|,
+\end{code}
+where \meta{shape} is an optional argument that can be ``|upright|'' (default) or ``|italic|,'' and \meta{prev arg} should be any argument that you have previously fed to |\mathfont|. When you call |\mathconstantsfont|, \textsf{mathfont} forces Lua\TeX\ to always use the MathConstants table from the font that corresponded to that instance of |\mathfont| in the specified \meta{shape}. You don't need to set the MathConstants table when you use |\setfont| because the package calls |\mathconstantsfont| automatically when you use |\setfont|. This command will not work in \XeTeX\ and should appear only in the preamble.
+
\section{Lua Font Adjustments}
-\begin{figure}[b]
+\begin{figure}[t]
\labelfig{Charm}
\centerline{\bfseries Table \the\fig: Number of Integers Required in \vrb\CharmLine\strut}
\global\advance\fig by 1\relax
@@ -4959,14 +4877,7 @@ The \textsf{mathfont} package provides six user-level commands to change positio
\end{itemize}
Writing an asterisk tells \textsf{mathfont} to use whatever value it has saved in memory, either the default value or the value from the most recent call to |\CharmLine| or |\CharmFile|. If you specify too few charm values, \textsf{mathfont} will raise an error, but if you provide too many, \textsf{mathfont} will silently ignore the extras.
-For most applications, you can probably ignore charm information altogether, but if you find bounding boxes or accent placement to be off slightly or if you want to change the scaling for a delimiter or big operator, you should try calling |\CharmLine| with different values to see what works. As is typical with decimal inputs in \TeX, \textsf{mathfont} divides your inputs by 1000 before computing with them. Positive integers mean ``increase,'' and negative integers mean ``decrease.'' For a given character, the scale is usually the glyph width. For example,
-\begin{code}
-|\CharmLine{97, 200, -200, *, 50}|
-\end{code}
-tells \textsf{mathfont} to take the lower-case ``a'' (unicode encoding value of 97), increase the bounding box on the left side by 20\% of the glyph width, decrease the bounding box on the right side by 20\% of the glyph width, do nothing to the top accent, and shift the bottom accent right by 5\% of the glyph width. There is no general formula for what charm values to use for a given font! Rather, you will need to make a design choice based on what looks best, and if you regularly use a particular font, consider making a custom set of charm values uploading it to \textsc{ctan}. Additionally, if you store your charm information in a file, you can read it in with |\CharmFile|. The argument of this command should be a file name, and \textsf{mathfont} reads the file and feeds each line individually to |\CharmLine|.
-
-
-\begin{figure}[tb]
+\begin{figure}[b]
\labelfig{Factors}
\centerline{\bfseries Table \the\fig: Commands to Adjust Individual Characters\strut}
\global\advance\fig by 1\relax
@@ -4980,6 +4891,13 @@ Command & Default Value & What It Does\\\midrule
\end{figure}
+For most applications, you can probably ignore charm information altogether, but if you find bounding boxes or accent placement to be off slightly or if you want to change the scaling for a delimiter or big operator, you should try calling |\CharmLine| with different values to see what works. As is typical with decimal inputs in \TeX, \textsf{mathfont} divides your inputs by 1000 before computing with them. Positive integers mean ``increase,'' and negative integers mean ``decrease.'' For a given character, the scale is usually the glyph width. For example,
+\begin{code}
+|\CharmLine{97, 200, -200, *, 50}|
+\end{code}
+tells \textsf{mathfont} to take the lower-case ``a'' (unicode encoding value of 97), increase the bounding box on the left side by 20\% of the glyph width, decrease the bounding box on the right side by 20\% of the glyph width, do nothing to the top accent, and shift the bottom accent right by 5\% of the glyph width. There is no general formula for what charm values to use for a given font! Rather, you will need to make a design choice based on what looks best, and if you regularly use a particular font, consider making a custom set of charm values uploading it to \textsc{ctan}. Additionally, if you store your charm information in a file, you can read it in with |\CharmFile|. The argument of this command should be a file name, and \textsf{mathfont} reads the file and feeds each line individually to |\CharmLine|.
+
+
The commands in Table~\ref{Factors} adjust other aspects of the font as indicated. Each command accepts a single integer as an argument, and \textsf{mathfont} once again divides the input by 1000. With each of these macros, \textsf{mathfont} multiplies the quotient by some default length, so values greater than or less than 1000 mean ``scale up'' or ``scale down'' respectively. For example,
\begin{code}
|\RuleThicknessFactor{2000}|
@@ -5005,15 +4923,6 @@ Callback Name & What It Does By Default\\\midrule
Finally, advanced users who want to interact with the font adjustment process directly should use the six callbacks in Table~\ref{Callbacks}. When Lua\TeX\ loads a font, \textsf{mathfont} (1) always calls |mathfont.inspect_font| and (2) calls the other five callbacks in the order that they appear in Table~\ref{Callbacks} if the font object contains |nomath=true|. Functions added to these callbacks should accept a font object as a single argument and return nothing. Further, please be careful when loading functions in the |disable_nomath|, |add_math_constants|, and |fix_character_metrics| callbacks. If you add a function there, Lua\TeX\ will not carry out the default behvaior associated with the callback, so do not mess with these three callbacks unless you are duplicating the default behavior of the callback or you really know what you're doing. Otherwise, you risk breaking the package. See |mathfont_code.pdf| for more information.
-\section{Default Math Parameters}
-
-Lua\TeX\ uses the MathConstants table from the most recent font assigned for use in math mode, and this means that in a document with multiple math fonts, the choice of MathConstants table can depend on the order of font declaration and be unpredictable. To avoid potential problems from using the wrong MathConstants table, \textsf{mathfont} provides the command
-\begin{code}
-|\mathconstantsfont{|\meta{prev arg}|}|,
-\end{code}
-where \meta{prev arg} should be any argument that you have previously fed to |\mathfont|. When you call |\mathconstantsfont|, \textsf{mathfont} forces Lua\TeX\ to always use the MathConstants table from the font that corresponded to that instance of |\mathfont|. You don't need to worry about MathConstants when you use |\setfont| because the package calls |\mathconstantsfont| automatically when you use |\setfont|. This command should appear in the preamble only.
-
-
\end{document}
%</user>
@@ -5028,7 +4937,7 @@ where \meta{prev arg} should be any argument that you have previously fed to |\m
\usepackage{mathfont}
\mathfont[agreeklower=upright,agreekupper]{Crimson}
\mathfont[hebrew]{Coelacanth}
-\mathfont[\M@normalkeys,\M@letterlikekeys]{STIXGeneral}
+\mathfont[\M@keys]{STIXGeneral}
\usepackage{shortvrb,doc}
\MakeShortVerb{|}
\raggedcolumns
@@ -5956,9 +5865,9 @@ t'=\left(t-\frac{vx}{c^2}\right)\frac1{\sqrt{1-\frac{v^2}{c^2}}}
\usepackage{mathfont}
\DeclareFontFamily{TU}{Cormorant}{}
\DeclareFontShape{TU}{Cormorant}{m}{n}
- {<->"Cormorant Medium:\M@default@otf@features;-liga"}{}
+ {<->"Cormorant Medium:\M@otf@features;-liga"}{}
\DeclareFontShape{TU}{Cormorant}{m}{it}
- {<->"Cormorant Medium Italic:\M@default@otf@features"}{}
+ {<->"Cormorant Medium Italic:\M@otf@features"}{}
\mathfont[greeklower=upright,greekupper]{Crimson}
\mathfont[diacritics]{Bona Nova}
\setfont{Cormorant}
@@ -5976,7 +5885,7 @@ t'=\left(t-\frac{vx}{c^2}\right)\frac1{\sqrt{1-\frac{v^2}{c^2}}}
\input mathfont_heading.tex
-This is Cormorant with Crimson for Greek characters and Bona Nova for diacritics. Testing. Testing. Brown foxes quickly jump over dazzling does and harts. This document shows an example of mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
+This is Cormorant with Crimson for Greek characters and Bona Nova for diacritics. ``Testing. Testing.'' Brown foxes quickly jump over dazzling does and harts. This document shows an example of mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
\input{mathfont_equations.tex}
@@ -6007,7 +5916,7 @@ This is Cormorant with Crimson for Greek characters and Bona Nova for diacritics
\input mathfont_heading.tex
-This is Kelvinch with Crimson for the radical signs. Testing. Testing. Brown foxes quickly jump over dazzling does and harts. This document shows an example of mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
+This is Kelvinch with Crimson for the radical signs. ``Testing. Testing.'' Brown foxes quickly jump over dazzling does and harts. This document shows an example of mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
\input{mathfont_equations.tex}
@@ -6041,7 +5950,7 @@ This is Kelvinch with Crimson for the radical signs. Testing. Testing. Brown fox
\input mathfont_heading.tex
-This is Roboto with Overpass for the radical signs and STIXGeneral for the tensor product. Testing. Testing. Brown foxes quickly jump over dazzling does and harts. This document shows an example of mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
+This is Roboto with Overpass for the radical signs and STIXGeneral for the tensor product. ``Testing. Testing.'' Brown foxes quickly jump over dazzling does and harts. This document shows an example of mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
\input{mathfont_equations.tex}
@@ -6060,13 +5969,13 @@ This is Roboto with Overpass for the radical signs and STIXGeneral for the tenso
\mathfont[radical]{Crimson}
\DeclareFontFamily{TU}{Typey}{}
\DeclareFontShape{TU}{Typey}{m}{n}
- {<->"Typey McTypeface:\M@default@otf@features"}{}
+ {<->"Typey McTypeface:\M@otf@features"}{}
\DeclareFontShape{TU}{Typey}{m}{it}
- {<->"Typey McTypeface/I:\M@default@otf@features"}{}
+ {<->"Typey McTypeface/I:\M@otf@features"}{}
\DeclareFontShape{TU}{Typey}{b}{n}
- {<->"Typey McTypeface:\M@default@otf@features;embolden=6"}{}
+ {<->"Typey McTypeface:\M@otf@features;embolden=6"}{}
\DeclareFontShape{TU}{Typey}{b}{it}
- {<->"Typey McTypeface/I:\M@default@otf@features;embolden=6"}{}
+ {<->"Typey McTypeface/I:\M@otf@features;embolden=6"}{}
\setfont{Typey}
\mathfont[]{STIXGeneral}
\DeclareSymbolFont{Mroman2}{TU}{STIXGeneral}{m}{n}
@@ -6084,7 +5993,7 @@ This is Roboto with Overpass for the radical signs and STIXGeneral for the tenso
\input mathfont_heading.tex
-This is Typey McTypeface with Crimson for the radical signs and STIXGeneral for the tensor product. Testing. Testing. Brown foxes quickly jump over dazzling does and harts. This document shows mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
+This is Typey McTypeface with Crimson for the radical signs and STIXGeneral for the tensor product. ``Testing. Testing.'' Brown foxes quickly jump over dazzling does and harts. This document shows mathfont in action. Unfortunately, there are many more equations in the world than I have space for here. Nevertheless, I hope I hit some of the highlights. Happy \TeX ing!
\let\bullet\cdot
\input{mathfont_equations.tex}
@@ -6094,8 +6003,8 @@ This is Typey McTypeface with Crimson for the radical signs and STIXGeneral for
%<*heading>
% package date and edition
-\def\packagedate{December 2021}
-\def\packageversion{2.0}
+\def\packagedate{November 2022}
+\def\packageversion{2.1}
% header and footer commands
diff --git a/macros/latex/contrib/mathfont/mathfont_code.pdf b/macros/latex/contrib/mathfont/mathfont_code.pdf
index 2872bf268f..bc13cf288a 100644
--- a/macros/latex/contrib/mathfont/mathfont_code.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_code.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/mathfont_example_cormorant.pdf b/macros/latex/contrib/mathfont/mathfont_example_cormorant.pdf
index 5c86d9e601..fd96765a92 100644
--- a/macros/latex/contrib/mathfont/mathfont_example_cormorant.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_example_cormorant.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/mathfont_example_kelvinch.pdf b/macros/latex/contrib/mathfont/mathfont_example_kelvinch.pdf
index 43e7a1009f..971da39b76 100644
--- a/macros/latex/contrib/mathfont/mathfont_example_kelvinch.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_example_kelvinch.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/mathfont_example_roboto.pdf b/macros/latex/contrib/mathfont/mathfont_example_roboto.pdf
index 66ec5982b5..80c4022a38 100644
--- a/macros/latex/contrib/mathfont/mathfont_example_roboto.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_example_roboto.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/mathfont_example_typey.pdf b/macros/latex/contrib/mathfont/mathfont_example_typey.pdf
index 364d67688a..efc1846e4e 100644
--- a/macros/latex/contrib/mathfont/mathfont_example_typey.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_example_typey.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/mathfont_symbol_list.pdf b/macros/latex/contrib/mathfont/mathfont_symbol_list.pdf
index e870ea3f89..53981a25a3 100644
--- a/macros/latex/contrib/mathfont/mathfont_symbol_list.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_symbol_list.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfont/mathfont_user_guide.pdf b/macros/latex/contrib/mathfont/mathfont_user_guide.pdf
index 9327d64bc2..1a94d2b93f 100644
--- a/macros/latex/contrib/mathfont/mathfont_user_guide.pdf
+++ b/macros/latex/contrib/mathfont/mathfont_user_guide.pdf
Binary files differ
diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf
index d3d0cb3baa..8c656653b0 100644
--- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf
+++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex
index c4bc9a4016..a084d8c5e0 100644
--- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex
+++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex
@@ -62,8 +62,8 @@
\setlength{\parindent}{0pt}
\definecolor{LightGray}{gray}{0.9}
-\def\PLversion{2.0.5}
-\def\PLdate{20 Novembre 2022}
+\def\PLversion{2.0.6}
+\def\PLdate{30 Novembre 2022}
\tcbset{vignettes/.style={%
nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,%
@@ -2271,6 +2271,58 @@ Le \textsf{cartouche} peut être \og cliquable \fg{} grâce à \ctex{href}.
\newpage
+\section{Présentation de code \LaTeX}\label{prescode}
+
+\subsection{Introduction}
+
+\begin{codeidee}
+\cmaj{2.0.6} L'idée est de proposer un environnement pour présenter du code \LaTeX. Ce n'est pas forcément lié à l'enseignement en Lycée mais pourquoi pas !
+
+\smallskip
+
+Il s'agir d'un environnement créé en \ctex{tcolorbox}, et utilisant la présentation \textit{basique} de code via \ctex{listings}.
+\end{codeidee}
+
+\subsection{Commandes}
+
+\begin{codetex}[listing only]
+\begin{PresentationCode}[<Couleur>]{<options tcbox>}
+...
+\end{PresentationCode}
+\end{codetex}
+
+\begin{codecles}
+Peu de personnalisations pour ces commandes :
+
+\begin{itemize}
+ \item le premier argument, optionnel, permet de préciser la \textit{couleur} de la présentation ;\hfill{}défaut \Cle{ForestGreen}
+ \item le second, mandataire, correspond aux éventuelles options liées à la \ctex{tcolorbox}.
+\end{itemize}
+\end{codecles}
+
+\begin{codeinfo}
+Il est à noter que, même dans le cas d'option vide pour la \ctex{tcolorbox}, les \ctex{\{\}} sont nécessaires.
+
+\smallskip
+
+On peut par exemple utiliser l'option \Cle{listing only} pour ne présenter \textit{que} le code source.
+\end{codeinfo}
+
+\begin{codetex}[]
+\begin{PresentationCode}{}
+\xdef\ValAleaA{\fpeval{randint(1,100)}}
+\xdef\ValAleaB{\fpeval{randint(1,100)}}
+
+Avec $A=\ValAleaA$ et $B=\ValAleaB$, on a $A\times B=\inteval{\ValAleaA * \ValAleaB}$
+\end{PresentationCode}
+
+\begin{PresentationCode}[DarkBlue]{}
+On peut faire beaucoup de choses avec \LaTeX{} !
+\end{PresentationCode}
+\end{codetex}
+
+\pagebreak
+
\part{Outils pour la géométrie}
\section{Pavé droit \og simple \fg}\label{pave}
@@ -5417,6 +5469,10 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0
\part{Historique}
+{\small \bverb|v 2.0.6|~:~~~~Changement de taille de la police des codes Python (page \pageref{pythonsimple})
+
+{\small \bverb| |~:~~~~Ajout d'un environnement pour présenter du code \LaTeX{} (page \pageref{prescode})
+
{\small \bverb|v 2.0.5|~:~~~~Correction d'un bug avec les calculs de suites récurrentes (page \pageref{calcrecurr})
{\small \bverb|v 2.0.4|~:~~~~Ajout d'une commande pour une présentation de solution par TVI (page \pageref{solutiontvi})
diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty
index 8802424614..fbd1a83b54 100644
--- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty
+++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty
@@ -3,7 +3,8 @@
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ProfLycee}[2022/11/20 2.0.5 Aide pour l'utilisation de LaTeX en lycee]
+\ProvidesPackage{ProfLycee}[2022/11/30 2.0.6 Aide pour l'utilisation de LaTeX en lycee]
+% 2.0.6 Quelques modifications sur les codes python (taille police et marges)...
% 2.0.5 Correction d'un bug avec les calculs en valeurx exactes avec les suites récurrentes...
% 2.0.4 Ajout d'une commande pour présenter un balayage (TVI) + calculs suites récurrentes
% 2.0.3Correction d'un bug avec les arbres 3x3
@@ -61,10 +62,11 @@
\ProcessOptions\relax
%------Packages utiles
+\RequirePackage{mathtools}
+%\RequirePackage{amssymb}
\RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs
\RequirePackage{tikz}
\RequirePackage{tkz-tab}
-\RequirePackage{mathtools}
\RequirePackage{pgf,pgffor}
\RequirePackage{ifthen}
\RequirePackage{xparse}
@@ -85,7 +87,7 @@
reset-text-series = false, reset-text-shape = false,%
text-family-to-math = true, text-series-to-math = true,%
output-decimal-marker={,},%
- group-minimum-digits=4%
+% group-minimum-digits=4%
}%
\RequirePackage{fontawesome5}
\if@csvii
@@ -138,7 +140,7 @@
fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,%
listing options={%
style=tcblatex,basicstyle=\footnotesize\ttfamily,%
- keywordstyle=\bfseries\color{Blue},tabsize=4,%
+ keywordstyle=\bfseries\color{Blue},tabsize=2,%
},%
#2
}
@@ -472,14 +474,14 @@
\tcbset{pytmintedno/.style={%
listing engine=minted,minted style=colorful,
minted language=python,listing only,
- minted options={tabsize=4,fontsize=\small,autogobble},
+ minted options={tabsize=4,fontsize=\footnotesize,autogobble},
}
}
\tcbset{pytminted/.style={%
listing engine=minted,minted style=colorful,
minted language=python,listing only,
- minted options={tabsize=4,fontsize=\small,autogobble,xleftmargin=16pt,linenos,numbersep=10pt},
+ minted options={tabsize=4,fontsize=\footnotesize,autogobble,xleftmargin=16pt,linenos,numbersep=10pt},
}
}
@@ -521,8 +523,8 @@
commentstyle = \color{gray}\itshape,
stringstyle = \color{red!75},
numberstyle = \scriptsize\ttfamily\color{Green},
- aboveskip = 4pt,
- belowskip = 1pt,
+ aboveskip = 0pt,
+ belowskip = 0pt,
tabsize = 4,
showstringspaces = false,
columns = fullflexible,
@@ -545,8 +547,8 @@
commentstyle = \color{gray}\itshape,
stringstyle = \color{red!75},
numberstyle = \scriptsize\ttfamily\color{Green},
- aboveskip = 4pt,
- belowskip = 1pt,
+ aboveskip = 0pt,
+ belowskip = 0pt,
tabsize = 4,
showstringspaces = false,
columns = fullflexible,
@@ -621,7 +623,7 @@
\ifboolKV[envpiton]{Lignes}%si lignes=true
{\PitonOptions{left-margin=auto,line-numbers}}%
{\PitonOptions{}}%
- \begin{tcolorbox}[stylepythontex,leftupper=8pt,colframe=Green,colback=ForestGreen!5,width=\CODPITlargeur,fontlower=\small,\CODPITalign]
+ \begin{tcolorbox}[stylepythontex,leftupper=8pt,colframe=Green,colback=ForestGreen!5,width=\CODPITlargeur,fontupper=\footnotesize,fontlower=\footnotesize,\CODPITalign]
}%
{%
\end{tcolorbox}%
@@ -1178,6 +1180,7 @@
\draw ({-0.707*\PLcerclerayon},0) node[above=2pt,PLval] {$-\tfrac{\sqrt{2}}{2}$} ;
\draw (0,{0.707*\PLcerclerayon}) node[right=2pt,PLval] {$\tfrac{\sqrt{2}}{2}$} ;
\draw (0,{-0.707*\PLcerclerayon}) node[right=2pt,PLval] {$-\tfrac{\sqrt{2}}{2}$} ;
+ %\draw[\PLcerclethick] (0,0) circle[radius=\PLcerclerayon] ; %on retrace par dessus ?
}%
{}
%valeurs remarquables en dernier
diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md
index c431f70b1e..d3e4b75425 100644
--- a/macros/latex/required/babel/base/README.md
+++ b/macros/latex/required/babel/base/README.md
@@ -1,4 +1,4 @@
-## Babel 3.82
+## Babel 3.83
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -8,9 +8,9 @@ is a set of ini files for about 250 languages.
The latest stable version is available on <https://ctan.org/pkg/babel>.
-Changes in version 3.82 are described in:
+Changes in version 3.83 are described in:
-https://latex3.github.io/babel/news/whats-new-in-babel-3.82.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.83.html
Apart from the manual, you can find information on some aspects of babel at:
@@ -46,17 +46,17 @@ respective authors.
### Summary of latest changes
```
-3.82 2022-10-23
- * Predefined transforms can be activated after the first
- \babelprovide (lua).
- * Tibetan for XeTeX.
- * More updates to the CLDR 41: Albanian, Kinyarwanda, Maltese,
- Odia, Ossetic, Pashto, Polish, Portuguese, Punjabi, Romanian,
- Romansh, Russian, Sakha, Sinhala, Slovak, Slovenian, Somali.
+3.83 2022-11-30
+ * Improved Punjabi, thanks to Arvinder Singh (@punjab).
+ * Compatibility with 'lscape', thanks to Salim Bou (@seloumi).
+ * New locale files: Kaingang, Nheengatu, Sardinian.
+ * Better handling of `leqno` with `amsmath`.
* Fixes:
- - \MakeXXXcase: a (hopefully) better hack for #189 (see
- also #193).
- - Thai (with xetex): #182 wasn’t quite fixed.
+ - Wrong date format for Australian in babel-en-AU.ini (#195)
+ - Option handling was broken with braces (#198)
+ - Stray punctuation with tikz lead to lua error (#197)
+ - Hungarian as a secondary language reordered some captions
+ (#203).
```
### Previous changes
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index 44ed19a8f2..792605685a 100644
--- a/macros/latex/required/babel/base/babel.dtx
+++ b/macros/latex/required/babel/base/babel.dtx
@@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2022/10/23 v3.82 The Babel package]
+\ProvidesFile{babel.dtx}[2022/11/30 v3.83 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -1502,23 +1502,22 @@ captions):
\def\hascapl{\textsuperscript{l}}
\begin{multicols}{2}
-
\tag{af} Afrikaans\hascapu\hascapl
\tag{agq} Aghem
\tag{ak} Akan
\tag{am} Amharic\hascapu\hascapl
-\tag{ar} Arabic\hascapu\hascapl
-\tag{ar-DZ} Arabic\hascapu\hascapl
-\tag{ar-EG} Arabic\hascapu\hascapl
-\tag{ar-IQ} Arabic\hascapu\hascapl
-\tag{ar-JO} Arabic\hascapu\hascapl
-\tag{ar-LB} Arabic\hascapu\hascapl
-\tag{ar-MA} Arabic\hascapu\hascapl
-\tag{ar-PS} Arabic\hascapu\hascapl
-\tag{ar-SA} Arabic\hascapu\hascapl
-\tag{ar-SY} Arabic\hascapu\hascapl
-\tag{ar-TN} Arabic\hascapu\hascapl
-\tag{as} Assamese
+\tag{ar-DZ} Arabic\hascapu
+\tag{ar-EG} Arabic\hascapu
+\tag{ar-IQ} Arabic\hascapu
+\tag{ar-JO} Arabic\hascapu
+\tag{ar-LB} Arabic\hascapu
+\tag{ar-MA} Arabic\hascapu
+\tag{ar-PS} Arabic\hascapu
+\tag{ar-SA} Arabic\hascapu
+\tag{ar-SY} Arabic\hascapu
+\tag{ar-TN} Arabic\hascapu
+\tag{ar} Arabic\hascapu
+\tag{as} Assamese\hascapu
\tag{asa} Asu
\tag{ast} Asturian\hascapu\hascapl
\tag{az-Cyrl} Azerbaijani
@@ -1530,8 +1529,9 @@ captions):
\tag{bez} Bena
\tag{bg} Bulgarian\hascapu\hascapl
\tag{bm} Bambara
-\tag{bn} Bangla\hascapu\hascapl
+\tag{bn} Bangla\hascapu
\tag{bo} Tibetan\hascapu
+\tag{br} Breton\hascapu\hascapl
\tag{brx} Bodo
\tag{bs-Cyrl} Bosnian
\tag{bs-Latn} Bosnian\hascapu\hascapl
@@ -1540,16 +1540,24 @@ captions):
\tag{ce} Chechen
\tag{cgg} Chiga
\tag{chr} Cherokee
-\tag{ckb} Central Kurdish
+\tag{ckb-Arab} Central Kurdish\hascapu
+\tag{ckb-Latn} Central Kurdish\hascapu
+\tag{ckb} Central Kurdish\hascapu
\tag{cop} Coptic
\tag{cs} Czech\hascapu\hascapl
-\tag{cu} Church Slavic
-\tag{cu-Cyrs} Church Slavic
+\tag{cu-Cyrs} Church Slavic\hascapu
\tag{cu-Glag} Church Slavic
+\tag{cu} Church Slavic\hascapu
\tag{cy} Welsh\hascapu\hascapl
\tag{da} Danish\hascapu\hascapl
\tag{dav} Taita
-\tag{de-AT} German\hascapu\hascapl
+\tag{de-1901} German\hascapu\hascapl
+\tag{de-1996} German\hascapu\hascapl
+\tag{de-AT-1901} Austrian German\hascapu\hascapl
+\tag{de-AT-1996} Austrian German\hascapu\hascapl
+\tag{de-AT} Austrian German\hascapu\hascapl
+\tag{de-CH-1901} Swiss High German\hascapu\hascapl
+\tag{de-CH-1996} Swiss High German\hascapu\hascapl
\tag{de-CH} Swiss High German\hascapu\hascapl
\tag{de} German\hascapu\hascapl
\tag{dje} Zarma
@@ -1559,30 +1567,30 @@ captions):
\tag{dz} Dzongkha
\tag{ebu} Embu
\tag{ee} Ewe
-\tag{el} Greek\hascapu\hascapl
\tag{el-polyton} Polytonic Greek\hascapu\hascapl
-\tag{en-AU} English\hascapu\hascapl
-\tag{en-CA} English\hascapu\hascapl
-\tag{en-GB} English\hascapu\hascapl
+\tag{el} Greek\hascapu\hascapl
+\tag{en-AU} Australian English\hascapu\hascapl
+\tag{en-CA} Canadian English\hascapu\hascapl
+\tag{en-GB} British English\hascapu\hascapl
\tag{en-NZ} English\hascapu\hascapl
-\tag{en-US} English\hascapu\hascapl
+\tag{en-US} American English\hascapu\hascapl
\tag{en} English\hascapu\hascapl
\tag{eo} Esperanto\hascapu\hascapl
-\tag{es-MX} Spanish\hascapu\hascapl
+\tag{es-MX} Mexican Spanish\hascapu\hascapl
\tag{es} Spanish\hascapu\hascapl
\tag{et} Estonian\hascapu\hascapl
-\tag{eu} Basque\hascapu\hascapl
+\tag{eu} Basque\hascapu\hascapl\hascapl
\tag{ewo} Ewondo
-\tag{fa} Persian\hascapu\hascapl
+\tag{fa} Persian\hascapu
\tag{ff} Fulah
\tag{fi} Finnish\hascapu\hascapl
\tag{fil} Filipino
\tag{fo} Faroese
-\tag{fr} French\hascapu\hascapl
\tag{fr-BE} French\hascapu\hascapl
-\tag{fr-CA} French\hascapu\hascapl
-\tag{fr-CH} French\hascapu\hascapl
+\tag{fr-CA} Canadian French\hascapu\hascapl
+\tag{fr-CH} Swiss French\hascapu\hascapl
\tag{fr-LU} French\hascapu\hascapl
+\tag{fr} French\hascapu\hascapl
\tag{fur} Friulian\hascapu\hascapl
\tag{fy} Western Frisian
\tag{ga} Irish\hascapu\hascapl
@@ -1594,15 +1602,15 @@ captions):
\tag{guz} Gusii
\tag{gv} Manx
\tag{ha-GH} Hausa
-\tag{ha-NE} Hausa\hascapl
-\tag{ha} Hausa
+\tag{ha-NE} Hausa
+\tag{ha} Hausa\hascapu\hascapl
\tag{haw} Hawaiian
\tag{he} Hebrew\hascapu\hascapl
\tag{hi} Hindi\hascapu
\tag{hr} Croatian\hascapu\hascapl
\tag{hsb} Upper Sorbian\hascapu\hascapl
-\tag{hu} Hungarian\hascapu\hascapl
-\tag{hy} Armenian\hascapu
+\tag{hu} Hungarian\hascapu\hascapl\hascapl\hascapl
+\tag{hy} Armenian\hascapu\hascapl
\tag{ia} Interlingua\hascapu\hascapl
\tag{id} Indonesian\hascapu\hascapl
\tag{ig} Igbo
@@ -1612,20 +1620,24 @@ captions):
\tag{ja} Japanese\hascapu
\tag{jgo} Ngomba
\tag{jmc} Machame
-\tag{ka} Georgian\hascapu\hascapl
+\tag{ka} Georgian\hascapu
\tag{kab} Kabyle
\tag{kam} Kamba
\tag{kde} Makonde
\tag{kea} Kabuverdianu
+\tag{kgp} Kaingang
\tag{khq} Koyra Chiini
\tag{ki} Kikuyu
\tag{kk} Kazakh
\tag{kkj} Kako
\tag{kl} Kalaallisut
\tag{kln} Kalenjin
-\tag{km} Khmer
-\tag{kmr} Northern Kurdish\hascapu
-\tag{kn} Kannada\hascapu\hascapl
+\tag{km} Khmer\hascapu
+\tag{kmr-Arab} Northern Kurdish\hascapu
+\tag{kmr-Latn} Northern Kurdish\hascapu\hascapl
+\tag{kmr} Northern Kurdish\hascapu\hascapl
+\tag{kn} Kannada\hascapu
+\tag{ko-Hani} Korean\hascapu
\tag{ko} Korean\hascapu
\tag{kok} Konkani
\tag{ks} Kashmiri
@@ -1634,14 +1646,18 @@ captions):
\tag{ksh} Colognian
\tag{kw} Cornish
\tag{ky} Kyrgyz
+\tag{la-x-classic} Classic Latin\hascapu\hascapl
+\tag{la-x-ecclesia} Ecclesiastic Latin\hascapu\hascapl
+\tag{la-x-medieval} Medieval Latin\hascapu\hascapl
+\tag{la} Latin\hascapu\hascapl
\tag{lag} Langi
\tag{lb} Luxembourgish\hascapu\hascapl
\tag{lg} Ganda
\tag{lkt} Lakota
\tag{ln} Lingala
-\tag{lo} Lao\hascapu\hascapl
+\tag{lo} Lao\hascapu
\tag{lrc} Northern Luri
-\tag{lt} Lithuanian\hascapu\hascapl
+\tag{lt} Lithuanian\hascapu\hascapl\hascapl\hascapl
\tag{lu} Luba-Katanga
\tag{luo} Luo
\tag{luy} Luyia
@@ -1653,11 +1669,11 @@ captions):
\tag{mgh} Makhuwa-Meetto
\tag{mgo} Metaʼ
\tag{mk} Macedonian\hascapu\hascapl
-\tag{ml} Malayalam\hascapu\hascapl
+\tag{ml} Malayalam\hascapu
\tag{mn} Mongolian
-\tag{mr} Marathi\hascapu\hascapl
-\tag{ms-BN} Malay\hascapl
-\tag{ms-SG} Malay\hascapl
+\tag{mr} Marathi\hascapu
+\tag{ms-BN} Malay
+\tag{ms-SG} Malay
\tag{ms} Malay\hascapu\hascapl
\tag{mt} Maltese
\tag{mua} Mundang
@@ -1671,26 +1687,27 @@ captions):
\tag{nmg} Kwasio
\tag{nn} Norwegian Nynorsk\hascapu\hascapl
\tag{nnh} Ngiemboon
-\tag{no} Norwegian
+\tag{no} Norwegian\hascapu\hascapl
\tag{nus} Nuer
\tag{nyn} Nyankole
+\tag{oc} Occitan\hascapu\hascapl
\tag{om} Oromo
\tag{or} Odia
\tag{os} Ossetic
\tag{pa-Arab} Punjabi
-\tag{pa-Guru} Punjabi
-\tag{pa} Punjabi
+\tag{pa-Guru} Punjabi\hascapu
+\tag{pa} Punjabi\hascapu
\tag{pl} Polish\hascapu\hascapl
\tag{pms} Piedmontese\hascapu\hascapl
\tag{ps} Pashto
-\tag{pt-BR} Portuguese\hascapu\hascapl
-\tag{pt-PT} Portuguese\hascapu\hascapl
+\tag{pt-BR} Brazilian Portuguese\hascapu\hascapl
+\tag{pt-PT} European Portuguese\hascapu\hascapl
\tag{pt} Portuguese\hascapu\hascapl
\tag{qu} Quechua
\tag{rm} Romansh\hascapu\hascapl
\tag{rn} Rundi
-\tag{ro} Romanian\hascapu\hascapl
\tag{ro-MD} Moldavian\hascapu\hascapl
+\tag{ro} Romanian\hascapu\hascapl
\tag{rof} Rombo
\tag{ru} Russian\hascapu\hascapl
\tag{rw} Kinyarwanda
@@ -1705,6 +1722,7 @@ captions):
\tag{sah} Sakha
\tag{saq} Samburu
\tag{sbp} Sangu
+\tag{sc} Sardinian
\tag{se} Northern Sami\hascapu\hascapl
\tag{seh} Sena
\tag{ses} Koyraboro Senni
@@ -1712,7 +1730,7 @@ captions):
\tag{shi-Latn} Tachelhit
\tag{shi-Tfng} Tachelhit
\tag{shi} Tachelhit
-\tag{si} Sinhala
+\tag{si} Sinhala\hascapu
\tag{sk} Slovak\hascapu\hascapl
\tag{sl} Slovenian\hascapu\hascapl
\tag{smn} Inari Sami
@@ -1730,8 +1748,9 @@ captions):
\tag{sr} Serbian\hascapu\hascapl
\tag{sv} Swedish\hascapu\hascapl
\tag{sw} Swahili
+\tag{syr} Syriac
\tag{ta} Tamil\hascapu
-\tag{te} Telugu\hascapu\hascapl
+\tag{te} Telugu\hascapu
\tag{teo} Teso
\tag{th} Thai\hascapu\hascapl
\tag{ti} Tigrinya
@@ -1740,9 +1759,9 @@ captions):
\tag{tr} Turkish\hascapu\hascapl
\tag{twq} Tasawaq
\tag{tzm} Central Atlas Tamazight
-\tag{ug} Uyghur
+\tag{ug} Uyghur\hascapu
\tag{uk} Ukrainian\hascapu\hascapl
-\tag{ur} Urdu\hascapu\hascapl
+\tag{ur} Urdu\hascapu
\tag{uz-Arab} Uzbek
\tag{uz-Cyrl} Uzbek
\tag{uz-Latn} Uzbek
@@ -1757,14 +1776,15 @@ captions):
\tag{yav} Yangben
\tag{yi} Yiddish
\tag{yo} Yoruba
+\tag{yrl} Nheengatu
\tag{yue} Cantonese
\tag{zgh} Standard Moroccan Tamazight
-\tag{zh-Hans-HK} Chinese\hascapu
-\tag{zh-Hans-MO} Chinese\hascapu
-\tag{zh-Hans-SG} Chinese\hascapu
+\tag{zh-Hans-HK} Chinese
+\tag{zh-Hans-MO} Chinese
+\tag{zh-Hans-SG} Chinese
\tag{zh-Hans} Chinese\hascapu
-\tag{zh-Hant-HK} Chinese\hascapu
-\tag{zh-Hant-MO} Chinese\hascapu
+\tag{zh-Hant-HK} Chinese
+\tag{zh-Hant-MO} Chinese
\tag{zh-Hant} Chinese\hascapu
\tag{zh} Chinese\hascapu
\tag{zu} Zulu
@@ -1787,7 +1807,7 @@ by |\babelprovide| with a valueless |import|.
\let\\\par
\begin{multicols}{2}
-
+afrikaans\\
aghem\\
akan\\
albanian\\
@@ -2120,8 +2140,6 @@ yiddish\\
yoruba\\
zarma\\
zulu
-afrikaans\\
-
\end{multicols}
\endgroup
\hrule
@@ -2609,7 +2627,9 @@ locale (as set with |\babelfont|). Characters can be added or modified with
\New{3.81} Option |letters| restricts the ‘actions’ to letters, in the
\TeX{} sense (i.~e., with catcode 11). Digits and punctuation are then
-considered part of current locale (as set by a selector).
+considered part of current locale (as set by a selector). This option
+is useful when the main script in non-Latin and there is a secondary
+one whose script is Latin.
\begin{note}
An alternative approach with \luatex{} and Harfbuzz is the font
@@ -2618,6 +2638,21 @@ considered part of current locale (as set by a selector).
cases it can be enough.
\end{note}
+\begin{note}
+ \newcommand\artxt[1]{{%
+ \fontspec[Script=Arabic]{FreeSerif}\textdir TRT #1}}
+ There is no general rule to set the font for a punctuation mark,
+ because it is a semantic decision and not a typographical one.
+ Consider the following sentence: “\artxt{یک}, \artxt{دو}, and
+ \artxt{سه} are Persian numbers”. In this case the punctuation font
+ must be the English one, even if the commas are surrounded by
+ non-Latin letters. Quotation marks, parenthesis, etc., are even more
+ complex. Several criteria are possible, like the main language (the
+ default in \babel), the first letter in the paragraph, or the
+ surrounding letters, among others, but even so manual switching can
+ be still necessary.
+\end{note}
+
\Describe{intraspace=}{\meta{base} \meta{shrink} \meta{stretch}}
Sets the interword space for the writing system of the language, in em
units (so, |0 .1 0| is |0em plus .1em|). Like |\spaceskip|, the em unit
@@ -5153,8 +5188,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.82>>
-%<<date=2022/10/23>>
+%<<version=3.83>>
+%<<date=2022/11/30>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -8690,49 +8725,26 @@ help from Bernd Raichle, for which I am grateful.
{\bbl@tolower\@empty}{\bbl@toupper\@empty}}%
\gdef\bbl@tolower{\csname\languagename @bbl@lc\endcsname}%
\gdef\bbl@toupper{\csname\languagename @bbl@uc\endcsname}}}
-% A temporary hack:
-\ifx\BabelCaseHack\@undefined
-\AtBeginDocument{%
- \bbl@xin@{\string\@uclclist}%
- {\bbl@carg\meaning{MakeUppercase }}%
- \ifin@\else
- \chardef\bbl@ulflag\z@
- \bbl@ncarg\let\bbl@newuc{MakeUppercase }%
- \protected\@namedef{MakeUppercase }#1{{%
- \chardef\bbl@ulflag\@ne
- \ifx\bbl@uclc\@undefined
- \bbl@newuc{#1}%
- \else
- \bbl@ifunset{\languagename @bbl@uclc}%
- {\bbl@newuc{#1}}%
- {\def\reserved@a##1##2{\let##1##2\reserved@a}%
- \bbl@uclc\reserved@a\reserved@b{\reserved@b\@gobble}%
- \protected@edef\reserved@a{\bbl@newuc{#1}}% Pre-expand
- \reserved@a}%
- \fi}}%
- \bbl@ncarg\let\bbl@newlc{MakeLowercase }%
- \protected\@namedef{MakeLowercase }#1{{%
- \chardef\bbl@ulflag\tw@
- \ifx\bbl@uclc\@undefined
- \bbl@newlc{#1}%
- \else
- \bbl@ifunset{\languagename @bbl@uclc}%
- {\bbl@newlc{#1}}%
- {\def\reserved@a##1##2{\let##2##1\reserved@a}%
- \bbl@uclc\reserved@a\reserved@b{\reserved@b\@gobble}%
- \protected@edef\reserved@a{\bbl@newlc{#1}}% Pre-expand
- \reserved@a}%
- \fi}}%
- \def\bbl@cased{%
- \ifcase\bbl@ulflag
- \expandafter\@firstofone
- \or
- \expandafter\MakeUppercase
- \or
- \expandafter\MakeLowercase
- \fi}%
- \fi}
-\fi
+% A temporary hack, for testing purposes:
+\def\BabelRestoreCase{%
+ \DeclareRobustCommand{\MakeUppercase}[1]{{%
+ \def\reserved@a####1####2{\let####1####2\reserved@a}%
+ \def\i{I}\def\j{J}%
+ \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
+ \let\UTF@two@octets@noexpand\@empty
+ \let\UTF@three@octets@noexpand\@empty
+ \let\UTF@four@octets@noexpand\@empty
+ \protected@edef\reserved@a{\uppercase{##1}}%
+ \reserved@a
+ }}%
+ \DeclareRobustCommand{\MakeLowercase}[1]{{%
+ \def\reserved@a####1####2{\let####2####1\reserved@a}%
+ \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
+ \let\UTF@two@octets@noexpand\@empty
+ \let\UTF@three@octets@noexpand\@empty
+ \let\UTF@four@octets@noexpand\@empty
+ \protected@edef\reserved@a{\lowercase{##1}}%
+ \reserved@a}}}
% \end{macrocode}
%
% \begin{macrocode}
@@ -10658,8 +10670,11 @@ help from Bernd Raichle, for which I am grateful.
\fi
\bbl@xin@{,\bbl@tempa,}{,figure,table,}%
\ifin@
- \toks@\expandafter{\bbl@toreplace}%
- \bbl@exp{\gdef\<fnum@\bbl@tempa>{\the\toks@}}%
+ \global\bbl@csarg\let{\bbl@tempa fmt@#2}\bbl@toreplace
+ \bbl@exp{\gdef\<fnum@\bbl@tempa>{%
+ \\\bbl@ifunset{bbl@\bbl@tempa fmt@\\\languagename}%
+ {\[fnum@\bbl@tempa]}%
+ {\\\@nameuse{bbl@\bbl@tempa fmt@\\\languagename}}}}%
\fi}
\def\bbl@ini@captions@aux#1#2{%
\bbl@trim@def\bbl@tempa{#1}%
@@ -12451,8 +12466,12 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl@opt@main\@nnil
\edef\bbl@tempa{\@classoptionslist,\bbl@language@opts}
\let\bbl@tempc\@empty
+ \edef\bbl@templ{,\bbl@loaded,}
+ \edef\bbl@templ{\expandafter\strip@prefix\meaning\bbl@templ}
\bbl@for\bbl@tempb\bbl@tempa{%
- \bbl@xin@{,\bbl@tempb,}{,\bbl@loaded,}%
+ \edef\bbl@tempd{,\bbl@tempb,}%
+ \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}%
+ \bbl@xin@{\bbl@tempd}{\bbl@templ}%
\ifin@\edef\bbl@tempc{\bbl@tempb}\fi}
\def\bbl@tempa#1,#2\@nnil{\def\bbl@tempb{#1}}
\expandafter\bbl@tempa\bbl@loaded,\@nnil
@@ -14817,6 +14836,9 @@ end
\expandafter\bbl@sreplace\csname] \endcsname{$$}{\eqno\kern.001pt$$}%
\else % amstex
\ifx\bbl@noamsmath\@undefined
+ \bbl@exp{% Hack to hide maybe undefined conditionals:
+ \chardef\bbl@eqnpos=0%
+ \<iftagsleft@>1\<else>\<if@fleqn>2\<fi>\<fi>\relax}%
\ifnum\bbl@eqnpos=\@ne
\let\bbl@ams@lap\hbox
\else
@@ -14960,6 +14982,9 @@ end
"Babel.picture_dir")
}%
\AtBeginDocument{%
+ \def\LS@rot{%
+ \setbox\@outputbox\vbox{%
+ \hbox dir TLT{\rotatebox{90}{\box\@outputbox}}}}%
\long\def\put(#1,#2)#3{%
\@killglue
% Try:
@@ -22300,7 +22325,7 @@ function Babel.bidi(head, ispar, hdir)
if Babel.mirroring_enabled and item.id == GLYPH
and temp == 'r' and characters[item.char] then
local font_mode = ''
- if font.fonts[item.font].properties then
+ if item.font > 0 and font.fonts[item.font].properties then
font_mode = font.fonts[item.font].properties.mode
end
if font_mode ~= 'harf' and font_mode ~= 'plug' then
diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins
index 5128ec755d..dddb4bc51f 100644
--- a/macros/latex/required/babel/base/babel.ins
+++ b/macros/latex/required/babel/base/babel.ins
@@ -26,7 +26,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%%
-\def\filedate{2022/10/23}
+\def\filedate{2022/11/30}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf
index 161bd23b21..57211aa2fd 100644
--- a/macros/latex/required/babel/base/babel.pdf
+++ b/macros/latex/required/babel/base/babel.pdf
Binary files differ
diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx
index 2ad2e626b7..e84432d1ba 100644
--- a/macros/latex/required/babel/base/bbcompat.dtx
+++ b/macros/latex/required/babel/base/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/10/23 v3.82]
+\ProvidesFile{bbcompat.dtx}[2022/11/30 v3.83]
%</dtx>
%
%% File 'bbcompat.dtx'
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.lua b/macros/luatex/generic/lutabulartools/lutabulartools.lua
index 23ef965482..719f89873e 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.lua
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2022-11-27
+--% 2022-11-29
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -30,31 +30,33 @@ if (__PL_EXTRAS__ == nil) or (__PENLIGHT__ == nil) then
end
local T = pl.tablex
-local ltt = {}
+local lutabt = {}
-ltt.tablelevel = 0
+lutabt.tablelevel = 0
-ltt.debug = false
+lutabt.debug = false
-ltt.auto_topbot = false
+lutabt.auto_topbot = false
+lutabt.auto_topbot_old = false
-ltt.auto_crules = {} -- {{span,trim}, } appearance is like this, 'range|trim', -- auto_rules created by MC
-ltt.auto_midrules = {}
+lutabt.auto_crules = {} -- {{span,trim}, } appearance is like this, 'range|trim', -- auto_rules created by MC
+lutabt.auto_midrules = {}
-ltt.col_spec1 = {} -- column spec if one column wide (since makcell nests a tabular, preserve col_spec below)
-ltt.col_spec = {} -- tab column spec if above 1
-ltt.col = '' -- current column spec, single char, only applies to tabular with more than 1 column
-ltt.col_num = 1 -- current column number
-ltt.row_num = 0 -- current row number
+lutabt.col_spec1 = {} -- column spec if one column wide (since makcell nests a tabular, preserve col_spec below)
+lutabt.col_spec = {} -- tab column spec if above 1
+lutabt.col = '' -- current column spec, single char, only applies to tabular with more than 1 column
+lutabt.col_num = 1 -- current column number
+lutabt.row_num = 0 -- current row number
+lutabt.actlvl = 1 -- 'active' level on which to apply midrules, normally 1
-ltt.col_ver_repl = {
+lutabt.col_ver_repl = {
m = 'm',
M = 'm',
b = 'b',
}
-ltt.col_hor_repl = { -- horizontal cell alignment that multicolumn should use if () or [hori] not passed to func
+lutabt.col_hor_repl = { -- horizontal cell alignment that multicolumn should use if () or [hori] not passed to func
l = 'l',
c = 'c',
r = 'r',
@@ -70,11 +72,11 @@ ltt.col_hor_repl = { -- horizontal cell alignment that multicolumn should use if
}
-- allow user to place their own replacements in for a table, say if they define a column that expands to multiple
-ltt.col_replaces = {
+lutabt.col_replaces = {
--x = 'lll'
}
-ltt.SI_cols = {'S', 'N', 'Q', 'L', 'R'}
+lutabt.SI_cols = {'S', 'N', 'Q', 'L', 'R'}
@@ -83,24 +85,33 @@ ltt.SI_cols = {'S', 'N', 'Q', 'L', 'R'}
-----
-function ltt.debugtalk(s, ss)
+function lutabt.debugtalk(s, ss)
ss = ss or ''
- if ltt.debug then
+ if lutabt.debug then
pl.tex.help_wrt(s, ss..' (lutabulartools)')
end
end
+function __lutabt__debugprtall()
+ --pl.help_wrt(pl.tablex.filter({ lutabt }, function(v) return type(v) ~= 'function' end), '(lutabulartools state)')
+ pl.help_wrt(lutabt, '(lutabulartools state)')
+end
+
-function ltt.set_tabular(sett)
+function lutabt.set_tabular(sett)
sett = luakeys.parse(sett)
local trim = ''
for k, v in pairs(sett) do
if k == 'tbrule' then
- ltt.auto_topbot = v
+ lutabt.auto_topbot = v
elseif k == 'nopad' then
if pl.hasval(v) then trim = '@{}' end -- set to trim
tex.print('\\newcolumntype{\\lttltrim}{'..trim..'}')
tex.print('\\newcolumntype{\\lttrtrim}{'..trim..'}')
+ elseif k =='rowsep' then
+ tex.print('\\gdef\\arraystretch{'..v..'}')
+ elseif k =='colsep' then
+ tex.print('\\global\\setlength{\\tabcolsep}{'..(v*6)..'pt'..'}')
end
end
end
@@ -110,13 +121,13 @@ end
----- tabular utility funcs
-----
-function ltt.reset_rows()
- if ltt.tablelevel == 1 then
- ltt.row_num = 0
+function lutabt.reset_rows()
+ if lutabt.isactlevel() then
+ lutabt.row_num = 0
end
end
-function ltt.set_col_num()
+function lutabt.set_col_num()
-- register current column info (column number and specification)
local nest
for i = tex.nest.ptr, 1, -1 do
@@ -131,16 +142,16 @@ function ltt.set_col_num()
for _, sub in node.traverse_id(node.id'unset', nest.head) do
col = col + sub + 1
end
- ltt.col_num = col
+ lutabt.col_num = col
else
- ltt.col_num = 1
+ lutabt.col_num = 1
end
- ltt.col = ltt.col_spec[ltt.col_num]
- ltt.debugtalk('col_num='..ltt.col_num..'; col_spec='..ltt.col,'set_col_num')
+ lutabt.col = lutabt.col_spec[lutabt.col_num]
+ lutabt.debugtalk('col_num='..lutabt.col_num..'; col_spec='..lutabt.col,'set_col_num')
end
-function ltt.set_col_spec(zz)
+function lutabt.set_col_spec(zz)
-- contents of string 'zz'
-- register the table column specification
zz = zz:gsub ( "%*%s-{(%d-)}%s-(%b{})" , -- expand expressions such as "*{5}{l}" to "lllll"
@@ -148,15 +159,15 @@ function ltt.set_col_spec(zz)
zz = zz:gsub ( "%b{}" , "" ) -- omit all stuff in curly braces and square
zz = zz:gsub ( "%b[]" , "" )
zz = zz:gsub ( "[@!|><%s%*\']" , "" ) -- some more characters to ignore
- zz = zz:gsub('%a', ltt.col_replaces) -- sub extra column
+ zz = zz:gsub('%a', lutabt.col_replaces) -- sub extra column
_col_spec = zz:totable() -- requires pl extras
--help_wrt(_col_spec, 'helpme')
if #_col_spec > 1 then
- ltt.col_spec = _col_spec
+ lutabt.col_spec = _col_spec
else
- ltt.col_spec1 = _col_spec
+ lutabt.col_spec1 = _col_spec
end
- ltt.debugtalk(ltt.col_spec,'set_col_spec')
+ lutabt.debugtalk(lutabt.col_spec,'set_col_spec')
end
@@ -171,23 +182,26 @@ end
----- magic cell and helpers
-----
-function ltt.MagicCell(s0,spec,mcspec,pre,content,trim)
+function lutabt.MagicCell(s0,spec,mcspec,pre,content,trim)
+ -- todo delete trim!!!
--
- ltt.set_col_num() -- register current column number and column spec
+ lutabt.set_col_num() -- register current column number and column spec
local STR = ''
pl.tex.reset_bkt_cnt()
- local v, h, r, c, mrowsym, skipmakecell = ltt.parse_MagicCell_spec(spec) -- get v/h align, number rows/columns
+ local spec, iscmidrule, trim = lutabt.check_MC_cmidrule(spec) -- check for cmidrule and clean spec
+
+ local v, h, r, c, mrowsym, skipmakecell = lutabt.parse_MagicCell_spec(spec) -- get v/h align, number rows/columns
local mcspec = mcspec or ''
- h, mcspec, c = ltt.get_HColSpec(h, mcspec, c) -- infer horizontal alignment, num columns
+ h, mcspec, c = lutabt.get_HColSpec(h, mcspec, c) -- infer horizontal alignment, num columns
- ltt.debugtalk(pl.List{v, h, r, c, mcspec}:join'; ','v, h, r, c, mcspec')
+ lutabt.debugtalk(pl.List{v, h, r, c, mcspec}:join'; ','v, h, r, c, mcspec')
--help_wrt(_CurTabColAbv,'current column')
- if s0 == pl.tex._xTrue or (pl.List(ltt.SI_cols):contains(ltt.col) -- special columns for SI
+ if s0 == pl.tex._xTrue or (pl.List(lutabt.SI_cols):contains(lutabt.col) -- special columns for SI
and c == '') then -- multicolumn cannot have {} around it
STR = STR .. '{' -- multirow and makcell must have {} around it S column is used
pl.tex.add_bkt_cnt()
@@ -217,17 +231,30 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content,trim)
STR = STR..content..pl.tex.close_bkt_cnt()
--Troubleshooting
--help_wrt(STR..' <<< magic cell string')
- ltt.debugtalk(STR,'MagicCell')
+ lutabt.debugtalk(STR,'MagicCell')
tex.sprint(STR)--tex print the STR
- local en
- if c == '' then en = ltt.col_num else en = ltt.col_num + c -1 end
- ltt.add_auto_crule(ltt.col_num, en, trim)
+ if iscmidrule then
+ local en
+ if c == '' then en = lutabt.col_num else en = lutabt.col_num + c -1 end
+ lutabt.add_auto_crule(lutabt.col_num, en, trim)
+ end
end
+function lutabt.check_MC_cmidrule(spec)
+ local iscmidrule = false
+ local trim = ''
+ local st, en = spec:find('_')
+ if st ~= nil then
+ trim = spec:sub(st+1, #spec)
+ spec = spec:sub(1,st-1)
+ iscmidrule = true
+ end
+ return spec, iscmidrule, trim
+end
-function ltt.parse_MagicCell_spec(spec)
+function lutabt.parse_MagicCell_spec(spec)
local mrowsym = '*' -- * = natural width, = will match p{2cm} for example
local skipmakecell = false
if string.find(spec, '=') then
@@ -238,7 +265,7 @@ function ltt.parse_MagicCell_spec(spec)
spec = spec:lower():gsub('%s','') -- take lower case and remove space
local vh, rc = spec:gextract('%a') -- extract characters
- local v = vh:gfirst({'t', 'm', 'b'}) or ltt.col_ver_repl[ltt.col] or 't'
+ local v = vh:gfirst({'t', 'm', 'b'}) or lutabt.col_ver_repl[lutabt.col] or 't'
local h = vh:gfirst({'l', 'c', 'r'}) or ''
v = v:gsub('m', 'c')
@@ -252,27 +279,27 @@ function ltt.parse_MagicCell_spec(spec)
end
-function ltt.get_HColSpec(h, mcspec, c) -- take horizontal alignment
+function lutabt.get_HColSpec(h, mcspec, c) -- take horizontal alignment
-- c is num columns, h is horizontal alginment,
--Assumes _TabColNum was calculated previosly
if c == '+' then -- fill row to end
- c = tostring(#ltt.col_spec - ltt.col_num + 1)
+ c = tostring(#lutabt.col_spec - lutabt.col_num + 1)
end
if h == '' then -- if horizontal not provided, use declared column
- h = ltt.col_hor_repl[ltt.col] or 'l'
+ h = lutabt.col_hor_repl[lutabt.col] or 'l'
end
if c ~= '' then -- only make new mcspec if column nums > 0
if mcspec == '' then -- and if no mcspec was passed
mcspec = h
- if ltt.col_num == 1 then -- if first column, auto detect padding
+ if lutabt.col_num == 1 then -- if first column, auto detect padding
mcspec = '@{}'..mcspec
end
- if (ltt.col_num + tonumber(c) - 1) == #ltt.col_spec then -- if end on last column
+ if (lutabt.col_num + tonumber(c) - 1) == #lutabt.col_spec then -- if end on last column
mcspec = mcspec..'@{}'
end
else -- if mcspec if given, extract the alignment
- ltt.set_col_spec(mcspec)
- h = ltt.col_spec1[1] -- get 1 character column spec from mcspec and override h
+ lutabt.set_col_spec(mcspec)
+ h = lutabt.col_spec1[1] -- get 1 character column spec from mcspec and override h
end
end
return h, mcspec, c
@@ -280,52 +307,54 @@ end
-----
------ autorules (with \MC() or auto top bot
+----- autorules (with \MC() or auto top bot or midrule X, performed after \\
-----
-function ltt.add_auto_midrules(rows)
- ltt.auto_midrules = rows:split(',')
+function lutabt.add_auto_midrules(rows)
+ lutabt.auto_midrules = rows:split(',')
end
-function ltt.add_auto_crule(st,en,trim)
+function lutabt.add_auto_crule(st,en,trim)
if trim ~= 'x' then
- ltt.auto_crules[#ltt.auto_crules + 1] = {math.floor(st)..'-'..math.floor(en), trim} -- append here
+ lutabt.auto_crules[#lutabt.auto_crules + 1] = {math.floor(st)..'-'..math.floor(en), trim} -- append here
-- {{span 1-2, trim}, ..}
end
end
+function lutabt.isactlevel()
+ lutabt.tablelevel = tonumber(lutabt.tablelevel)
+ lutabt.actlvl = tonumber(lutabt.actlvl)
+ return lutabt.actlvl == lutabt.tablelevel
+end
-function ltt.process_auto_rules()
- if ltt.tablelevel == 1 then
- ltt.row_num = ltt.row_num + 1
- end
- if ltt.auto_crules ~= {} then
- if ltt.tablelevel == 1 then
- for _, v in ipairs(ltt.auto_crules) do
- --pl.help_wrt(ltt.auto_crules, 'fuck')
- ltt.make1cmidrule('', v[2], v[1], 'cmidrule')
+
+function lutabt.process_auto_rules()
+ if lutabt.isactlevel() then
+ lutabt.row_num = lutabt.row_num + 1
+ if lutabt.auto_crules ~= {} then
+ for _, v in ipairs(lutabt.auto_crules) do
+ lutabt.make1cmidrule('', v[2], v[1], 'cmidrule')
end
- for i, v in ipairs(ltt.auto_midrules) do
- --pl.help_wrt(ltt.auto_midrules, 'fuck')
- --pl.help_wrt(v, 'fuck')
- pl.help_wrt(ltt.row_num, 'fuck')
- if tonumber(v) == ltt.row_num then
- _ = table.remove(ltt.auto_midrules,i)
- --pl.help_wrt(v, 'removed!')
+ for i, v in ipairs(lutabt.auto_midrules) do
+ if tonumber(v) == lutabt.row_num then
+ _ = table.remove(lutabt.auto_midrules,i)
tex.print('\\midrule ')
end
end
end
+ if lutabt.mrX.settings.on then
+ lutabt.mrX.midruleX()
+ end
end
- ltt.auto_crules = {}
+ lutabt.auto_crules = {}
end
-function ltt.process_auto_topbot_rule(rule)
- if ltt.tablelevel == 1 then
- if ltt.auto_topbot then
+function lutabt.process_auto_topbot_rule(rule)
+ if lutabt.isactlevel() then
+ if lutabt.auto_topbot then
tex.print('\\'..rule..'rule ')
end
end
@@ -337,31 +366,24 @@ end
-----
------ midrule and midruleX stuff
+----- extra midrule
-----
-ltt.mrX = {}
-ltt.mrX.defaults = {step=5, rule='midrule', reset=false, resetnum=0, cntr=0}
-ltt.mrX.settings = T.copy(ltt.mrX.defaults)
-ltt.mrX.cntr = 0
-ltt.mrX.pgcntr = 0
-
-
-function ltt.get_midrule_col(s)
+function lutabt.get_midrule_col(s)
if string.find(s, '+') then
s = s:gsub('+', '')
if (s == '') or (s == '0') then
s = 1
end
- s = tostring(#ltt.col_spec - tonumber(s) + 1) -- use number of tabular columns above 0,
+ s = tostring(#lutabt.col_spec - tonumber(s) + 1) -- use number of tabular columns above 0,
end
return s
end
-function ltt.make1cmidrule(s, r, c, cmd) -- s=square r=round c=curly
+function lutabt.make1cmidrule(s, r, c, cmd) -- s=square r=round c=curly
cmd = '\\'..cmd
if s ~= '' then
cmd = cmd..'['..s..']'
@@ -376,61 +398,86 @@ function ltt.make1cmidrule(s, r, c, cmd) -- s=square r=round c=curly
if t[2] == nil then
t[2] = t[1]
end
- c = ltt.get_midrule_col(t[1])..'-'..ltt.get_midrule_col(t[2])
+ c = lutabt.get_midrule_col(t[1])..'-'..lutabt.get_midrule_col(t[2])
cmd = cmd..'{'..c..'}'
- ltt.debugtalk(cmd,'make1cmidrule')
+ lutabt.debugtalk(cmd,'make1cmidrule')
tex.print(cmd)
end
-function ltt.makecmidrules(s, r, c, cmd)
+function lutabt.makecmidrules(s, r, c, cmd)
for k, c1 in pairs(string.split(c, ',')) do
r1, c2 = c1:gextract('%a')
if r1 == '' then -- if nothing passed in with the column
r1 = r -- set to the global value passed in round brackets
end
- ltt.make1cmidrule(s, r1:strip(), c2:strip(), cmd)
+ lutabt.make1cmidrule(s, r1:strip(), c2:strip(), cmd)
end
end
+-----
+----- midruleX
+-----
+
+lutabt.mrX = {}
+lutabt.mrX.resets = {long=false, longhead=0, cntr=0, head=nil, longx=false, on=true} -- settings that reset when \setmidruleX used
+lutabt.mrX.resets['head*'] = nil
+lutabt.mrX.settings = T.update(T.copy(lutabt.mrX.resets), {pgcntr=0, step=5, rule='midrule'}) -- current settings, not overwritten with each call
+
+
+function lutabt.mrX.reset_midruleX(n)
+ lutabt.mrX.settings.cntr = tonumber(n)
+end
+
+function lutabt.mrX.off()
+ if lutabt.isactlevel() then
+ lutabt.mrX.settings.on = false
+ end
+end
-function ltt.mrX.set_midruleX(new_sett, def)
- def = def or ''
- local curr_sett = {}
- if def == pl.tex._xTrue then -- default flag, if true, reset all non-used keys to default
- curr_sett = ltt.mrX.defaults
+function lutabt.mrX.set_midruleX(new_sett, def)
+ lutabt.mrX.settings = T.update(lutabt.mrX.settings, T.union(lutabt.mrX.resets, luakeys.parse(new_sett)))
+ lutabt.debugtalk(lutabt.mrX.settings, 'new midruleX settings')
+ if lutabt.mrX.settings.head ~= nil then
+ lutabt.mrX.settings.cntr = -1*tonumber(lutabt.mrX.settings.head)
+ elseif lutabt.mrX.settings['head*'] ~= nil then
+ lutabt.mrX.settings.cntr = -1*tonumber(lutabt.mrX.settings['head*'])
+ lutabt.auto_midrules[#lutabt.auto_midrules + 1] = lutabt.mrX.settings['head*']
+ lutabt.mrX.settings['head*'] = nil -- for some reason need to do this to clear head*
+ end
+ if lutabt.mrX.settings.longx then -- longtable X messes with the tablelevel settings, hack to fix, use longx keyword
+ lutabt.actlvl = 3
+ lutabt.mrX.settings.long = true
else
- curr_sett = ltt.mrX.settings
+ lutabt.actlvl = 1
end
- new_sett = luakeys.parse(new_sett)
- ltt.mrX.settings = T.union(curr_sett, new_sett)
- ltt.debugtalk(ltt.mrX.settings, 'new midruleX settings')
- ltt.mrX.cntr = curr_sett.cntr
end
-function ltt.mrX.midruleX(n)
+
+function lutabt.mrX.midruleX(n)
n = n or '' -- todo placeholder for noalign ?
- local s = ltt.mrX.settings
+ lutabt.debugtalk(lutabt.mrX.settings, 'midruleX here')
+ local s = lutabt.mrX.settings
local rule = s.rule
- if pl.hasval(s.reset) and ltt.mrX.add_label_and_check_page_change() then ltt.mrX.cntr = s.resetnum end
- ltt.mrX.cntr = ltt.mrX.cntr + 1
- if ltt.mrX.cntr == s.step then
+ if pl.hasval(s.long) and lutabt.mrX.add_label_and_check_page_change() then lutabt.mrX.settings.cntr = -1*s.longhead end -- reset to number on page change
+ lutabt.mrX.settings.cntr = lutabt.mrX.settings.cntr + 1
+ if lutabt.mrX.settings.cntr == s.step then
if not rule:startswith('\\') then rule = '\\'..rule end -- todo consider allowing \gmidrule syntax, possible issue with expansion
- ltt.debugtalk(rule, 'apply midruleX')
+ lutabt.debugtalk(rule, 'apply midruleX')
tex.sprint(rule)
- ltt.mrX.cntr = 0
+ lutabt.mrX.settings.cntr = 0
end
end
-function ltt.mrX.add_label_and_check_page_change()
- ltt.mrX.pgcntr = ltt.mrX.pgcntr + 1
- tex.print('\\noalign{\\label{ltt@tabular@row@'..ltt.mrX.pgcntr..'}}')
- local rcurr = pl.tex.get_ref_info('ltt@tabular@row@'..ltt.mrX.pgcntr)
- local rprev = pl.tex.get_ref_info('ltt@tabular@row@'..ltt.mrX.pgcntr-1)
- --local rcurrc, _, _ = pl.tex.get_ref_info_all_cref('ltt@tabular@row@'..ltt.mrX.pgcntr)
- ltt.debugtalk('curr: '..rcurr[2]..' prev: '..rprev[2]..' row: '..ltt.mrX.pgcntr, 'check midruleX page change')
- ltt.debugtalk(rcurr, 'miduleX current reference info for row: '..ltt.mrX.pgcntr)
- --ltt.debugtalk(rcurrc, 'miduleX current cleveref cref info')
+function lutabt.mrX.add_label_and_check_page_change()
+ lutabt.mrX.settings.pgcntr = lutabt.mrX.settings.pgcntr + 1
+ tex.print('\\noalign{\\label{ltt@tabular@row@'..lutabt.mrX.settings.pgcntr..'}}')
+ local rcurr = pl.tex.get_ref_info('ltt@tabular@row@'..lutabt.mrX.settings.pgcntr)
+ local rprev = pl.tex.get_ref_info('ltt@tabular@row@'..lutabt.mrX.settings.pgcntr-1)
+ --local rcurrc, _, _ = pl.tex.get_ref_info_all_cref('ltt@tabular@row@'..lutabt.mrX.settings.pgcntr)
+ lutabt.debugtalk('curr: '..rcurr[2]..' prev: '..rprev[2]..' row: '..lutabt.mrX.settings.pgcntr, 'check midruleX page change')
+ lutabt.debugtalk(rcurr, 'miduleX current reference info for row: '..lutabt.mrX.settings.pgcntr)
+ --lutabt.debugtalk(rcurrc, 'miduleX current cleveref cref info')
if rcurr[2] ~= rprev[2] then -- pg no is second element
return true
end
@@ -438,18 +485,28 @@ function ltt.mrX.add_label_and_check_page_change()
end
+return lutabt -- lutabulartools
+
+
+
+--http://ctan.mirror.rafal.ca/macros/latex/contrib/multirow/multirow.pdf
+--http://ctan.mirror.colo-serv.net/macros/latex/contrib/makecell/makecell.pdf
+-- https://tex.stackexchange.com/questions/331716/newline-in-multirow-environment
+
+
+
--
---ltt.tabular_row_pages_cntr = 0
---function ltt.reset_midruleX_on_newpage(n)
+--lutabt.tabular_row_pages_cntr = 0
+--function lutabt.reset_midruleX_on_newpage(n)
-- local n = n or 0
--- ltt.tabular_row_pages_cntr = ltt.tabular_row_pages_cntr + 1
--- tex.print('\\noalign{\\label{tabular@row@'..ltt.tabular_row_pages_cntr..'}}')
--- if ltt.get_ref_page('tabular@row@'..ltt.tabular_row_pages_cntr) -
--- ltt.get_ref_page('tabular@row@'..(ltt.tabular_row_pages_cntr-1)) == 1 then
+-- lutabt.tabular_row_pages_cntr = lutabt.tabular_row_pages_cntr + 1
+-- tex.print('\\noalign{\\label{tabular@row@'..lutabt.tabular_row_pages_cntr..'}}')
+-- if lutabt.get_ref_page('tabular@row@'..lutabt.tabular_row_pages_cntr) -
+-- lutabt.get_ref_page('tabular@row@'..(lutabt.tabular_row_pages_cntr-1)) == 1 then
-- tex.print('\\setcounter{midruleX}{'..n..'}')
-- end
--end
@@ -457,14 +514,29 @@ end
--help_wrt('TEST COL ')
--for _, s in ipairs{ 'll', '*{6}{s}', 'l*{6}{l}', 'lll', 'll[]', 'll[]*{6}{l}', '*{6}{l}', 'y*{6}{sq}x', } do
--- ltt. set_col_spec(s)
--- help_wrt(ltt.col_spec,s)
+-- lutabt. set_col_spec(s)
+-- help_wrt(lutabt.col_spec,s)
--end
-return ltt -- lutabulartools
-
-
---http://ctan.mirror.rafal.ca/macros/latex/contrib/multirow/multirow.pdf
---http://ctan.mirror.colo-serv.net/macros/latex/contrib/makecell/makecell.pdf
--- https://tex.stackexchange.com/questions/331716/newline-in-multirow-environment
+-- todo move mrX mechanim to avoid @{}
+--function lutabt.mrX.set_midruleX(new_sett, def)
+-- def = def or ''
+-- local curr_sett = {}
+-- if def == pl.tex._xTrue then -- default flag, if true, reset all non-used keys to default
+-- curr_sett = lutabt.mrX.defaults
+-- else
+-- curr_sett = lutabt.mrX.settings
+-- end
+-- new_sett = luakeys.parse(new_sett)
+-- lutabt.mrX.settings = T.union(curr_sett, new_sett)
+--
+-- lutabt.debugtalk(lutabt.mrX.settings, 'new midruleX settings')
+-- lutabt.mrX.settings.cntr = tonumber(curr_sett.cntr) -- todo this needs to be a settings var
+-- if new_sett.cntr ~= nil then -- todo fix the counter
+-- lutabt.mrX.settings.cntr = tonumber(new_sett.cntr)
+-- end
+-- if new_sett.head ~= nil then -- todo fix the counter
+-- lutabt.mrX.settings.cntr = -1*tonumber(new_sett.head)
+-- end
+--end
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.pdf b/macros/luatex/generic/lutabulartools/lutabulartools.pdf
index c915ba6291..74c3446796 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.pdf
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.pdf
Binary files differ
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.sty b/macros/luatex/generic/lutabulartools/lutabulartools.sty
index 1d2522b099..4ca3752578 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.sty
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-11-27
+% 2022-11-29
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +23,7 @@
% OR OTHER DEALINGS IN THE SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lutabulartools}[2022-11-27]
+\ProvidesPackage{lutabulartools}[2022-11-29]
\RequirePackage{booktabs}
\RequirePackage{multirow}
@@ -39,6 +39,7 @@
\newcommand{\lttdebugON}{\luadirect{lutabt.debug = true}}
\newcommand{\lttdebugOFF}{\luadirect{lutabt.debug = true}}
+\newcommand{\lttdebugprt}{\luadirect{__lutabt__debugprtall()}}
\newcolumntype{\lttltrim}{}
\newcolumntype{\lttrtrim}{}
@@ -46,15 +47,38 @@
%%% midrule every X rows
-\def\midruleX{\aftergroup\aftergroup\aftergroup\midruleX@aux}
-\def\midruleX@aux{\luadirect{lutabt.mrX.midruleX('')}} % todo argument for vadjust or noalign??
-\NewDocumentCommand{\setmidruleX}{s O{N} m}{%
+% NO LONGER NEEDED %%% this was used for @{\midruleX} in colspec, but I made a better way
+%\def\midruleX{\aftergroup\aftergroup\aftergroup\midruleX@aux}
+%\def\midruleX@aux{\luadirect{lutabt.mrX.midruleX('')}} %
+%%%
+
+\NewDocumentCommand{\midruleX}{s O{N} m}{%
\MakeluastringCommands[N]{#2}%
\luadirect{lutabt.mrX.set_midruleX(\plluastringA{#3}, \luastring{#1})}%
}
-\NewDocumentCommand{\midruleXreset}{O{0}}{\luadirect{lutabt.mrX.cntr = tonumber(\luastring{#1})}}
-\NewCommandCopy\resetmidruleX\midruleXreset
+\NewDocumentCommand{\resetmidruleX}{O{0}}{\luadirect{lutabt.mrX.reset_midruleX(\luastring{#1})}}
+
+
+\NewDocumentCommand{\settabular}{s m}{\luadirect{lutabt.set_tabular(\luastring{#2})}} %
+
+\def\ltt@resetrownum{\luadirect{lutabt.reset_rows()}}
+\def\ltt@resetrownumhard{\luadirect{lutabt.row_num = 0}}
+\def\ltt@autotoprule{\luadirect{lutabt.process_auto_topbot_rule('top')}}
+\def\ltt@autobotrule{\luadirect{lutabt.process_auto_topbot_rule('bottom')}}
+\def\ltt@storeautotbandfalse{\luadirect{
+ lutabt.auto_topbot_old = lutabt.auto_topbot
+ lutabt.auto_topbot = false}}
+\def\ltt@restoreautotb{\luadirect{lutabt.auto_topbot = lutabt.auto_topbot_old}}
+\def\ltt@inctablelevel{\luadirect{lutabt.tablelevel = lutabt.tablelevel + 1}}
+\def\ltt@dectablelevel{\luadirect{lutabt.tablelevel = lutabt.tablelevel - 1}}
+\def\ltt@midruleXoff{\luadirect{lutabt.mrX.off()}}
+\def\ltt@actlevelreset{\luadirect{lutabt.actlvl = 1}}
+
+\apptocmd{\@arraycr}{\luadirect{lutabt.process_auto_rules()}}{}{}
+
+
+\NewDocumentCommand{\midrulesat}{m}{\luadirect{lutabt.add_auto_midrules(\luastring{#1})}}
%%%%
@@ -138,16 +162,11 @@
-\NewDocumentCommand{\midrulesat}{m}{\luadirect{lutabt.add_auto_midrules(\luastring{#1})}}
+\apptocmd{\LTXtable}{\ltt@actlevelreset\ltt@resetrownumhard\luadirect{lutabt.tablelevel=0}}{}{}
-\NewDocumentCommand{\settabular}{s m}{\luadirect{lutabt.set_tabular(\luastring{#2})}} % make kv interface for auto
-
-\def\ltt@resetrownum{\luadirect{lutabt.reset_rows()}}
-\def\ltt@autotoprule{\luadirect{lutabt.process_auto_topbot_rule('top')}}
-\def\ltt@autobotrule{\luadirect{lutabt.process_auto_topbot_rule('bottom')}}
\let\oldtabular\tabular
\let\oldendtabular\endtabular
@@ -155,9 +174,7 @@
\luadirect{lutabt.set_col_spec(\luastringN{#2})}%
\oldtabular[#1]{\lttltrim#2\lttrtrim}\ltt@inctablelevel\ltt@resetrownum\ltt@autotoprule%
}
-\def\endtabular{\ltt@autobotrule\ltt@dectablelevel\oldendtabular}
-
-
+\def\endtabular{\ltt@autobotrule\ltt@midruleXoff\ltt@dectablelevel\oldendtabular}
\expandafter\let\expandafter\oldtabulars\csname tabular*\endcsname
@@ -166,27 +183,21 @@
\luadirect{lutabt.set_col_spec(\luastringN{#3})}%
\begin{oldtabulars}{#1}[#2]{\lttltrim#3\lttrtrim}\ltt@inctablelevel\ltt@resetrownum\ltt@autotoprule%
}{%
- \ltt@autobotrule\ltt@dectablelevel\end{oldtabulars}%
+ \ltt@autobotrule\ltt@midruleXoff\ltt@dectablelevel\end{oldtabulars}%
}
%%% NOTE tabularx uses tabular*, NO NEED TO CHANGE TABULARX!
+
\let\oldlongtable\longtable
\RenewExpandableDocumentCommand{\longtable}{ O{l} m }{%
- \luadirect{lutabt.auto_topbot_old = lutabt.auto_topbot
- lutabt.auto_topbot = false}%
+ \ltt@storeautotbandfalse%
\luadirect{lutabt.set_col_spec(\luastringN{#2})}%
\oldlongtable[#1]{\lttltrim#2\lttrtrim}\ltt@inctablelevel\ltt@resetrownum%
}
\let\oldendlongtable\endlongtable
-\def\endlongtable{\luadirect{lutabt.auto_topbot = lutabt.auto_topbot_old}
- \ltt@dectablelevel\oldendlongtable}% restore status of auto topbot rule
-
-\apptocmd{\@arraycr}{\luadirect{lutabt.process_auto_rules()}}{}{}
+\def\endlongtable{\ltt@restoreautotb\ltt@midruleXoff\ltt@dectablelevel\oldendlongtable}% restore status of auto topbot rule
-\def\ltt@inctablelevel{\luadirect{lutabt.tablelevel = lutabt.tablelevel + 1}}
-\def\ltt@dectablelevel{\luadirect{lutabt.tablelevel = lutabt.tablelevel - 1}}
-
%s0,spec,mcspec,pre,content
% Magic Cell
\NewExpandableDocumentCommand{\MC}{ s O{} O{} D<>{} D(){x} m }{%
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.tex b/macros/luatex/generic/lutabulartools/lutabulartools.tex
index 7af9cbc4a6..25acf21e25 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.tex
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-11-27
+% 2022-11-29
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -86,12 +86,13 @@
% todo: can improve naming... set col spec to a table instead of a string
-
\maketitle
-lutabulartools is a package that contains a few useful Lua\LaTeX-based macros to help with tables.
-This package redefines the {\ttfamily tabular} and {\ttfamily tabular*} environments.
-The following packages are loaded if not already, so if you have specific settings for these packages, load this package after:
+\cmd{lutabulartools} is a package that contains a few useful Lua\LaTeX-based macros to help with tables.
+A global \cmd{lua} variable \cmd{lutabt} is created.
+This package redefines the {\ttfamily tabular} and {\ttfamily tabular*} environments as well as \cmd{\@arraycr} to add functionarlity.
+The following packages are loaded by this one,
+so if you have specific settings for these packages, load the \cmd{lutabulartools} package after:
\texttt{
{booktabs},
{multirow},
@@ -101,19 +102,21 @@ The following packages are loaded if not already, so if you have specific settin
{xcolor},
{colortbl},
{luacode},
-{penlight}
-}.
+{penlight}}.
-\section{settabular}
+\section{\texttt{\textbackslash settabular}}
A key-val interface in the \cmd{\settabular{}} command is used to set some tabular settings.
\cmd{nopad} automatically adds \cmd{@{}} on each end of the column spec.\\
-\cmd{tbrule} automatically adds \cmd{\toprule} as the first thing in the environment, and \cmd{\bottomrule} as the last.
-Note that automatic rule adding is disabled in \cmd{longtable}.
-\begin{LTXexample}
-\settabular{nopad,tbrule} % or
-\settabular{nopad=false,tbrule=false}
-\end{LTXexample}
+\cmd{tbrule} automatically adds \cmd{\toprule} as the first thing in the \cmd{tabular(*|x)} environment, and \cmd{\bottomrule} as the last.
+Note that this automatic top/bottom rule adding is disabled in \cmd{longtable}.
+\cmd{row/colsep} tweaks the row spacing with \cmd{arraystretch}
+or adjusts the \cmd{tabcolsep} length (an integer must be used, the result is multiplied by 6pt). For example:
+\begin{verbatim}
+\settabular{nopad,tbrule,rowsep=2,colsep=2} % or
+\settabular{nopad=false,tbrule=false} % to set the switches to off
+\end{verbatim}
+
\section{Debugging}
You can toggle log output debugging with \cmd{\lttdebugON} and \cmd{\lttdebugOFF}.
@@ -124,6 +127,9 @@ msg2
^^^^^
\end{verbatim}
+\cmd{\lttdebugprt} can be used pretty-print the \cmd{lutabt} module and its attributes---useful for checking the
+``state'' of the package.
+
\section{\texttt{\textbackslash MC} -- Magic Cell}
\texttt{\textbackslash MC} (magic cell) combines the facilities of
\cmd{\multirow} and \cmd{\multicolumn} from the \texttt{multirow} package, and \cmd{\makcell} from the titular package.
@@ -131,7 +137,7 @@ With the help of LuaLaTeX, it takes an easy-to-use cell specification and employ
\cmd{\MC} will not work properly if your table is only 1 column wide (you probably don't need \cmd{MC} in that case anyway...).
Here is the usage:
-\texttt{\textbackslash MC * [cell spec] [override multicol] <cell format> (add cmidrule) \{contents\} }
+\texttt{\textbackslash MC * [cell spec] [override multicol] <cell format> \{contents\} }
\llcmd{*}This will wrap the entire command in \{\}. This is necessary for \texttt{siunitx} single-column width columns.
However, the \cmd{\MC} command attempts to detect this automatically.
@@ -162,24 +168,19 @@ Examples:\\
\cmd{\MC[+,2]}, if placed in the first column, occupies the entire row and is two rows tall.\\
\cmd{\MC[+,2]}, if placed in the second column, occupies the second column to the end of the table and is two rows tall.\\
In any of these examples, you can place the alignment letters anywhere.
-So, \cmd{\MC[l1,2b]} and \cmd{\MC[1,2 lb]} are both left-bottom aligned (spaces are ignored).
-
+So, \cmd{\MC[l1,2b]} and \cmd{\MC[1,2 lb]} are both left-bottom aligned (spaces are ignored).\\
+Put an \cmd{_} as the last thing to add a \cmd{cmidrule} under, followed by a trim spec (the thing that goes in \cmd{()})
+\cmd{\MC[+c_l]} will add a \cmd{cmidrule} underneath the cell (which fills until the end of the table), with the left side trimmed.
\llcmd{[override mc]}%
You may want to adjust the column specification of a multicolumn cell,\\
\texttt{[@\{\}c@\{\}]} for example to remove padding between the cell.
-\llcmd{(cmidrule)} will add a cmidrule at end of row. \cmd{()} to add without trim or \cmd{(lr)} to trim.
-
\llcmd{<cell format>}%
You can place formatting like \cmd{\bfseries} here.
-\subsection{midrulesat}
-If you'd rather specify the location of midrules outside the table, use \cmd{\midrulesat{1,2,3}}: a midrule will be
-placed on rows 1, 2, and 3, for the next table only.
-
-\subsection{Defaults}\label{s.def}
+\subsection{\texttt{\textbackslash MC} Defaults}\label{s.def}
The \cmd{tabular[*]} environment is re-defined to use Lua pattern matching
to parse the column specification of the table. This is done to determine how many columns there are,
and what the current column type is, even if specifications like \cmd{r@{.}l*{3}{r}} are used.
@@ -189,18 +190,20 @@ You can also specify default horizontal and vertical alignments (ie if alignment
for an arbitrary column by \cmd{\setMChordef{?}{l|r|c}} and\\
\cmd{\setMChordef{?}{t|m|b}}, where \cmd{?} is the column.
To add a column that should be surrounded by brackets for \cmd{siunitx} purposes, do so with \cmd{\addMCsicol{?}}.
-S is included by default.
+\cmd{S} is included by default.
+
+\section{\texttt{\textbackslash midrulesat}}
+If you'd rather specify the location of midrules outside the table, use \cmd{\midrulesat{1,2,3}}: a midrule will be
+placed on rows 1, 2, and 3, for the next table only.
-\subsection{Examples}
+\section{Examples}
\let\nl\\
-
Change the settings for the rest of the doc.
-
\begin{LTXexample}
\settabular{nopad,tbrule}
\end{LTXexample}
@@ -214,14 +217,12 @@ Change the settings for the rest of the doc.
\begin{tabular}{ l l l }
\MC[+m]<\itshape>{A Decent
Example}\\\midrule
- & \MC[2m](r){Heading} \\
+ & \MC[2m_]{Heading} \\
\MC[b,-2]{Multi\\Line} & A & B \\\midrule
end & & \\
\end{tabular}
\end{LTXexample}
-
-
\subsubsection{A small example}
\begin{LTXexample}
\midrulesat{1,2,3}
@@ -238,9 +239,9 @@ d \\
\begin{LTXexample}
\begin{tabular}{ l l l }\midrule
- \MC(){A} & \MC[mc2,2]{Lttrs} \\
- \MC(r){B} & \\ \cmidrule{2-3}
- \MC(r){1} & \MC(r){A} & \MC(r){B} \\ % todo must fix
+ \MC[_]{A} & \MC[mc2,2]{Lttrs} \\
+ \MC[_r]{B} & \\ \cmidrule{2-3}
+ \MC[_r]{1} & \MC[_r]{A} & \MC[_r]{B} \\
\\
\end{tabular}
\end{LTXexample}
@@ -296,35 +297,6 @@ doesn't play particularly well with the middle aligned \cmd{\MC}
-
-
-%%% https://tex.stackexchange.com/questions/287346/width-of-column-after-multicolumn-header
-
-%\textbackslash MC[<spec>]{<contents}
-
-
-%\subsubsection{And another one}
-%
-%\begin{LTXexample}
-%\setMChordef{l}{r}
-%\setMCverdef{l}{b}
-%% change deflt alignment ^
-%\newcolumntype{e}{ll}
-%\setMCrepl{e}{ll}
-%% e -> l l ^
-%\begin{tabular}{l l l e}\toprule
-%aaaaa & bbb & ccc & eee & fff\\
-%\MC{aaaaa}\\
-%\MC{a}\\\midrule
-%\MC{a\\bbbbb} & x\\\midrule
-%\makecell[br]{a\\b} & x\\\midrule
-%\MC[+]{--- ---}\\
-%\end{tabular}
-%\end{LTXexample}
-%% WHY ISNT THIS RIGHT?
-
-
-
\newpage
@@ -347,65 +319,58 @@ Here's an example:
\begin{LTXexample}
\begin{tabular}{c c c c c c}
- 1 & 2 & 3 & 4 & 5 & 6\\
+ a & 2 & 3 & 4 & 5 & 6\\
\cmidrule{+1} % rule on last column
- 1 & 2 & 3 & 4 & 5 & 6\\
+ b & 2 & 3 & 4 & 5 & 6\\
\cmidrules{1,3-+3,+} % rule on first col, third to third last col, and last col
- 1 & 2 & 3 & 4 & 5 & 6\\
+ c & 2 & 3 & 4 & 5 & 6\\
\cmidrules{1,3-+3rl,+} % same as above, but trim middle
- 1 & 2 & 3 & 4 & 5 & 6\\
+ d & 2 & 3 & 4 & 5 & 6\\
\cmidrules(l){1,r3-+3,+1}% trim left for all, but only trim right for middle rule
- 1 & 2 & 3 & 4 & 5 & 6\\
+ e & 2 & 3 & 4 & 5 & 6\\
\gcmidrule{+1} % rule on last column
- 1 & 2 & 3 & 4 & 5 & 6\\
+ f & 2 & 3 & 4 & 5 & 6\\
\gcmidrules{1,3-+3,+} % rule on first col, third to third last col, and last col
- 1 & 2 & 3 & 4 & 5 & 6\\
+ g & 2 & 3 & 4 & 5 & 6\\
\gcmidrules{1,3-+3rl,+} % same as above, but trim middle
- 1 & 2 & 3 & 4 & 5 & 6\\
+ h & 2 & 3 & 4 & 5 & 6\\
\gcmidrules(l){1,r3-+3,+1}% trim left for all, but only trim right for middle rule
\end{tabular}
\end{LTXexample}
-\subsection{Midrule every X\textsuperscript{th} row}
+\section{\texttt{\textbackslash midruleX} - Midrule every X\textsuperscript{th} row}
-\llcmd{\midruleX}%
With this command, you can place a rule
-every X rows.
-To use, place \cmd{@{\midruleX}} at the end of the tabular column spec, eg. \cmd{\begin{tabular}{ll@{\midruleX}}..}.
+every X rows for the next table made (place command outside of table).
You can configure the step size and what kind of midrule you prefer with the following key-val syntax, with default values below:\\
-\cmd{\setmidruleX{step=5,rule=midrule,reset=false,resetnum=0,cntr=0}}\\
+\cmd{\midruleX{step=5,rule=midrule,cntr=0,head=0,long=false,longhead=0}}\\
\cmd{step} is the number of rows (X) before applying the rule set by \cmd{rule}. \\
-Concering \cmd{longtable}s: If \cmd{reset} is set to \cmd{true},
+Concering \cmd{longtable}s: If \cmd{long} is set to \cmd{true} (or the key is present),
\cmd{\midruleX} will also add a unique \cmd{\label{}} on each row, and if the row starts on a newpage,
-resets the row counter to \cmd{resetnum}, to ensure you have the same X number of rows after the header of each page of a \cmd{longtable}.\\
-The starred version of first reverts the settings to default, then loads your inputted settings, which the non-starred
-version only overwrites the settings specified. \cmd{\setmidruleX*{}} will restore to default.
-Use optional parameter \cmd{\setmidruleX*[o|n|f]{}}
+resets the row counter to -1*\cmd{longhead}, to ensure you have the same X number of rows after the header of each page of a \cmd{longtable}.\\
+Use optional parameter \cmd{\midruleX*[o|n|f]{}}
to control expansion of the key-val settings (\cmd{[n]} for not expanded is default).
-Before you want counting to begin, you should
-apply \cmd{\resetmidruleX} to avoid header rows being counted.
-Use \cmd{\noalign{\resetmiduleX}} if you need place a rule on the same line the reset takes place, or in a cell before \cmd{\\}.
-Note that \cmd{\resetmidruleX} resets the row counter to 0, and is in effect, a short-cut for \cmd{\setmidruleX{}} or \cmd{\setmidruleX{cntr=0}}
+Before you want counting to begin, or anywhere in the table, you could
+apply \cmd{\resetmidruleX[cntr]} (\cmd{cnter} is incremented each row) to avoid header
+rows being counted and set the row \cmd{cntr} to an arbitrary value.
+If you want to skip the first \cmd{x} rows with \cmd{\midruleX}, set \cmd{head=x} (which is equivalent to \cmd{cntr=-x}).
+If you want to add a \cmd{midrule} under row \cmd{x}, use \cmd{head*=x} instead.
+Note: Use \cmd{\noalign{\resetmiduleX}} if you need place a rule on the same line the reset takes place (ie. in a cell before \cmd{\\}).
-%
-%\begin{tabular}{l@{\luadirect{tex.print('\\midrule')}}}
-% Hello \\
-%\end{tabular}
-%
+\subsection{\texttt{\textbackslash midruleX} examples}
+
\begin{LTXexample}
-\setmidruleX{step=3,rule=gmidrule}
-\begin{tabular}{rclc@{\midruleX}}
+\midruleX{step=3,rule=gmidrule,head*=1}
+\begin{tabular}{rclc}
% ^^^ inject midruleX
Num & . & . & . \\
-\midrule\resetmidruleX
-% reset so header dont count
1 & & & \\
2 & & & \\
3 & & & \\
-4 & & & \\
+4 & \MC[2,2]{Hi\\world} \\
5 & & & \\
6 & & & \\
7 & & & \\
@@ -419,21 +384,17 @@ Num & . & . & . \\
\end{tabular}
\end{LTXexample}
-%}
-
-%
-
\pagebreak
Here's an example with long table. Notice the gray rules reliably appear 3 rows after each header.
\begin{verbatim}
-\setmidruleX{reset=true,resetnum=0,rule="\gcmidrules{1r,2-}"}
+\midruleX{long=true,step=3,rule="\gcmidrules{1r,2-}"}
\def\tblhead{\toprule No & Name & Place & other\\\midrule}
\def\tblcontinued{\MC[+l]{Continued...}\\}
-\def\tblcontinues\MC[+r]{...Continues}\\}
-\begin{longtable}{rclc@{\midruleX}}
+\def\tblcontinues{\MC[+r]{...Continues}\\}
+\begin{longtable}{rclc}
\tblhead\endfirsthead
- \tblcontinued\head\endhead % all the lines above this will be repeated on every page
+ \tblcontinued\tblhead\endhead % all the lines above this will be repeated on every page
\tblcontinues\endfoot
\bottomrule End.\endlastfoot
\resetmidruleX
@@ -448,29 +409,29 @@ Here's an example with long table. Notice the gray rules reliably appear 3 rows
9 & & & \\
10 & & & \\
11 & & & \\
-12 & & & \\
+12 & \MC[2,-2](){Hi\\world} \\
13 & & & \\
14 & & & \\
15 & & & \\\newpage
-16 & & & \\
+16 & \MC[2,2]{Hi\\world} \\
17 & & & \\
18 & & & \\\resetmidruleX
19 & & & \\
\end{longtable}
\end{verbatim}
-\setmidruleX{reset=true,resetnum=0,rule="\gcmidrules{1r,2-}"}
+\midruleX{long=true,rule="\gcmidrules{1r,2-}"}
\def\tblhead{\toprule No & Name & Place & other\\\midrule}
\def\tblcontinued{\MC[+l]{Continued...}\\}
\def\tblcontinues{\MC[+r]{...Continues}\\}
-\begin{longtable}{rclc@{\midruleX}}
+\begin{longtable}{rclc}
\tblhead\endfirsthead
\tblcontinued\tblhead\endhead % all the lines above this will be repeated on every page
\tblcontinues\endfoot
\bottomrule End.\endlastfoot
\resetmidruleX
1 & & & \\
-2 & & & \\
+2 & \MC[_]{hi} & & \\
3 & & & \\
4 & & & \\
5 & & & \\
@@ -480,18 +441,41 @@ Here's an example with long table. Notice the gray rules reliably appear 3 rows
9 & & & \\
10 & & & \\
11 & & & \\
-12 & & & \\
+12 & \MC[2,-2_]{Hi\\world} \\
13 & & & \\
14 & & & \\
15 & & & \\\newpage
-16 & & & \\
+16 & \MC[2,-2_]{Hi\\world} \\
17 & & & \\
18 & & & \\\resetmidruleX
19 & & & \\
\end{longtable}
+%\begin{tabular}{ll}
+% a \\
+% b \\
+% v \\
+% d \\
+% r \\
+%\end{tabular}
+
+Long table X example
\LTXtable{\linewidth}{ltxexample}
+%\luadirect{pl.help_wrt(lutabt.actlvl, 'actlevel')}
+%\luadirect{pl.help_wrt(lutabt.row_num, 'row')}
+%\lttdebugprt
+
+%\settabular{tbrule} % glitch with LTX
+%\midrulesat{1,2,3}
+%\begin{tabular}{ll}
+% a \\
+% b \\
+% c \\
+% d \\
+% e \\
+%\end{tabular}
+
\end{document}