diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-20 23:18:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-20 23:18:53 +0000 |
commit | b7107e5924c67d251214ec24e021f79dc8aeaa88 (patch) | |
tree | db57ca450caa67b5f5c80417658497ee70bd386b /Master | |
parent | 0a9c7c7a36016413358a7590677f5741abedf868 (diff) |
mathfont (20jan19)
git-svn-id: svn://tug.org/texlive/trunk@49773 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/mathfont/README.txt | 13 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mathfont/mathfont.pdf | bin | 237484 -> 291212 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mathfont/mathfont_example.pdf | bin | 0 -> 86277 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mathfont/mathfont_example.tex | 80 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mathfont/mathfont_greek.tex | 8 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mathfont/mathfont.dtx | 414 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/mathfont/mathfont.sty | 112 |
7 files changed, 520 insertions, 107 deletions
diff --git a/Master/texmf-dist/doc/latex/mathfont/README.txt b/Master/texmf-dist/doc/latex/mathfont/README.txt index 928b71d928f..d1d100782f0 100644 --- a/Master/texmf-dist/doc/latex/mathfont/README.txt +++ b/Master/texmf-dist/doc/latex/mathfont/README.txt @@ -7,12 +7,11 @@ the corresponding .sty file and complete the installation. 2. mathfont.pdf: the package documentation. -3. mathfont.ind: the index file. Include this file in the same -directory as mathfont.dtx when compiling to generate a code index. - -4. mathfont_greek.pdf: a table of Greek characters provided by +3. mathfont_greek.pdf: a table of Greek characters provided by mathfont. +4. mathfont_example.pdf: an example of mathfont in action. + The mathfont package is Copyright 2018 by Conrad Kosowsky. This work may be distributed and modified under the terms @@ -24,9 +23,9 @@ The most recent version of this license is available online at 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 of the file mathfont.dtx, -the derived files mathfont.sty and mathfont_greek.tex, and -all other files created through the configuration process such as -mathfont.pdf, mathfont.idx, and mathfont.ind. +the derived files mathfont.sty, mathfont_greek.tex, and +mathfont_example.tex, and all other files created through the configuration +process such as mathfont.pdf, mathfont.idx, and mathfont.ind. To install mathfont, run mathfont.dtx through LaTeX and move the generated file mathfont.sty into a directory searchable by TeX. diff --git a/Master/texmf-dist/doc/latex/mathfont/mathfont.pdf b/Master/texmf-dist/doc/latex/mathfont/mathfont.pdf Binary files differindex b509bd2b0c4..27194280adf 100644 --- a/Master/texmf-dist/doc/latex/mathfont/mathfont.pdf +++ b/Master/texmf-dist/doc/latex/mathfont/mathfont.pdf diff --git a/Master/texmf-dist/doc/latex/mathfont/mathfont_example.pdf b/Master/texmf-dist/doc/latex/mathfont/mathfont_example.pdf Binary files differnew file mode 100644 index 00000000000..17c70c713f2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mathfont/mathfont_example.pdf diff --git a/Master/texmf-dist/doc/latex/mathfont/mathfont_example.tex b/Master/texmf-dist/doc/latex/mathfont/mathfont_example.tex new file mode 100644 index 00000000000..efb26fe250c --- /dev/null +++ b/Master/texmf-dist/doc/latex/mathfont/mathfont_example.tex @@ -0,0 +1,80 @@ +%% +%% This is file `mathfont_example.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% mathfont.dtx (with options: `example') +%% +%% Copyright 2018 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 +%% +%% 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 of the file mathfont.dtx, +%% the derived files mathfont.sty, mathfont_greek.tex, and +%% mathfont_example.tex, and all other files created through the configuration +%% process such as mathfont.pdf, mathfont.idx, and mathfont.ind. For more +%% information, see the original mathfont.dtx file. +%% +\documentclass[12pt]{article} +\usepackage[margin=72.27pt]{geometry} +\usepackage[factor=600,stretch=14,shrink=14,step=1]{microtype} +\usepackage{selnolig} +\usepackage[no-operators]{mathfont} +\mathfont{Times New Roman} +\mathfont[bb]{Symbola} +\restoremathinternals +\setmainfont{Times New Roman} +\nolig{Th}{T|h} +\hyphenpenalty=10 +\exhyphenpenalty=5 +\pretolerance=30 +\finalhyphendemerits=300 +\pagestyle{empty} +\begin{document} + +\centerline{The \textsf{mathfont} Package in Action: Two Mathematical Snippets Rendered in Times New Roman} +\centerline{Conrad Kosowsky} + +\bigskip + +Mathematicians usually define $e$ in one of two ways: as the horizontal asymptote of a certain function or as the limit of an infinite series. Specifically, it's most common to see $e$ defined as either +\[ +e=\lim_{x\to\infty}\left(1+\frac1x\right)^x +\] +or +\[ +e=\sum_{k=0}^\infty\frac1{k!}. +\] +The first definition is simpler in that involves a limit of a single expression, not a limit of partial sums, but in practice, the second tends to be more tractable. The power series expression of $e^x$ is given by +\[ +\sum_{n=0}^\infty\frac{x^n}{n!}, +\] +and the relationship between this expression and the series definition is much more apparent than it is for the first limit. This relationship arises in a variety of different mathematical contexts, for example the famous Euler's formula $e^{i\theta}=\cos\theta+i\sin\theta$ or the related definition of the characteristic function for a random variable $X$: +\[ +\phi_X(t)=\mathbb E\left(e^{iX}\right). +\] +Expanding $e^{iX}$ as a power series gives an expression for $\phi_X$ that we can differentiate term by term. + +\vfil + +A smooth manifold consists of a topological space $M$ equipped with a smooth maximal atlas $\leftbrace \phi_i\rightbrace$. The maps $\phi_i\colon U_i\longrightarrow\mathbb R$ technically aren't themselves differentiable, but their compositions $\phi_i^{}\circ\phi_j^{-1}$ are diffeomorphisms on subsets of $\mathbb R^n$. If we have a map $f\colon M\longrightarrow N$ between manifolds, this structure allows us to talk about differentiability of $f$. Specifically, we say that $f$ is smooth if for any $i$ and $j$, the composition +\[ +\psi_j^{}\circ f\circ\phi_i^{-1} +\] +is itself smooth, where $\leftbrace\psi_i\rightbrace$ is a smooth atlas for $N$. Differentiating $f$ produces the associated tangent map $Df$. The function $Df$ maps the tangent space $TM$ to the tangent space $TN$ and is linear when restricted to individual tangent spaces $T_pM$. If $M$ can be written as a product $M_1\times M_2$, we can consider the partial tangent maps $\partial_1f$ and $\partial_2f$ by considering the compositions $f\circ\iota_1$ and $f\circ\iota_2$, where $\iota_1$ and $\iota_2$ are inclusion maps with respect to a particular point. Combining both maps, we have the equation +\[ +Df(u,v)=\partial_1f(u)+\partial_2f(v), +\] +and this relationship can be thought of as an adaption of the standard product rule. + +\end{document} +\endinput +%% +%% End of file `mathfont_example.tex'. diff --git a/Master/texmf-dist/doc/latex/mathfont/mathfont_greek.tex b/Master/texmf-dist/doc/latex/mathfont/mathfont_greek.tex index 12c710eeb17..0120697eaf1 100644 --- a/Master/texmf-dist/doc/latex/mathfont/mathfont_greek.tex +++ b/Master/texmf-dist/doc/latex/mathfont/mathfont_greek.tex @@ -17,16 +17,16 @@ %% 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 of the file mathfont.dtx, -%% the derived files mathfont.sty and mathfont_greek.tex, and -%% all other files created through the configuration process such as -%% mathfont.pdf, mathfont.idx, and mathfont.ind. For more +%% the derived files mathfont.sty, mathfont_greek.tex, and +%% mathfont_example.tex, and all other files created through the configuration +%% process such as mathfont.pdf, mathfont.idx, and mathfont.ind. For more %% information, see the original mathfont.dtx file. %% \documentclass[12pt]{article} \usepackage[margin=72.27pt]{geometry} \usepackage{booktabs} \usepackage{mathfont} -\mathfont[greekupper,greeklower=roman]{Symbola} +\mathfont{Symbola} \usepackage{shortvrb} \MakeShortVerb{|} \pagestyle{empty} diff --git a/Master/texmf-dist/source/latex/mathfont/mathfont.dtx b/Master/texmf-dist/source/latex/mathfont/mathfont.dtx index 0f39863b248..61c9a6ef4dd 100644 --- a/Master/texmf-dist/source/latex/mathfont/mathfont.dtx +++ b/Master/texmf-dist/source/latex/mathfont/mathfont.dtx @@ -16,9 +16,9 @@ % 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 of the file mathfont.dtx, -% the derived files mathfont.sty and mathfont_greek.tex, and -% all other files created through the configuration process such as -% mathfont.pdf, mathfont.idx, and mathfont.ind. +% the derived files mathfont.sty, mathfont_greek.tex, and +% mathfont_example.tex, and all other files created through the configuration +% process such as mathfont.pdf, mathfont.idx, and mathfont.ind. % % To install mathfont, run mathfont.dtx through LaTeX and move % the generated file mathfont.sty into a directory searchable by TeX. @@ -28,7 +28,7 @@ % \iffalse % % The installation and driver files are incorporated into mathfont.dtx, -% so we do not need to generate them saparately. The <batchfile> and +% so we do not need to generate them separately. The <batchfile> and % <driver> tags are for reference. % %<*batchfile> @@ -48,15 +48,16 @@ The most recent version of this license is available online at 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 of the file mathfont.dtx, -the derived files mathfont.sty and mathfont_greek.tex, and -all other files created through the configuration process such as -mathfont.pdf, mathfont.idx, and mathfont.ind. For more +the derived files mathfont.sty, mathfont_greek.tex, and +mathfont_example.tex, and all other files created through the configuration +process such as mathfont.pdf, mathfont.idx, and mathfont.ind. For more information, see the original mathfont.dtx file. \endpreamble \generate{ \file{mathfont.sty}{\from{mathfont.dtx}{package}} - \file{mathfont_greek.tex}{\from{mathfont.dtx}{greek}}} + \file{mathfont_greek.tex}{\from{mathfont.dtx}{greek}} + \file{mathfont_example.tex}{\from{mathfont.dtx}{example}}} \bgroup \catcode`\ =\active \def {\space} @@ -81,11 +82,13 @@ information, see the original mathfont.dtx file. \usepackage[factor=600,stretch=14,shrink=14,step=1]{microtype} \usepackage{booktabs} \usepackage{graphicx} +\usepackage{tabularx} \hyphenpenalty=10 \exhyphenpenalty=5 -\pretolerance=50 -\finalhyphendemerits=500 +\pretolerance=30 +\finalhyphendemerits=300 \c@IndexColumns=2 +\renewcommand\textfraction{0} \EnableCrossrefs \CodelineIndex \begin{document} @@ -97,7 +100,7 @@ information, see the original mathfont.dtx file. % % \fi % -% \CheckSum{2257} +% \CheckSum{2599} % % \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 @@ -116,15 +119,18 @@ information, see the original mathfont.dtx file. % Right brace \} Tilde \~} % \makeatletter % +% % \DoNotIndex{\NeedsTeXFormat,\ProvidesPackage,\DeclareOption,\ProcessOptions} -% \DoNotIndex{\def,\edef,\global,\let,\csname,\endcsname,\expandafter,\relax} -% \DoNotIndex{\newcount,\newif,\z@,\@ne,\ifx,\ifcat,\ifnum,\else,\fi,\noexpand} -% \DoNotIndex{\PackageInfo,\PackageWarning,\PackageError} -% \DoNotIndex{\space,\MessageBreak,\string,\define@x,\M@count} +% \DoNotIndex{\def,\edef,\global,\let,\csname,\endcsname,\expandafter,\relax,\advance} +% \DoNotIndex{\newcount,\newif,\z@,\@ne,\m@ne,\ifx,\ifcat,\ifnum,\ifmmode,\else,\fi} +% \DoNotIndex{\PackageInfo,\PackageWarning,\PackageError,\message,\@undefined} +% \DoNotIndex{\space,\MessageBreak,\string,\M@count,\count@,\noexpand,\protect} % \DoNotIndex{\@tempa,\@tempb,\@tempc,\@i,\@j,\@k,\count,\tw@,\@empty} -% \DoNotIndex{\do,\DeclareMathSymbol,\the,\mathalpha,\mathord} -%^^A \DoNotIndex{\M@lower,\M@upper,\M@greeklower,\M@greekupper,\M@digits} -% \DoNotIndex{\M@bb,\M@cal,\M@frak,\M@bcal,\M@bfrak} +% \DoNotIndex{\do,\DeclareMathSymbol,\the,\mathalpha,\mathord,\protect,\multiply} +% \DoNotIndex{\M@symbols,\mathop,\mathbin,\mathrel,\mathopen,\mathclose,\mathpunct} +% \DoNotIndex{\M@lower,\M@upper,\M@greeklower,\M@greekupper,\M@digits} +% \DoNotIndex{\M@bb,\M@cal,\M@frak,\M@bcal,\M@bfrak,\mathinner} +% \DoNotIndex{\DeclareRobustCommand,\joinrel,\smash} % \DoNotIndex{\M@bb@A,\M@bb@B,\M@bb@C,\M@bb@D,\M@bb@E,\M@bb@F} % \DoNotIndex{\M@bb@G,\M@bb@H,\M@bb@I,\M@bb@J,\M@bb@K,\M@bb@L} % \DoNotIndex{\M@bb@M,\M@bb@N,\M@bb@O,\M@bb@P,\M@bb@Q,\M@bb@R} @@ -173,6 +179,8 @@ information, see the original mathfont.dtx file. % \DoNotIndex{\M@bfrak@t,\M@bfrak@u,\M@bfrak@v,\M@bfrak@w,\M@bfrak@x} % \DoNotIndex{\M@bfrak@y,\M@bfrak@z} % +% +% % \newenvironment{code} % {\strut\vadjust\bgroup\medskip\parindent=4em\relax\indent\strut\ignorespaces} % {\strut\par\medskip\egroup\hfill\break\strut\ignorespacesafterend} @@ -187,57 +195,58 @@ information, see the original mathfont.dtx file. % \renewcommand\topfraction{0.9} % % {\large -% \centerline{\Large Package \textsf{mathfont} v.\ 1.2 Documentation}\par +% \centerline{\Large Package \textsf{mathfont} v.\ 1.3 Documentation}\par % \centerline{Conrad Kosowsky}\par -% \centerline{August 2018}\par +% \centerline{January 2019}\par % \centerline{\ttfamily kosowsky.latex@gmail.com}\par} % % \bigskip % % \begin{abstract} -% The \textsf{mathfont} package provides a flexible interface for changing the font of math mode characters. The package allows the user to specify a default unicode font for each of six basic classes of Latin and Greek characters, and it provides additional support for unicode alphanumeric symbols. Crucially, \textsf{mathfont} is compatible with both Lua\LaTeX\ and \XeLaTeX, and it provides several font-loading commands that allow the user to change fonts locally or for individual symbols within math mode. +% The \textsf{mathfont} package provides a flexible interface for changing the font of math mode characters. The package allows the user to specify a default unicode font for each of six basic classes of Latin and Greek characters, and it provides additional support for unicode math and alphanumeric symbols. Crucially, \textsf{mathfont} is compatible with both Lua\LaTeX\ and \XeLaTeX, and it provides several font-loading commands that allow the user to change fonts locally or for individual characters within math mode. % \end{abstract} % -% Handling fonts in \TeX\ and \LaTeX\ is a notoriously difficult task. The \TeX\ engine originally supported only fonts designed with Donald Knuth's Metafont, and while subsequent versions of \TeX\ extended this functionality to postscript fonts, Plain \TeX's font-loading capabilities remain limited. Many, if not most, \LaTeX\ users are unfamiliar with the |.fd| files that must be used in font declaration, and the minutiae of \TeX's |\font| primitive can be esoteric and confusing. \LaTeXe's New Font Selection System (\textsc{nfss}) implemented a straightforward syntax for loading and managing fonts, but \LaTeX\ macros overlaying a \TeX\ core face the same versatility issues as Plain \TeX\ itself. Fonts in math mode present a double challenge: even if the user successfully loads a font either in Plain \TeX\ or through the \textsc{nfss}, defining math symbols can be unintuitive for users who are unfamiliar with \TeX's |\mathcode| primitive. Again, \LaTeXe\ simplifies much of the coding challenges with its |\DeclareMathSymbol| macro, but the fundamental aspects of the task remain the same. +% Handling fonts in \TeX\ and \LaTeX\ is a notoriously difficult task. The \TeX\ engine originally supported only fonts designed with Donald Knuth's Metafont, and while subsequent versions of \TeX\ extended this functionality to postscript fonts, Plain \TeX's font-loading capabilities remain limited. Many, if not most, \LaTeX\ users are unfamiliar with the |.fd| files that must be used in font declaration, and the minutiae of \TeX's |\font| primitive can be esoteric and confusing. \LaTeXe's New Font Selection System (\textsc{nfss}) implemented a straightforward syntax for loading and managing fonts, but \LaTeX\ macros overlaying a \TeX\ core face the same versatility issues as Plain \TeX\ itself. Fonts in math mode present a double challenge: even if the user successfully loads a font either in Plain \TeX\ or through the \textsc{nfss}, defining math symbols can be unintuitive for users who are unfamiliar with \TeX's |\mathcode| primitive. Again, \LaTeXe\ simplifies much of the coding challenges with its |\DeclareMathSymbol| macro, but from the computer's perspective, the fundamental aspects of the task remain the same. % -% More recent engines such as Jonathan Kew's \XeTeX\ and Hans Hagen, et al.'s Lua\TeX\ significantly extend the font-loading capabilities of \TeX. Both support TrueType and OpenType font formats and provide many additional primitives for managing fonts. The \textsf{fontspec} package by Will Robertson and Khaled Hosny acts as a front-end for the font management built into these two engines. It allows users to easily load new fonts and transition between those ones already in memory, and users who are interested in changing text fonts should consult the documentation for that package. Notably, \textsf{fontspec} provides users with the tools to manually adjust OpenType features of the fonts they load, so the package gives equivalent or in some cases superior font management capabilities to a modern WYSIWYG word processor. (Of course, the efficiency depends on the skill of the \LaTeX\ user.) In situations where a font's OpenType features are unclear or difficult to access, \textsf{fontspec}'s typographical advantages can significantly outweigh the accessibility of a word processor. -% -% \section*{Basic Functionality} +% More recent engines such as Jonathan Kew's \XeTeX\ and Hans Hagen, et al.'s Lua\TeX\ significantly extend the font-loading capabilities of \TeX.\footnote{Information on \XeTeX\ is available at \texttt{https://tug.org/xetex/}, and information on Lua\TeX\ is available at the official website for Lua\TeX: \texttt{http://www.luatex.org/}.} Both support TrueType and OpenType font formats and provide many additional primitives for managing fonts. The \textsf{fontspec} package by Will Robertson and Khaled Hosny acts as a front-end for the font management built into these two engines.\footnote{Will Robertson and Khaled Hosny, ``\textsf{fontspec}---Advanced font selection in \XeLaTeX\ and Lua\LaTeX,'' \texttt{https://ctan.org/pkg/fontspec}.} It allows users to easily load new fonts and transition between those ones already in memory, and users who are interested in changing text fonts should consult the documentation for that package. Notably, \textsf{fontspec} provides users with the tools to manually adjust OpenType features of the fonts they load, so the package gives equivalent or in some cases superior font management capabilities to a modern WYSIWYG word processor. (Of course, the efficiency depends on the skill of the \LaTeX\ user.) In situations where a font's OpenType features are unclear or difficult to access, \textsf{fontspec}'s typographical advantages can significantly outweigh the accessibility of a word processor. +% +% This document is organized as follows. Section~1 presents the basic functionality and related packages. The following two sections explain how to use the default and local font-change commands, and users in a hurry will find the most important information here. Sections~4 and 5 discuss the Greek characters and mathematical symbols that \textsf{mathfont} provides, and section~6 describes the more complicated error messages that \textsf{mathfont} may throw. The remaining five sections detail the implementation. Section~7 lays out the initial implementation for the package, and sections~8 and 9 deal again with default and local font changes, respectively. The following section covers the code for the unicode alphanumeric letterlike symbols, and the final section~11 contains the unicode hex values for every character supported by \textsf{mathfont}. For an example of the package in action, see |mathfont_example.pdf|, which is included with the \textsf{mathfont} installation and available on \textsc{ctan}. % -% The \textsf{mathfont} package uses \textsf{fontspec} as a back end to load fonts for use in math mode, and it provides two ways to do this: (1) changing the default font for certain classes of math mode characters; and (2) defining new commands that change the font locally for the so-called ``math alphabet'' characters. (The math alphabet characters are all Latin letters, all Arabic numerals, and any Greek letters that \textsf{mathfont} has set the font for.) The package can change the math font for Latin and Greek letters, Arabic numerals, and unicode alphanumeric symbols to any unicode OpenType or TrueType font. Tables~1 and 2 display the individual classes of characters that \textsf{mathfont}'s default font-change command acts on, and currently, \textsf{mathfont} does not support font changes for any mathematical symbols beyond those in both tables, although it does provide control sequences to typeset several ancient Greek characters that are typically unavailable. +% \section{Basic Functionality} % -% The package can be loaded with the standard |\usepackage| syntax. The only valid option for \textsf{mathfont} is ``|packages|,'' and this option determines when \textsf{mathfont} resets two \LaTeX\ internal commands used in declaring math characters. During loading, \textsf{mathfont} redefines two \LaTeX\ internal macros so that \LaTeX\ can declare math symbols from unicode fonts. The |\mathfont| command works only with these redefinitions, and the package will issue an error if the user calls the command without them. If the user loads the package without the |packages| option, \textsf{mathfont} will reset these two \LaTeX\ kernel macros just before the user loads another package, and at that point, the user will not be able to call the |\mathfont| control sequence any more. The advantage of this behavior is that it makes \textsf{mathfont} less likely to disturb the functionality of other packages, particularly those that define any math symbols. With |packages|, \textsf{mathfont} does nto reset the kernel automatically, so users can call |\mathfont| any time in the document preamble. The command |\restoremathinternals| manually restores the kernal, and users who load \textsf{mathfont} without |packages| should use this command to avoid clashes with other packages. In any event, it is best practice to include all |\mathfont| commands immediately after loading the package. +% The \textsf{mathfont} package uses \textsf{fontspec} as a back end to load fonts for use in math mode, and it provides two ways to do this: (1) changing the default font for certain classes of math mode characters; and (2) defining new commands that change the font locally for the so-called ``math alphabet'' characters. (The math alphabet characters are all Latin letters, all Arabic numerals, and any Greek letters that \textsf{mathfont} has set the font for.) The package can change the default math font for Latin and Greek letters, Arabic numerals, and unicode alphanumeric symbols to any unicode OpenType or TrueType font. Tables~1 and 2 display the specific classes of characters that \textsf{mathfont}'s default font-change command acts on. % -% The functionality of \textsf{mathfont} is most closely related to that of the \textsf{mathspec} package by Andrew Gilbert Moschou. These two packages incorporate the use of individual unicode characters into math mode, and their symbol declaration process is similar. Both use \textsf{fontspec} as a back end. Both create font-changing commands for math mode characters. However, the functionality differs in two crucial respects: \textsf{mathfont} is compatible with Lua\LaTeX, and its local math-font-changing mechanisms provide a slightly greater level of flexibility than what users can achieve with \textsf{mathspec}. Further, as far as I am aware, this package is the first to provide robust support for the unicode alphanumeric symbols listed in Table~2, even in the context of fonts without built-in math support. (Please let me know if this is incorrect!) In this way \textsf{mathfont}, like \textsf{mathspec}, is significantly more versatile than the \textsf{unicode-math} package, although its impact is less far-reaching. Unlike the \textsf{mathastext} package, \textsf{mathfont} preserves \TeX's traditional mathematics spacing. +% The package can be loaded with the standard |\usepackage| syntax, and it has three optional arguments: \texttt{packages}, \texttt{operators}, and \texttt{no-operators}. During loading, \textsf{mathfont} redefines two \LaTeX\ internal macros to make symbol declaration compatible with unicode fonts, and the |packages| option determines when \textsf{mathfont} resets the two internal commands. If the user loads the package without the |packages| option, \textsf{mathfont} will reset the internal commands at the next |\usepackage| declaration, but with the argument, \textsf{mathfont} does not reset them at all. In practice, using this option should be harmless in most situations, and the issue is primarily one of convenience. The |\mathfont| command works only with these redefinitions, so once the package has reset the \LaTeX\ kernel, it will not adjust the default font for any class of characters. Thus the \texttt{packages} option allows users to sprinkle |\mathfont| declarations throughout their preamble, and doing so may be advantageous depending on the situation. However, leaving the kernel modified could induce clashes with other packages, so proceed at your own risk! For users who provided the \texttt{packages} argument or are loading packages before the |\documentclass| declaration, the control sequence |\restoremathinternals| manually returns the internal commands to their default definitions. It should be considered best practice to load \textsf{mathfont} without \texttt{packages} and put all |\mathfont| commands as soon after loading the package as possible. +% +% The package arguments \texttt{operators} and \texttt{no-operators} determine \textsf{mathfont}'s behavior regarding the integral, summation, and product signs. The \texttt{operators} argument tells the package to adjust the font for these three symbols, and the \texttt{no-operators} argument does the opposite. By default, the package executes the \texttt{operators} option, but users may want to disable this behavior depending on the desired math font and other symbols being used. See sections~2 and 5 for more information. % -% The package loads \textsf{fontspec} with the ``|no-math|'' option if and only if the user has not already loaded \textsf{fontspec}. Users who want \textsf{fontspec} without |no-math| or with other options in place should manually load it before requiring \textsf{mathfont}. It is strongly recommended that users who manually load \textsf{fontspec} do so with the |no-math| option. Alternatively, users who want to pass options to \textsf{fontspec} without having to load it themselves can use \LaTeX's |\PassOptionsToPackage| command. +% The package loads \textsf{fontspec} with the ``|no-math|'' option if and only if the user has not already loaded \textsf{fontspec}. Users who want \textsf{fontspec} without |no-math| or with other options in place should manually load it before requiring \textsf{mathfont}, and I strongly recommend that users who do so load \textsf{fontspec} with the |no-math| option. Alternatively, users who want to pass options to \textsf{fontspec} without loading it themselves can use \LaTeX's |\PassOptionsToPackage| command. % -% Compatibility with Lua\LaTeX\ comes at the expense of \textsf{mathspec}'s convenient space-adjustment character |"|, so spacing-conscientious users should either manually add |\kern| or |\muskip| to their equations or redefine an active version of |"|. For example, the code +% Compatibility with Lua\LaTeX\ comes at the expense of \textsf{mathspec}'s convenient space-adjustment character |"|, and spacing-conscientious users can either manually add |\kern| or |\muskip| to their equations or redefine an active version of |"|.\footnote{The problem isn't one of ability---Lua\TeX's programming capabilities tend to outweigh those of \XeTeX. Rather, I'm unfamiliar with most of the workings of Lua\TeX. One of my eventual goals for this package is a Lua script that could automatically adjust spacing in math mode for any combination of two characters, but I don't know if or when I will be able to do that.} For example, the code % \begin{code} % \begingroup\obeylines|\catcode`\"=\active| % |\def"#1{\ifmmode| -% | \kern|\argtext{dimension}| #1\kern|\argtext{other dimension} +% | \kern|\argtext{dimension}|\relax #1\kern|\argtext{other dimension}|\relax| % | \else| % | \char`\"%| % | \fi}|\endgroup % \end{code} -% will serve as a hack that very roughly approximates \textsf{mathspec}'s |"|. This code will redefine |"| to typeset a right double quotation mark in horizontal mode, but in math mode, the character will insert \textit{dimension} and \textit{other dimension} of white space on either side respectively of the following character. More advanced users can automate the dimensions by using \TeX's |\if| conditional to test whether the following character needs a particular spacing adjustment. (For example, Computer Modern's math-mode $f$ is notorious for being significantly wider than its italic counterpart.) Future versions of \textsf{mathfont} may provide an automated space-adjustment command, but it is not a priority. +% will serve as a hack that very roughly approximates \textsf{mathspec}'s |"|. This code will redefine |"| to typeset a right double quotation mark in horizontal mode, but in math mode, the character will insert \textit{dimension} and \textit{other dimension} of white space on either side respectively of the following character. More advanced users can automate the dimensions by using \TeX's |\if| conditional to test whether the following character needs a particular spacing adjustment. (For example, Computer Modern's math-mode $f$ is notorious for being significantly wider than its italic counterpart.) Future versions of \textsf{mathfont} may provide an automated space-adjustment command, but it is not one of my priorities. % -% \section*{Setting the Default Font} +% The functionality of \textsf{mathfont} is most closely related to that of the \textsf{mathspec} package by Andrew Gilbert Moschou.\footnote{Andrew Gilbert Moschou, ``\textsf{mathspec}---Specify arbitrary fonts for mathematics in \XeTeX,''\hfil\break\texttt{https://ctan.org/pkg/mathspec}.} These two packages incorporate the use of individual unicode characters into math mode, and their symbol declaration process is similar. Both use \textsf{fontspec} as a back end, and both create font-changing commands for math mode characters. However, the functionality differs in three crucial respects: \textsf{mathfont} is compatible with Lua\LaTeX; it can adjust the font of basic mathematical symbols; and its local math-font-changing mechanisms provide a slightly greater level of flexibility than what users can achieve with \textsf{mathspec}. Further, as far as I am aware, this package is the first to provide support for the unicode alphanumeric symbols listed in Table~2, even in the context of fonts without built-in math support. (Please let me know if this is incorrect!) In this way \textsf{mathfont}, like \textsf{mathspec}, is more versatile than the \textsf{unicode-math} package, although potentially less far-reaching.\footnote{Will Robertson, ``\textsf{unicode-math}---Unicode mathematics support for \XeTeX\ and Lua\TeX,''\hfil\break\texttt{https://ctan.org/pkg/unicode-math}.} +% +% Users who want to stick with pdf\LaTeX\ should consider Jean-Fran\c cois Burnol's \textsf{mathastext} as a useful alternative to \textsf{mathfont}.\footnote{Jean-Fran\c cois Burnol, ``\textsf{mathastext}---Use the text font in maths mode,''\hfil\break\texttt{https://ctan.org/pkg/mathastext}. In several previous versions of this documentation, I mistakenly stated that \textsf{mathastext} distorts \TeX's internal mathematics spacing. In fact the opposite is true: \textsf{mathastext} goes to significant lengths to preserve and even extend rules for space between various math-mode characters.} This package allows the user to specify the math-mode font for a large subset of the ASCII characters and is the most closely related package to \textsf{mathfont} among those packages designed specifically for the \LaTeX\ kernel in conjunction with Plain \TeX. Whereas \textsf{mathfont} works exclusively in the context of unicode fonts, \textsf{mathastext} was designed for the T1 and related encodings of Plain \TeX\ and \LaTeX, and \textsf{mathfont} provides support for a larger class of symbols. However, the \textsf{mathastext} functionality extends beyond that of \textsf{mathfont} in two notable aspects: (1) \textsf{mathastext} makes use of math versions, extra spacing, and italic corrections; and (2) \textsf{mathastext} allows users to change the font for the twenty-five non-alphanumeric characters supported by that package multiple times. After setting the default font, \textsf{mathfont} allows users to change it for only Latin, Greek, and digit characters. +% +% \section{Setting the Default Font} % % The |\mathfont| command sets the default font for certain classes of characters, and it can be called any number of times in the document preamble. Its structure is % \begin{code} % |\mathfont[|\argtext{optional character classes}|]{|\argtext{font name}|}|, % \end{code} -% where the \textit{optional character classes} can be any set of keywords from Table~1 or Table~2, and the \textit{font name} can be any OpenType or TrueType font in a directory searchable by \TeX. Specifically, \textsf{fontspec} must be able to recognize and load the font specified in the mandatory argument of |\mathfont|. Advanced users will note that |\mathfont| uses the |\fontspec_set_family:Nnn| command and therefore loads fonts in the same way as all the |\fontspec| and related macros from that package. Currently, \textsf{mathfont} does not support the use of OpenType features in math mode. -% -% The user should specify any keyword optional arguments for |\mathfont| as entries in a comma-separated list. The order is irrelevant, and for each item in the list, the package will change the math font for that class of characters to the font specified in the mandatory argument. If the user does not specify an optional argument for |\mathfont|, the macro will insert all keywords from Table~1 as the optional argument. By default, \textsf{mathfont} will use either an upright or italic shape corresponding to each character-class keyword, but the user can override this setting by writing an equals sign next to the keyword and a shape suboption---either ``|roman|'' or ``|italic|''---following that. Table~1 contains the default shapes for the keywords listed there, while the default shape for all classes of characters in Table~2 is upright. The package interprets the |roman| suboption as specifying an upright shape---normal shape in the language of the \textsc{nfss}---and the |italic| suboption as specifying an italic shape. Currently \textsf{mathfont} does not support default font shapes beyond these two. For example, the command -% \begin{code} -% |\mathfont[upper=roman,lower=roman]{Times New Roman}| -% \end{code} -% would change all math-mode Latin letters to Times New Roman with upright shape. The optional argument for |\mathfont| should not contain any spaces because \textsf{mathfont} will not be able to parse the text correctly, and if the user mistakenly includes a space after a comma or around an equals sign, the package will issue an ``Invalid option" error. Future versions of \textsf{mathfont} may address this limitation, but it is not a priority. Users should be aware that, in order to limit the number of symbol fonts in memory, |\mathfont| will not change the default font for a class of symbols once it has already done so. +% where the \textit{optional character classes} can be any set of keywords from Tables~1 and 2, and the \textit{font name} can be any OpenType or TrueType font in a directory searchable by \TeX. If the user does not specify any optional argument for |\mathfont|, the macro will take all keywords from Table~1 and the |symbols| keyword from Table~2 as the optional argument. When specifying the \textit{font name}, users need to input a name that \textsf{fontspec} will recognize and be able to load. Advanced users will note that |\mathfont| uses |\fontspec_set_family:Nnn| and therefore loads fonts in the same way as |\fontspec| and related macros from that package. Currently, \textsf{mathfont} does not support OpenType features in math mode. +% % -% \begin{figure} +% \begin{figure}[ht] % \centering % Table~1: Math Alphabet Characters\par\penalty\@M\smallskip % \begin{tabular}{lll} @@ -253,24 +262,25 @@ information, see the original mathfont.dtx file. % \bottomrule % \end{tabular} % \end{figure} -% -% The Unicode Consortium designates the Mathematical Alphanumeric Symbols (U+1D400--U+1D7FF) code block for several classes of letters and letterlike symbols that appear frequently in math writing. The \textsf{mathfont} package provides easy access to these symbols through the |\mathfont| command, and Table~2 lists the corresponding keywords that should be used with |\mathfont| to do so. When the user calls |\mathfont| with a keyword from Table~2 in its optional argument, \textsf{mathfont} both declares the appropriate unicode characters as math symbols and defines the macro -% \begin{code} -% |\math|\argtext{keyword}|{|\argtext{argument}|}|. -% \end{code} -% The control sequence takes one argument, and it converts the characters in its argument into the corresponding style. For example, +% +% The user should specify any keyword optional arguments for |\mathfont| as entries in a comma-separated list. The order is irrelevant, and for each item in the list, the package will change the math font for that class of characters to the font specified in the mandatory argument. If the user does not specify an optional argument for |\mathfont|, e.g.\ writes +% \begin{code} +% |\mathfont{Helvetica}|, +% \end{code} +% the package will change all math-mode Latin characters, Greek characters, digits, operators such as $\log$ or $\sin$, and all symbols from Tables~5 and 6 to the font in the mandatory argument. In this example, that would be Helvetica. By default, \textsf{mathfont} will use either an upright or italic shape corresponding to each character-class keyword, but the user can override this setting by writing an equals sign next to the keyword and a shape suboption---either ``|roman|'' or ``|italic|''---following that. Table~1 contains the default shapes for the keywords listed there, while the default shape for all classes of characters in Table~2 is upright. The package interprets the |roman| suboption as specifying an upright shape---normal shape in the language of the \textsc{nfss}---and the |italic| suboption as specifying an italic shape. Currently \textsf{mathfont} does not support default font shapes beyond these two. For example, the command % \begin{code} -% |\mathfont[bcal]{STIXGeneral}| +% |\mathfont[upper=roman,lower=roman]{Times New Roman}| % \end{code} -% will set STIXGeneral as the font for bold caligraphic characters and define the command |\mathbcal| to access them in math mode. The argument of the macro produced this way must be a single string of Latin letters without braces or control sequences, although in somewhat idiosyncratic fashion, the |\mathbb| command can also accept Arabic numerals in its argument. Spaces and any character of catcode 12 will be ignored. -% -% \begin{figure}[h] +% would change all math-mode Latin letters to Times New Roman with upright shape. The optional argument for |\mathfont| should not contain any spaces because \textsf{mathfont} will not be able to parse the text correctly, and if the user mistakenly includes a space after a comma or around an equals sign, the package will issue an ``Invalid option" error. Future versions of \textsf{mathfont} may address this limitation, but it is not a priority. Users should be aware that, in order to limit the number of symbol fonts in memory, |\mathfont| will not change the default font for a class of symbols once it has already done so. +% +% \begin{figure}[t] % \centering -% Table~2: Alphanumeric Symbols\par\penalty\@M\smallskip +% Table~2: Other Math Symbols\par\penalty\@M\smallskip % \begin{tabular}{ll} % \toprule % Keyword & Meaning\\ % \midrule +% |symbols| & Basic mathematical symbols\\ % |bb| & Blackboard Bold (Double-struck)\\ % |cal| & Caligraphic\\ % |frak| & Fraktur\\ @@ -280,11 +290,21 @@ information, see the original mathfont.dtx file. % \end{tabular} % \end{figure} % -% Because these commands can handle capital and minuscule Latin letters, the \textsf{mathfont} package significantly extends the functionality of \TeX's standard |\mathcal| command and the |\mathbb| command from the \textsf{amssymb} package. Users should note that typesetting symbols from a class of characters in Table~2 will require a unicode font that actually contains those characters, such as Symbola or STIXGeneral. That being said, users who need only a few alphanumeric symbols may be able to use a less specialized font that contains for example the characters from the Letterlike Symbols (U+2100--U+214F) code block. This block contains the blackboard bold versions of C, N, Q, R, and Z, and the fonts providing these characters are significantly more common than those that contain the full blackboard bold alphabet. +% The Unicode Consortium designates the Mathematical Alphanumeric Symbols (U+1D400--U+1D7FF) code block for several classes of letters and letterlike symbols that appear frequently in mathematical writing. The \textsf{mathfont} package provides easy access to these symbols through the |\mathfont| command, and Table~2 lists the corresponding keywords that should be used with |\mathfont| to do so. When the user calls |\mathfont| with any of the last five keywords from Table~2 in its optional argument, \textsf{mathfont} both declares the appropriate unicode characters as math symbols and defines the macro +% \begin{code} +% |\math|\argtext{keyword}|{|\argtext{argument}|}|. +% \end{code} +% This control sequence takes one argument, and it converts the characters in its argument into the corresponding style. For example, +% \begin{code} +% |\mathfont[bcal]{STIXGeneral}| +% \end{code} +% will set STIXGeneral as the font for bold caligraphic characters and define the command |\mathbcal| to access them in math mode. The argument of the macro produced this way must be a single string of Latin letters without braces or control sequences, although in somewhat idiosyncratic fashion, the |\mathbb| command can also accept Arabic numerals in its argument. Spaces and any character of catcode 12 will be ignored. +% +% Because these commands can handle capital and minuscule Latin letters, the \textsf{mathfont} package significantly extends the functionality of \TeX's standard |\mathcal| command and the |\mathbb| command from the \textsf{amssymb} package. Users should note that typesetting symbols from a letterlike class of characters in Table~2 will require a unicode font that actually contains those characters, such as Symbola or STIXGeneral. That being said, users who need only a few alphanumeric symbols may be able to use a less specialized font that contains for example the characters from the Letterlike Symbols (U+2100--U+214F) code block. This block contains the blackboard bold versions of C, N, Q, R, and Z, and the fonts providing these characters are significantly more common than those that contain the full blackboard bold alphabet. % -% \section*{Local Font Changes} +% \section{Local Font Changes} % -% With \textsf{mathfont}, users can locally change the font in math mode by creating a new control sequence for each new font desired. The commands created this way function analogously to the standard math font macros from the \LaTeX\ kernel such as |\mathrm|, |\mathit|, and |\mathnormal|. The package includes four basic commands to produce these new control sequences. Table~3 lays them out, and they all have the same argument structure. As an example, the macro |\newmathrm| looks like +% With \textsf{mathfont}, users can locally change the font in math mode by creating a new control sequence for each new font desired. The commands created this way function analogously to the standard math font macros from the \LaTeX\ kernel such as |\mathrm|, |\mathit|, and |\mathnormal|, and the package includes four basic commands to produce new control sequences. Table~3 lists these commands, and they all have the same argument structure: a control sequence as the first mandatory argument and a font name as the second. For example, the macro |\newmathrm| looks like % \begin{code} % |\newmathrm{|\argtext{control sequence}|}{|\argtext{font name}|}|. % \end{code} @@ -296,7 +316,9 @@ information, see the original mathfont.dtx file. % \begin{code} % |\matharial{|\argtext{argument}|}|, % \end{code} -% which can be used only in math mode and which converts the math alphabet characters in its \textit{argument} into the Arial font with upright shape and medium weight. The other three commands in Table~3 function in the same way except that they select different series or shape values for the font in question, and Table~3 lists this information. If the user specifies the font for Greek letters using |\mathfont|, the macros created with the commands from Table~3 will affect those characters; otherwise, they will not. \LaTeXe\ does not define Greek letters as math alphabet characters, and this switch to being math alphabet characters occurs only during a font change due to |\mathfont|. More specifically, \textsf{mathfont} defines Greek characters as |\mathalpha| type when it declares them as symbols. If the user doesn't change the |greekupper| or |greeklower| characters in a |\mathfont| command, the package won't change any Greek characters, and they will still be typeset as |\mathord| characters in Computer Modern (or potentially Latin Modern). In such a situation, any |\newmathfontcommand| or related macro will not be able to adjust Greek characters' font. +% which can be used only in math mode and which converts the math alphabet characters in its \textit{argument} into the Arial font with upright shape and medium weight. The other three commands in Table~3 function in the same way except that they select different series or shape values for the font in question, and Table~3 lists this information. +% +% Unlike the traditional |\mathrm| and company, \textsf{mathfont}'s local font change commands create macros that can act on Greek characters. If the user specifies the font for Greek letters using |\mathfont|, macros created with the commands from Table~3 will affect those characters; otherwise, they will not. Specifically, \LaTeXe\ defines Greek letters as |\mathord| characters, and \textsf{mathfont} changes this classification to |\mathalpha| type when it declares them as symbols. The local font change commands here act only on characters of class |\mathalpha|, so if the user doesn't set the font for |greekupper| or |greeklower| characters in a |\mathfont| command, any macro from this section will not be able to act on any Greek letters. Instead, they will still be typeset as |\mathord| characters in Computer Modern. % % \begin{figure} % \centering @@ -317,20 +339,18 @@ information, see the original mathfont.dtx file. % \begin{code} % |\newmathfontcommand{|\argtext{control sequence}|}{|\argtext{font name}|}{|\argtext{series}|}{|\argtext{shape}|}|, % \end{code} -% where the font name again means any OpenType or TrueType font in a directory searchable by \TeX. The series and shape information refers to the \textsc{nfss} codes for these attributes, and the control sequence in the first argument becomes the command that allows the user to access the specified font. Advanced users will note that these five macros are essentially wrapped versions of \LaTeX's |\DeclareMathAlphabet|, so like |\mathfont|, they must be used in the document preamble. -% -% \section*{Greek Characters} +% where the font name again means any OpenType or TrueType font in a directory searchable by \TeX. The series and shape information refers to the \textsc{nfss} codes for these attributes, and the control sequence in the first argument becomes the command that allows the user to access the specified font. Advanced users will note that these five macros are essentially wrapped versions of \LaTeX's |\DeclareMathAlphabet|, and like |\mathfont|, they must be used in the document preamble. % -% Unlike Plain \TeX\ and \LaTeXe, \textsf{mathfont} defines control sequences for all characters in the Greek alphabet. (\TeX's OT encodings do not include the captial Greek characters that resemble Latin letters. Presumably Donald Knuth made this decision to conserve encoding slots.) All such control sequences instruct \LaTeX\ to typeset the corresponding unicode Greek character, and \textsf{mathfont} also provides control sequences for several ancient Greek letters. Table~4 lists all Greek character control sequences provided by \textsf{mathfont}. I do not include typeset versions of these characters in this documentation because I wanted to avoid potential problems with users being unable to compile \texttt{mathfont.dtx} properly. However, see the file \texttt{mathfont\char`\_greek.pdf}, which is included with the \textsf{mathfont} installation and is available on \textsc{ctan}. +% \section{Greek Characters} % -% \begin{figure}[t] +% \begin{figure}[ht] % \centering % Table 4: Greek Character Control Sequences\par\penalty\@M\smallskip -% \begin{tabular}{llll} +% \begin{tabularx}{\textwidth}{XXXX} % \toprule % \multicolumn{2}{c}{Modern Greek Characters} & \multicolumn{2}{c}{Ancient Greek Characters}\\ % \cmidrule(r{3pt}){1-2}\cmidrule(l{3pt}){3-4} -% \hbox to 7em{Capital\hfil} & \hbox to 7em{Minuscule\hfil} & \hbox to 7em{Capital\hfil} & \hbox to 7em{Minuscule\hfil}\\ +% Capital & Minuscule & Capital & Minuscule\\ % \midrule % |\Alpha| & |\alpha| & |\Heta| & |\heta| \\ % |\Beta| & |\beta| & |\Sampi| & |\sampi| \\ @@ -363,29 +383,93 @@ information, see the original mathfont.dtx file. % & |\varsigma| & & \\ % & |\varphi| & & \\ % \bottomrule -% \end{tabular} +% \end{tabularx} % \end{figure} % -% \section*{Handling Errors} +% Unlike Plain \TeX\ and \LaTeXe, \textsf{mathfont} defines control sequences for all characters in the Greek alphabet. (\TeX's OT encodings do not include the capital Greek characters that resemble Latin letters. Presumably Donald Knuth made this decision to conserve encoding slots.) All such control sequences instruct \LaTeX\ to typeset the corresponding unicode Greek character, and \textsf{mathfont} also provides control sequences for several ancient Greek letters. This package's additional Greek character control sequences will become available once the user calls |\mathfont| for the corresponding class of Greek characters. Table~4 lists all such control sequences. I do not include typeset versions of these characters in this documentation because I wanted to avoid potential compilation problems regarding \texttt{mathfont.dtx}. However, see the file \texttt{mathfont\char`\_greek.pdf}, which is included with the \textsf{mathfont} installation and is available on \textsc{ctan}. As with the unicode letterlike symbols, not all fonts contain ancient Greek or even modern Greek characters, and setting \texttt{greekupper} and \texttt{greeklower} to a font without these symbols will produce a document with missing characters. +% +% \section{Math Symbols} +% +% \begin{figure}[ht] +% \centering +% Table 5: Characters Corresponding to the |symbols| Keyword\par\penalty\@M\smallskip +% \begin{tabularx}{\textwidth}{Xp{9em}XXX} +% \toprule +% Character & Control Sequence & Class & Punctuation & Class \\\cmidrule(r{4pt}){1-3}\cmidrule(l{4pt}){4-5} +% $\#$ & |\#| & |\mathord| & |.| & |\mathord|\\ +% $\$$ & |\$| & |\mathord| & |@| & |\mathord|\\ +% $\%$ & |\%| & |\mathord| & \texttt{\string|} & |\mathord|\\ +% $\&$ & |\&| & |\mathord| & |'| & |\mathord|\\ +% $\P$ & |\P| & |\mathord| & |"| & |\mathord|\\ +% $\S$ & |\S| & |\mathord| & |+| & |\mathbin|\\ +% $\pounds$ & |\pounds| & |\mathord| & |-| & |\mathbin|\\ +% $\neg$ & |\neg| & |\mathord| & |*| & |\mathbin|\\ +% $\infty$ & |\infty| & |\mathord| & |/| & |\mathbin|\\ +% $\partial$ & |\partial| & |\mathord| & |=| & |\mathrel|\\ +% $\Delta$ & |\Delta| & |\mathord| & |<| & |\mathrel|\\ +% $\sum$* & |\sum| & |\mathop| & |>| & |\mathrel|\\ +% $\prod$* & |\prod| & |\mathop| & |:| & |\mathrel|\\ +% $\int$* & |\int| & |\mathop| & |(| & |\mathopen|\\ +% $\times$ & |\times| & |\mathbin| & |)| & |\mathclose|\\ +% $\div$ & |\div| & |\mathbin| & |[| & |\mathopen|\\ +% $\pm$ & |\pm| & |\mathbin| & |]| & |\mathclose|\\ +% $\cdot$ & |\cdot| & |\mathbin| & |!| & |\mathclose|\\ +% $\bullet$ & |\bullet| & |\mathbin| & |?| & |\mathclose|\\ +% $\dagger$ & |\dag| & |\mathbin| & |,| & |\mathpunct|\\ +% $\ddagger$ & |\ddag| & |\mathbin| & |;| & |\mathpunct|\\ +% $\setminus$ & |\setminus| & |\mathbin| & & \\ +% $\leq$ & |\leq| & |\mathrel| & & \\ +% $\geq$ & |\geq| & |\mathrel| & & \\ +% $\sim$ & |\sim| & |\mathrel| & & \\ +% $\approx$ & |\approx| & |\mathrel| & & \\ +% $\equiv$ & |\equiv| & |\mathrel| & & \\ +% $\mid$ & |\mid| & |\mathrel| & & \\ +% $\parallel$ & |\parallel| & |\mathrel| & &\\ +% $\colon$ & |\colon| & |\mathpunct| & & \\ +% $\dots$ & |\dots| & |\mathinner| & & \\\bottomrule +% \end{tabularx} +% \par\penalty\@M\smallskip +% \hbox to \hsize{\strut*If the package option |operators| is enabled.\hfill} +% \end{figure} +% +% \begin{figure}[b] +% \centering +% Table 6: Extra Macros Created with the |symbols| Keyword\par\penalty\@M\smallskip +% \begin{tabularx}{\textwidth}{XllXll} +% \toprule +% Character & Control Sequence & Class & Character & Control Sequence & Class\\\cmidrule(r{4pt}){1-3}\cmidrule(l{4pt}){4-6} +% $\backslash$ & |\mathbackslash| & |\mathord| & $\{$ & |\leftbrace| & |\mathopen|\\ +% $^\circ$ & |\degree| & |\mathord| & $\}$ & |\rightbrace| & |\mathclose|\\\bottomrule +% \end{tabularx} +% \end{figure} +% +% +% +% With the |symbols| keyword, the |\mathfont| command will change the default math-mode font for all characters in Table~5. For the control sequences on the left half of the table that function in both math and horizontal modes, \textsf{mathfont} acts on the character only when it appears in math mode, so the character will be unaffected when used in regular text. The same is true for the punctuation marks on the right side. Notice that by default the package acts on the integral, summation, and product symbols. As stated previously, users can enable or disable this behavior with the optional package arguments |operators| and |no-operators| respectively, and doing so may be desirable depending on which math symbols the user wants and the math font in use. Finally, a technical point: when \textsf{mathfont} acts on the |symbols| characters, it redefines the four macros |\#|, |\$|, |\%|, and |\&| as robust commands more complicated than a single |\char|, so constructs like |\number\#| will need to be rewritten as |\number`\#|. +% +% Choosing which unicode characters to recode is something of a delicate task because so few unicode fonts contain more than the most basic mathematics symbols. \vadjust{\clearpage}In designing this portion of \textsf{mathfont}, I attempted to find the largest set of characters that reliably appears in every or nearly every major unicode font, and that's why Table~5 contains no arrows, subset and element symbols, quantifiers, and complicated operation and grouping symbols. Most standard unicode fonts don't contain those glyphs, and I wanted \textsf{mathfont} to be useful for as many fonts as possible. That being said, the package provides the four new control sequences listed in Table~6. The |\degree| command functions as the unicode alternative to the |$^\circ$| construction, and the other three control sequences print the associated unicode character. None of these characters are coded as delimiters, so they will not respond to \LaTeX's |\left| and |\right| sizing commands.\footnote{Because of time constraints, I couldn't figure out how to use Lua\TeX's \texttt{\string\Udelimiter} primitive to code the backslash and braces properly. Any suggestions in this area are welcome.} +% +% +% \section{Handling Errors} % % Most of \textsf{mathfont}'s error messages are self-explanatory, and the help text will contain instructions for how to resolve the message. Nevertheless, some of the possible error messages warrant additional explanation. % -% The most salient error is the ``Missing \XeTeX\ or Lua\TeX'' message. If a user tries to load \textsf{mathfont} without one of these two engines, \TeX\ will crash, either through \textsf{mathfont}'s fatal error message or when \textsf{fontspec} performs its own engine checks. Advanced users should note that \textsf{mathfont} doesn't actually determine the typesetting engine. Rather, it checks whether the \XeTeX\ and Lua\TeX\ primitives |\Umathcode| and |\Umathchardef| are defined, so if for some reason these control sequences have definitions when the user loads \textsf{mathfont}, \textsf{fontspec}'s more robust engine checks will cause \TeX\ to abort. The reasoning here is straightforward: \textsf{mathfont} verifies only that the current typesetting engine provides the commands that it directly needs, so its potential functionality remains as broad as possible. If \textsf{fontspec} becomes compatible with a third engine that also provides (analogues of) |\Umathcode| and |\Umathchardef|, there is no reason to prevent \textsf{mathfont} from working with that engine as well. The obvious corollary to this setup is that users with very old \XeTeX\ or Lua\TeX\ distributions could see this fatal error even when running one of these engines, and the solution is probably to upgrade a more recent version of the engine in question. Unfortunately, I do not know exactly when \XeTeX\ and Lua\TeX\ introduced these primitives. +% The most salient error is the ``Missing \XeTeX\ or Lua\TeX'' message. If a user tries to load \textsf{mathfont} without one of these two engines, \TeX\ will crash, either through \textsf{mathfont}'s fatal error message or when \textsf{fontspec} performs its own engine checks. Advanced users should note that \textsf{mathfont} doesn't actually determine the typesetting engine. Rather, it checks whether the \XeTeX\ and Lua\TeX\ primitives |\Umathcode| and |\Umathchardef| are defined, so if for some reason these control sequences have definitions when the user loads \textsf{mathfont}, \textsf{fontspec}'s more robust engine checks will cause \TeX\ to abort. The reasoning here is straightforward: \textsf{mathfont} verifies only that the current typesetting engine provides the commands that it directly needs, so its potential functionality remains as broad as possible. If \textsf{fontspec} becomes compatible with a third engine that also provides (analogues of) |\Umathcode| and |\Umathchardef|, there is no reason to prevent \textsf{mathfont} from working with that engine as well. The obvious corollary to this setup is that users with very old \XeTeX\ or Lua\TeX\ distributions could see this fatal error even when running one of these engines, and the solution is probably to upgrade to a more recent version of the engine in question. Unfortunately, I do not know exactly when \XeTeX\ and Lua\TeX\ introduced these primitives.\footnote{However, the manual for a beta version of Lua\TeX, v.\ 0.70.1, includes both primitives, so they are at least as old as May 2011. See\hfill\break \texttt{https://osl.ugr.es/CTAN/obsolete/systems/luatex/base/manual/luatexref-t.pdf}} % -% The \textsf{fontspec} package includes a ``|no-math|'' option, and \textsf{mathfont} expects \textsf{fontspec} to be loaded with this option. As mentioned previously, \textsf{mathfont} loads \textsf{fontspec} by default, but users can load \textsf{fontspec} before \textsf{mathfont} if they want to manually specify the package options. Alternatively, \LaTeX's |\PassOptionsToPackage| may be an even better way to proceed. If \textsf{mathfont} detects that \textsf{fontspec} was loaded without the |no-math| option, it will issue an error message saying so. This error is not paramount in the sense that the document will compile almost normally if a user ignores it, but \textsf{mathfont} will probably have trouble changing the font of certain math-mode characters in this situation. During development, Arabic numerals posed a particular issue in this regard. +% The \textsf{fontspec} package includes a ``|no-math|'' option, and \textsf{mathfont} expects \textsf{fontspec} to be loaded with this option. As mentioned previously, \textsf{mathfont} loads \textsf{fontspec} by default, but users can load \textsf{fontspec} before \textsf{mathfont} if they want to manually specify the package options. Alternatively, \LaTeX's |\PassOptionsToPackage| may be an even better way to proceed. If \textsf{mathfont} detects that \textsf{fontspec} was loaded without the |no-math| option, it will issue an error message saying so. This error is not paramount in the sense that the document will compile almost normally if a user ignores it, but \textsf{mathfont} will probably have trouble changing the font of certain math-mode characters in this situation. During development, Arabic numerals posed a particular challenge in this regard. % -% The ``internal commands restored'' error arises when the user calls |\mathfont| in a situation where \textsf{mathfont} has already restored the small portion of the \LaTeX\ kernel that it adjusts when loaded. Unless the user loads \textsf{mathfont} with the |packages| option, this process happens when the user loads an additional package after \textsf{mathfont}, and \textsf{mathfont} will not carry out a call to |\mathfont| at that point. As mentioned previously, users who want to manually restore the \LaTeX\ kernel can do so with the |\restoremathinternals| command. +% The ``internal commands restored'' error arises when the user calls |\mathfont| in a situation where the package already restored the small portion of the \LaTeX\ kernel that it adjusts when loaded. Unless the user loads \textsf{mathfont} with the |packages| option, this process happens when the user next calls |\usepackage|, and \textsf{mathfont} will not carry out any calls to |\mathfont| at that point. As mentioned previously, users who want to manually restore the \LaTeX\ kernel can do so with the |\restoremathinternals| command. % % Users who receive an ``Invalid option'' error for |\mathfont| should make sure they removed any extra spaces from their list of keywords in the command's optional argument. It is also worth pointing out if the user tries to reset the default font for some characters with |\mathfont|, the package will issue a warning but will not halt the compilation process. % % -% What should you do if you can't resolve an error? First, always, always make sure that you spelled all of your commands correctly and closed all braces and brackets. Then check the \textsf{mathfont} documentation---you may be trying to do something outside the scope of the package, or you may be dealing with a special case. In particular, read all the sections of the documentation that relate to the command or commands you are having trouble with! It is possible (likely) that I have organized the information here differently from your ideal package documentation, so you may be looking in the wrong portions of the documentation for help. The internet is a great resource, and websites such as the \TeX\ StackExchange, Share\LaTeX, and Wikibooks's \LaTeX\ wiki are often invaluable in dealing with \TeX-related issues. Definitely ask another human as well! At that point, and only at that point, should you email the author about your code. If you believe that you have found a bug, please indicate that clearly in your email subject line! Please also include a minimal working example that demonstrates the problem in any such correspondence. I will make every effort to write back to emails about \textsf{mathfont}, but I cannot guarantee a timely response. +% What should you do if you can't resolve an error? First, always, always make sure that you spelled all of your commands correctly and closed all braces and brackets. Then check the \textsf{mathfont} documentation---you may be trying to do something outside the scope of the package, or you may be dealing with a special case. In particular, read all the sections of the documentation that relate to the command or commands you are having trouble with. The internet is a great resource, and websites such as the \TeX\ StackExchange, Share\LaTeX, and Wikibooks's \LaTeX\ wiki are often invaluable in dealing with \TeX-related issues. Definitely ask another human as well! At that point you should email the author about your code---you might have identified a bug. Please include a minimal working example that demonstrates the problem in any such correspondence. I welcome emails about \textsf{mathfont} and will make every effort to write back to emails about the package, but I cannot guarantee a timely response. % % +% \init@checksum % % -% -% \eject\section*{Implementation} +% \section{Implementation} % % % @@ -395,14 +479,18 @@ information, see the original mathfont.dtx file. % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mathfont}[2018/08/01 v. 1.2 Package mathfont] +\ProvidesPackage{mathfont}[2019/01/19 v. 1.3 Package mathfont] \newif\if@packages +\newif\if@operators +\@operatorstrue \DeclareOption{packages}{\@packagestrue} +\DeclareOption{operators}{\@operatorstrue} +\DeclareOption{no-operators}{\@operatorsfalse} \DeclareOption*{\PackageError{mathfont} {Option "\CurrentOption" unknown} {I'm ignoring that option because\MessageBreak I don't know what it means.}} -\ProcessOptions\relax +\ProcessOptions* % \end{macrocode} % Some error and informational messages. % \begin{macrocode} @@ -421,10 +509,10 @@ information, see the original mathfont.dtx file. command}} \def\M@SetInternalsInfo{\PackageInfo{mathfont} {Adjusting \string\set@mathchar\space and\MessageBreak - \string\set@mathcode}} + \string\set@mathsymbol}} \def\M@RestoreInternalsInfo{\PackageInfo{mathfont} {Restoring \string\set@mathchar\space and\MessageBreak - \string\set@mathcode}} + \string\set@mathsymbol}} \def\M@CharsSetWarning#1{\PackageWarning{mathfont} {Font for #1 chars has already\MessageBreak been set}} @@ -554,6 +642,7 @@ information, see the original mathfont.dtx file. \newif\if@greeklower \newif\if@operator \newif\if@digits +\newif\if@symbols \newif\if@bb \newif\if@cal \newif\if@frak @@ -565,6 +654,7 @@ information, see the original mathfont.dtx file. \def\@greekuppershape{roman} \def\@greeklowershape{italic} \def\@digitsshape{roman} +\def\@symbolsshape{roman} \def\@operatorshape{roman} \def\@bbshape{roman} \def\@calshape{roman} @@ -598,7 +688,7 @@ information, see the original mathfont.dtx file. % \begin{macrocode} \def\check@option@valid#1{% \def\@temperror{\M@InvalidOptionError{#1}} - \@for\@j:=upper,lower,greekupper,greeklower,digits,operator\do{% + \@for\@j:=upper,lower,greekupper,greeklower,digits,symbols,operator\do{% \ifx\@j#1 \let\@temperror\relax \fi} @@ -622,7 +712,7 @@ information, see the original mathfont.dtx file. \@temperror} % \end{macrocode} % -% \section*{Implementation of Default Font Changes} +% \section{Implementation of Default Font Changes} % % The user-level command |\mathfont| passes % its mandatory argument to |\@newfont| through the |\@mathfont| command. If the user @@ -642,7 +732,7 @@ information, see the original mathfont.dtx file. % for that collection of characters. If the user specifies a suboption for any keyword in the % optional argument of |\mathfont|, the package overrides the default shape by % redefining |\@|\argtext{keyword}|shape| to the value of the suboption. For -% example, suppose the loads \textsf{mathfont} and then immediately writes +% example, suppose the user loads \textsf{mathfont} and then immediately writes % \begin{code} % |\mathfont[upper=roman]{Helvetica}|. % \end{code} @@ -650,7 +740,7 @@ information, see the original mathfont.dtx file. % \begin{macrocode} \def\gobble@equals#1=#2\@nil{#1} \def\mathfont{\@ifnextchar[{\@mathfont} - {\@mathfont[upper,lower,greekupper,greeklower,digits,operator]}} + {\@mathfont[upper,lower,greekupper,greeklower,digits,symbols,operator]}} \def\@mathfont[#1]#2{% \ifx\@@set@mathchar\set@mathchar \M@InternalsRestoredError @@ -695,11 +785,13 @@ information, see the original mathfont.dtx file. \csname @\@tempa true\endcsname \fi} \advance\M@count\@ne\relax + \message{^^J:: mathfont :: math font for character keyword classes^^J#1^^J% + changed to #2^^J^^J} \fi} \@onlypreamble\mathfont % \end{macrocode} % -% \section*{Implementation of Local Font Changes} +% \section{Implementation of Local Font Changes} % % The general |\newmathfontcommand| macro creates commands that locally change the math font. This macro creates a new math alphabet, and it stores that alphabet in the user-provided control sequence. First, we check to make sure that the user provided a control sequence for the first argument of |\newmathfontcommand|, and if the user did not, |\check@csarg| issues an error. % \begin{macrocode} @@ -731,7 +823,7 @@ information, see the original mathfont.dtx file. \@onlypreamble\newmathboldit % \end{macrocode} % -% \section*{Implementation of Alphanumeric Symbols} +% \section{Implementation of Alphanumeric Symbols} % % Each |\define@|\argtext{keyword} macro redefines one of the standard |\math|\argtext{keyword} commands. The new versions first check if they are in math mode using |\check@mmode| and then scan all tokens of their argument using |\@tfor|. For each token, the macro calls |\M@|\argtext{keyword}|@|\argtext{token}, which evaluates to a |\mathord| symbol in the desired style. % \begin{macrocode} @@ -766,7 +858,7 @@ information, see the original mathfont.dtx file. \def\@mathbfrak##1{\process@tokens{##1}{bfrak}}} % \end{macrocode} % -% \section*{Unicode Hex Values} +% \section{Unicode Hex Values} % % Set capital Latin characters. We use an |\edef| for |\M@upper| because % every expansion now will save \LaTeX\ twenty-six expansions later when it @@ -932,6 +1024,101 @@ information, see the original mathfont.dtx file. \DeclareMathSymbol{8}{\mathalpha}{\M@digits}{`8} \DeclareMathSymbol{9}{\mathalpha}{\M@digits}{`9}} % \end{macrocode} +% Set symbols. +% \begin{macrocode} +\def\M@symbols@set{% + \edef\M@symbols{M\@symbolsshape\the\M@count} + \DeclareMathSymbol{.}{\mathord}{\M@symbols}{"2E} + \DeclareMathSymbol{@}{\mathord}{\M@symbols}{"40} + \DeclareMathSymbol{\mathpound}{\mathord}{\M@symbols}{"23} + \DeclareMathSymbol{\mathdollar}{\mathord}{\M@symbols}{"24} + \DeclareMathSymbol{\mathpercent}{\mathord}{\M@symbols}{"25} + \DeclareMathSymbol{\mathand}{\mathord}{\M@symbols}{"26} + \DeclareMathSymbol{\mathparagraph}{\mathord}{\M@symbols}{"B6} + \DeclareMathSymbol{\mathsection}{\mathord}{\M@symbols}{"A7} + \DeclareMathSymbol{\mathsterling}{\mathord}{\M@symbols}{"A3} + \DeclareMathSymbol{|}{\mathord}{\M@symbols}{"7C} + \DeclareMathSymbol{\neg}{\mathord}{\M@symbols}{"AC} + \DeclareMathSymbol{\infty}{\mathord}{\M@symbols}{"221E} + \DeclareMathSymbol{\partial}{\mathord}{\M@symbols}{"2202} + \DeclareMathSymbol{\mathbackslash}{\mathord}{\M@symbols}{"5C} + \DeclareMathSymbol{\degree}{\mathord}{\M@symbols}{"B0} + \DeclareMathSymbol{\Delta}{\mathord}{\M@symbols}{"2206} + \DeclareMathSymbol{'}{\mathord}{\M@symbols}{"2032} + \DeclareMathSymbol{"}{\mathord}{\M@symbols}{"2033} + \if@operators + \DeclareMathSymbol{\sum}{\mathop}{\M@symbols}{"2211} + \DeclareMathSymbol{\prod}{\mathop}{\M@symbols}{"220F} + \DeclareMathSymbol{\intop}{\mathop}{\M@symbols}{"222B} + \fi + \DeclareMathSymbol{+}{\mathbin}{\M@symbols}{"2B} + \DeclareMathSymbol{-}{\mathbin}{\M@symbols}{"2212} + \DeclareMathSymbol{*}{\mathbin}{\M@symbols}{"2A} + \DeclareMathSymbol{\times}{\mathbin}{\M@symbols}{"D7} + \DeclareMathSymbol{/}{\mathbin}{\M@symbols}{"2215} + \DeclareMathSymbol{\div}{\mathbin}{\M@symbols}{"F7} + \DeclareMathSymbol{\pm}{\mathbin}{\M@symbols}{"B1} + \DeclareMathSymbol{\cdot}{\mathbin}{\M@symbols}{"2219} + \DeclareMathSymbol{\bullet}{\mathbin}{\M@symbols}{"2022} + \DeclareMathSymbol{\dagger}{\mathbin}{\M@symbols}{"2020} + \DeclareMathSymbol{\ddagger}{\mathbin}{\M@symbols}{"2021} + \DeclareMathSymbol{\setminus}{\mathbin}{\M@symbols}{"5C} + \DeclareMathSymbol{=}{\mathrel}{\M@symbols}{"3D} + \DeclareMathSymbol{<}{\mathrel}{\M@symbols}{"3C} + \DeclareMathSymbol{>}{\mathrel}{\M@symbols}{"3E} + \DeclareMathSymbol{\leq}{\mathrel}{\M@symbols}{"2264} + \DeclareMathSymbol{\geq}{\mathrel}{\M@symbols}{"2265} + \DeclareMathSymbol{\sim}{\mathrel}{\M@symbols}{"7E} + \DeclareMathSymbol{\approx}{\mathrel}{\M@symbols}{"2248} + \DeclareMathSymbol{\equiv}{\mathrel}{\M@symbols}{"2261} + \DeclareMathSymbol{\mid}{\mathrel}{\M@symbols}{"7C} + \DeclareMathSymbol{\parallel}{\mathrel}{\M@symbols}{"2016} + \DeclareMathSymbol{:}{\mathrel}{\M@symbols}{"3A} + \DeclareMathSymbol{(}{\mathopen}{\M@symbols}{"28} + \DeclareMathSymbol{)}{\mathclose}{\M@symbols}{"29} + \DeclareMathSymbol{[}{\mathopen}{\M@symbols}{"5B} + \DeclareMathSymbol{]}{\mathclose}{\M@symbols}{"5D} + \DeclareMathSymbol{\leftbrace}{\mathopen}{\M@symbols}{"7B} + \DeclareMathSymbol{\rightbrace}{\mathclose}{\M@symbols}{"7D} + \DeclareMathSymbol{?}{\mathclose}{\M@symbols}{"3F} + \DeclareMathSymbol{!}{\mathclose}{\M@symbols}{"21} + \DeclareMathSymbol{,}{\mathpunct}{\M@symbols}{"2C} + \DeclareMathSymbol{;}{\mathpunct}{\M@symbols}{"3B} + \DeclareMathSymbol{\colon}{\mathpunct}{\M@symbols}{"3A} + \let\mathellipsis\@undefined + \DeclareMathSymbol{\mathellipsis}{\mathinner}{\M@symbols}{"2026} +% \end{macrocode} +% Redefining |\#|, |\$|, |\%|, and |\&| is tricky. We use |\string| to declare robust versions of these commands that expand to previously declared |\mathpound|, etc.\ symbols in math mode and retain their standard |\char| definitions otherwise. Other commands that function in both math and horizontal modes such as |\S| or |\dag| also use this technique. +% \begin{macrocode} + \count@\escapechar + \escapechar\m@ne + \edef\#{\noexpand\protect + \expandafter\noexpand\csname\string\# \endcsname} + \expandafter\def\csname\string\# \endcsname{\ifmmode + \mathpound\else\char"23\fi} + \edef\${\noexpand\protect + \expandafter\noexpand\csname\string\$ \endcsname} + \expandafter\def\csname\string\$ \endcsname{\ifmmode + \mathdollar\else\char"24\fi} + \edef\%{\noexpand\protect + \expandafter\noexpand\csname\string\% \endcsname} + \expandafter\def\csname\string\% \endcsname{\ifmmode + \mathpercent\else\char"25\fi} + \edef\&{\noexpand\protect + \expandafter\noexpand\csname\string\& \endcsname} + \expandafter\def\csname\string\& \endcsname{\ifmmode + \mathand\else\char"26\fi} + \escapechar\count@ +% \end{macrocode} +% Finally a bit of housekeeping. +% \begin{macrocode} + \DeclareMathSymbol{\@relbar}{\mathbin}{symbols}{"00} + \DeclareMathSymbol{\@Relbar}{\mathrel}{operators}{"3D} + \DeclareMathSymbol{\@verticalbar}{\mathord}{symbols}{"6A} + \DeclareRobustCommand\relbar{\mathrel{\smash\@relbar}} + \DeclareRobustCommand\Relbar{\mathrel{\@Relbar}} + \DeclareRobustCommand\models{\mathrel{\@verticalbar}\joinrel\Relbar}} +% \end{macrocode} % Set new operator font. % \begin{macrocode} \def\M@operator@set{% @@ -1272,20 +1459,18 @@ information, see the original mathfont.dtx file. \usepackage[margin=72.27pt]{geometry} \usepackage{booktabs} \usepackage{mathfont} -\mathfont[greekupper,greeklower=roman]{Symbola} +\mathfont{Symbola} \usepackage{shortvrb} \MakeShortVerb{|} \pagestyle{empty} \begin{document} - \topskip=0pt \centering \vbox to 0pt{}\vfil\nointerlineskip - Greek Characters Provided by \textsf{mathfont}, Rendered in Symbola\par\penalty10000\smallskip \begin{tabular}{llllllll} \toprule @@ -1326,11 +1511,66 @@ Greek Characters Provided by \textsf{mathfont}, Rendered in Symbola\par\penalty1 \bottomrule \end{tabular} - \end{document} %</greek> +%<*example> +\documentclass[12pt]{article} +\usepackage[margin=72.27pt]{geometry} +\usepackage[factor=600,stretch=14,shrink=14,step=1]{microtype} +\usepackage{selnolig} +\usepackage[no-operators]{mathfont} +\mathfont{Times New Roman} +\mathfont[bb]{Symbola} +\restoremathinternals +\setmainfont{Times New Roman} +\nolig{Th}{T|h} +\hyphenpenalty=10 +\exhyphenpenalty=5 +\pretolerance=30 +\finalhyphendemerits=300 +\pagestyle{empty} +\begin{document} + +\centerline{The \textsf{mathfont} Package in Action: Two Mathematical Snippets Rendered in Times New Roman} +\centerline{Conrad Kosowsky} + +\bigskip + +Mathematicians usually define $e$ in one of two ways: as the horizontal asymptote of a certain function or as the limit of an infinite series. Specifically, it's most common to see $e$ defined as either +\[ +e=\lim_{x\to\infty}\left(1+\frac1x\right)^x +\] +or +\[ +e=\sum_{k=0}^\infty\frac1{k!}. +\] +The first definition is simpler in that involves a limit of a single expression, not a limit of partial sums, but in practice, the second tends to be more tractable. The power series expression of $e^x$ is given by +\[ +\sum_{n=0}^\infty\frac{x^n}{n!}, +\] +and the relationship between this expression and the series definition is much more apparent than it is for the first limit. This relationship arises in a variety of different mathematical contexts, for example the famous Euler's formula $e^{i\theta}=\cos\theta+i\sin\theta$ or the related definition of the characteristic function for a random variable $X$: +\[ +\phi_X(t)=\mathbb E\left(e^{iX}\right). +\] +Expanding $e^{iX}$ as a power series gives an expression for $\phi_X$ that we can differentiate term by term. + +\vfil + +A smooth manifold consists of a topological space $M$ equipped with a smooth maximal atlas $\leftbrace \phi_i\rightbrace$. The maps $\phi_i\colon U_i\longrightarrow\mathbb R$ technically aren't themselves differentiable, but their compositions $\phi_i^{}\circ\phi_j^{-1}$ are diffeomorphisms on subsets of $\mathbb R^n$. If we have a map $f\colon M\longrightarrow N$ between manifolds, this structure allows us to talk about differentiability of $f$. Specifically, we say that $f$ is smooth if for any $i$ and $j$, the composition +\[ +\psi_j^{}\circ f\circ\phi_i^{-1} +\] +is itself smooth, where $\leftbrace\psi_i\rightbrace$ is a smooth atlas for $N$. Differentiating $f$ produces the associated tangent map $Df$. The function $Df$ maps the tangent space $TM$ to the tangent space $TN$ and is linear when restricted to individual tangent spaces $T_pM$. If $M$ can be written as a product $M_1\times M_2$, we can consider the partial tangent maps $\partial_1f$ and $\partial_2f$ by considering the compositions $f\circ\iota_1$ and $f\circ\iota_2$, where $\iota_1$ and $\iota_2$ are inclusion maps with respect to a particular point. Combining both maps, we have the equation +\[ +Df(u,v)=\partial_1f(u)+\partial_2f(v), +\] +and this relationship can be thought of as an adaption of the standard product rule. + +\end{document} +%</example> % % \fi % -% \Finale +% \check@checksum +% \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/mathfont/mathfont.sty b/Master/texmf-dist/tex/latex/mathfont/mathfont.sty index cd5bf8ab5d2..db4e26242a5 100644 --- a/Master/texmf-dist/tex/latex/mathfont/mathfont.sty +++ b/Master/texmf-dist/tex/latex/mathfont/mathfont.sty @@ -17,20 +17,24 @@ %% 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 of the file mathfont.dtx, -%% the derived files mathfont.sty and mathfont_greek.tex, and -%% all other files created through the configuration process such as -%% mathfont.pdf, mathfont.idx, and mathfont.ind. For more +%% the derived files mathfont.sty, mathfont_greek.tex, and +%% mathfont_example.tex, and all other files created through the configuration +%% process such as mathfont.pdf, mathfont.idx, and mathfont.ind. For more %% information, see the original mathfont.dtx file. %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mathfont}[2018/08/01 v. 1.2 Package mathfont] +\ProvidesPackage{mathfont}[2019/01/19 v. 1.3 Package mathfont] \newif\if@packages +\newif\if@operators +\@operatorstrue \DeclareOption{packages}{\@packagestrue} +\DeclareOption{operators}{\@operatorstrue} +\DeclareOption{no-operators}{\@operatorsfalse} \DeclareOption*{\PackageError{mathfont} {Option "\CurrentOption" unknown} {I'm ignoring that option because\MessageBreak I don't know what it means.}} -\ProcessOptions\relax +\ProcessOptions* \def\M@FontChangeInfo#1{\PackageInfo{mathfont} {Changing #1 characters to\MessageBreak math font \csname M@font\the\M@count\endcsname\MessageBreak @@ -46,10 +50,10 @@ command}} \def\M@SetInternalsInfo{\PackageInfo{mathfont} {Adjusting \string\set@mathchar\space and\MessageBreak - \string\set@mathcode}} + \string\set@mathsymbol}} \def\M@RestoreInternalsInfo{\PackageInfo{mathfont} {Restoring \string\set@mathchar\space and\MessageBreak - \string\set@mathcode}} + \string\set@mathsymbol}} \def\M@CharsSetWarning#1{\PackageWarning{mathfont} {Font for #1 chars has already\MessageBreak been set}} @@ -151,6 +155,7 @@ \newif\if@greeklower \newif\if@operator \newif\if@digits +\newif\if@symbols \newif\if@bb \newif\if@cal \newif\if@frak @@ -162,6 +167,7 @@ \def\@greekuppershape{roman} \def\@greeklowershape{italic} \def\@digitsshape{roman} +\def\@symbolsshape{roman} \def\@operatorshape{roman} \def\@bbshape{roman} \def\@calshape{roman} @@ -182,7 +188,7 @@ \fi} \def\check@option@valid#1{% \def\@temperror{\M@InvalidOptionError{#1}} - \@for\@j:=upper,lower,greekupper,greeklower,digits,operator\do{% + \@for\@j:=upper,lower,greekupper,greeklower,digits,symbols,operator\do{% \ifx\@j#1 \let\@temperror\relax \fi} @@ -201,7 +207,7 @@ \@temperror} \def\gobble@equals#1=#2\@nil{#1} \def\mathfont{\@ifnextchar[{\@mathfont} - {\@mathfont[upper,lower,greekupper,greeklower,digits,operator]}} + {\@mathfont[upper,lower,greekupper,greeklower,digits,symbols,operator]}} \def\@mathfont[#1]#2{% \ifx\@@set@mathchar\set@mathchar \M@InternalsRestoredError @@ -232,6 +238,8 @@ \csname @\@tempa true\endcsname \fi} \advance\M@count\@ne\relax + \message{^^J:: mathfont :: math font for character keyword classes^^J#1^^J% + changed to #2^^J^^J} \fi} \@onlypreamble\mathfont \def\check@csarg#1#2#3{% @@ -430,6 +438,92 @@ \DeclareMathSymbol{7}{\mathalpha}{\M@digits}{`7} \DeclareMathSymbol{8}{\mathalpha}{\M@digits}{`8} \DeclareMathSymbol{9}{\mathalpha}{\M@digits}{`9}} +\def\M@symbols@set{% + \edef\M@symbols{M\@symbolsshape\the\M@count} + \DeclareMathSymbol{.}{\mathord}{\M@symbols}{"2E} + \DeclareMathSymbol{@}{\mathord}{\M@symbols}{"40} + \DeclareMathSymbol{\mathpound}{\mathord}{\M@symbols}{"23} + \DeclareMathSymbol{\mathdollar}{\mathord}{\M@symbols}{"24} + \DeclareMathSymbol{\mathpercent}{\mathord}{\M@symbols}{"25} + \DeclareMathSymbol{\mathand}{\mathord}{\M@symbols}{"26} + \DeclareMathSymbol{\mathparagraph}{\mathord}{\M@symbols}{"B6} + \DeclareMathSymbol{\mathsection}{\mathord}{\M@symbols}{"A7} + \DeclareMathSymbol{\mathsterling}{\mathord}{\M@symbols}{"A3} + \DeclareMathSymbol{|}{\mathord}{\M@symbols}{"7C} + \DeclareMathSymbol{\neg}{\mathord}{\M@symbols}{"AC} + \DeclareMathSymbol{\infty}{\mathord}{\M@symbols}{"221E} + \DeclareMathSymbol{\partial}{\mathord}{\M@symbols}{"2202} + \DeclareMathSymbol{\mathbackslash}{\mathord}{\M@symbols}{"5C} + \DeclareMathSymbol{\degree}{\mathord}{\M@symbols}{"B0} + \DeclareMathSymbol{\Delta}{\mathord}{\M@symbols}{"2206} + \DeclareMathSymbol{'}{\mathord}{\M@symbols}{"2032} + \DeclareMathSymbol{"}{\mathord}{\M@symbols}{"2033} + \if@operators + \DeclareMathSymbol{\sum}{\mathop}{\M@symbols}{"2211} + \DeclareMathSymbol{\prod}{\mathop}{\M@symbols}{"220F} + \DeclareMathSymbol{\intop}{\mathop}{\M@symbols}{"222B} + \fi + \DeclareMathSymbol{+}{\mathbin}{\M@symbols}{"2B} + \DeclareMathSymbol{-}{\mathbin}{\M@symbols}{"2212} + \DeclareMathSymbol{*}{\mathbin}{\M@symbols}{"2A} + \DeclareMathSymbol{\times}{\mathbin}{\M@symbols}{"D7} + \DeclareMathSymbol{/}{\mathbin}{\M@symbols}{"2215} + \DeclareMathSymbol{\div}{\mathbin}{\M@symbols}{"F7} + \DeclareMathSymbol{\pm}{\mathbin}{\M@symbols}{"B1} + \DeclareMathSymbol{\cdot}{\mathbin}{\M@symbols}{"2219} + \DeclareMathSymbol{\bullet}{\mathbin}{\M@symbols}{"2022} + \DeclareMathSymbol{\dagger}{\mathbin}{\M@symbols}{"2020} + \DeclareMathSymbol{\ddagger}{\mathbin}{\M@symbols}{"2021} + \DeclareMathSymbol{\setminus}{\mathbin}{\M@symbols}{"5C} + \DeclareMathSymbol{=}{\mathrel}{\M@symbols}{"3D} + \DeclareMathSymbol{<}{\mathrel}{\M@symbols}{"3C} + \DeclareMathSymbol{>}{\mathrel}{\M@symbols}{"3E} + \DeclareMathSymbol{\leq}{\mathrel}{\M@symbols}{"2264} + \DeclareMathSymbol{\geq}{\mathrel}{\M@symbols}{"2265} + \DeclareMathSymbol{\sim}{\mathrel}{\M@symbols}{"7E} + \DeclareMathSymbol{\approx}{\mathrel}{\M@symbols}{"2248} + \DeclareMathSymbol{\equiv}{\mathrel}{\M@symbols}{"2261} + \DeclareMathSymbol{\mid}{\mathrel}{\M@symbols}{"7C} + \DeclareMathSymbol{\parallel}{\mathrel}{\M@symbols}{"2016} + \DeclareMathSymbol{:}{\mathrel}{\M@symbols}{"3A} + \DeclareMathSymbol{(}{\mathopen}{\M@symbols}{"28} + \DeclareMathSymbol{)}{\mathclose}{\M@symbols}{"29} + \DeclareMathSymbol{[}{\mathopen}{\M@symbols}{"5B} + \DeclareMathSymbol{]}{\mathclose}{\M@symbols}{"5D} + \DeclareMathSymbol{\leftbrace}{\mathopen}{\M@symbols}{"7B} + \DeclareMathSymbol{\rightbrace}{\mathclose}{\M@symbols}{"7D} + \DeclareMathSymbol{?}{\mathclose}{\M@symbols}{"3F} + \DeclareMathSymbol{!}{\mathclose}{\M@symbols}{"21} + \DeclareMathSymbol{,}{\mathpunct}{\M@symbols}{"2C} + \DeclareMathSymbol{;}{\mathpunct}{\M@symbols}{"3B} + \DeclareMathSymbol{\colon}{\mathpunct}{\M@symbols}{"3A} + \let\mathellipsis\@undefined + \DeclareMathSymbol{\mathellipsis}{\mathinner}{\M@symbols}{"2026} + \count@\escapechar + \escapechar\m@ne + \edef\#{\noexpand\protect + \expandafter\noexpand\csname\string\# \endcsname} + \expandafter\def\csname\string\# \endcsname{\ifmmode + \mathpound\else\char"23\fi} + \edef\${\noexpand\protect + \expandafter\noexpand\csname\string\$ \endcsname} + \expandafter\def\csname\string\$ \endcsname{\ifmmode + \mathdollar\else\char"24\fi} + \edef\%{\noexpand\protect + \expandafter\noexpand\csname\string\% \endcsname} + \expandafter\def\csname\string\% \endcsname{\ifmmode + \mathpercent\else\char"25\fi} + \edef\&{\noexpand\protect + \expandafter\noexpand\csname\string\& \endcsname} + \expandafter\def\csname\string\& \endcsname{\ifmmode + \mathand\else\char"26\fi} + \escapechar\count@ + \DeclareMathSymbol{\@relbar}{\mathbin}{symbols}{"00} + \DeclareMathSymbol{\@Relbar}{\mathrel}{operators}{"3D} + \DeclareMathSymbol{\@verticalbar}{\mathord}{symbols}{"6A} + \DeclareRobustCommand\relbar{\mathrel{\smash\@relbar}} + \DeclareRobustCommand\Relbar{\mathrel{\@Relbar}} + \DeclareRobustCommand\models{\mathrel{\@verticalbar}\joinrel\Relbar}} \def\M@operator@set{% \edef\operator@font{\noexpand\mathgroup \expandafter\noexpand |