% -*- coding: iso-latin-1; -*- %<*dtx> {\def\dtxtimestamp {Time-stamp: <26-02-2015 23:33:58 CET>}% \def\getdtxtimestamp #1 <#2 #3 #4>{#2 at #3 #4}% \xdef\dtxtimestamp {\expandafter\getdtxtimestamp\dtxtimestamp }}% \def\docdate{2015/02/26} % %%---------------------------------------------------------------- %% Package: mathastext %%% Use the text font in math mode (jfB) %% Version: 1.3d (2014/05/23; doc of 2015/02/26) %% License: LPPL 1.3c %% Copyright (C) 2011-2015 Jean-Francois Burnol %% Examples of use of mathastext: %% http://jf.burnol.free.fr/mathastext.html %% http://jf.burnol.free.fr/showcase.html %%---------------------------------------------------------------- % This Work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3c of this license or (at your option) any later % version. This version of this license is in % http://www.latex-project.org/lppl/lppl-1-3c.txt % and the latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of % LaTeX version 2005/12/01 or later. % % The Author of this Work is: Jean-Francois Burnol %<*drv|ins> \def\MSTpkgdate {2014/05/23} \def\MSTpkgversion {1.3d} % % Installation: % ============= % % The fastest way is: unzip -d mathastext.tds.zip, where % could be ~/texmf or, on mac os x, ~/Library/texmf. % % Else, download mathastext.dtx, possibly also mathastext.ins, and follow % these instructions: % % * with mathastext.ins: run tex on mathastext.ins to generate the package % style file mathastext.sty as well as mathastext.tex and some test files. % % * without mathastext.ins: run tex on mathastext.dtx to generate the package % style file mathastext.sty as well as mathastext.tex and some test files. % (and also mathastext.ins) % % Move the style file mathastext.sty to a location where TeX can find it. % In a TDS compliant hierarchy this will be % :tex/latex/mathastext/mathastext.sty % % *documentation*: run latex thrice on mathastext.tex then dvipdfmx. Or, run % pdflatex thrice on mathastext.dtx. In the former case the documentation is % with source code included, in the latter without. The file mathastext.tex % can be customized to change the font size or set other options therein. % % (One cannot use lualatex/xelatex to compile the documentation.) % % *test files*: mathastexttestmathversions.tex % mathastexttestunicodemacos.tex % mathastexttestunicodelinux.tex % mathastexttestalphabets.tex % %<*dtx> \chardef\noetex 0 \expandafter\ifx\csname numexpr\endcsname\relax \chardef\noetex 1 \fi \ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop \else \expandafter\ifx\csname ProvidesFile\endcsname\relax \chardef\extractfiles 0 % etex etc.. on mathastext.dtx \else % latex/pdflatex on mathastext.tex or on mathastext.dtx \expandafter\ifx\csname Withdvipdfmx\endcsname\relax % latex run is on mathastext.dtx, we will extract all files \chardef\extractfiles 1 % 1 = extract all and typeset doc \chardef\Withdvipdfmx 0 % 0 = pdflatex or latex+dvips \chardef\NoSourceCode 1 % \NeedsTeXFormat{LaTeX2e}% \PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}% \else % latex run is on mathastext.tex, \chardef\extractfiles 2 % no extractions \fi \ProvidesFile{mathastext.dtx}% [bundle source (\MSTpkgversion, \MSTpkgdate) and documentation (\docdate)]% \fi \fi \ifnum\extractfiles<2 % extract files \def\MessageDeFin{\newlinechar10 \let\Msg\message \Msg{^^J}% \Msg{********************************************************************^^J}% \Msg{*^^J}% \Msg{* To finish the installation you have to move the following^^J}% \Msg{* file into a directory searched by TeX:^^J}% \Msg{*^^J}% \Msg{*\space\space\space\space mathastext.sty^^J}% \Msg{*^^J}% \Msg{* To produce the documentation with source code included run latex^^J}% \Msg{* thrice on file mathastext.tex and then dvipdfmx on mathastext.dvi^^J}% \Msg{*^^J}% \Msg{* Happy TeXing!^^J}% \Msg{*^^J}% \Msg{********************************************************************^^J}% }% \begingroup \input docstrip.tex \askforoverwritefalse \def\testfilepreamble{\string\def\string\testfileincipit{Test file to accompany \string\texttt{mathastext}^^J% version \string\texttt{\MSTpkgversion} of \string\texttt{\MSTpkgdate}}} \generate{\nopreamble \file{mathastext.ins}{\from{mathastext.dtx}{ins}} \file{mathastext.tex}{\from{mathastext.dtx}{drv}} \usepreamble\testfilepreamble \file{mathastexttestmathversions.tex}{\from{mathastext.dtx}{mathversions}} \file{mathastexttestunicodemacos.tex}{\from{mathastext.dtx}{macos}} \file{mathastexttestunicodelinux.tex}{\from{mathastext.dtx}{linux}} \file{mathastexttestalphabets.tex}{\from{mathastext.dtx}{alphabets}} \usepreamble\defaultpreamble \file{mathastext.sty}{\from{mathastext.dtx}{package}}% } \endgroup \fi % end of file extraction \ifnum\extractfiles=0 % direct tex/etex/xetex/etc on mathastext.dtx, files now extracted, stop \MessageDeFin\expandafter\end \fi % no use of docstrip to extract files if latex compilation was on mathastext.tex \ifdefined\MessageDeFin\AtEndDocument{\MessageDeFin}\fi \catcode`\~0\catcode`\\12 % this is to fool TeX's recognition of \if... ~iffalse % conditionals, which are used in the test files % %<*drv> %---------------------------------------------------------------- mathastext.tex %% This is a generated file. Run latex thrice on this file mathastext.tex then %% run dvipdfmx on mathastext.dvi to produce the documentation mathastext.pdf, %% with the package source code included. %% %% Customize as desired the class options and the two toggles below. %% %% See mathastext.dtx for the copyright and the conditions for distribution %% and/or modification of this work. %% \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathastext.tex}% [\MSTpkgdate\space v\MSTpkgversion\space driver file for mathastext documentation (jfB)]% \PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc} \chardef\Withdvipdfmx 1 % replace 1 by 0 for using latex/pdflatex \chardef\NoSourceCode 0 % replace 0 by 1 for no source code \input mathastext.dtx %%% Local Variables: %%% mode: latex %%% End: % %-------------------------------------------------------------EOF mathastext.tex %<*ins> %---------------------------------------------------------------- mathastext.ins %% This is a generated file. "tex mathastext.ins" extracts mathastext.sty from %% mathastext.dtx as well as mathastext.tex (for typesetting the documentation), %% and some test files to check the package commands. %% %% See mathastext.dtx for the copyright and the conditions for distribution %% and/or modification of this work. %% \input docstrip.tex \askforoverwritefalse \def\testfilepreamble{% \string\def\string\testfileincipit{Test file to accompany \string\texttt{mathastext}^^J% version \string\texttt{\MSTpkgversion} of \string\texttt{\MSTpkgdate}}} \generate{\nopreamble \file{mathastext.tex}{\from{mathastext.dtx}{drv}} \usepreamble\testfilepreamble \file{mathastexttestmathversions.tex}{\from{mathastext.dtx}{mathversions}} \file{mathastexttestunicodemacos.tex}{\from{mathastext.dtx}{macos}} \file{mathastexttestunicodelinux.tex}{\from{mathastext.dtx}{linux}} \file{mathastexttestalphabets.tex}{\from{mathastext.dtx}{alphabets}} \usepreamble\defaultpreamble \file{mathastext.sty}{\from{mathastext.dtx}{package}}% } \catcode32=13\relax% active space \let =\space% \Msg{************************************************************************} \Msg{*} \Msg{* To finish the installation you have to move the following} \Msg{* file into a directory searched by TeX:} \Msg{*} \Msg{* mathastext.sty} \Msg{*} \Msg{* To produce the documentation run latex thrice on file mathastext.tex} \Msg{* and then run dvipdfmx on file mathastext.dvi} \Msg{*} \Msg{* Happy TeXing!} \Msg{*} \Msg{************************************************************************} \endbatchfile % %------------------------------------------------------------ EOF mathastext.ins %<*mathversions> %---------------------------------------------------- mathastexttestversions.tex %% This file `mathastexttestversions.tex' is for testing the enhanced %% concept of math versions provided by the package `mathastext'. %% %% See `mathastext.dtx' for the copyright and conditions of distribution or %% modification. %% \documentclass{article} \usepackage[T1]{fontenc} \usepackage{newcent} \usepackage[subdued]{mathastext} \Mathastext[newcent] \renewcommand\familydefault\ttdefault \Mathastext[courier] \renewcommand\familydefault\sfdefault \Mathastext[avantgarde] \renewcommand\familydefault\rmdefault \begin{document} \testfileincipit text in NewCentury and $math\ as\ in\ default$,% \MTversion{courier} text in Courier and $math\ in\ Courier$,% \MTversion{avantgarde} text in AvantGarde and $math\ in\ AvantGarde$,% \MTversion[newcent]{courier} text in NewCentury and $math\ in\ Courier$,\MTversion{bold} text in bold NewCentury and $math\ as\ in\ bold\ default$,\MTversion[courier]{avantgarde} text in Courier and $math\ in\ AvantGarde$. \end{document} %-------------------------------------------------EOF mathastexttestversions.tex % %<*macos> %------------------------------------------------ mathastexttestunicodemacos.tex %% This file `mathastexttestunicodemacos.tex' is for testing the use %% of the package `mathastext' with the unicode engines XeTeX or LuaLaTeX. %% %% Mac OS X specific fonts are used (10.8.2). %% %% See `mathastext.dtx' for the copyright and conditions of distribution or %% modification. %% \documentclass{article} \usepackage[hscale=0.85]{geometry} \usepackage{multicol} \usepackage[no-math]{fontspec} \usepackage{lmodern} \usepackage{metalogo} \usepackage{iftex} \ifXeTeX \expandafter\def\expandafter\testfileincipit\expandafter {\testfileincipit\ (compiled with \XeLaTeX)} \else \ifLuaTeX \expandafter\def\expandafter\testfileincipit\expandafter {\testfileincipit\ (compiled with \LuaLaTeX)} \fi\fi \usepackage[subdued,italic,asterisk]{mathastext} \setmainfont[Color=FF0000]{Hoefler Text} \Mathastext[Hoefler] \setmainfont[Color=336633]{American Typewriter}\Mathastext[Typewriter] \setmainfont[Color=0000FF]{Herculanum} \Mathastext[Herculanum] \setmainfont[Color=FF00FF]{Didot} \Mathastext[Didot] \setmainfont[Color=999999]{Comic Sans MS} \Mathastext[Comic] \MTDeclareVersion{Times}{T1}{ptm}{m}{n} \begin{document} \MTversion{normal} \testfileincipit This test uses \verb|mathastext| with its \emph{italic}, \emph{asterisk}, and \emph{subdued} options. The base document fonts are the Latin Modern ones (in OpenType format). The other fonts used were chosen from those of a Mac OS machine. We also used the Times font in T1 encoding, to illustrate a warning from the user manual when using different encodings in the various math versions: here the minus sign has disappeared from the Times math mode block, precisely for this matter of encoding. Furthermore we test if the non-letter characters obey the math alphabet \verb|\mathbf|. In the normal and bold math versions, this feature is de-activated, as option \emph{subdued} was used; and if activated we should then use in these math versions the package \verb|\Mathbf| rather than \verb|\mathbf| which is there still the original one, which will use encoding \verb|OT1| in the normal and bold versions, as we loaded \verb|fontspec| with its option \emph{no-math}. Some among the fonts tested have no bold variant or no italic variant. Note (tested 2013/09/03): for some reason the \verb|Color| specifications in the \verb|\setmainfont| commands work only with \XeTeX{}, not with \LuaLaTeX{}; a few months back I had not noticed such a difference between the two engines. \newcommand\TEST[1]{\MTversion{#1}\def\tmpa{#1}% \def\tmpb{normal}\def\tmpc{bold}% \ifx\tmpa\tmpb\else\ifx\tmpa\tmpc\else \MTnonlettersobeymathxx \MTexplicitbracesobeymathxx\fi\fi \begin{multicols}{2} \hbox to\columnwidth{\hbox to\columnwidth{\hfil $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}} \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ } \centerline{ $0123456789$ } \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ } \centerline{ $\mathbf{!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash}$ } \columnbreak \centerline{ abcdefghijklmnopqrstuvwxyz } \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ } \centerline{ 0123456789 } \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 } \centerline{\bfseries !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 } \end{multicols}} \begin{multicols}{2} \centerline{\textbf{math mode}} \columnbreak \centerline{ \textbf{text} } \end{multicols} \TEST{Didot}\TEST{Comic}\TEST{normal}\TEST{Herculanum} \TEST{Hoefler}\TEST{Typewriter}\TEST{bold}\TEST{Times} \end{document} %---------------------------------------------EOF mathastexttestunicodemacos.tex % %<*linux> %------------------------------------------------ mathastexttestunicodelinux.tex %% This file `mathastexttestunicodelinux.tex' is for testing the use %% of the package `mathastext' with the unicode engines XeTeX or LuaLaTeX. %% %% Fonts available on a Linux machine are used. %% %% See `mathastext.dtx' for the copyright and conditions of distribution or %% modification. %% \documentclass{article} \usepackage[hscale=0.8]{geometry} \usepackage{multicol} \usepackage[no-math]{fontspec} \usepackage{lmodern} \usepackage{metalogo} \usepackage{iftex} \ifXeTeX \expandafter\def\expandafter\testfileincipit\expandafter {\testfileincipit\ (compiled with \XeLaTeX)} \else \ifLuaTeX \expandafter\def\expandafter\testfileincipit\expandafter {\testfileincipit\ (compiled with \LuaLaTeX)} \fi\fi \usepackage[subdued,italic,asterisk]{mathastext} \setmainfont[Color=999999]{Verdana} \Mathastext[Verdana] \setmainfont[Color=0000FF]{Arial} \Mathastext[Arial] \setmainfont[Color=00C000]{DejaVu Serif} \Mathastext[DejaVu] \setmainfont[Color=FF0000]{Andale Mono} \Mathastext[Andale] \setmainfont[Color=C000C0]{URW Chancery L} \Mathastext[Chancery] \setmainfont[Color=800080]{URW Palladio L} \Mathastext[Palladio] \setmainfont[Color=808000]{Liberation Serif} \Mathastext[Liberation] \MTDeclareVersion{Times}{T1}{ptm}{m}{n} \begin{document} \MTversion{normal} \testfileincipit This test uses \verb|mathastext| with its \emph{italic}, \emph{asterisk}, and \emph{subdued} options. The base document fonts are the Latin Modern ones (in OpenType format). The other fonts used were chosen from those of a Linux machine. We also used the Times font in T1 encoding, to illustrate a warning from the user manual when using different encodings in the various math versions: here the minus sign has disappeared from the Times math mode block, precisely for this matter of encoding. Furthermore we test if the non-letter characters obey the math alphabet \verb|\mathbf|. In the normal and bold math versions, this feature is de-activated, as option \emph{subdued} was used; and if activated we should then use in these math versions the package \verb|\Mathbf| rather than \verb|\mathbf| which is there still the original one, which will use encoding \verb|OT1| in the normal and bold versions, as we loaded \verb|fontspec| with its option \emph{no-math}. Some among the fonts tested have no bold variant or no italic variant. \newcommand\TEST[1]{\MTversion{#1}\def\tmpa{#1}% \def\tmpb{normal}\def\tmpc{bold}% \ifx\tmpa\tmpb\else\ifx\tmpa\tmpc\else \MTnonlettersobeymathxx \MTexplicitbracesobeymathxx\fi\fi \begin{multicols}{2} \hbox to\columnwidth{\hbox to\columnwidth{\hfil $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}} \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ } \centerline{ $0123456789$ } \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ } \centerline{ $\mathbf{!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash}$ } \columnbreak \centerline{ abcdefghijklmnopqrstuvwxyz } \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ } \centerline{ 0123456789} \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 } \centerline{\bfseries !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 } \end{multicols}} \begin{multicols}{2} \centerline{\textbf{math mode}} \columnbreak \centerline{ \textbf{text} } \end{multicols} \TEST{DejaVu}\TEST{Verdana}\TEST{Andale}\TEST{Palladio} \TEST{Arial}\TEST{Chancery}\TEST{Liberation} \TEST{bold}\TEST{normal}\TEST{Times} \end{document} %---------------------------------------------EOF mathastexttestunicodelinux.tex % %<*alphabets> %--------------------------------------------------- mathastexttestalphabets.tex %% This file `mathastexttestalphabets.tex' is for testing the extended %% scope of the math alphabet commands with package `mathastext', via %% the package command \MTnonlettersobeymathxx. %% %% Compile either with latex, pdflatex, lualatex (pdf output) or xelatex. %% %% See `mathastext.dtx' for the copyright and conditions of distribution or %% modification. %% \documentclass{article} \usepackage[hscale=0.66]{geometry} \usepackage{amsmath} \usepackage{mathtools}\mathtoolsset{centercolon} %% WARNING THIS IS INCOMPATIBLE WITH BABEL+FRENCHB %% BUT WITH MATHASTEXT LOADED THIS IS CORRECTED %% *IF* \MTnonlettersobeymathxx IS MADE USE OF. \usepackage{iftex} \ifXeTeX \expandafter\def\expandafter\testfileincipit\expandafter {\testfileincipit\ (compiled with \XeLaTeX)} \usepackage[no-math]{fontspec} \setmainfont[ExternalLocation, Mapping=tex-text, BoldFont=texgyretermes-bold, ItalicFont=texgyretermes-italic, BoldItalicFont=texgyretermes-bolditalic]{texgyretermes-regular} \setmonofont[ExternalLocation, Mapping=tex-text]{texgyrecursor-regular} \setsansfont[ExternalLocation, Mapping=tex-text]{texgyreheros-regular} \else \ifLuaTeX % for pdf output \expandafter\def\expandafter\testfileincipit\expandafter {\testfileincipit\ (compiled with \LuaLaTeX)} \usepackage[no-math]{fontspec} \setmainfont[Ligatures=TeX]{TeX Gyre Termes} \setmonofont[Ligatures=TeX]{TeX Gyre Cursor} \setsansfont[Ligatures=TeX]{TeX Gyre Heros} \else \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tgtermes} \usepackage{tgcursor} \usepackage{tgheros} \fi\fi \usepackage{metalogo} % must be loaded /after/ [no-math]fontspec \usepackage[french]{babel} \usepackage[italic,asterisk]{mathastext} \MTlettershape{n}\Mathastext[upright] \MTnonlettersobeymathxx \MTexplicitbracesobeymathxx \delimitershortfall-1pt \begin{document} \testfileincipit \begin{center} \bfseries Two features of \texttt{mathastext}:\\ extended scope of the math alphabets and added italic corrections\par \end{center} The package makes ${!}\,{?}\,{,}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,{[}\,{]}\,{<}\,{>}\,{\{}\,{\}}$, the asterisk $*$, and $.\,/\,\vert\,\backslash\,{\#}\,{\$}\,{\%}\,{\&}$ obey the math alphabet commands (this is the maximal list, some characters may have been excluded by the corresponding package options). For the characters listed first the mechanism involves a `mathematical activation'. As this process may create incompatibilities, it will be put into action for ${!}\,{?}\,{,}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,{[}\,{]}\,{<}\,{>}$ only if the user makes use of the package command \verb|\MTnonlettersobeymathxx| (and the braces necessitate \verb|\MTexplicitbracesobeymathxx|). It could be that one such character has been made `active' in the entire document by some other package, typically a language definition file for the \verb|babel| system. Here for example we have used \verb|babel| with the \verb|french| option, which makes the high punctuation characters !?:; active throughout the document (extra spacing is put in front of the character when used in text; no change in math but perhaps for other languages and characters this could happen, it is up to the language definition file to decide). When \verb|mathastext| detects that a character it wants to `mathematically activate' is already `active', it does not go further except if it seems that the activation was done by Babel. If the activation was done by Babel, then \verb|mathastext| replaces the expansion of the active character in math mode by what is necessary to achieve its goal. It does not additionally mathematically activate the character; rather it makes sure that the character is \emph{not} mathematically active. In the present document the colon was made mathematically active by \verb|mathtools| but this was already canceled in the preamble by \verb|mathastext| as it was loaded later. And it is better so, because the combination \verb|babel| (with option \verb|frenchb|) +\verb|mathtools| (with \verb|centercolon|) makes \verb|$:$| create an infinite loop! But even if someone had mathematically activated the colon after the preamble, or after the loading of \verb|mathastext|, this would be canceled again automatically for each inline or displayed mathematical formula (if the user does \verb|\MTnonlettersobeymathxx|). The conclusion with \verb|\MTnonlettersobeymathxx| is: if some package has tried to make the character mathematically active, this will be overruled by \verb|mathastext|; if some package has made the character globally active, then the package wins except if it is Babel, as \verb|mathastext| may in the latter case safely modify the action in math mode (paying attention to the fact that the character should be usable in \verb|\label| and \verb|\ref| in and outside of math mode). The displayed equations next illustrate the extended scope of the math alphabets which now apply to $=$, $-$, $($, $)$, $[$, $]$ (but not to the large delimiters of course). Furthermore, for testing purposes the equations were labeled using such characters, for example the last one has label \verb|eq=7|, to check that the mathematical activation of $=$ does not cause problems with \verb|\label/\ref|. \def\testformula{\quad\Biggl\lbrace\biggl(\left(\left[[\sin(a) + \cos(b) - \log(c) = \sec(d)]\right]\right)\biggr)\Biggr\rbrace} \begin{equation}\testformula\label{eq:1}\end{equation} \begin{equation}\mathnormalbold{mathnormalbold:\testformula}\label{eq;2}\end{equation} \begin{equation}\mathrm{mathrm:\testformula}\label{eq?3}\end{equation} \begin{equation}\mathbf{mathbf:\testformula}\label{eq!4}\end{equation} \begin{equation}\mathit{mathit:\testformula}\label{eq(5}\end{equation} \begin{equation}\mathtt{mathtt:\testformula}\label{eq)6}\end{equation} \begin{equation}\mathsf{mathsf:\testformula}\label{eq=7}\end{equation} Equations above are numbered \ref{eq:1}, \ref{eq;2}, \ref{eq?3}, \ref{eq!4}, and $\ref{eq(5}$, $\ref{eq)6}$, and $\ref{eq=7}$. \def\testline#1{$#1$&$\mathnormalbold{#1}$&$\mathrm{#1}$&$\mathbf{#1}$&$\mathit{#1}$&$\mathtt{#1}$&$\mathsf{#1}$} \centerline{\begin{tabular}{ccccccc} \testline{a!b}\\ \testline{a?b}\\ \testline{a,b}\\ \testline{a;b}\\ \testline{a:b}\\ \testline{a:=b}\\ \testline{a\vcentcolon= b}\\ \testline{a\colon b}\\ \testline{a.b}\\ \testline{a-b}\\ \testline{a+b}\\ \testline{a=b}\\ \testline{ab}\\ \testline{}\\ \testline{\mathopen{<} x,y\mathclose{>}}\\ \testline{\left< x,y\right>}\\ \testline{a/b}\\ \testline{a\backslash b}\\ \testline{a\setminus b}\\ \testline{a|b}\\ \testline{a\mid b}\\ \testline{(a,b)}\\ \testline{[a,b]}\\ \testline{\{a,b\}} \end{tabular}} The question mark has been made active by \verb|babel+frenchb|. \verb|mathastext| has imposed in math mode its ways (now \verb|$\mathbf{???}$| gives $\mathbf{???}$). As the extra spacing is added by \verb|frenchb| only in text, we had to use the math alphabet to check that indeed \verb|mathastext| overruled Babel. To double-check we will now make \string? mathematically active: \verb|\mathcode`?="8000|\mathcode`?="8000. This is a sure cause for disaster normally with Babel (don't do this at home without \verb|mathastext|!). But here with \verb|$?$| no bad surprise (infinite loop!) awaits us: just $?$. Let's take some other character, for example the opening parenthesis, and make it catcode active: \verb|\catcode`(=\active \def ({X}|. Let's try the input \verb|( and $($|. \begingroup \catcode`(=\active \gdef ({X} This gives ( and $($. We see that \verb|mathastext| does not attempt to modify the definition of the active character, as this activation was not done via the \verb|babel| services. \catcode`\(=12 \mathcode`(="8000 We now revert the parenthesis to catcode other (but maintain \verb|\def ({X}| as definition of its active version), and then make it mathematically active using the command \verb|\mathcode`(="8000|. If we try \verb|$((($| we see that the parenthesis is not converted into an $X$: $((($. The mathematically active character was overruled by \verb|mathastext|. Issuing \verb|\MTnonlettersdonotobeymathxx|\MTnonlettersdonotobeymathxx\ we do get the $X$'s from the input \verb|$((($|: $((($ \endgroup This shows that \verb|mathastext| now does not modify in math mode the non-letter \verb|(|. \MTversion{upright}\MTnonlettersobeymathxx We defined in the preamble of the document a \verb|mathastext|-enhanced math version (named \verb|upright|) having the Latin letters upright in math mode. Let's switch to it: \newline \hbox to\linewidth{\hss\verb|\MTversion{upright}|\hss} With a font which is neither italic nor slanted, \verb|mathastext| automatically inserts italic corrections for better positioning of the subscript: \verb|$f_i^i$| gives $f_i^i$. After \verb|\MTnoicinmath| which turns off this feature\MTnoicinmath{}, the same input gives $f_i^i$, which is different. \footnote{last time I tried, this only worked with PDF\LaTeX{}, not with \LuaLaTeX{} or \XeTeX{}.} Again with italic corrections on (\verb|\MTicinmath|)\MTicinmath{} \verb|$f_{abc}^{def}$| gives $f_{abc}^{def}$, and here is another one: $f^{f_{abc}^{def}}_u$. Without italic corrections\MTnoicinmath: $f_{abc}^{def}$, and respectively $f^{f_{abc}^{def}}_u$.\MTicinmath We can also check that the added italic corrections do not prevent the formation of ligatures when using the math alphabets, apart from \verb|\mathnormal| (which comes first): $\mathnormal{ff}$, $\mathrm{ff}$, $\mathit{ff}$, $\mathbf{ff}$, $\mathtt{ff}$ (no ligature in teletype) and $\mathsf{ff}$. \centerline{\begin{tabular}{ccccccc} \testline{a!b}\\ \testline{a?b}\\ \testline{a,b}\\ \testline{a;b}\\ \testline{a:b}\\ \testline{a:=b}\\ \testline{a\vcentcolon= b}\\ \testline{a\colon b}\\ \testline{a.b}\\ \testline{a-b}\\ \testline{a+b}\\ \testline{a=b}\\ \testline{ab}\\ \testline{}\\ \testline{\mathopen{<} x,y\mathclose{>}}\\ \testline{\left< x,y\right>}\\ \testline{a/b}\\ \testline{a\backslash b}\\ \testline{a\setminus b}\\ \testline{a|b}\\ \testline{a\mid b}\\ \testline{(a,b)}\\ \testline{[a,b]}\\ \testline{\{a,b\}} \end{tabular}} \end{document} %------------------------------------------------EOF mathastexttestalphabets.tex % %<*dtx> ~fi % end of \iffalse block ~catcode`~\0 \catcode`\~\active %------------------------------------------------------------------------------- % customization should be done in mathastext.tex, not here. \documentclass[abstract]{scrdoc} \ifnum\NoSourceCode=1 \OnlyDescription\fi \makeatletter \ifnum\Withdvipdfmx=1 \@for\@tempa:=hyperref,bookmark,graphicx,color\do {\PassOptionsToPackage{dvipdfmx}\@tempa} % \PassOptionsToPackage{dvipdfm}{geometry} \PassOptionsToPackage{bookmarks=true}{hyperref} \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref} \PassOptionsToPackage{dvipdfmx-outline-open}{bookmark} % \def\pgfsysdriver{pgfsys-dvipdfm.def} \else \PassOptionsToPackage{bookmarks=true}{hyperref} \fi \makeatother \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath}\allowdisplaybreaks \usepackage{lmodern} \usepackage{enumitem} \DeclareSymbolFont{largesymbols}{OMX}{txex}{m}{n} \SetSymbolFont{largesymbols}{bold}{OMX}{txex}{bx}{n} \DeclareFontSubstitution{OMX}{txex}{m}{n} % in order to cancel the removal done by ltxdoc % of comment characters inside verbatim blocks. \makeatletter\let\check@percent\relax\makeatother \usepackage{color} \definecolor{DarkMagenta}{RGB}{139,0,139} \definecolor{joli}{RGB}{225,95,0} \usepackage{xspace} \usepackage{metalogo} \usepackage{framed} \usepackage[hscale=0.66]{geometry} \usepackage[pdfencoding=pdfdoc]{hyperref} \hypersetup{linktoc=all,% %hidelinks,% colorlinks=true,% breaklinks=true,% linkcolor={blue},% urlcolor={joli}, pdfauthor={Jean-Fran\c cois Burnol},% pdftitle={The mathastext package},% pdfsubject={LaTeX, math fonts},% pdfkeywords={LaTeX, Fonts},% pdfstartview=FitH,% pdfpagemode=UseOutlines,% } \usepackage{bookmark} % ---- \centeredeline: OUR OWN LITTLE MACRO FOR CENTERING LINES (fait % initialement pour la documentation de mes autres paquetages etoc et xint) % 7 mars 2013 % This macro allows to conveniently center a line inside a paragraph and still % use therein \verb or other commands changing catcodes. % A proposito, the \LaTeX \centerline uses \hsize and not \linewidth ! % (which in my humble opinion is bad) % \ignorespaces ajouté le 9 juin. Cela m'aurait évité des dizaines de % lorsque % plusieurs \centeredline se suivent (car on reste en mode horizontal si on y % est au début). \makeatletter \newcommand*\centeredline {% \ifhmode \\\relax \def\centeredline@{\hss\egroup\hskip\z@skip\ignorespaces }% \else \def\centeredline@{\hss\egroup }% \fi \afterassignment\@centeredline \let\next=} \def\@centeredline {\hbox to \linewidth \bgroup \hss \bgroup \aftergroup\centeredline@ } \makeatother \DeclareRobustCommand\cs[1]% {{\ttfamily\hyphenchar\font45\char`\\#1}} \DeclareRobustCommand\csb[1]% {\hyperref[#1]{\ttfamily\char`\\#1}} \newcommand*\blueit[1]{\texorpdfstring{\blueitaux #1\relax}{#1}} \def\blueitaux #1#2\relax{\hyperref[#2]{\ttfamily #1#2}} % 2 septembre 2013, 22:25 % je réussis avec un minimum de modifs dans la source à convertir tous mes % mots-clés bleux en hyperliens; les labels sont créés simplement en modifiant % plus loins \@jfendshrtverb \catcode`\§=13 \makeatletter \def§{\begingroup \let\do\@makeother\dospecials \@jfendshrtverb } \def\@jfendshrtverb #1#2§{\hyperref[#2]{\ttfamily #1#2}\endgroup} \makeatother \newcommand\mst{% \texorpdfstring{{\color{joli}\ttfamily\bfseries mathastext}} {mathastext}\xspace} \let\oldexists\exists\let\oldforall\forall \usepackage[italic,subdued,asterisk,defaultmathsizes,symbolmisc,symbolre, LGRgreek]{mathastext} \Mathastext[italic] \MTlettershape{\updefault} \Mathastext[upright] \MTupgreek \MTgreekfont{cmtt} \MTDeclareVersion[n]{lmvtt}{T1}{lmvtt}{m}{n} \MTlettershape{\itdefault} \usepackage{newcent} \Mathastext[newcent] \MTseries{b} \Mathastext[boldnewcent][bold] \MTseries{m} \MTitgreek\MTupGreek \MTgreekfont{txr} \usepackage{times} \Mathastext[times] \MTlettershape{\updefault} \MTseries{bx} \Mathastext[timesbold][bold] \MTlettershape{\itdefault} \MTseries{m} \usepackage[scaled]{helvet} \renewcommand\familydefault\sfdefault \MTgreekfont{cmss} \Mathastext[helvet] \usepackage{etoc} \begin{document} \MTversion{normal} \renewcommand\familydefault\sfdefault \pdfbookmark[1]{Title page}{TOP} \frenchspacing \begin{center} {\normalfont\LARGE The \mst package}\\ \textsc{\small Jean-François Burnol}\par \footnotesize \ttfamily jfbu (at) free (dot) fr\par \let\thefootnote\empty Package version: \MSTpkgversion\ (\MSTpkgdate)% \footnote{Documentation generated from the source file with timestamp ``\dtxtimestamp''.}\par \end{center} \setcounter{footnote}{0} \begin{small} \noindent The \mst package changes the fonts which are used in math mode for letters, digits and a few other punctuation and symbol signs to replace them with the font as used for the document text. Thus, the package makes it possible to use a quite arbitrary font without worrying too much that it does not have specially designed accompanying math fonts. Also, \mst provides a simple mechanism in order to use more than one math-as-text font in the same document.\baselineskip.9\baselineskip\par \end{small} \medskip \begin{verbatim} `mathastext' is a LaTeX package \usepackage{mathastext} The document will use in math mode the text font as configured at package loading time, for these characters: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 !?,.:;+-=()[]/#$%&<>|{}\ The command \MTsetmathskips allows to set up extra spacings around each given letter. Use multiple \Mathastext[name]'s to define in the preamble various math versions using each a given text font, to be later activated in the document body via the command \MTversion{name}. With the subdued option, mathastext will be active only inside such math versions distinct from the normal and bold. Main options: italic, defaultmathsizes, subdued, asterisk, LGRgreek. \end{verbatim} \clearpage \etoctoclines \renewcommand\etocaftertitlehook {\hypersetup{hidelinks}% added 1.3 \setlength{\columnseprule}{.4pt}% \renewcommand{\columnseprulecolor}{\color{DarkMagenta}}% } \renewcommand\etocbelowtocskip{1ex} \etocruledstyle{\color{DarkMagenta}\normalfont\large\bfseries\contentsname } % pdfbookmark added 2013/12/11. Attention si je le mets dans ruled style % il est exécuté deux fois et ça cause un problème. % et le aftertitlehook est trop bas. \pdfbookmark[1]{Table of contents}{MAINTOC} \tableofcontents {\color{DarkMagenta}\hrule}% \vskip 5ex plus 2ex minus 1ex \section{Recent changes and installation instructions} \subsection{Recent changes} This is the documentation for version \texttt{\MSTpkgversion} of \texttt{\MSTpkgdate}. Updated \texttt{\docdate} to mention \hyperref[ssec:beamer]{better compatibility} with |beamer|. Changes for this release: \begin{enumerate}[noitemsep] \item if one of the Greek related options (§LGRgreek§(s), §selfGreek§(s), §eulergreek§, §symbolgreek§) has been passed to the package, its action may be turned off and again on using §\MTstandardgreek§ and §\MTcustomgreek§ at any location in the document body. \item in the §subdued§ normal and bold math versions, the Greek letters in math mode are the default ones, even if the package was loaded with one of the Greek related options (previously, this was the case only for §LGRgreek§ and §LGRgreeks§). \end{enumerate} Changes for release |1.3c| of |2013/12/14|: \begin{enumerate}[noitemsep] \item §\Mathastext§ and §\MTDeclareVersion§ both accept a final optional argument, a math version name whose settings regarding things not otherwise changed by \mst (like most symbols and large symbols) will be inherited by the declared math version (first optional argument of §\Mathastext§ or first mandatory argument of §\MTDeclareVersion§). Typical use will be with this final optional argument set to be |[bold]|. \item §\MTversion§ has a starred variant which will not modify the document text fonts, but only the math fonts (for those characters treated by \mst). \item in case of option §symbolmisc§: |\defaultprod| and |\defaultsum| have been renamed to, respectively, |\MToriginalprod| and |\MToriginalsum|. \end{enumerate} Changes for release |1.3a| of |2013/09/04|: \begin{enumerate}[noitemsep] \item (see \autoref{sec:mathskips}) new command §\MTsetmathskips§ allows to specify, on a letter by letter basis, extra spaces (expressed in terms of `mu' units, or as \cs{thinmuskip} for example) to be inserted automatically in math mode around the specified letter. This is provided for text fonts whose use in math mode creates glyph collisions or excessive crampedness, \item use of the latest version of \cs{luatexUmathcodenum} now allows equal treatment of |=| and |-| by \mst under both unicode engines \LuaTeX{} and \XeTeX. So \mst version |1.3| under \LuaLaTeX{} \emph{requires} the version of |lualatex| (binaries and format) as included for example in the TeXLive 2013 distribution, or later, \item a few minor changes and code improvements for better compatibility in various contexts, \item blue keywords in the documentation are now (mostly) hyperlinked to their more detailed descriptions, \item various other documentation improvements. \end{enumerate} {\small Version |1.2f|: addition of the ``change log'' at the end of this user manual, and some minor code improvements not changing neither features nor user interface. \smallskip Version |1.2e| made additions: in this user manual to the section \ref{sec:compat} describing the compatibility issues, and to the test files illustrating various package features. Important changes to the source code were done to fix compatibility problems with active characters dating back to the |1.2| version. Also, an oversight in the implementation of the italic correction features from |1.2b| was corrected. \smallskip Version |1.2d| introduced the |asterisk| option and addressed a problem of compatibility with |amsmath|. \smallskip The main new features in versions |1.2| and |1.2b| were the \hyperref[sec:mathxx]{extended scope of the math alphabets} and, respectively, \hyperref[sec:ic]{added italic corrections in math mode}. Both use mathematically active characters and some (thorny) technical problems related to globally active characters were finally solved to (almost) complete satisfaction (let's hope) only in the current |1.2e| version. These issues are commented upon in the \hyperref[sec:compat]{compatibility section}, in the test file \texttt{mathastexttestalphabets.tex} and in the commented source code. \smallskip Earlier, version |1.15| introduced the concept of the \hyperref[sec:subdued]{{subdued} math versions.} \par } \subsection{Installation} \begin{verbatim} Installation: ============= The fastest way is: unzip -d mathastext.tds.zip, where could be ~/texmf or, on mac os x, ~/Library/texmf. Else, download mathastext.dtx, possibly also mathastext.ins, and follow these instructions: * with mathastext.ins: run tex on mathastext.ins to generate the package style file mathastext.sty as well as mathastext.tex and some test files. * without mathastext.ins: run tex on mathastext.dtx to generate the package style file mathastext.sty as well as mathastext.tex and some test files. (and also mathastext.ins) Move the style file mathastext.sty to a location where TeX can find it. In a TDS compliant hierarchy this will be :tex/latex/mathastext/mathastext.sty *documentation*: run latex thrice on mathastext.tex then dvipdfmx. Or, run pdflatex thrice on mathastext.dtx. In the former case the documentation is with source code included, in the latter without. The file mathastext.tex can be customized to change the font size or set other options therein. (One cannot use lualatex/xelatex to compile the documentation.) *test files*: mathastexttestmathversions.tex mathastexttestunicodemacos.tex mathastexttestunicodelinux.tex mathastexttestalphabets.tex \end{verbatim} % \clearpage \section{What \mst does} \subsection{Examples} \mst's basic aim is to have the same font for text and mathematics. With hundreds of free text fonts packaged for \LaTeX{} and only a handful of math ones, chances are your favorite text font does not mix so well with the available math ones; \mst may then help. Note that \mst was initially developed for the traditional \TeX{} fonts and engines, and that compatibility with Unicode engines and OpenType fonts is partial. Here is an example with Latin Modern typewriter proportional: {\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth \MTversion{lmvtt} Let $(X,Y)$ be two functions of a variable $a$. If they obey the differential system $(VI_{\nu,n})$: \begin{align*} a\frac{d}{da} X &= \nu X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\ a\frac{d}{da} Y &= -(\nu+1) Y + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} \end{align*} then the quantity $q = a \frac{aX+Y}{X+aY}$ satisfies as function of $b= a^2$ the $P_{VI}$ differential equation: \begin{equation*} \begin{split} \frac{d^2 q}{db^2} = \frac12\left\{\frac1q+\frac1{q-1} +\frac1{q-b}\right\}\left(\frac{dq}{db}\right)^2 - \left\{\frac1b+\frac1{b-1} +\frac1{q-b}\right\}\frac{dq}{db}\\+\frac{q(q-1)(q-b)}{b^2(b-1)^2}\left\{\alpha+\frac{\beta b}{q^2} + \frac{\gamma (b-1)}{(q-1)^2}+\frac{\delta b(b-1)}{(q-b)^2}\right\} \end{split} \end{equation*} with parameters $(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2, \frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par } Notice that the Latin (and Greek letters) are in upright shape. But perhaps we insist on obeying the standardized habits: {\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth \MTversion{times} Let $(X,Y)$ be two functions of a variable $a$. If they obey the differential system $(VI_{\nu,n})$: \begin{align*} a\frac{d}{da} X &= \nu X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\ a\frac{d}{da} Y &= -(\nu+1) Y + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} \end{align*} then the quantity $q = a \frac{aX+Y}{X+aY}$ satisfies as function of $b= a^2$ the $P_{VI}$ differential equation: \begin{equation*} \begin{split} \frac{d^2 q}{db^2} = \frac12\left\{\frac1q+\frac1{q-1} +\frac1{q-b}\right\}\left(\frac{dq}{db}\right)^2 - \left\{\frac1b+\frac1{b-1} +\frac1{q-b}\right\}\frac{dq}{db}\\+\frac{q(q-1)(q-b)}{b^2(b-1)^2}\left\{\alpha+\frac{\beta b}{q^2} + \frac{\gamma (b-1)}{(q-1)^2}+\frac{\delta b(b-1)}{(q-b)^2}\right\} \end{split} \end{equation*} with parameters $(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2, \frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par } This was typeset using the Times font (available in any \TeX{} distribution). Let us now be a bit more original and have our mathematics with italic letters from the sans serif font Helvetica, while the letters in text use New Century Schoolbook. {\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth \MTversion[newcent]{helvet} Let $(X,Y)$ be two functions of a variable $a$. If they obey the differential system $(VI_{\nu,n})$: \begin{align*} a\frac{d}{da} X &= \nu X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\ a\frac{d}{da} Y &= -(\nu+1) Y + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} \end{align*} then the quantity $q = a \frac{aX+Y}{X+aY}$ satisfies as function of $b= a^2$ the $P_{VI}$ differential equation: \begin{equation*} \begin{split} \frac{d^2 q}{db^2} = \frac12\left\{\frac1q+\frac1{q-1} +\frac1{q-b}\right\}\left(\frac{dq}{db}\right)^2 - \left\{\frac1b+\frac1{b-1} +\frac1{q-b}\right\}\frac{dq}{db}\\+\frac{q(q-1)(q-b)}{b^2(b-1)^2}\left\{\alpha+\frac{\beta b}{q^2} + \frac{\gamma (b-1)}{(q-1)^2}+\frac{\delta b(b-1)}{(q-b)^2}\right\} \end{split} \end{equation*} with parameters $(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2, \frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par } And after all that, we may wish to return to the default math typesetting (let's shorten the extract here in case the reader makes an indigestion \dots): {\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth Let $(X,Y)$ be two functions of a variable $a$. If they obey the differential system $(VI_{\nu,n})$: \begin{align*} a\frac{d}{da} X &= \nu X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\ a\frac{d}{da} Y &= -(\nu+1) Y + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} \end{align*} then the quantity $q = a \frac{aX+Y}{X+aY}$ satisfies as function of $b= a^2$ the $P_{VI}$ differential equation with parameters $(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2, \frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par } \vskip\baselineskip Notice that the Greek letters also changed according to the \emph{math version}: \mst has indeed some (limited) capabilities to this effect, with its §LGRgreek§ option. This document uses the |LGR| encoded fonts |cmtt|, |cmss|, and |txr|, which are part of standard \TeX{} distributions.\footnote{The first two are available (with no need to load explicitely any package in the document) via the combination |cbfonts| (|cbgreek-complete|) \& |babel|, and the |LGR| encoded |txr| font (again no package loading is necessary) is part of the files of the |txfonstb| package.} % \href{http://mirrors.ctan.org/help/Catalogue/entries/cbgreek-complete.html}{cbfonts}, % \href{http://mirrors.ctan.org/help/Catalogue/entries/txfontsb.html}{txfontsb}. \subsection{Overview} \subsubsection{Basic use} The initial ideology of \mst was to produce mathematical texts with a very uniform look, not separating math from text as strongly as is usually done. As soon as one tries out other fonts for text than the Computer Modern ones one realizes how extremely ``thin'' are the default \TeX{} fonts for mathematics: they definitely do not fit well visually with the majority of text fonts. With \mst one can get one's (simple\dots{} or not) mathematics typeset in a manner more compatible with the text, without having to look for an especially designed font. Here is a minimal example of what may go into the preamble: \begin{verbatim} \usepackage[T1]{fontenc} \usepackage{times} \usepackage[italic]{mathastext} \end{verbatim} The package records which font is set up for text, at the time it is loaded,\footnote{alternatively it is possible to configure the text font after loading \mst, and then the command \cs{Mathastext} will accomplish the necessary changes to the font for letters, digits and a few extra ascii symbols in math mode.} and then arranges things in order for this text font to be used in math mode as well. So, with the preamble as above all letters, digits, and punctuation signs inside math mode will then be typeset in Times.\footnote{let's do as if we did not know the excellent |txfonts| package which employs Times for text and has a very complete math support, including many additional mathematical glyphs in comparison to the CM fonts.} The exact list of characters concerned by \mst is a subset of the basic |ASCII| set: \begin{framed}\centering\MTversion{timesbold}% \begingroup\color{joli}% $abcdefghijklmnopqrstuvwxyz$\par $ABCDEFGHIJKLMNOPQRSTUVWXYZ$\par $0123456789$\par \DeleteShortVerb{\|}% global! ${!}\,{?}\,{*}\,{,}\,{.}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\, {[}\,{]}\,{/}\,{\#}\,{\$}\,{\%}\,{\&}\,{<}\,{>}\,{|}\,{\{}\,{\}} \textrm{ \color{black}\mdseries and }{\backslash}$% \endgroup\par\MakeShortVerb{\|}% \end{framed} As one can see, this is a very limited list! some possibilities are offered by \mst for Greek letters and will be described later. The text characters {}'{} and {}-{} are not used, and the asterisk is done optionally: \begin{itemize} \item the derivative sign ${}'$ is left to its default as the text font glyph {}'{} is not, as a rule, a satisfying alternative.\footnote{|v1.2| adds a customizable tiny space before ${}'$ to separate it from the previous letter, this is really needed when using upright letters in math mode with the CM derivative glyph.{\MTversion{upright}\sffamily\MTprimeskip{.5mu}% Compare $f'$ with \MTprimeskip{0mu}$f'$.} } \item for the minus sign \mst uses the endash character \textendash, if available, and not the hyphen character -, \item the option §asterisk§ is necessary for \mst to replace the binary math operator $*$ (and the equivalent control sequence \cs{ast}) with a version which uses the text asterisk * suitably lowered\footnote{the amount of lowering can be customized.} (and with the correct spaces around it as binary operator). The reason for making it optional is that after this |$R^*$| or |$R^\ast$| do not work and have to be written |$R^{*}$| or |$R^{\ast}$|. \end{itemize} Nothing is changed to the ``large'' math symbols, except for $\MToriginalprod$ and $\MToriginalsum$ in inline math which, like here: $\prod\sum$, will be taken from the Symbol Font if option §symbolmisc§ was used. The left and right delimiters are taken from the text font only for the base size: any |\big|, |\bigl|, |\bigr|, etc\dots reverts to the original math symbols. \subsubsection{always load \mst last} The ``large'' math symbols are not modified in any way by \mst. Only loading some math font packages such as |fourier|, |kpfonts|, |mathabx|, |mathdesign|, |txfonts|, |newtxmath|, etc\dots{} will change them. Think of loading these packages before \mst, else they might undo what \mst did. More generally any package (such as |amsmath|) dealing with math mode should be loaded \emph{before} \mst. \subsubsection{sans in math} The following set-up often gives esthetically pleasing results: it is to use the sans-serif member of the font family for math, and the serif for text. \begin{verbatim} \renewcommand\familydefault\sfdefault \usepackage{mathastext} \renewcommand\familydefault\rmdefault \begin{document} \end{verbatim} \subsubsection{using \mst with \texttt{beamer}}\label{ssec:beamer} \noindent\llap{\textcolor{green}{\bfseries 2015/02/26}\hspace{1em}}Starting with release |3.34| of |beamer|, \mst is recognized as a ``math font package''. Only with \textbf{earlier} |beamer| versions is it necessary to issue \centeredline{|\usefonttheme{professionalfonts}|} in the preamble. Example: \begin{verbatim} \documentclass{beamer} \usefonttheme{professionalfonts} \usepackage{newcent} \usepackage[scaled=.9]{helvet} \renewcommand{\familydefault}{\rmdefault} \usepackage[defaultmathsizes,symbolgreek]{mathastext} \renewcommand{\familydefault}{\sfdefault} \begin{document} \begin{frame} This is some text and next comes some math: $E=mc^2$ \[ E=mc^2=a^n+b^n-c^n=\alpha\beta\gamma \] \begin{align} E&=mc^2\\ E&=h\nu \end{align} And again some text. \end{frame} \end{document} \end{verbatim} \subsubsection{option \blueit{LGRgreek}} There is the issue of Greek letters. Sometimes the text font has Greek glyphs, in |LGR| encoding (this will be mentioned in the documentation of the font package). Then option §LGRgreek§ tells \mst to pick up these Greek letters. And it is possible to specify whether the Greek letters should be upright, or ``italic''.\footnote{a more detailed discussion comes next. Note that the default CM and its replacement Latin Modern for european languages are (transparently to the user) extended with |LGR| encoded fonts from the |cbfonts| (|cbgreek-complete|) package.} It is naturally possible to leave the responsability to set up Greek letters to some other packages loaded previously to \mst. And even if \mst has been loaded with one of its Greek related options the command §\MTstandardgreek§ will locally cancel its customization of Greek letters. See also §\MTcustomgreek§. % \href{http://mirrors.ctan.org/help/Catalogue/entries/cbgreek-complete.html}{cbfonts} \subsubsection{avoid \texorpdfstring{\texttt{OT1}}{OT1} encoding} We specified in our minimal working example a |T1| encoding (|LY1| would have been ok, too) because the default |OT1| does not have the {\color{joli}\DeleteShortVerb{\|} $\mathord{<}\,\mathord{>}\,\mathord{|}$\,\{\,\}} and {\color{joli}$\backslash$\MakeShortVerb{\|}} glyphs. If \mst detects |OT1| as the default encoding it will leave these characters to their defaults from the math fonts.\footnote{the §subdued§ option, described next, acts a bit otherwise, it forces, contrarily to its usual low-key character, the replacement of |OT1| by |T1| for the fonts ultimately used with letters and digits in math mode.} \begin{framed} If \mst detects the obsolete |OT1| encoding it does not do anything with \DeleteShortVerb{\|}<, >, |, \{, and \} which (except for monospace fonts) are not available in that encoding.\MakeShortVerb{\|} To fully benefit from \mst it is recommended to use some other encoding having these glyphs such as |T1| or |LY1|. \end{framed} \subsection{Main options} \subsubsection{The \blueit{italic} option} In the initial version |1.0|, the Latin letters in mathematical mode assumed the exact same shape as in text mode, and this meant, generally speaking, that they would turn up upright. Doing this gives a very uniform look to the document, so that one has to make an effort and read it with attention, and this was one of the design goals of \mst. Nevertheless, soon after I posted the initial version of the package to CTAN, I was overwhelmed by numerous\footnote{this means ``more then one.''} questions\footnote{I thank in particular \textsc{Tariq~Perwez} and \textsc{Kevin~Klement} for their kind remarks (chronological order).} on how to have the letters be in italic shape. The default is still, as in version |1.0|, for everything to be in upright shape, but it suffices to pass to the package the option §italic§ to have the Latin letters in math mode in italic shape.\footnote{more precisely stated, the value of \cs{itdefault} is used.} There is also an option §frenchmath§ to make the uppercase letters nevertheless upright, because this is the way of traditional French mathematical typography.\footnote{more precisely stated, the value of \cs{shapedefault} is used.} \subsubsection{The \blueit{defaultmathsizes} option} The default sizes give for subscripts of subscripts barely legible glyphs (author's opinion!). So \mst makes more reasonable choices. It also redefines \cs{Huge} and defines a \cs{HUGE} size, copied from the |moresize| package. To cancel all of this use option §defaultmathsizes§. \subsubsection{The \blueit{subdued} option}\label{sec:subdued} This option was introduced in |v1.15|. It provides a manner to switch on the \mst-\emph{ification} only for limited portions of the document, with the help of the mechanism of math versions. Without the §subdued§ option, the \emph{mathastextification} applies by default to the whole of the document (and one may also define additional math versions in the preamble); with the §subdued§ option the \emph{mathastextification} is done only in \emph{math versions} distinct from the standard and bold ones. The previous description is in fact a bit optimistic: \mst was not written initially in order to allow its action to be completely cancelled, and achieving this would require a complete rewrite of large portions of the code. In order to really have the displayed math (almost) as if \mst had not been loaded, one must at a minimum also use the option §defaultmathsizes§. This does not quite suffice, because, for example, the colon, the dot, and the minus sign belong in the default \LaTeX{} math mode set-up to three distinct fonts whereas \mst will pick (even subdued) the three of them in the same font, and although it will make a reasonable choice of this font, this is not a return to the previously prevailing situation. And then arbitrary packages could have done arbitrary things... so to be on the safe side one needs the §basic§ option which limits the mathastextification to letters and digits (and should also be accompanied by §defaultimath§ which prevents redefinition of the \cs{imath} macro, and §nohbar§ which prevents redefinition of the \cs{hbar} macro\dots). And even then, in some circumstances, this will still not suffice; for example the \emph{euler} package puts the digits in the same font as the Latin letters in math mode, but the subdued \mst will pick them up in the same font as used in operator names, and in the case of the \emph{euler} package, this is the main document font. So, even subdued, \mst still kicks. But, as I think is illustrated by the examples given at the start of this document, the §subdued§ option has its utility, and works reasonably well. Starting with package version |1.3d|, the §subdued§ mode does extinguish in the normal and bold math versions the action of options §selfGreek§, §eulergreek§, and §symbolgreek§ (previously only §LGRgreek§ was subdue-able). \subsection{Math versions}\label{sec:mathversions} \LaTeX{} has the concept of \emph{math versions}, but most font packages do not define any such version beyond the default normal and bold (that they possibly customize to use such or such math font). The package |unicode-math| for unicode engines fruitfully uses this concept. \mst uses math versions in order to allow the math mode fonts (for letters, digits, punctuation and a few other ascii symbols) used in the different parts of the document to be kept in sync with the text fonts. However the other math symbols (sums, products, integrals, logical signs, etc\dots) will be the same throughout the document as it is not in \mst power to modify them. There are some possibilities to use different sets of fonts for the Greek letters, though. The present document illustrated the use of various fonts, here is its preamble (slightly stripped-down): \begin{center} \begin{minipage}{.8\linewidth} \begin{verbatim} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage[subdued,italic,defaultmathsizes]{mathastext} \MTDeclareVersion[n]{lmvtt}{T1}{lmvtt}{m}{n} \usepackage{newcent} \Mathastext[newcent] \usepackage{times} \Mathastext[times] \usepackage[scaled]{helvet} \renewcommand\familydefault\sfdefault \Mathastext[helvet] \begin{document}\MTversion{normal} \end{verbatim} \end{minipage} \end{center} Let us examine this code: it uses once the command §\MTDeclareVersion§ and three times the command §\Mathastext§, thus defining four |math versions|\footnote{|math versions| are discussed in the document |fntguide.pdf| from your \TeX{} distribution.}: |lmvtt|, |newcent|, |times|, and |helvet|. The names can be taken arbitrarily (they only need to be suitable arguments to the \LaTeX{} \cs{DeclareMathVersion} command which is invoked internally). Two additional math versions preexist: the |normal| and |bold|, which, because there was the §subdued§ option, were left untouched by \mst. Once these |math versions| are defined, §\MTversion§|{name_of_version}|, or equivalently §\Mathastextversion§|{name_of_version}|, enacts the font switches in the body of the document. As is usual with \LaTeX{} one can limit the scope to the inside of a group, or also switch back to the main set-up through issuing \cs{Mathastextversion\{normal\}}. When \cs{Mathastext} is used in the preamble, it records the current font defaults and (except for the |normal| and |bold| versions under the §subdued§ regime) sets up the math font to be used in that version to be the text font as found in \cs{familydefault}. But it is still possible for a \mst-declared math version to have distinct fonts for text and math: \begin{enumerate} \item in the body of the \TeX{} source, an optional argument (the name of a \mst-declared math version) to \cs{MTversion} is allowed, and for example we used in the source of this document \cs{MTversion[newcent]\{helvet\}} meaning ``New Century Schoolbook for the text and Helvetica for the math.'' \item there are preamble-only commands \cs{MTencoding}, \cs{MTfamily}, \cs{MTseries}, \cs{MTshape}, \cs{MTlettershape} which tell \mst what to do (for math \emph{only}) in each math version declared \emph{afterwards}, independently of the text fonts. \end{enumerate} In the body of the document the \LaTeX{} command \cs{mathversion}\marg{version\_name} will change only the fonts used in math mode. It is recommended to use instead the package command \csb{MTversion} (or one of its synonyms \cs{mathastextversion}, \cs{Mathastextversion}, \cs{MTVersion}), with a mandatory argument \marg{version\_name}. It \begin{itemize} \item checks in case the §subdued§ option was specified whether the asked-for math version is \meta{normal} or \meta{bold}, and adapts the following to that case, \item sets the font which will be used in math mode for letters (including math operator names), digits, punctuations and other ascii symbols, \item the non-starred variant sets the font of the document text (if another version name is additionally passed as optional argument, it uses instead the corresponding font for text), and resets the |\(family,rm,sf,...)default|s to their values as registered at the time of definition of the version. The starred variant (which has only one mandatory argument) does not change anything to the text font set-up. \item (see sections \ref{sec:mathskips} and \ref{sec:ic}) re-issues the command §\MTmathactiveletters§ to let a to z, A to Z, be mathematically active in order to automatically insert the skips as defined by the user with §\MTsetmathskips§, and the italic corrections (if the font is not italic or slanted), \item (see section \ref{sec:extraskips}) resets the extra spaces after the symbols $\exists$, $\forall$ and before the derivative ${}'$ to the values as decided by the user in the preamble on a \emph{per version} basis, \item (see section \ref{sec:mathxx}) makes the math operator names as well as the `easy' non letter characters (and the asterisk) obey the math alphabets, \item does the additional set up for Greek letters in case of one the Greek related options. \end{itemize} The scope is limited to the current \LaTeX{} environment or group. It is sometimes not compatible with \mst to load a font package after it, as the font package may contain instructions which will modify the math set-up. This may be a bit hidden to the user: for example the |epigrafica| package loads |pxfonts|. Hence it will interfere with \mst if it is loaded after it.\footnote{may typically give a `too many math alphabets' error message.} But one can use instead |\renewcommand{\rmdefault}{epigrafica}|,\footnote{sometimes one needs to look in the |.sty| file of the font package to figure out the font name (it is rarely as |epigrafica|, the same as the package name), and, if one does not know the arcanes of finding |.fd| files in one's \TeX{} distribution, one should look at the log file of a test document to see if for example |T1| is available for that font; for |epigrafica| it is not, only |OT1| and |LGR| are possible.} followed with \cs{Mathastext}, or also |\MTfamily{epigrafica}\Mathastext| which will only change the font in math. To use |epigrafica| for Greek in math mode one can use the package option §LGRgreek§ and the command |\MTgreekfont{epigrafica}\Mathastext|. Or \cs{usepackage}|{epigrafica}| followed with |\usepackage[LGRgreek]{mathastext}|. \subsection{Extra spaces around letters} \label{sec:mathskips} This is a new feature added with release |1.3|: the command §\MTsetmathskips§ allows the user to set up some spaces (more precisely, `mu glue') to be automatically inserted around the letters in math mode. Some (very) unrealistic uses: \begin{verbatim} % this may be anywhere in the document (also within a math group): \MTsetmathskips{x}{20.33mu}{15.66mu}% 20.33mu before all x's and 15.66mu after. \MTsetmathskips{y}{\thickmuskip}{\thickmuskip}% \MTsetmathskips{z}{10mu plus 10mu minus 5mu}{5mu plus 2mu minus 3mu}% \MTsetmathskips{A}{\muexpr \thickmuskip*2}{\muexpr \medmuskip-\thinmuskip/2}% \end{verbatim} Here is what |$wxtytz^{wxtytz}=BAC^{BAC}$| then gives using the Times font: \begingroup \MTsetmathskips{x}{20.33mu}{15.66mu}% \MTsetmathskips{y}{\thickmuskip}{\thickmuskip}% \MTsetmathskips{z}{10mu plus 10mu minus 5mu}{5mu plus 2mu minus 3mu}% \MTsetmathskips{A}{\muexpr \thickmuskip*2}{\muexpr \medmuskip-\thinmuskip/2}% \MTversion{times}% $wxtytz^{wxtytz}=BAC^{BAC}$.\endgroup{} Any \TeX{} group or \LaTeX{} environment limits as usual the scope of this command. Furthermore the command §\MTunsetmathskips§ cancels previous use of \cs{MTsetmathskips} for a given letter (in a more complete manner than re-using it to specify |0mu| as the before and after skips). The implementation relies on the `mathematical activation' of letters, which is done by default by the package since release |1.2b|. Should this cause compatibility problems, the command §\MTmathstandardletters§ cancels it entirely. To reactivate it, there is §\MTmathactiveletters§. Note that \cs{MTmathactiveletters} is done automatically by \mst when loaded, and also each time the package enhanced math-version-switch command §\MTversion§ is used, except for the normal and bold math versions under the §subdued§ option. Earlier this `mathematical activation' of letters had been used by the package only to add automatically italic corrections, as described in the next section. \subsection{Italic corrections} \label{sec:ic} {\small Note: this is somewhat technical discussion which may well be skipped in its entirety on first reading.\par} \begingroup \fboxsep0pt\fboxrule.1pt With the §italic§ option the letters in math will be generally in italic shape (and, normally, upright in operator names). For the built-in placement routines of \TeX{} in math mode to work as well as they usually do, the characters from the math italic font obviously should have their bounding boxes wide enough for the glyphs not to collide with other symbols. A letter from a text italic font such as \emph{f} extends way out of its declared bounding box; let us compare the bounding boxes\footnote{let's be honest, we are lying here about what exactly the first of these is bounding; this is explained later!} for the letter $f$ in the math italic font to the one from the text italic font: \fbox{$f$} vs. {\itshape\fbox{f}}. This could make us think that attempting to use in math a text italic font will lead to disaster. Well, surprisingly the situation is not that bad. Sure |$f(x)$| is wider with the standard math italic \fbox{$f(x)$} (\setbox0=\hbox{$f(x)$}\texttt{\the\wd0}) than it is with the text italic font used in math:\footnote{we used simply \texttt{\$\string\mathit\{f(x)\}\$}.} \fbox{$\mathit{f(x)}$} (\setbox0=\hbox{$\mathit{f(x)}$}\texttt{\the\wd0}) but we should be surprised that our text italic {\itshape f} did not end up even closer to the opening parenthesis. Why is it so? The explanation is that \TeX{} uses in such a situation the \emph{italic correction} for the letter {\itshape f}. The italic correction also exists and is used for the math italic font, it was inserted in |$f$| without us having to ask anything. Its value is \texttt{1.17865pt} for the math italic $f$ and \texttt{1.8919pt} for the text italic \emph{f}.\footnote{these values are for the Latin Modern fonts of course.} With the italic corrections included our bounding boxes are indeed more alike: \fbox{\usefont{OML}{lmm}{m}{it}f\/} vs \fbox{\itshape f\/}. Without the italic corrections\footnote{here we give correctly the bounding box for the math italic $f$... without its italic correction!} it is \fbox{\usefont{OML}{lmm}{m}{it}f} vs \fbox{\itshape f}. I said that |$f$| included the italic correction automatically, but if we tell \TeX{} to use the text italic in math, and typeset the alphabet, we obtain something exactly identical to typing the letters in text, hence without any italic correction:\par {\leftskip2cm\rightskip5cm% \noindent{\itshape abcdefghijklmnopqrstuvwxyz}\hfill\rlap{\texttt{text italic in text}}\break $\mathit{abcdefghijklmnopqrstuvwxyz}$\hfill \rlap{\texttt{text italic in math}}\break $abcdefghijklmnopqrstuvwxyz$\hfill \rlap{\texttt{math italic in math}}\break {\usefont{OML}{cmm}{m}{it}abcdefghijklmnopqrstuvwxyz}\hfill \rlap{\texttt{math italic in text}}\par} Where are our italic corrections gone? the last line was done with \cs{usefont\{OML\}\{lmm\}\{m\}\{it\}} and confirms that italic corrections have been used for the math italic in math. Turning to the \TeX book (and its Appendix G) we learn that in such circumstances, for the italic corrections to be put in from the font, one of its parameters, the interword space (aka \cs{fontdimen2}), should be zero. It is indeed zero for the math italic font, not for the text italic. It is possible to make \TeX{} believe it is. Doing so, we obtain in math mode with the text italic:\par {\leftskip2cm\rightskip5cm% \noindent{\mathastextversion{italic}% $\xdef\mstrestorefontdimen{\fontdimen2\textfont\symmtletterfont= \the\fontdimen2\textfont\symmtletterfont}% \fontdimen2\textfont\symmtletterfont=0pt% abcdefghijklmnopqrstuvwxyz$}\hfill\rlap{\texttt{text italic in math}}\break $abcdefghijklmnopqrstuvwxyz$\hfill\rlap{\texttt{math italic in math}}\par} We saw that the italic correction was taken into acount automatically (independently of the value of the interword space font parameter) in expressions such as |$f(x)$|. Another clever thing done by \TeX{} is to use it for the placement of superscripts; the next examples systematically use the text italic in math. We see that {\mathastextversion{italic}$\mstrestorefontdimen f^j$} is very different from $\hbox{\itshape f}^j$... where the latter was coded with |$\hbox{\itshape f}^j$|. The inputs |$\mathit{\hbox{\itshape f\/}^j}$| and |$\mathit{f^j}$| give almost identical results: \fbox{$\mathit{\hbox{\itshape f\/}^j}$} vs. \fbox{$\mathit{f^j}$}. Close examination reveals that the horizontal spacing is exactly identical, however the exponent in the second case is a bit lower. Anyway, the point is that in the second case the italic correction for $\mathit f$ was indeed used. Subscripts are another matter: they do \emph{not} take into account the italic correction. For example |$\mathit{f_i}$| gives the same horizontal positions as |$\mathit{\hbox{\itshape f}_i}$|: $\mathit{f_i}$ vs. $\mathit{\hbox{\itshape f}_i}$. Printing them one on another gives \rlap{$\mathit{f_i}$}$\mathit{\hbox{\itshape f}_i}$ and reveals (use the zoom of your viewer!) that only the vertical placement was affected, not the horizontal placement. We learn in Appendix G of the \TeX book that the italic correction is used for the horizontal shift of the superscript with respect to the position of the subscript: $\mathit{f_i^j}$, or, going back now to the the standard math italics $f_i^j$. In the next paragraphs we use $f_i^i$ for more accurate comparison of the positioning of the sub- and superscript. If we try something like this: |${f\/}_i^i$| we obtain ${f\/}_i^i$. Our overlapping game with |\rlap{$f_i^i$}${f\/}_i^i$| gives \rlap{$f_i^i$}${f\/}_i^i$. We discover that the effect of the explicit italic correction has mainly been to translate the subscript horizontally to be positioned exactly below the superscript!\footnote{there are also some tiny vertical displacements of the sub- and superscripts.} We most probably do \emph{not} want this to happen for our indices and exponents in math mode. So perhaps we can rejoice in how astute \TeX{} has been in judiciously using the italic correction data, and there seems to be no need into fiddling with this algorithm which seems to work well even when applied to a text italic font. Actually we may even be of the opinion that the text italic version $\mathit{f_i^i}$ is a bit better-looking than the true math italic $f_i^i$ . . . But wait... \mst was initially developed to easily use in math mode the document text font not in its italic variant, but as is, so, usually, upright. And upright \TeX{} fonts may also have italic correction data! And what I just said about the shift of the superscript with respect to the subscript apply equally well to such a font, if \TeX{} has been told to use it. Let's try Latin Modern Upright for letters in math: |$f_i^i$| now gives\footnote{we just use \texttt{\$\string\mathrm\{f\_i\^{}i\}\$}.} $\mathrm{f_i^i}$. We see the italic correction in action for the positioning of the superscript! Compare with |$\mathrm{\hbox{f}_i^i}$|: $\mathrm{\hbox{f}_i^i}$. Overlapping with |\rlap{$\mathrm{f_i^i}$}$\mathrm{\hbox{f}_i^i}$| gives \rlap{$\mathrm{f_i^i}$}$\mathrm{\hbox{f}_i^i}$ and shows that the upright $\mathrm{f}$ has an italic correction which was used to shift the superscript to the right (and it is now in a slightly lower position). Let's now do |$\mathrm{{f\/}_i^i}$|: this gives $\mathrm{{f\/}_i^i}$ and the subscript is shifted to the right, and is now on the same vertical axis as the superscript. There are also some slight vertical displacements, |\rlap{$\mathrm{f_i^i}$}$\mathrm{{f\/}_i^i}$| gives \rlap{$\mathrm{f_i^i}$}$\mathrm{{f\/}_i^i}$. People will tell me crazy, but if we decide for using upright fonts in math, wouldn't it be satisfying to have the subscript and superscript positioned on the same vertical axis? the letter has no slant, why should the indices display one? We end up in this strange situation that it is attractive to systematically incorporate the italic corrections after the upright Latin letters in math! But we don't want to do this inside the arguments to math alphabets as this would make impossible the formation of ligatures (the standard |$\mathrm{ff}$|, |$\mathit{ff}$|, |$\mathbf{ff}$|, |$\mathsf{ff}$| all give ligatures $\mathrm{ff}$, $\mathit{ff}$, $\mathbf{ff}$, and $\mathsf{ff}$ and we would like to preserve this behavior). \begin{framed}\kern-.75\baselineskip \begin{framed} Starting with version |v1.2b|, \mst adds the italic correction automatically after each letter of the Latin alphabet in math mode, \emph{except} when these letters are italic or slanted.\footnotemark\par These italic corrections are cancelled inside the arguments to the math alphabet commands others than \cs{mathnormal}, to allow the formation of ligatures as is expected in the standard default \TeX{} font set-up in math. \end{framed}\vskip-.75\baselineskip \end{framed} \footnotetext{the situation is rather ironical! by the way, the warnings in section \ref{sec:mathxx} with \texttt{\$x\^{}?\$} or similar are less of an issue here, because the letter is only \emph{followed} by \texttt{\char92/} and anyhow the whole is put by \mst within group braces, so no surprises with \texttt{\$x\^{}y\$} or \texttt{\$\char92mathbin x\$}. Nevertheless it is still true that (in math mode only) the letters |a-z|, |A-Z|, expand to composite objects, something which could surprise other packages. The command \csb{MTmathstandardletters} cancels this mechanism.} The feature-implementing commands §\MTicinmath§, §\MTnoicinmath§, §\MTicalsoinmathxx§ are described in section \ref{sec:cmds}. \endgroup \textbf{\hbox{Note:}} \emph{from brief testing on 2012/12/28, \XeTeX{} seems not to create fake italic corrections for OpenType fonts. Hence the \TeX{} placement algorithms for math mode described in this section do not work well when an OpenType (text) font is used for the letters in math mode, and the document is compiled with the \XeTeX{} engine. On the other hand \LuaLaTeX{} seems to implement the italic corrections when using OpenType fonts, but only with italic fonts (as far as I could tell). Try the following (which will use the OpenType Latin Modern font) on a recent \TeX{} installation and compare the output of both engines:}\par \kern-.5\baselineskip \indent\vbox{\begin{verbatim} \documentclass{article} \usepackage{fontspec} \begin{document} \Huge $\mathit{f_i^i}$\par $\mathrm{f_i^i}$ \end{document}\end{verbatim} % problème de syntax highlighting dans emacs \kern-.75\baselineskip}\\ \emph{Comment out the} |fontspec| \emph{line and use pdf\LaTeX{}. All three outputs are different on my \TeX{} installation. \XeTeX does not have the italic corrections. \LuaLaTeX{} does, but only for the italic font. pdf\LaTeX{} has them for both the italic and the upright font.} \subsection{Other extra glue in math mode} \label{sec:extraskips} \begingroup\MTversion{upright}\renewcommand\familydefault\sfdefault \makeatletter % c'est parce que sinon ils sont pris dans Symbol \let\mst@stdexists\oldexists \let\mst@stdforall\oldforall \makeatother \csb{MTforallskip}, \csb{MTexistsskip}, and \csb{MTprimeskip} are three commands with each a mandatory argument like for example |3mu plus 1mu minus 1mu| or just |2.5mu|. They are especially useful when using an upright font in math mode. {The |mu| is a unit length used in math mode (`math unit', 1/18th of the `quad' value of the symbol font in the current style). Its value is relative to the current math style. Its use is \textcolor{DarkMagenta}{mandatory} in the commands described here.} \begin{itemize} \item compare $\forall B$ with\MTforallskip{2mu} $\forall B$, typeset after |\MTforallskip{2mu}|, \item compare $\exists N$ with\MTexistsskip{2mu} $\exists N$, typeset after |\MTexistsskip{2mu}|, \item and finally compare $f'$ with\MTprimeskip{2mu} $f'$, typeset after |\MTprimeskip{2mu}|. \end{itemize} These three commands may be used throughout the document, or also in the preamble, in which case the declared math versions will record the then current values of the skips. \mst applies the following (small) default skips: |0.6667mu| for the skip after $\forall$, |1mu| for the skip after $\exists$, and |0.5mu| for the skip before the prime. The examples above become \MTforallskip{.6667mu}\MTexistsskip{1mu}\MTprimeskip{.5mu}$\forall B$, $\exists N$ and $f'$.\footnote{the derivative glyph from the |txfonts| math symbols adapts itself better to an upright letter, no skip seems to be needed then.} With the §italic§ option the defaults are set to zero. \MTversion{italic}\renewcommand\familydefault\sfdefault Indeed $\forall B$, $\exists N$ and $f'$ look fine without additional skips. If the document decides then to declare in the preamble a math version with an upright font it is thus recommended to use the commands in the preamble before the \cs{Mathastext}\oarg{version\_name} (or \cs{MTDeclareVersion}) command defining the version. They will be remembered when this math version is entered in the document. The commands may also be used directly in the document body. Also, when the §subdued§ option has been used, the normal and bold math versions have by default zero length skips. There is no |\MTversion{normal}|\footnote{or even \texttt{\char92MTversion*\{normal\}}.} done implicitely by the package when the document body starts (\emph{i.e.} at the level of |\begin{document}|), even when the §subdued§ option is in force. As a result the last use in the preamble of the |\MT...skip| commands decides the skips which will be initially used; this is cancelled if |\begin{document}| is followed with |\MTversion{normal}|, in which case the skips used are the ones in force at the latest \cs{Mathastext} (without optional argument) preamble use, or just zero skips under the |subdued| regime. \endgroup \subsection{Extended scope of the math alphabets commands} \label{sec:mathxx} \begingroup \MTversion{italic}\renewcommand\familydefault\sfdefault % il faudra peut-être que j'annule cette façon qu'à mathastext de tripatouiller % \familydefault... \makeatletter\let\mst@doasterisk\relax\makeatother Ever since the initial version of the package, some characters usually unaffected by the math alphabet commands \cs{mathbf}, \cs{mathtt}, \cs{mathsf}\dots{} are declared to be of `variable family type', in order for them to obey these commands: for example the hash sign $\#$ gives $\mathbf{\#}$ if input as |$\mathbf{\#}$| (\mst, especially in its beginnings, wanted as many characters as possible to be picked up from the text font and to behave similarly to letters and digits). So it was especially frustrating that mathematical characters such as $+$, or $<$, or $]$ could not be declared of `variable family' (in addition to being picked up in the text font) as this would, for reasons of the inner workings of \TeX{}, not be compatible with the automatically inserted spaces around them. A revolutionary ;-) novelty is introduced with version |1.2| of the package: \begin{enumerate} \item the pre-declared or user-declared (using the |amsmath| \cs{DeclareMathOperator} or equivalent) operator names obey the math alphabet commands,\footnote{contrarily to the next feature, this one is not likely to create incompatibilities with other packages, so it is activated by default.} \item and, \emph{optionally}, all non alphabetical characters\footnote{of course some of them are input preceded by a backslash, and the backslash itself is input as \cs{backslash}.} treated by \mst, \emph{i.e.}, if not disabled by options, ${!}\,{?}\,{,}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,{[}\,{]}\,{<}\,{>}\,{\{}\,{\}}$, the asterisk $*$, and $.\,/\,\vert\,\backslash\,{\#}\,{\$}\,{\%}\,{\&}$\footnote{% ${\#}\,{\$}\,{\%}\,{\&}$ obey the math alphabets since the initial version of \mst; the dot $.$, the slash $/$, the vertical bar $\vert$ and the backslash $\backslash$ do not have specific spacings inserted by \TeX{} around them, and the procedure is then not a devilish one, this is why it is made the default for these characters which are listed apart. The math symbols \cs{mid} (which is $\vert$ with type \cs{mathrel}) and \cs{setminus} ($\backslash$ with type \cs{mathbin}) are counted among the `difficult' cases, not the `easy non-letters'.} will also obey the math alphabet commands (when not used as delimiters). The important thing is that the spaces added by \TeX{} before and after are not modified. \end{enumerate} Let us compare, for example, the new behavior of \cs{mathtt} and \cs{mathbf} \MTmathoperatorsobeymathxx\MTnonlettersobeymathxx\MTeasynonlettersobeymathxx \[ \mathtt{(\sin(n!)<\cos(m-p)?)}\qquad \mathbf{[\sin(x+y)=\cos(z-t)]}\] with the traditional default behavior: \MTmathoperatorsdonotobeymathxx\MTnonlettersdonotobeymathxx \MTeasynonlettersdonotobeymathxx \[ \mathtt{(\sin(n!)<\cos(m-p)?)}\qquad \mathbf{[\sin(x+y)=\cos(z-t)]}\] The first feature is activated by default, except of course for the normal and bold math versions when the package was given the \emph{subdued} option. The second feature is \emph{off} by default for the characters listed first. It is \emph{on} for the `easy' cases ${\#}\,{\$}\,{\%}\,{\&}\,.\,/\,\vert\,\backslash$ (activating the feature for them puts no constraint on the user input and should not be too upsetting to other packages), and also for $*$ but only if this was required explicitely by the option §asterisk§, as the user then is supposed to know that |$R^*$| is no valid input anymore and should be replaced by |$R^{*}$|. The remaining `difficult' cases create similar constraints, which will be commented more upon next. The relevant commands are\\ \mbox{}\hspace{2cm}\csb{MTmathoperatorsdonotobeymathxx}\\ \mbox{}\hspace{2cm}\csb{MTnonlettersdonotobeymathxx}\\ \mbox{}\hspace{2cm}\csb{MTeasynonlettersdonotobeymathxx}\\ for deactivation and \\ \mbox{}\hspace{2cm}\csb{MTmathoperatorsobeymathxx}\\ \mbox{}\hspace{2cm}\csb{MTnonlettersobeymathxx}\\ \mbox{}\hspace{2cm}\csb{MTeasynonlettersobeymathxx}\\ for activation.\footnote{these commands are to be used outside of math mode. Their scope is limited to the current \LaTeX{} environment or group. They use the \cs{everymath} and \cs{everydisplay} mechanism so if the document needs to modify these token lists it has to do so in a responsible manner, extending not annihilating their previous contents.} \footnote{when in subdued mode, the math alphabets are the default ones, not the ones modified by \mst to use the document text fonts. As a result, matters of font encodings may then give unexpected results, for example for $-$. On the present document page we switched to a math version to escape from the |subdued| mode and avoid the problem with \cs{mathbf\{-\}} giving in the normal (subdued) math version {\MTversion{normal}\MTnonlettersobeymathxx$\mathbf-$\sffamily, when `non-letters' are declared to obey math alphabets.}} \begin{framed} \textbf{Important:} the package does \csb{MTnonlettersdonotobeymathxx} by default. The reason is that activating the mechanism adds some constraints to the way things must be input, adding |\usepackage{mathastext}|{}\cs{MTnon\-letters\-obey\-mathxx} to a pre-existing document might well create errors: all these characters treated by \mst, such as |?|, |[|, |<| now represent (in math mode only!) \emph{two} `tokens' and this will utterly confuse \TeX{} if some precautions are not taken: |$x^?$|, |$R^+$| or |$\mathopen$| \emph{must} now be coded as |$x^{?}$|, |$R^{+}$| and |$\mathopen{<}A\mathclose{>}$| (the rule is to do as if |?|, |+|, |<| or |>| were each really \emph{two} characters). Even if this rule is respected in the document source, it is still a possibility that incompatibilities with other packages will arise because \mst does a `mathematical activation' of the characters which could be unexpected and unchecked for by other packages. This is precisely the case with the |amsmath| package, and the problem goes away by just making sure that |amsmath| is loaded before \mst{} (generally speaking, \mst should be loaded last after all packages dealing with math things). \end{framed} The brace control sequences |\{| and |\}| have their own (supplementary) switch, which is (even) less activated by default. The reason is that after \csb{MTexplicitbracesobeymathxx}, they regrettably can not be used anymore as delimiters: |\big\{| or |\big\}| cease to function and must be replaced by |\big\lbrace| and |\big\rbrace|. But \MTmathoperatorsobeymathxx\MTnonlettersobeymathxx\MTexplicitbracesobeymathxx we can now enjoy $\mathtt{\{a, a>b\}}$, $\mathbf{\{a, a>b\}}$, $\mathsf{\{a, a>b\}}$, or even $\mathnormalbold{\{a, a>b\}}$.\footnote{this last example uses the \cs{mathnormalbold} additional alphabet defined by \mst.} There is no such restriction with $($, $)$ or the brackets $[$, $]$. When used as delimiters though, they will become again unreactive to the math alphabets: the same applies to $<$ and $>$ or to any of the other characters such as the slashes $/$, $\backslash$, when they are used as delimiters. This is a rather obvious restriction except possibly for the smallest size delimiters (the so-called `small variants'), as all other sizes will be anyway absent from the text fonts. Even the small variants may not be really available in the text fonts: for example the standard $<$ used as a delimiter is in \LaTeX{} a \cs{langle}: $\langle$. With standard \LaTeX{} |$\left< x\right>$| gives $\langle x\rangle$. Actually, \mst does try to pick up most of the `small variants' in the text font: |$\left$| gives $\left$ (but |$\left$| gives $\left$.) If you don't like that use the option §nosmalldelims§ (it is indeed perhaps a bit strange to have $\left< x\right>$ next to $\left< X\right>$, again before blaming me, consider using §nosmalldelims§.) At any rate, whether `small' or not, delimiters are not under the extended law of math alphabets, this is a general rule of the way \mst manages these things. Examples: |\mathbf{}| gives $\mathbf{}$. |\mathbf{\left}| gives $\mathbf{\left}$. |\mathbf{\mathopen{<}a,b \mathclose{>}}| gives $\mathbf{\mathopen{<} a,b \mathclose{>}}$. The \LaTeX{} standard behavior for |\mathbf{\mathopen{<}a,b\mathclose{>}}| is \endgroup $\mathbf{\mathopen{<} a,b \mathclose{>}}$. \subsection{Greek letters} The Computer Modern fonts are very light and thin in comparison to many text fonts, and as a result rarely mix well with them (particularly if the Latin letters in math mode are upright). The following options are provided by \mst: \begin{description} \item[no option:] nothing is done by the package, Greek letters are the default Computer Modern ones or have been set-up by other packages; for example by the |fourier| package with option `upright', which gives upright Greek letters. \item[§LGRgreek§:] this is for fonts which additionally to Latin letters also provide Greek letters in |LGR| encoding. Here is a list from a 2012 standard \TeX{} installation: the Computer Modern, Latin Modern, and the CM-LGC fonts; the Greek Font Society fonts (such as GFS Didot), the epigrafica and kerkis packages, the txfontsb package which extends the txfonts package with LGR-encoded Greek letters; the Droid fonts, the DejaVu fonts, the Comfortaa font, and the Open Sans font. The |LGR| encoded |CM/LM| fonts (in serif, sans-serif and typewriter family) give the nice Greek letters in upright shape from the |cbfonts| package. To get these letters in your \mst math mode, you can do the following: \begin{verbatim} % instructions to load the document fonts: \usepackage{nice_font} % and then the following: \renewcommand{\familydefault}{cmr} % or cmss or cmtt for sans resp. mono \usepackage[LGRgreek]{mathastext} \renewcommand{\familydefault}{\rmdefault} \Mathastext % this re-initializes mathastext with the nice_font, % without changing the LGR font cmr/cmss/cmtt used for Greek letters % in math mode. \begin{document} \end{verbatim} If you use the §italic§ option note that the italic Greek letters from the |cbfonts| are not the same glyphs as the default Greek letters from the |OML| encoded font |cmmi|. \item[§eulergreek§:] the Greek letters will be taken from the Euler font (the document does not have to load the eulervm package, \mst directly uses some file included in this package, as it provides a mechanism to scale by an arbitrary factor the Euler font.) The letters are upright. \item[§symbolgreek§:] the Greek letters will be taken from the (Adobe Postscript) Symbol font. A command is provided so that the user can scale the Symbol font to let it better fit with the text font. The letters are upright. \item[§selfGreek§:] this option concerns only the eleven Greek capitals from the |OT1|-encoding. It does nothing for the lowercase Greek letters. The encoding used in the document does not have to be |OT1|. \end{description} There is also §LGRgreeks§ which tells \mst to pick up in each math version the letters from the |LGR| encoded font used in that version, and §selfGreeks§ to tell \mst to do as for §selfGreek§ but separately in all math versions. Under the §subdued§ option the Greek letters in the normal and bold math versions are kept to their defaults as found at the time of loading the package. The commands §\MTstandardgreek§ allow at any point in the document to turn inactive any Greek related option passed to \mst. And conversely §\MTcustomgreek§ reactivates it. \subsubsection{Shape of Greek letters} Classic \TeX{} uses in math mode italic lowercase and upright uppercase Greek letters. French typography uses upright shape for both lowercase and uppercase. And the ISO standard is to use italic shape for both lowercase and uppercase. The Euler and Symbol fonts not being available in other than their default upright shape, this question of shapes for Greek letters raises issues only in the case of the options §LGRgreek§ and §selfGreek§. The options §frenchmath§, §itgreek§, §upgreek§, §itGreek§ and §upGreek§ modify the Greek letter shapes according to the following rules, listed from the lowest to the highest priority: \begin{description} \item[no option:] the lowercase Greek letters are in the same shape as Latin letters, and the uppercase in the same shape as applied to digits and operator names, \item[§frenchmath§:] both lowercase and uppercase are in the same shape as the digits and operator names (most of the time this means ``upright shape'', but it can be otherwise), \item[§itgreek§, §upgreek§:] both lowercase and uppercase are in the \cs{itdefault}, respectively the \cs{updefault} shape (at the time of loading the package or at the time of a subsequent call to \cs{Mathastext} or \cs{MathastextWillUse}), \item[§itGreek§, §upGreek§:] same as above, but only for the uppercase letters. \end{description} So, the default gives the classic \TeX{} behavior when option §italic§ was passed. Each call to \cs{Mathastext} (or \cs{MathastextWillUse}) macros (described in a later section) reinitializes the computation of the shapes. As mentioned already the package allows to define various ``math versions''. In the case of §eulergreek§ or §symbolgreek§ they apply to all these versions. In the case of the options §LGRgreeks§ or §selfGreeks§ (notice the additional ``s''), each math version is assumed to have its text font available in |LGR| (or |OT1| encoding) and also the shapes will be local to the math version. Finally version |1.15c| of \mst introduces new preamble-only commands to change the shapes, and even the font, used for Greek letters, in case of package options §LGRgreek§/§selfGreek§. They are §\MTitgreek§, §\MTupgreek§, §\MTitGreek§, §\MTupGreek§: these are used like the options and change only the shapes for the math versions which will be declared \emph{next} in the preamble; and §\MTgreekfont§|{name_of_font}| will tell the \emph{next} math versions to use that font family. To use this command you need to know the (little) name of a suitable font family available in |LGR| encoding: for example |lmr|, |txr| (needs |txfontsb| package on your system), |DejaVuSerif-TLF| (needs |dejavu| package on your system), etc\dots \enlargethispage{\baselineskip} \subsection{Unicode engines} \mst has been made minimally unicode-aware and can be used with \XeTeX{} or \LuaLaTeX{}. With \XeTeX{} the user is strongly advised to first consider using the |mathspec| package, which is designed for Unicode, with a key-value interface. With both \XeTeX{} and \LuaLaTeX{}, |unicode-math| is recommended for OpenType math fonts. Particularly in the latter case you probably don't need, don't want, and should not use \mst: it is extremely far from being able to define a math font, as it applies basically only to a subset of the 32-127 ascii range, and in particular it does not know how to use a given Unicode font simultaneously for Latin and Greek letters. Again the user is strongly advised to look at |mathspec| and |unicode-math|. Let me point out explicitely that \mst has not been tested in any systematic manner under the Unicode engines; and that it is expected to be most definitely incompatible with |unicode-math|, although your mileage may vary and some features may appear to work. When using \mst with either \XeTeX{} or \LuaLaTeX{} it is recommended to use the |fontspec| package. Else, some of the encoding dependent things done by \mst like using the en-dash character to get a minus sign in math mode will not work correctly. Furthermore, it is \emph{necessary} to load |fontspec| with its |no-math| option, and this \emph{must} happen before loading \mst. \begin{framed} Use |fontspec| with its \emph{no-math} option, and load it \emph{prior} to \mst. For example, when using |polyglossia| one should presumably say: \centeredline{|\PassOptionsToPackage{no-math}{fontspec}|} before the |\usepackage{polyglossia}| as |fontspec| will then be loaded in a manner compatible with \mst. \end{framed} \begin{framed} Starting with release |1.3| of \mst, the |luatex| engine binary must be at least as recent as the one which was provided with the TL2013 distribution. The |amsmath| package, if used, \emph{must} be loaded \emph{prior} to \mst. Under |lualatex| engine, it is recommended to also load the package |lualatex-math|. \end{framed} % obsolte with release 1.3: % A little piece of the functionality of \mst is less fully % realized under the \LuaLaTeX{} engine than it is with % \XeTeX{}. This is a temporary situation as the needed feature % of \LuaLaTeX{} has been implemented in its latest development % release. I will update \mst when these binaries will have % reached the distribution stage. I already mentioned in the section \ref{sec:ic} the fact that the italic corrections were not available for OpenType fonts under the \XeTeX{} engine and only partially available for the \LuaLaTeX{} engine, with the result that the spacings in math mode when using for the letters an upright text font will be less satisfying than with the standard |pdfetex| engine (the OpenType fonts not being usable with the latter engine, this is not a criterion of choice anyhow). To specify math versions using unicode fonts, use the |fontspec| \cs{setmainfont} command (with arbitrary optional features). This command can be issued before loading \mst, or after and then will be followed by a \cs{Mathastext} command with the name of the version in square brackets. It is possible to mix unicode fonts and classical \TeX{} fonts. But this is definitely \emph{not} recommended as \mst decides once and for all what is the font slot of things such as the text endash (used for the minus sign) and this is encoding dependent. So it is best to have either only unicode fonts, or only old-fashioned \TeX{} fonts in a fixed encoding (T1, or LY1 for example). The package was not extensively tested with unicode engines. I include here two examples which compiled successfully with \XeTeX{} and \LuaLaTeX{}, the first one on a Linux machine, the second one on a Mac OS X machine.\footnote{running |tex| (in a temporary repertory) on a copy of the file |mathastext.dtx| will extract extended versions of these examples as test files. Notice that the |Color=| specifications are not recognized anymore under the current version of \LuaLaTeX{}, they used to be in earlier versions.} \begin{verbatim} \documentclass{article} \usepackage[hscale=0.8]{geometry} \usepackage{multicol} \usepackage[no-math]{fontspec} \usepackage{lmodern} \usepackage[subdued,italic]{mathastext} \setmainfont[Color=999999]{Verdana} \Mathastext[Verdana] \setmainfont[Color=0000FF]{Arial} \Mathastext[Arial] \setmainfont[Color=00FF00]{DejaVu Serif} \Mathastext[DejaVu] \MTDeclareVersion{times}{T1}{ptm}{m}{n} \setmainfont[Color=FF0000]{Andale Mono} \Mathastext[Andale] \begin{document} \newcommand\TEST[1]{\MTversion{#1}% \begin{multicols}{2} \hbox to\columnwidth{\hbox to\columnwidth{\hfil $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}} \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ } \centerline{ $0123456789$ } \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ } \columnbreak \centerline{ abcdefghijklmnopqrstuvwxyz } \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ } \centerline{ 0123456789} \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,% \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 } \end{multicols}} \begin{multicols}{2} \centerline{\textbf{math mode}} \columnbreak \centerline{ \textbf{text} } \end{multicols} \TEST{DejaVu}\TEST{Verdana}\TEST{times}\TEST{Andale} \TEST{Arial}\TEST{bold}\TEST{normal} \end{document} \end{verbatim} And now the same thing with fonts available on Mac OS X: \begin{verbatim} \documentclass{article} \usepackage[hscale=0.8]{geometry} \usepackage{multicol} \usepackage[no-math]{fontspec} \usepackage{lmodern} \usepackage[subdued,italic]{mathastext} \setmainfont[Color=FF0000]{Hoefler Text} \Mathastext[Hoefler] \setmainfont[Color=336633]{American Typewriter}\Mathastext[Typewriter] \setmainfont[Color=0000FF]{Herculanum} \Mathastext[Herculanum] \setmainfont[Color=FF00FF]{Didot} \Mathastext[Didot] \setmainfont[Color=999999]{Comic Sans MS} \Mathastext[Comic] \begin{document} --- copy here the code from the previous example --- \TEST{Didot}\TEST{Comic}\TEST{normal}\TEST{Herculanum} \TEST{Hoefler}\TEST{Typewriter}\TEST{bold} \end{document} \end{verbatim} % The test files which will be produced by running |latex| on % |mathastext.dtx| are more extent. \subsection{Compatibility issues}\label{sec:compat} Compatibility issues (or just questions of who decides last) are naturally to be expected with packages dealing with the math setting; the fix is simply to load \mst last. And one should always load |amsmath| before \mst (this is especially true when using Unicode engines but applies in general as well). Any definition made in a package loaded before \mst of the font to be used for letters or for the common characters in the |ascii| basic range will be overruled by the loading of \mst (this includes the case when the earlier package had made the character `mathematically active'). Conversely most of the set-up done by \mst may well be overruled by packages loaded later which do math related things. In case of a `too many math alphabets' message try the |defaultalphabets| option or one of its |defaultnormal|, |defaulttt|, etc\dots sub-options. Starting with version |1.2|, \mst makes some characters `mathematically active' to achieve certain effects: automatic insertion of the italic corrections when using an upright text font in math, extended scope of the math alphabet commands which now apply to non-letter symbols (and also to math operator names, but this is much easier to achieve). And the (already mathematically active) right quote is modified to have some extra space added before the derivative glyph ${}'$. This is compatible with using \cs{label} and \cs{ref} in and outside of math mode. But a difficulty arises when some other package has made the character `globally active' everywhere in the document. The action of \mst is made anew at each mathematical inline or displayed formula. If it is detected that a character has been activated then nothing further will be done (so the \mst feature\footnote{italic correction insertion for the latin letters, receptivity to the math alphabet action for the other characters.} for that character is lost) \emph{except} if it appears that this activation was done by the Babel system. In that case \mst does not make the character mathematically active but it modifies in the appropriate manner the action of Babel for that character in math mode. Furthermore \mst makes the character mathematically \emph{inactive}.\footnote{only the characters {{;}\,{,}\,{:}\,{!}\,{?}\,{+}\,{\textendash}\,{=}\,{<}\,{>}\,{(}\,{)}\,{[}\,{]}\,*} mentioned in section \ref{sec:mathxx} as `difficult non letters' (and the right quote {'}) and the latin letters are concerned here; it seems highly unprobable that a latin letter ${\in}\{a\mbox{--}z,A\mbox{--}Z\}$ will have been made globally active (only letters never being used in command names are possible candidates), but \mst has been designed to cope with it, should it happen ...} Here is indeed some code that you should \textbf{ABSOLUTELY NOT} try at home: \begin{verbatim} \documentclass{article} \usepackage[french]{babel} \usepackage{mathtools}\mathtoolsset{centercolon} \begin{document} $:$ \end{document} \end{verbatim} \fbox{DO NOT DO THIS AT HOME}\thinspace: it creates an infinite loop.\footnote{This seems to still be the case with Babel |3.9f| and frenchb.ldf |2.6e|, as tested on Sep. 2, 2013.} This is due to the fact that the colon is simultaneously active (this is made by |babel+frenchb| at begin document) and mathematically active (done by |mathtools| in the preamble). The interaction gives an infinite loop. Such a situation will be cured by |mathastext|, even loaded before |mathtools|, \emph{if} use is made of \cs{MTnonlettersobeymathxx}. At each math formula \mst will detect that Babel has activated the colon, and will cancel the mathematical activation (the precise definition done by |mathtools| was already lost at begin document due to overwriting by |babel| but the fact that the character was mathematically active remained true). So far I have briefly described the problem of document active characters (see the test file |mathastexttestalphabets.tex| for more explanations and illustrations, and the commented source code of the package). Pure mathematical activation revealed an incompatibility of another type with |amsmath|. To fix it, \mst now replaces an inner macro of |amsmath| (\cs{resetMathstrut@}) with its own version.\\ \null\hspace{1cm}\fbox{Always load |amsmath| before \mst.}\\ Actually this last commandment was already made necessary by the use of the text endash to represent the minus sign in math mode, and, especially for Unicode engines, some aspects of the \cs{DeclareMathOperator} macro from |amsmath|. \begin{framed}\kern-.75\baselineskip \begin{framed} \textbf{Important!} As is mentioned in the section \ref{sec:mathxx}, with the ``non letters obey math alphabets'' mechanism, characters such as |?|, or |[|, now represent \emph{two} `tokens' and this will utterly confuse \TeX{} if some precautions are not taken. Examples: |$0^+$| or |$x\mathrel?y$| or |$R^*$| \emph{must} be input now as |$0^{+}$| and, respectively, |$x\mathrel{?}y$| or |$R^{*}$|. This is why the package does §\MTnonlettersdonotobeymathxx§ by default. \end{framed}\vskip-.75\baselineskip \end{framed} One thing to take note of is that this mechanism uses the \cs{everymath} and \cs{everydisplay}, so if it is needed to add to these \TeX{} `token lists' some additional things this should be done in a way preserving the former contents. Doing (after the |\begin{document}|) |\everymath={}| and |\everydisplay={}| (preemptively) annihilates all of the \mst (evil) doing with math active characters but it annihilates also everything else some other package might have put in there, so it is much better, in case the need arises to preemptively cancel the action of \mst, to use the package macros §\MTmathoperatorsdonotobeymathxx§, §\MTnonlettersdonotobeymathxx§ (already done by default), §\MTmathstandardletters§ (cancels the math activation of letters), §\MTnormalprime§ (cancels the redefinition done by \mst of the action of the right quote |'| in math mode). Regarding $\oldexists$ and $\oldforall$: the old definitions could be saved before loading the package but just |\MTexistsskip{0mu}| and |\MTforallskip{0mu}| should be sufficient, except if it is important that the \cs{exists} and \cs{forall} control sequences always expand to only one token each. \section{Package options and commands} \subsection{Summary of main options} \begin{description} \item[{§italic§, §frenchmath§}:] italic letters in math, upright uppercase if §frenchmath§. \item[{§subdued§}:] acts in a subdued way. The \LaTeX{} normal and bold math versions are left (quasi) unchanged. With version |1.15e| of the package this statement applies also to the math alphabets \cs{mathbf}, \cs{mathit}, \cs{mathsf}, and \cs{mathtt} (and not only to \cs{mathnormal} and \cs{mathrm} as in previous versions.) \item[{§LGRgreek§, §eulergreek§, §symbolgreek§}:] the Greek letters will be taken, respectively from the text font itself (in |LGR| encoding), or from the Euler font, or from the Postscript Symbol font. \item[{§symbolmax§}:] all characters other than letters and digits, are taken from the Symbol font. This option also makes a number of further glyphs available, such as some basic mathematical arrows, and the sum and product signs. For documents with very simple needs in mathematical symbols, \mst with option §symbolmax§ may give in the end a PDF file quite smaller than the one one would get without the package. \item[{§defaultmathsizes§}:] \mst sets up bigger sizes for subscripts (it also copies code from the |moresize| package to redefine \cs{Huge} and define \cs{HUGE}). Use this option to prevent it from doing so. \item[{§defaultalphabets§}:] by default, \mst redeclares the math alphabets \cs{mathrm}, \cs{mathit}, \cs{mathtt} etc\dots{} (but not \cs{mathcal} of course) to refer to the current document text fonts (at the time of loading the package and in each \mst math version). Use this option to prevent it from doing so (each alphabet also has its own disabling option). \end{description} \subsection{Miscellaneous} \begin{description} \item[the en-dash as minus sign:] very often the - character from the text font does not give a good minus sign. So by default, the package uses the en-dash sign \textendash{}. Use §noendash§ to deactivate it. Starting with version |1.12| of the package this `en-dash as minus' should work in all encodings, including Unicode (if |fontspec| has been loaded). \item[amsmath:] the behavior of the \cs{DeclareMathOperator} command of |amsmath| is slightly modified by \mst. This command initially allows crazy things like \cs{DeclareMathOperator}\cs{crazy}\{m.ch-in'tr/u:c\} and then the ., -, ', / and : will be typeset in the roman font. But the font number was hardcoded in the macro and furthermore the code of |amsmath| would cause an error with Unicode engine as soon as some Unicode code is assigned to the minus character.\footnote{To the experts: the $\sin$, $\cos$, \dots{} operator names are \emph{not} defined by |amsmath| with the help of the \cs{DeclareMathOperator} macro, hence are not the cause of an error in \XeTeX{}/\LuaLaTeX{}. What \mst does is to let to relax the \cs{newmcodes@} macro, so it is possible to save it before loading \mst and re-establish later, if really really this is what you want.}\footnote{new with \texttt{1.3d}: if \mst detacts the \texttt{lualatex-math} package which fixes this \texttt{amsmath} issue, it does not change \texttt{\char92newmcodes@}.} This specific issue will perhaps be fixed by some hypothetic future release of |amsmath|, or by other packages providing patches, but I decided for a preemptive strike. As a result the declaration above will not cause an error when \cs{crazy} is used with a Unicode engine, but there are now some spacings around the punctuation characters. To avoid this use (also with \LaTeX{}):\\ \centerline{\cs{DeclareMathOperator}\cs{crazy}\{m\{.\}ch\{-\}in\{'\}tr\{/\}u\{:\}c\}} Note though that the quote ' will be typeset as a derivative sign $'$. \item[hbar:] the definition of \cs{hbar} inherited from default \LaTeX{} will in our context make use of the |h| of the current math font (so for us, it is also the text font, perhaps in italic shape), but the bar accross the |h| will come from the original default math font for letters (usually |cmmi|), and furthermore its placement on the |h| can be odd-looking. So we redefine \cs{hbar} to use only the text font (and this will be aware of the §italic§ option). Our construction does not always give an optimal result (and its scope is limited to the |OT1|, |LY1| and |T1| encodings), so an option §nohbar§ deactivates it. There is no \cs{hslash} provided by the package, though. The version |1.12| of the package when dealing with a Unicode font tries to get the \cs{hbar} directly as a glyph from the font. \item[dotless i and j:] by default the package redefines \cs{i} and \cs{j} to give the dotless i and j (if it exists at all), \emph{also in math mode,} in the text font. Will overwrite the default commands \cs{imath} and \cs{jmath}. In version |1.12| of the package this should work in all encodings, including Unicode (it is then assumed that |fontspec| has been loaded, and of course that the glyphs are indeed in the font). \item[asterisk:] previous versions of \mst did not do anything with the \cs{ast} control sequence but did pick the asterisk $*$ in the document text font, and this often was a rather silly thing as the text asterisk is generally in a raised position. Furthermore, the $*$ lost its status of a binary operator and was treated as an `ordinary' symbol. An option |noasterisk| turned this feature off. Starting with |1.2d|, the |noasterisk| option is deprecated and the new default is to do nothing. But when option §asterisk§ is received by the package, then both \cs{ast} and $*$ are simultaneously modified to use (as binary operators) the text asterisk, slightly lowered. The amount of lowering\footnote{with the option \texttt{symbolmisc}, the asterisk is picked from the Symbol font, and the amount of lowering is non-customizable; however if a math alphabet command is used, the asterisk is then again from a text font and the lowering will be as specified by \cs{MTlowerast}.} is decided by the mandatory argument to the command \csb{MTlowerast}\marg{dimen}. The package initially does \cs{MTlowerast}|{.3\height}|. Doing \cs{MTlowerast}|{.5ex}| is not a good idea as it does not scale properly in the script and scriptscript styles. With an argument given as a multiple of |\height|, the asterisk will behave as expected in subscripts and subscripts of subscripts. But $*$ is now `mathematically active'\thinspace\footnote{in a hopefully safe way, for example {\ttfamily\$\string\label\{eq*1\}\$} is ok.} and |$R^*$| or |$R^\ast$| \emph{must} be input as |$R^{*}$| and |$R^{\ast}$|. Furthermore, they will obey the math alphabet commands. \item[\XeTeX{} and \LuaLaTeX{}:] for the en-dash and the dotless i and j, the package expects to detect either the EU1 encoding for XeTeX{} or the EU2 encoding for \LuaLaTeX{} (this will be true if |fontspec| was loaded), or one of |OT1|, |LY1| or |T1|, else it will renounce and not attempt to access the en-dash or the dotless i and j glyphs. With \LaTeX{} and Pdf\LaTeX{}, there is no such limitation and all 8bit-encodings (containing these glyphs) should be ok. \item[fontspec:] one more note to users of \XeTeX{}/\LuaLaTeX{} with |fontspec|: it has to be loaded {with the option} |no-math|, {and before} \mst. \item[vec accent:] The default \cs{vec} accent is not appropriate for upright letters, so \mst provides a \cs{fouriervec} which takes its glyph in a Fourier font, and an Ersatz \cs{pmvec} which is reasonably good looking on upright letters and works with the \cs{rightarrow} glyph. Contrarily to version |1.0|, the default \cs{vec} is not overwritten with \cs{fouriervec}. And contrarily to version |1.1|, one now needs to pass the option §fouriervec§ to have the math accent \cs{fouriervec} defined by the package. \item[math alphabets:] \begin{itemize} \item We define a new math alphabet command \cs{mathnormalbold} which gives direct access to the bold version of the \cs{mathnormal} alphabet (rather than using either the \cs{bm} command from the |bm| package or the \cs{boldsymbol} command from the |amsbsy| package). As it does not exist in the default \LaTeX{} math font set-up, this alphabet is \emph{not} subjected to the {subdued option} action. \item The other math alphabet changing commands defined by the package are \cs{MathEulerBold}, \cs{MathEuler} and \cs{MathPSymbol}. \item \cs{mathnormal}, \cs{mathrm}, \cs{mathbf}, \cs{mathit}, \cs{mathsf} and \cs{mathtt} are modified to make reference to the document text fonts (this can be disabled by suitable package options). \item version |1.2| of \mst has extended the scope of the math alphabets to apply to non-alphabetical characters and to operator names. This respects the automatic white spaces added by \TeX{} around math symbols. \end{itemize} \item[math accents:] an option §mathaccents§ is provided to pick up the accents in math mode from the text font, but the package knows only |T1|, |LY1| or |OT1|-compatible encodings. \end{description} Regarding the encoding-dependent glyphs: the en-dash, the dotless i and j, the math accents, the hbar, are encoding dependent and the relevant decisions are made once by \mst at the time it is loaded and are applied to all declared math versions. So you can use math versions with different encodings but, regarding these characters only those with the same encoding as the normal math version will display them correctly. \begin{framed} It is thus recommended that all declared mathastext math versions use the same font encoding. \end{framed} % 2 septembre 2013; finalisé 22:58 \makeatletter \def\@jfendshrtverb #1#2§{\@ifundefined{FLAG#2}% {\color{blue}\ttfamily #1#2\endgroup \global\@namedef{FLAG#2}{}\label{#2}}% {\hyperref[#2]{\ttfamily #1#2}\endgroup}} \makeatother \subsection{Commands} \newsavebox\boite \subsubsection{Preamble-only commands} These commands mainly facilitate the definition of math versions, in a \mst extended sense. It is not necessary to use them to activate the package basic functionalities, as loading \mst is enough (except with the |subdued| option). \begin{enumerate}[label=$\bullet$] \item §\Mathastext§ (or §\mathastext§) reinitializes \mst: it sets the fonts used in math mode (in versions |normal| and |bold|) for letters, digits and a few ascii symbols to the \emph{current} defaults of encoding, family, series and shape.\footnote{\texttt{\char92Mathastext} updates also the font and shapes for the Greek letters (|LGRgreek| option), and the skips to be inserted after the symbols $\oldforall$ and $\oldexists$, see \emph{infra.}} Both the normal and bold math version are modified by this action of §\Mathastext§. \begin{enumerate}[label=$\bullet$] \item \textbf{math versions:} \csb{Mathastext} accepts an optional argument \oarg{name}. With this (within square brackets) argument, rather than redefining the fonts for math mode, §\Mathastext§ declares a new \emph{math version}, and it is this math version which will use the then current text font in math mode.\footnote{The allowed version names are as for the \LaTeX{} \cs{DeclareMathVersion} macro. \textbf{Do not use ``normal'' or ``bold'';} this is already taken care of by the initial loading of the package or a later command \cs{Mathastext} without any optional argument.} \item \textbf{inheritance:} starting with version |1.3c| a second optional argument \oarg{other\_version} will transfer its set-up for things not affected by \mst action, like large symbols, to the declared math version whose name was given as first optional argument. The main use will be with |[bold]| in order for the symbols and large symbols to be typeset as in the |bold| math version. For example, this document has in its preamble:\hfill\break\begingroup\small \begin{lrbox}{\boite}|\usepackage{newcent}% this package makes New Century the roman font|\end{lrbox}\rlap{\usebox{\boite}}\hfill\break |\Mathastext[newcent]% this math version will use New Century|\hfill\break |\MTseries{b} % next \Mathastext will use a bold font|\hfill\break \begin{lrbox}{\boite}|\Mathastext[boldnewcent][bold]% large symbols, etc, will be bold too|\end{lrbox}\rlap{\usebox{\boite}}\hfill\break\endgroup We can check that it does work: \centeredline{|\MTversion{newcent}:|\MTversion{newcent} $abcde\displaystyle\ointop\bigvee\biguplus\bigotimes\bigoplus$} \centeredline{|\MTversion{boldnewcent}:|\MTversion{boldnewcent} $abcde\displaystyle\ointop\bigvee\biguplus\bigotimes\bigoplus$} Naturally, for this one needs an initial math font setup with some nice bold fonts also for large symbols. This is the case with the excellent |txfonts| package of \textsc{Young~Ryu}. As the present document must use many fonts and declares many math alphabets, we did not load the full package and fonts but only the |largesymbols|:\hfill\break |\DeclareSymbolFont{largesymbols}{OMX}{txex}{m}{n}|\hfill\break |\SetSymbolFont{largesymbols}{bold}{OMX}{txex}{bx}{n}|\hfill\break |\DeclareFontSubstitution{OMX}{txex}{m}{n}| \end{enumerate} \item §\Mathastext§ may be preceded optionally by one or more of\footnote{these commands exist also with long names: \texttt{\char92Mathastextencoding}, etc\dots{} The same applies to the other commands mentioned in this section.} §\MTencoding§\marg{enc}, §\MTfamily§\marg{fam}, §\MTseries§\marg{ser}, §\MTshape§\marg{sh}, and §\MTlettershape§\marg{sh}. For example valid values are, respectively, \meta{T1}, \meta{phv}, \meta{m}, \meta{n}, and \meta{it}: this is the Helvetica font in T1-encoding, regular (medium) series, upright shape, and the letters will be in italic shape. Once used their effect applies to all succeeding calls to \cs{Mathastext}, and can only be undone by using them again. \item §\MTWillUse§\oarg{ltsh}\marg{enc}\marg{fam}\marg{ser}\marg{sh} tells \mst to use the font with the specified encoding, family, series, and shape for the letters and digits (and all other afflicted characters) in math mode. The optional argument \meta{ltsh} specifies a shape for the letters, for example \cs{itdefault}, or directly \meta{it} or \meta{sc}. \item §\MTDeclareVersion§\oarg{ltsh}\marg{name}\marg{enc}\marg{fam}\marg{ser}\marg{sh}\oarg{other\_version}: declares that the document will have access to the font with the specified characteristics, under the math version name \meta{name}. For example: \centeredline{|\MTDeclareVersion[sc]{palatino}{T1}{ppl}{b}{sl}|} declares under the name |palatino| a version where mathematics will be typeset using the Palatino font in T1-encoding, bold, slanted, and the letters will in fact be in caps and small caps (and bold).\footnote{I do not especially recommend to use this in real life!} When the initial optional argument is absent, and \mst was loaded with the \blueit{italic} option, then the default letter shape will be |it|,\footnote{more precisely, the shape is the latest value passed in one of the previously used package commands to specify the shape of letters, or the \cs{itdefault} of the time of loading the package.} else letters will have the same shape as used for digits and operator-names. Another optional argument may be used as last argument. Similarly as its use with §\Mathastext§ this makes the declared math version inherit, for things not modified by \mst like large symbols, the font set up of the math version whose name was passed as optional argument (typical use will be with |[bold]|). \item §\MTboldvariant§\marg{var}: when used before §\Mathastext§, specifies which bold (|b|, |sb|, |bx|, \dots) to be used by \cs{mathbf} (and \cs{boldmath}). Default is the \cs{bfdefault} at the time of loading \mst. When used before the declaration of a version, decides the way \cs{mathbf} will act in this version. \item §\MTEulerScale§\marg{factor}: scales the Euler font by \meta{factor}. \item §\MTSymbolScale§\marg{factor}: scales the Symbol font by \meta{factor}. \item §\MTitgreek§, §\MTupgreek§, §\MTitGreek§, §\MTupGreek§: optional commands, active only in the case of the \blueit{LGRgreek} option, to decide the shape of the Greek letters in the versions which will be declared next. \item §\MTgreekfont§\marg{fontfamily}: optional command with a mandatory argument which specifies the font for Greek letters in all \mst math versions declared afterwards via \cs{Mathastext} or \cs{MTDeclareVersion}. Only effective with \blueit{LGRgreek} option. \end{enumerate} \subsubsection{Commands usable everywhere}\label{sec:cmds} \begin{enumerate}[label=$\bullet$]\DeleteShortVerb{\|}% \item §\MTsetmathskips§\marg{a-z|A-Z}\marg{muglue}\marg{muglue}: \MakeShortVerb{\|}is used to specify extra skips (or rather mu glue) to be inserted in math mode, before and after a letter. The rationale is that standard text fonts used in math mode may sometimes cause glyph (near-) collisions with math symbols, as \TeX{} has some implicit expectations on the design of fonts for math letters. Random (silly) examples: \centeredline{|\MTsetmathskips{x}{\medmuskip}{\thickmuskip}|} \centeredline {|\MTsetmathskips{A}{.5mu}{2.3mu plus .5mu minus .5mu}|} and the effect: \begingroup\MTversion{italic}\MTsetmathskips{x}{\medmuskip}{\thickmuskip}% \MTsetmathskips{A}{.5mu}{2.3mu plus .5mu minus .5mu}% $vwxyzABC^{vwxyzABC}$\endgroup. The effect obeys the usual \LaTeX{} scoping rules. The first argument of §\MTsetmathskips§ may be a macro or, more generally, any expandable code, giving a letter; this facilitates use of |\MTsetmathskip| in |\@for| loops such as this one: \begin{verbatim} \makeatletter \@for\@tempa:=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\do{% \MTsetmathskips{\@tempa}{2mu}{2mu}}% \makeatother \end{verbatim} Note that contrarily to the \csb{MTexistsskip}, \csb{MTforallskip}, and \csb{MTprimeskip} commands described next, these extra skips (which may be specified in the preamble) are not recorded in the definition of the math version (as defined via §\Mathastext§ with its optional argument or via §\MTDeclareVersion§). Rather the skips once set hold thoughout the document until modified or canceled, independently of the switches of math versions (of course, \mst cancels the effect in the normal and bold math versions if package option \blueit{subdued} was used).\DeleteShortVerb{\|} \item §\MTunsetmathskips§\marg{a-z|A-Z}: \MakeShortVerb{\|} cancels the effect of a previous \csb{MTsetmathskips} for that letter (this is better than setting the skips to |0mu|, which would still prevent formation of ligatures when the letter is used inside a \cs{mathbf} for example). Example (using a version with upright Latin Modern): \centeredline {|\MTsetmathskips{f}{8mu}{0mu}$gffg\MTunsetmathskips{f}ff\mathbf{ff}$|} gives: \begingroup\MTversion{upright}% \MTsetmathskips{f}{8mu}{0mu}$gffg\MTunsetmathskips{f}ff\mathbf{ff}$\endgroup. The ligature was correctly formed. The argument may be a macro (or any expandable code) expanding to a letter. \item §\MTmathstandardletters§: this command cancels the mechanism (used by the package to insert the extra skips as specified by \csb{MTsetmathskips}, and the italic corrections) of `math activation' of the letters. \item §\MTmathactiveletters§: this is done by default by the package (initially and each time a switch of math version occurs, except for the normal and bold math versions under the |subdued| option). It allows the mathematical activation of the Latin letters a to z, A to Z which is used to add user-specified optional spaces around the letters, or (automatically if the font is not italic nor slanted) the italic corrections. Canceled by \csb{MTmathstandardletters}. \item §\MTexistsskip§\marg{math glue}: specifies the amount of skip or more generally glue to put after each $\oldexists$ math symbol. Indeed, upright letters (or digits for that matter) often appear to be positioned a bit too close to the quantifier: $\oldexists\mathrm{B}$. The package default is to add a |1mu| skip (this default is set to zero in the case of |italic|): $\oldexists\mskip 1mu\mathrm{B}$. One can change the default with the following syntax: |\MTexistsskip{2mu plus 1mu minus 1mu}|, which if used in the preamble and followed with a \csb{Mathastext} command (or \csb{MTDeclareVersion}), will be recorded in the definition of this math version (and subsequent ones). One may also use the command at any time in the document. In the case of the option |subdued|, the skips are set to zero for the normal and bold math versions. In the case of the option |italic|, the default skip is set to zero. \item §\MTforallskip§\marg{math glue}: the default is to add a |.6667mu| math skip after each $\oldforall$ (except with the option |italic| for which the default is set to zero). Compare $\oldforall\mskip.6667mu\mathrm{F}$ (has the skip) with $\oldforall\mathrm{F}$ (has no skip). Use this command in the preamble to set up the skip or glue to be used in the \emph{next to be declared} math versions. In the case of the option |subdued|, the skips are set to be zero by default in the normal and bold math versions. In the case of the option |italic|, the default skip is zero for all math versions. One may use the command also at any time in the document. \item §\MTprimeskip§\marg{math glue}: the default is to add a |0.5mu| skip before the derivative glyph, except for the |italic| option, and except in the normal and bold math versions with option |subdued|. The same observations apply.\footnote{if \cs{begin\{document\}} is not followed with \cs{MTversion\{normal\}}, the latest values set in the preamble by these commands are used at the beginning of the document, even under option \texttt{subdued}.} \item §\MTnormalprime§: the prime $'$ is kept unchanged, it does not take into account the math glue specified by §\MTprimeskip§. \item §\MTlowerast§\marg{dimen}: a \cs{raisebox} command is used to lower the text asterisk to produce a reasonable math asterisk. The package uses this command initially with argument |0.3\height|, this will have to be fine-tuned for each given text font but worked out ok with the fonts we tried. Note that the dimension argument will be used also in sub-scripts and sub-sub-scripts, so it is best not to use an absolute dimension. \item §\MTmathoperatorsobeymathxx§, §\MTmathoperatorsdonotobeymathxx§, §\MTnonlettersobeymathxx§, §\MTnonlettersdonotobeymathxx§, §\MTexplicitbracesobeymathxx§, §\MTexplicitbracesdonotobeymathxx§, §\MTeasynonlettersobeymathxx§, §\MTeasynonlettersdonotobeymathxx§: these commands without argument must be used \emph{outside} of math mode. \mst issues automatically \cs{MTmathoperatorsobeymathxx}, \cs{MTeasynonlettersobeymathxx} and \cs{MTnonlettersdonotobeymathxx} at the time of \cs{usepackage\{math\-as\-text\}}. See the discussion in section \ref{sec:mathxx}. The `explicit braces' activation works only when \cs{MTnonletters\-obeymathxx} has already been used. \item §\MTicinmath§: this command tells \mst to add italic corrections after all letters in math mode. Its effect is cancelled inside math alphabets (except \cs{mathnormal}). The command is issued by default in the preamble when the shape of the letters used in math mode is neither italic nor slanted. It is reissued each time a math version is entered, under the same conditions (and except of course for the normal and bold subdued math versions). Its effect is local to the group or environment in which it has been issued. \item §\MTnoicinmath§: this command deactivates the package added italic corrections. It can be used inside as well as outside of math mode (or in the preamble of the document). Its effect remains local to the group or environment where it was issued. \item §\MTICinmath§, §\MTnoICinmath§: these commands activate the italic corrections only for the uppercase letters. Using \cs{MTICinmath} de-activates the added italic corrections for uppercase letters in the arguments of \emph{all} the math alphabet commands. \item §\MTicalsoinmathxx§: this command de-activates the de-activation of the italic corrections inside the arguments to the math alphabet commands apart from \cs{mathnormal}. It can be issued in as well as outside of math mode.\footnote{it is provided for the \mst defined math alphabet \cs{mathnormalbold} which contrarily to \cs{mathnormal} is not treated apart from the other math alphabets.} To cancel its effect either enclose it in a group or environment or re-issue \cs{MTicinmath} after it. \item §\MTstandardgreek§: in case \mst was loaded with one of the Greek related options this command reverts the customization, it resets the Greek letters to their definitions in force at package loading time. Can be used in the preamble, but is mainly for the document body. Done automatically under the |subdued| option when switching to the normal or bold math version. Also available as |\Mathastextstandardgreek|. \item §\MTcustomgreek§: in case \mst has been loaded with one of its Greek related options, this activates the corresponding customization of Greek letters in math mode. It is issued automatically by the package in the preamble (except if loaded with §subdued§ option) and at each switch of math version via |\MTversion| or |\MTversion*| (the normal and bold math versions in subdued mode being excepted). Also available as |\Mathastextcustomgreek|. \end{enumerate} \subsubsection{Body-only commands} \begin{enumerate}[label=$\bullet$] \item §\MTversion§\oarg{nametext}\marg{namemath}, §\MTversion§$\ast$\marg{namemath}, also known as §\Mathastextversion§ (and as \cs{MTVersion}, and \cs{mathastextversion}): \begin{enumerate}[label=$\bullet$] \item the non-starred version changes \emph{both} the document text fonts and the math fonts (for those characters treated by \mst): the mandatory argument is the math version to be used for math; the optional argument is the name of (another) \mst-declared math version, the font which was chosen during its declaration will be set as document text font (and |\familydefault| etc\dots also are redefined). In the absence of the optional argument, the mandatory one is used. The versions \emph{must} be either |normal|, or |bold|, or previously declared ones via §\Mathastext§ or §\MTDeclareVersion§. \item the starred variant does the math set-up, but changes \emph{nothing} to the text fonts (see \autoref{sec:mathversions} for a description of the math set-up, which summarizes what is done additionally to only using \LaTeX{}'s |\mathversion|). \end{enumerate} \cs{MTversion}\oarg{nametext}\marg{namemath} does §\MTmathactiveletters§ (except for |\MTversion{normal}| and |\MTversion{bold}| under package option |subdued|), and, if the font used in math mode is not \emph{italic} nor \emph{slanted}, it furthermore activates the automatic insertion of italic corrections (for better positioning of subscripts; see the discussion in \autoref{sec:ic}). Under the |frenchmath| option the package checks separately the letter shape for lowercase and uppercase. Under the \blueit{subdued} option, \cs{MTversion\{normal\}} and \cs{MTversion\{bold\}} do \csb{MTmathoperatorsdonotobeymathxx}, \csb{MTnonlettersdonotobeymathxx}, \csb{MTeasynonlettersdonotobeymathxx}, and \csb{MTmathstandardletters}. \end{enumerate} All further commands are for math mode only. \begin{enumerate}[label=$\bullet$] \item §\hbar§: this is constructed (in a way compatible with the |italic| option) from the |h| letter and the \={ } accent from the \mst font. Note that \cs{mathrm}|{\hbar}| and \cs{mathbf}|{\hbar}| should work and that \cs{hbar} does scale in subscripts and exponents. Only for |T1| and |OT1| (or |LY1|) encodings. \item §\fouriervec§: this is a |\vec| accent taken from the Fourier font; the |fourier| package need not be loaded. Active only if option §fouriervec§. \item §\pmvec§: this provides a poor man \cs{vec} accent command, for upright letters. It uses the right arrow. Does not change size in subscripts and exponents. \item §\mathnormal§, §\mathrm§, §\mathbf§, §\mathit§, §\mathsf§, §\mathtt§: modifications of the original \cs{mathnormal}, \cs{mathrm}, \cs{mathbf}, \cs{mathit}, \cs{mathsf}, \cs{mathtt} to use the mathastextified font. The underlying internal \LaTeX{} structures related to the original commands are not overwritten, so the original commands can be saved under other names before |\usepackage{mathastext}|, to be used in case of necessity (this is what option |subdued| does.) \item §\mathnormalbold§: a bold version of \cs{mathnormal}. Differs from §\mathbf§ when the |italic| option has been used, or when use has been made of §\MTlettershape§ to specify a shape for letters distinct from the one for digits and operator names, or similarly when the math version has been declared via §\MTDeclareVersion§ with its optional parameter for shape of letters. \item §\inodot§, §\jnodot§: the corresponding glyphs in the chosen font for math mode. By default, will overwrite |\imath| and |\jmath|. With version |1.12| by default §\i§ and §\j§ work also in math mode and give then §\inodot§, resp. §\jnodot§. This should work for all 8bit-encodings having these glyphs, and also in Unicode. \item §\MathEuler§, §\MathEulerBold§: math alphabets to access all the glyphs of the Euler font, if option |eulergreek| (or |eulerdigits| was passed to the package. \item §\MathPSymbol§: math alphabet to access the Symbol font. \item when one of the options \blueit{symbolgreek}, \blueit{eulergreek}, or \blueit{selfGreek} is passed to the package the capital Greek letters which look like their Latin counterparts acquire names: \cs{Digamma}, \cs{Alpha}, \cs{Beta}, \cs{Epsilon}, \cs{Zeta}, \cs{Eta}, \cs{Iota}, \cs{Kappa}, \cs{Mu}, \cs{Nu}, \cs{Omicron}, \cs{Rho}, \cs{Tau}, \cs{Chi} (no \cs{Digamma} for Symbol). Also an \cs{omicron} control sequence is provided. \item |LGR| Greek and `var'-letters: only the \cs{varsigma} is available in this encoding, so using for example \cs{varphi} will load the previous default math font. It might thus be suitable when recompiling already written \LaTeX{} sources to add to the preamble \cs{let}\cs{varphi}$=$\cs{phi}, \cs{let}\cs{varepsilon}$=$\cs{epsilon}, etc\dots, in case only the `variant' form of the letter was used in the documents. \item \hypertarget{symbolmisc}{Miscelleneous mathematical symbols} from the postscript Symbol font are made available (or replaced) by option §symbolmisc§.\footnote{option \blueit{asterisk} is also required to treat the $*$. Recall from \autoref{sec:mathxx} that the asterisk in math mode (also when using the control sequence \cs{ast}) appears then to \TeX{} to be a composite object.} \makeatletter\let\mst@doasterisk\mst@@doasterisk\makeatother They are \cs{prod}~$\prod$ \cs{sum}~$\sum$ \cs{implies}~$\implies$ \cs{impliedby}~$\impliedby$ \cs{iff}~$\iff$ \cs{shortiff}~$\shortiff$ \cs{to}~$\to$ \cs{longto}~$\longto$ \cs{mapsto}~$\mapsto$ \cs{longmapsto}~$\longmapsto$ \cs{aleph}~$\aleph$ \cs{inftypsy}~$\inftypsy$ \cs{emptyset}~$\emptyset$ \cs{surd}~$\surd$ \cs{nabla}~$\nabla$ \cs{angle}~$\angle$ \cs{forall}~$\forall$ \cs{exists}~$\exists$ \cs{neg}~$\neg$ \cs{clubsuit}~$\clubsuit$ \cs{diamondsuit}~$\diamondsuit$ \cs{heartsuit}~$\heartsuit$ \cs{spadesuit}~$\spadesuit$ \cs{smallint}~$\smallint$ \cs{wedge}~$\wedge$ \cs{vee}~$\vee$ \cs{cap}~$\cap$ \cs{cup}~$\cup$ \cs{bullet}~$\bullet$ \cs{div}~$\div$ \cs{otimes}~$\otimes$ \cs{oplus}~$\oplus$ \cs{pm}~$\pm$ \cs{ast}~$\ast$ \cs{times}~$\times$ \cs{proptopsy}~$\proptopsy$ \cs{mid}~$\mid$ \cs{leq}~$\leq$ \cs{geq}~$\geq$ \cs{approx}~$\approx$ \cs{supset}~$\supset$ \cs{subset}~$\subset$ \cs{supseteq}~$\supseteq$ \cs{subseteq}~$\subseteq$ \cs{in}~$\in$ \cs{sim}~$\sim$ \cs{cong}~$\cong$ \cs{perp}~$\perp$ \cs{equiv}~$\equiv$ \cs{notin}~$\notin$ \cs{langle}~$\langle$ \cs{rangle}~$\rangle$. And a \cs{DotTriangle}~$\DotTriangle$ is made available by option §symbolre§ (which overwrites \cs{Re} and \cs{Im}: $\Re,\Im$). The \cs{inftypsy} and \cs{proptopsy} have these names to leave up to the user the choice to replace (or no) the original (larger) \cs{infty} $\infty$ and \cs{propto} $\propto$. Regarding the \cs{prod} and \cs{sum} commands: they will use the Symbol glyphs $\prod\sum$ in inline math, and in display math the Computer Modern ones (or whatever is set up by other packages; here we have the symbols from |txfonts|): \[\prod\sum\] The package provides \cs{prodpsy} and \cs{sumpsy}: if one really wants in all situations the Symbol glyphs, one can do \cs{let}\cs{prod}\cs{prodpsy} and \cs{let}\cs{sum}\cs{sumpsy}. Also \cs{MToriginalprod} and \cs{MToriginalsum} will refer to the \cs{prod} and \cs{sum} before redefinition by the package: this is to allow constructs such as |$\displaystyle\MToriginalprod$| or |\[\textstyle\MToriginalprod\]|, because they would not work with the \cs{prod} and \cs{sum} as re-defined by the package. \end{enumerate} \subsection{Complete list of options} \begin{enumerate}[label=$\bullet$] \item §basic§: only mathastextify letters and digits. \item §subdued§: do not change the default fonts or the math alphabets in math mode for the normal and bold math versions, turn on the \mst-ification only after an explicit \csb{MTversion} (or \cs{mathastextversion}) command activating an additional math version as declared in the preamble. With option |subdued| \cs{MTversion\{normal\}} and \cs{MTversion\{bold\}} do \csb{MTmathoperatorsdonotobeymathxx}, \csb{MTeasynonlettersdonotobeymathxx}, \csb{MTnonlettersdonotobeymathxx}, \csb{MTmathstandardletters}. \item §italic§: the letters default to italic shape in math mode. \item §frenchmath§: italic lowercase Latin letters, but uppercase Latin letters in the same font as for digits and operator names. In general this means that they will be upright. In case of the \blueit{LGRgreek} option, §frenchmath§ influences also the shape of the Greek letters. \item §endash§, §emdash§: use the text font en-dash (\textendash) or even the em-dash (\textemdash, but this seems crazy) for the minus sign rather than {}-{}. §endash§ option is default for the package. \item §asterisk§: use the text font (or the Symbol font) asterisk in math mode. \item §noendash§: the minus sign will be the - from the text font, not the en-dash \textendash. \item §nohbar§: prevents \mst from defining its own \cs{hbar}. \item §nolessnomore§: besides !\,?\,,\,.\,:\,;\,+\,\textendash\,=\,(\,)\,[\,]\,/\,\#\,\$\,\%\,\& \mst treats also \DeleteShortVerb{\|} $\mathord{<}\,\mathord{>}\,\mathord{|}$\, \{\,\} and $\backslash$.\MakeShortVerb{\|} Use this option to let it not do it. This is the default in case of |OT1|-encoding. \item further excluding options: §noexclam§ !\,?\ \ §nopunctuation§ ,\,.\,:\,;\ §noplus§, §nominus§, §noplusnominus§\ +\,\textendash{} §noequal§ =\ §noparenthesis§ (\,)\,[\,]\,/\ §nospecials§ \#\,\$\,\%\,\&\ and §nodigits§. \item §alldelims§: true by default, means that the characters excluded by §nolessnomore§ are treated. Use this option in case of a mono-width |OT1|-encoded font. \item §nosmalldelims§: this prevents \mst from trying to pick up in the text font the `small variants' of some math delimiters; it only affects what happens when a character such as a left parenthesis $($ or $[$ is used as a delimiter, and \TeX{} has chosen the smallest sized variant. This has no impact on what happens when they are not used as delimiters: then, and if not disabled by the corresponding options, these characters are always picked up from the text font. \item §symbolgreek§, §symboldigits§: to let Greek letters (digits) use the Symbol font. \item §symbolre§: replaces \cs{Re} and \cs{Im} by the Symbol glyphs $\Re, \Im$ and defines a \cs{DotTriangle} command ($\DotTriangle$). \item §symbolmisc§: takes quite a few glyphs, including logical arrows, product and sum signs from Symbol. They are listed \hyperlink{symbolmisc}{\emph{supra}}. Doing \cs{renewcommand\{\string\int\}\{\string\smallint\}} will maximize even more the use of the Symbol font. \item §symboldelimiters§: the characters apart from letters and digits will be taken from the Symbol font. \item §symbol§: combines §symbolgreek§, §symbolre§, and §symbolmisc§. \item §symbolmax§: combines §symbol§ and §symboldelimiters§. \item §eulergreek§, §eulerdigits§: to let Greek letters (digits) use the Euler font. \item §LGRgreek§: this is for a font which is also available in LGR-encoding. It is possible to change the font per math version, via the use of the §\MTgreekfont§ command in the preamble. \item §LGRgreeks§: each declared math version will be supposed to be with a font which is also available in LGR-encoding. \item §selfGreek§: this is for a font which is also available in |OT1|-encoding and contains the glyphs for the default eleven capital Greek letters. \item §selfGreeks§: each declared math version will be supposed to be with a font with the eleven capital Greek letters in its |OT1|-encoded version. \item §upgreek§, §itgreek§, §upGreek§, §itGreek§: options to tell to use \cs{itdefault} or \cs{updefault} for the lowercase and uppercase (or only the uppercase) Greek letters. Only operant in the case of the |LGRgreek(s)| and |selfGreek(s)| options. \item §mathaccents§: use the text font also for the math accents. As in vanilla \LaTeX{}, they are taken from the font for the digits and \cs{log}-like names. Obey the alphabet changing commands. Will work only for |T1|, |LY1|, or |OT1|-compatible encodings. \item §defaultbf§, §defaultit§, §defaultsf§, §defaulttt§: do not set up, respectively, the \cs{mathbf}, \cs{mathit}, \cs{mathsf}, and \cs{mathtt} commands to use the mathastext-ified font. This also prevents \mst to create internally \cs{Mathxx} alphabets (it never overwrites the original \cs{mathxx} things but let \cs{mathxx} point to \cs{Mathxx} instead), so one can use these options if one encounters a `too many math alphabets' \LaTeX{} error. \item §defaulnormal§, §defaultrm§: do not identify the default \cs{mathnormal} (resp. \cs{mathrm}) with the newly created \cs{Mathnormal} (resp. \cs{Mathrm}) commands which use the mathastextified fonts in each math version. \item §defaultalphabets§: all the §defaultxx§ options together, and additionally tells \mst not to create the \cs{mathnormalbold} alphabet either. \item §defaultimath§: do not overwrite \cs{imath} and \cs{jmath}, do not extend \cs{i} and \cs{j} to math mode use. \item §defaultmathsizes§: do not change the \LaTeX{} defaults for the sizes of exponents and subscripts. \item §fouriervec§: provides a \cs{fouriervec} command. The user can then add in the preamble \cs{let}\cs{vec}$=$\cs{fouriervec}. There is also always available a ``poor man'' vec accent \cs{pmvec} for upright letters. \end{enumerate} Thanks to Kevin~\textsc{Klement}, Tariq~\textsc{Perwez} and Ricard~\textsc{Torres} for sending bug reports and feature requests when the first version of the package was issued. \begin{center} Numerous examples will be found there:\\ \url{http://jf.burnol.free.fr/mathastext.html}\\ \url{http://jf.burnol.free.fr/showcase.html} \end{center} \catcode`\§=12 \clearpage \section{Change log} \begingroup \def\MacroFont{\footnotesize\normalfont} \makeatletter \def\@verbatim{% \parindent \z@ \parfillskip \@flushglue \parskip \tw@\p@ \let \do \@makeother \dospecials \catcode`\ =10 \catcode`\~=13 } \def\endverbatim{} \let\@vobeyspaces\relax \begingroup \catcode `|=0 \catcode `[= 1 \catcode`]=2 \catcode `\{=12 \catcode `\}=12 \catcode`\\=12 |long|gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]] |endgroup \catcode`*=\active \def*{\leavevmode\kern.5em\smash{\raisebox{-.3\height}{\char42}}\kern1em} % pour pouvoir imposer un \pagebreak si nécessaire \catcode`\~=\active \def~{\pagebreak} \makeatother \begin{multicols}{2} \begin{verbatim} 1.3d [2014/05/23] * new commands \MTstandardgreek and \MTcustomgreek. * The Greek letters, in case of use of one of the package related options, are left to their defaults in the normal and bold math versions if the subdued option was also used (this was so far the case only with options LGRgreek/LGRgreeks). * \newmcodes@ of amsmath is left untouched if package lualatex-math is detected. 1.3c [2013/12/14] * added a starred variant to \MTversion which tells mathastext to only do the math set-up and not modify the text fonts. * added second optional version name argument to \Mathastext and to \MTDeclareVersion, to transfer settings for things not otherwise changed by mathastext from a math version to the one declared. This is mainly for symbols and large symbols to be the bold ones when the user sets up the series of a mathastextified font to be bold in a mathastext-declared version. * renamed \defaultprod to \MToriginalprod, \defaultsum to \MToriginalsum, (this is in case of option symbolmisc). * changes to the dtx organization; options for generating the documentation can be customized in generated mathastext.tex file. * 1.2d code for \#, \$, \%, and \& modified erroneously the earlier correct 1.2c code and created a bug showing up with more than 16 math families (a possibility only with lualatex or xelatex). 1.3a [2013/09/04] * the somewhat silly \string's are removed from the \MTsetmathskips command of release 1.3, thus allowing its first argument to be a macro, or any expandable code, giving a letter. * the amsmath \resetMathstrut@, which is incompatible with a mathematically active parenthesis ( is now modified only if necessary (i.e. only when \MTnonlettersobeymathxx is issued) and is restored to its original value if not needed anymore (i.e. after \MTnonlettersdonotobeymathxx, as for example when switching to the normal version under option subdued). * improved documentation. 1.3 [2013/09/02] * commands \MTsetmathskips and \MTunsetmathskips added. * commands \MTmathactiveletters and \MTmathstandardletters to govern the math activation of letters independently of its use for insertion of the italic corrections (\MTicinmath and \MTnoicinmath correspondingly modified). * the new \luatexUmathcodenum as available since TL2013 allows identical treatment by mathastext of = and - under both LuaTeX and XeTeX. * \newmcodes@ of amsmath is left untouched in case of option basic. * a sentence containing | which was written to the log during the loading caused a problem if | was active (typically if \MakeShortVerb{\|} was added to the preamble prior to the loading of mathastext). * some preemptive measures taken regarding things such as \mid, \lbrace, and \rbrace, as some packages define these things in manners which made the re-definitions done by mathastext issue errors. 1.2f [2013/01/21] * minor code improvements. Change log added to the user manual. 1.2e [2013/01/10] This version should be the last one in the 1.2 series as it seems to correct most of the main problems which were introduced with the massive use of mathematically active characters in versions 1.2 and 1.2b. * It is indeed a thorny point when one wants to modify only in math mode how an active character acts, without breaking things. The package now does that /only/ if the activation appears to originate in the Babel system, as it is then possible to modify appropriately the Babel macros \user@active and \normal@char. The relevant issues are discussed in section 2.10 of the user manual, in the test file mathastexttestalphabets.tex, and in the source code comments to the macro \mst@mathactivate. The inherent incompatibility of Babel with packages having made mathematically active the characters itself makes document active is circumvented by this interference of mathastext. A generally applicable Babel patch could be derived from the method used by mathastext. * The technique of mathematical activation is maintained only for the characters which are not catcode active (at the entrance in math mode, as mathastext does all its activation job at everymath and everydisplay). * Sadly, the feature of added italic corrections introduced in version 1.2b did not behave as described in the user manual, due to forgotten group braces. Fixed. * The command \MTlowerast from the user manual of v1.2d was not the one implemented in the source code. Fixed. * The test files automatically extracted from a latex run on the dtx file have been revised and extended. * The code is better documented. 1.2d [2013/01/02] * an incompatibility with amsmath (its macro \resetMathstrut@), exists since version 1.2 of the package. This is fixed here. * various improvements in dealing with the asterisk and in the mechanism of letting non-letter symbols obey the math alphabet commands. * documentation extended and improved. 1.2c [2012/12/31] * mathastext now inserts automatically after all (latin) letters in math mode their italic corrections, if the font used is upright (sic). This improves the spacings for the positioning of subscripts. The feature is de-activated inside the math alphabets commands (apart from \mathnormal), so as to not prohibit the formation of ligatures, * the documentation has been extended to explain in detail the issues which are relevant to the new feature of added italic corrections, * version 1.2 had some bad bugs when confronted to active characters. This is corrected and additionally \MTnonlettersdonotobeymathxx is made the default, as the user input is too much constrained in its absence. * a less fatal, but still annoying, typo had made the dot in 1.2 of type \mathpunct rather than \mathord * the inner namespace has been rationalized a bit. 1.2 [2012/12/20] * a new command sets up the amount of space to be automatically inserted before the derivative glyph (useful when using an upright font). * the scope of the math alphabets has been extended to apply to the non-alphabetical characters, and also to operator names. * the format of the dtx file has changed. The package file is self-extracting from the dtx, and four additional test files are also produced during `latex mathastext.dtx'. 1.15f and 1.15g [2012/10/25] * \$, \#, \&, and \% had been re-defined by mathastext since its inception in a rather strange (but working) way, which could cause surprises to other packages. Fixed. * the subdued mechanism for the math alphabets is implemented in a simpler and more efficient manner than in 1.15e. * the `defaultxx' options act a bit differently, and are more useful in case of a `too many math alphabets' situation. * various improvements in the documentation. * general clean up and better commenting of the source code. 1.15e [2012/10/22] * new user commands to specify skip or glue to be inserted after the math symbols \exists and \forall * complete (user transparent) rewrite of the code implementing the subdued option; and its action has been extended to apply also to the \mathbf, \mathit, \mathsf, \mathtt alphabets and not only to \mathrm and \mathnormal as in the previous versions. * improvements in the documentation. 1.15d [2012/10/13] * the Unicode situation is now correctly treated, throughout the code (this had been left in a half-done way from version 1.14 of April 2011). - this includes an issue related to amsmath and its DeclareMathOperator macro which has been fixed, - and the code related to \relbar and \Relbar (and \models) has been revised. 1.15c [2012/10/05] * it is now possible to use distinct fonts in LGR encoding for the Greek letters according to the current math version. * improvements to the documentation. 1.15b * corrected a `feature' of 1.15 which was backward- incompatible * improvements to the pdf documentation 1.15 [2012/09/26] * the subdued option allows the mathastextification to act only locally. * some measures taken to deal with amsmath related issues when using xetex or luatex. 1.14c * a bug is fixed: the \Mathastext macro reinitializes the fonts in the normal and bold math versions, but it also erroneously redeclared the math alphabet changing commands which could have been set up in previously defined math versions (via earlier calls to \Mathastext[version_name]). 1.14b [2011/04/03] * there was a bug with \$, \#, \&, \% in math mode which showed up when ten or more math families had been declared. This bug affected also the minus sign under the same circumstances, when Unicode engines were used. Fixed. * the options LGRgreek and selfGreek act now a bit differently, and new options LGRgreeks and selfGreeks have been defined. * I also cleaned up a bit the code, for a more structured namespace. 1.14 * mathastext now modifies also the math alphabets \mathit, \mathsf and \mathtt, thus making it a quite generic complete manner to adapt the math configuration to fonts provided with no math support. 1.13b * when the Symbol font is used for \prod and \sum this will be only for inline math; display math will use the default glyphs 1.13 [2011/03/11] * the LGRgreek option is added. * internal changes for better readability of the code. 1.12 * various bugs have been corrected. * the endash and alldelims options are active by default. * the package is more Unicode aware. * the \Mathastext command has been improved to facilitate the mechanism of math versions also when using XeTeX or LuaTeX (with package fontspec.) * the en-dash and dotless i and j now work with all encodings, Unicode inclusive. 1.11 [2011/02/06] optional argument to \Mathastext macro. 1.1 [2011/02/01] options italic and frenchmath. 1.0 [2011/01/25] Initial version. \end{verbatim} \end{multicols} \endgroup \ifnum\NoSourceCode=1 \bigskip \begin{framed} \def\givesomestretch{% \fontdimen2\font=0.33333\fontdimen6\font \fontdimen3\font=0.16666\fontdimen6\font \fontdimen4\font=0.11111\fontdimen6\font }% \ttfamily\small\givesomestretch\hyphenchar\font45 This documentation has been compiled without the source code. To produce the documentation with the source code included, run "tex mathastext.dtx" to generate mathastext.tex (if not already available), then thrice latex on mathastext.tex and finally dvipdfmx on mathastext.dvi. \end{framed} \fi \makeatletter \StopEventually{\end{document}\endinput} \makeatother \newgeometry{hmarginratio=3:2} \small \section{Implementation} % The catcode hackery next is to avoid to have <*package> to be listed % in the commented source code... % (c) 2012/11/19 jf burnol ;-) \MakePercentIgnore % % \catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11 % \let\relax % \def<*package>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12} % % %<*package> % The usual catcode regime for letters and digits is assumed and some characters % such as *, `, ", = are supposed to be of catcode other at the time of loading % of \mst. The source of \mst takes precautions for some other characters such % as the right quote ', which may thus be active with no harm at the time of % loading. By the way, I think \LaTeX2e should have provided to authors a % standard macro to be used at the beginning of a style file to make sure the % catcodes are standard. Shorthands created by Babel should be mostly no problem % as Babel does the activation only at the |\begin{document}|. % % The comments have been accumulating through successive versions with only % partial efforts to achieve some sort of coherence; as a result some are a % bit strange or obsolete to various degrees. And the similar remark % applies to some ancient parts of the code itself! % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {mathastext} [2014/05/23 v1.3d Use the text font in math mode (jfB)] % \end{macrocode} % Testing for XeTeX and LuaLaTeX. I should load some package for this code which % I copied somewhere (perhaps from the |iftex| package? or some post on % |comp.text.tex|). 2013/01/01: at least % the code now does not overwrite previous \cs{ifXeTeX} or \cs{ifLuaTeX}... % \begin{macrocode} \newif\ifmst@XeTeX \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname XeTeXinterchartoks\endcsname\relax \mst@XeTeXfalse \else \mst@XeTeXtrue \fi \newif\ifmst@LuaTeX \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname directlua\endcsname\relax \mst@LuaTeXfalse \else \mst@LuaTeXtrue \fi % \end{macrocode} % |1.2|: all inner macros of \mst now starts with |\mst@| for a cleaner % name-space. % \begin{macrocode} \def\mst@oti{OT1}\def\mst@ti{T1}\def\mst@lyi{LY1} \def\mst@eui{EU1}\def\mst@euii{EU2} \newif\ifmst@goahead \newif\ifmst@abort % \end{macrocode} % \begin{macro}{\mst@enc} % \begin{macro}{\mst@fam} % \begin{macro}{\mst@ser} % \begin{macro}{\mst@opsh} % \begin{macro}{\mst@bold} % \begin{macro}{\mst@ltsh} % Macros to store the font settings, each math version will store its % own records. % \begin{macrocode} \def\mst@enc{\encodingdefault} \def\mst@fam{\familydefault} \def\mst@ser{\seriesdefault} \def\mst@opsh{\shapedefault} %% will be default shape for operator names \def\mst@bold{\bfdefault} \def\mst@ltsh{\shapedefault} %% will be default shape for letters % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{\mst@greekfont} % |1.15c|: for use by the LGRgreek and selfGreek options. Defined as % an \cs{edef} in order to be able to set-up once and for all the % Greek at the time of \cs{usepackage}. Modifiable in the preamble % via \cs{MTgreekfont}\marg{font\_name}\cs{Mathastext}. % \begin{macrocode} \edef\mst@greekfont{\familydefault} %% v 1.15c % \end{macrocode} % \end{macro} % \begin{macro}{Package options} % 2011/03/09: |1.13| introduces the option LGRgreek and systematic use % of \cs{if...} conditionals, for better readability (by myself) of % the code. % \begin{macrocode} \newif\ifmst@italic \newif\ifmst@frenchmath \DeclareOption{italic}{\mst@italictrue \def\mst@ltsh{\itdefault}} \DeclareOption{frenchmath}{\mst@frenchmathtrue\mst@italictrue \def\mst@ltsh{\itdefault}} %% \newif\ifmst@endash\mst@endashtrue \DeclareOption{endash}{\mst@endashtrue} \DeclareOption{noendash}{\mst@endashfalse} \newif\ifmst@emdash \DeclareOption{emdash}{\mst@emdashtrue\mst@endashfalse} %% \newif\ifmst@alldelims \edef\mst@tmp{\encodingdefault}\ifx\mst@oti\mst@tmp\else\mst@alldelimstrue\fi \DeclareOption{alldelims}{\mst@alldelimstrue} \DeclareOption{nolessnomore}{\mst@alldelimsfalse} %% new with 1.2 \newif\ifmst@nosmalldelims \DeclareOption{nosmalldelims}{\mst@nosmalldelimstrue} %% \newif\ifmst@noplus \DeclareOption{noplus}{\mst@noplustrue} \newif\ifmst@nominus \DeclareOption{nominus}{\mst@nominustrue} \DeclareOption{noplusnominus}{\ExecuteOptions{noplus,nominus}} %% \newif\ifmst@noparen \DeclareOption{noparenthesis}{\mst@noparentrue} \newif\ifmst@nopunct \DeclareOption{nopunctuation}{\mst@nopuncttrue} \newif\ifmst@noequal \DeclareOption{noequal}{\mst@noequaltrue} \newif\ifmst@noexclam \DeclareOption{noexclam}{\mst@noexclamtrue} \newif\ifmst@asterisk \DeclareOption{noasterisk}{\PackageWarningNoLine{mathastext} {option `noasterisk\string' is deprecated.^^J\space\space\space Check the documentation}} \DeclareOption{asterisk}{\mst@asterisktrue \AtBeginDocument{ \everymath\expandafter{\the\everymath \mst@doasterisk \let\mst@doasterisk\relax} \everydisplay\expandafter{\the\everydisplay \mst@doasterisk \let\mst@doasterisk\relax}}} \newif\ifmst@nospecials \DeclareOption{nospecials}{\mst@nospecialstrue} \newif\ifmst@basic % 1.3 to avoid unnecessary patch of amsmath \newmcodes@ \DeclareOption{basic}{\mst@basictrue \ExecuteOptions{noparenthesis,nopunctuation,% noplusnominus,noequal,noexclam,nospecials,nolessnomore}} %% \newif\ifmst@nohbar \DeclareOption{nohbar}{\mst@nohbartrue} \newif\ifmst@nodigits \DeclareOption{nodigits}{\mst@nodigitstrue} \newif\ifmst@defaultimath \DeclareOption{defaultimath}{\mst@defaultimathtrue} \newif\ifmst@mathaccents \DeclareOption{mathaccents}{\mst@mathaccentstrue} %% \newif\ifmst@needsymbol \newif\ifmst@symboldelimiters \DeclareOption{symboldelimiters}{\mst@needsymboltrue\mst@symboldelimiterstrue} \newif\ifmst@symboldigits \DeclareOption{symboldigits}{\mst@needsymboltrue\mst@symboldigitstrue} \newif\ifmst@symbolgreek \newif\ifmst@customgreek %% new with 1.3d \DeclareOption{symbolgreek}{\mst@needsymboltrue\mst@symbolgreektrue \mst@customgreektrue } \newif\ifmst@symbolre \DeclareOption{symbolre}{\mst@needsymboltrue\mst@symbolretrue} \newif\ifmst@symbolmisc \DeclareOption{symbolmisc}{\mst@needsymboltrue\mst@symbolmisctrue} \DeclareOption{symbol}{\ExecuteOptions{symbolgreek,symbolmisc,symbolre}} \DeclareOption{symbolmax}{\ExecuteOptions{symbol,symboldelimiters}} %% \newif\ifmst@needeuler \newif\ifmst@eulerdigits \DeclareOption{eulerdigits}{\mst@needeulertrue\mst@eulerdigitstrue} \newif\ifmst@eulergreek \DeclareOption{eulergreek}{\mst@needeulertrue\mst@eulergreektrue \mst@customgreektrue } %% \newif\ifmst@selfGreek \DeclareOption{selfGreek}{\mst@selfGreektrue\mst@customgreektrue} \newif\ifmst@selfGreeks \DeclareOption{selfGreeks}{\mst@selfGreekstrue\mst@selfGreektrue \mst@customgreektrue } \newif\ifmst@LGRgreek \DeclareOption{LGRgreek}{\mst@LGRgreektrue\mst@customgreektrue} \newif\ifmst@LGRgreeks \DeclareOption{LGRgreeks}{\mst@LGRgreekstrue\mst@LGRgreektrue \mst@customgreektrue} %% \def\mst@greek@select{0} \newif\ifmst@itgreek \newif\ifmst@upgreek \DeclareOption{itgreek}{\mst@itgreektrue} \DeclareOption{upgreek}{\mst@upgreektrue} \DeclareOption{itGreek}{\def\mst@greek@select{1}} \DeclareOption{upGreek}{\def\mst@greek@select{2}} %% % \end{macrocode} % Starting with |1.15f| the meaning of the `defaultxx' options has changed. They % now prevent |mathastext| from defining additional alphabets rather than % prevent it from identifying the `mathxx' with the new `Mathxx'. The % `Mathnormal' and `Mathrm' alphabet commands are always created as they are % SymbolFontAlphabets. % \begin{macrocode} \newif\ifmst@defaultnormal \DeclareOption{defaultnormal}{\mst@defaultnormaltrue} \newif\ifmst@defaultrm \DeclareOption{defaultrm}{\mst@defaultrmtrue} \newif\ifmst@defaultbf \DeclareOption{defaultbf}{\mst@defaultbftrue} \newif\ifmst@defaultit \DeclareOption{defaultit}{\mst@defaultittrue} \newif\ifmst@defaultsf \DeclareOption{defaultsf}{\mst@defaultsftrue} \newif\ifmst@defaulttt \DeclareOption{defaulttt}{\mst@defaulttttrue} \newif\ifmst@nonormalbold \DeclareOption{defaultalphabets}{\ExecuteOptions{defaultnormal,defaultrm,% defaultbf,defaultit,defaultsf,defaulttt}\mst@nonormalboldtrue} % \end{macrocode} % |mathastext| considers the default script and especially scriptscript sizes to % be far too small, and it will modify them. An option maintains the default. % \begin{macrocode} \newif\ifmst@defaultsizes \DeclareOption{defaultmathsizes}{\mst@defaultsizestrue} \newif\ifmst@twelve \DeclareOption{12pt}{\mst@twelvetrue} \newif\ifmst@fouriervec \DeclareOption{fouriervec}{\mst@fouriervectrue} % \end{macrocode} % |1.15|: the subdued option. % \begin{macrocode} \newif\ifmst@subdued \DeclareOption{subdued}{\mst@subduedtrue} \DeclareOption*{\PackageWarningNoLine{mathastext} {Unknown option `\CurrentOption\string'}} % \end{macrocode} % \end{macro} % \begin{macrocode} \ProcessOptions\relax % \end{macrocode} % \begin{macro}{\exists} \begin{macro}{\mst@exists@skip} % \begin{macro}{\forall} \begin{macro}{\mst@forall@skip} % % |1.15e| [2012/10/21]: math skip/glue \emph{after} \cs{exists} and % \cs{forall}, this is useful with upright letters in math mode. % Each math version has its own user defined values for the skips, % stored as macros. The redefinitions of $\exists$ and $\forall$ are % done only at the end of the package as the |symbol| option will % also want to redefine these math symbols. % % The subdued option (later and only for the normal and bold math % version) and the italic option (here) set to zero the package % default skips. With |1.2| the skips can be modified on the fly in % the document, they are not necessarily set in the preamble once % and for all for each math version. % % \begin{macrocode} \newmuskip\mst@exists@muskip %% v 1.15e \newmuskip\mst@forall@muskip \def\mst@exists@skip{1mu} \def\mst@forall@skip{.6667mu} \ifmst@italic\ifmst@frenchmath\else \def\mst@exists@skip{0mu}\def\mst@forall@skip{0mu}\def\mst@prime@skip{0mu} \fi\fi \AtEndOfPackage{% must be at end of code \let\mst@stdexists\exists \let\mst@stdforall\forall \renewcommand\exists{\mst@stdexists\mskip\mst@exists@muskip} \renewcommand\forall{\mst@stdforall\mskip\mst@forall@muskip} } % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{\prime} % \begin{macro}{\mst@prime@skip} % \begin{macro}{\active@math@prime} % \begin{macro}{\MTnormalprime} % % |1.2| [2012/12/17]: math skip/glue \emph{before} the \cs{prime} % glyph. This is useful with the default CM glyph and upright letters % (in contrast the prime from |txfonts| works fine with upright % letters). For this we replace the \LaTeX{} kernel \cs{active@math@prime} % with our own skip-enhanced version \cs{mst@active@math@prime}. % % |1.2b| [2012/12/31]: doing\\ % \null\hspace{1cm}|{\catcode`\'=\active \global\let'\mst@active@math@prime}|\\ % is awfully wrong when the right quote is made active at begin document by % some other package (as happens with |babel| for some languages). So \mst % treats now the right quote with the same method as applied to the other % characters it makes mathematically active. This uses the macro % \cs{mst@mathactivate} which is defined later in the package. % % Babel does |\let\prim@s\bbl@prim@s| when |'| is made active via its % services (the czech and slovak languages also store the initial % version of \cs{prim@s}, else the quote would not work correctly % when being again of |catcode 12|), and it doesn't matter if \mst is % loaded before or after this happens, as the \cs{mst@mathactivate} % does its job only as part of the \cs{everymath} and % \cs{everydisplay} token lists. % % |1.2e| being paranoid, we take precautions against a possibly % catcode active right quote at % the time of loading mathastext. % \begin{macrocode} \newmuskip\mst@prime@muskip %% v 1.2 \def\mst@prime@skip{.5mu} \ifmst@italic\ifmst@frenchmath\else\def\mst@prime@skip{0mu}\fi\fi \def\mst@active@math@prime{\sp\bgroup\mskip\mst@prime@muskip\prim@s} {\catcode`\'=12 \gdef\mst@modifyprime{\mst@mathactivate'{}\mst@active@math@prime}} \newcommand*\MTnormalprime{\let\mst@modifyprime\relax} \AtBeginDocument{ \everymath\expandafter{\the\everymath \mst@modifyprime \MTnormalprime} \everydisplay\expandafter{\the\everydisplay \mst@modifyprime \MTnormalprime} } % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{\MTexistsskip} % \begin{macro}{\MTforallskip} % \begin{macro}{\MTprimeskip} % |1.15e|: These user macros set up the amount of muglue after % \cs{exists} or \cs{forall}. The normal and % bold math versions inherit the same skips; these skips are set to % zero in case of the subdued, or the italic option. Each command % \cs{Mathastext}\oarg{version\_name} stores the current values in % the definition of the math version. % % |1.2|: \cs{MTprimeskip} added, the silly \cs{@onlypreamble} are removed % and the macros are modified to have immediate effect in the document, % independently of their possible use in the preamble for the math % versions to store values. % % Note (september 2013): the names were badly chosen; \cs{MTsetprimeskipto} % for example would have been a better choice. % \begin{macrocode} \newcommand*\MTexistsskip[1]{\edef\mst@exists@skip{#1}% \mst@exists@muskip\mst@exists@skip\relax} \newcommand*\MTforallskip[1]{\edef\mst@forall@skip{#1}% \mst@forall@muskip\mst@forall@skip\relax} \newcommand*\MTprimeskip[1]{\edef\mst@prime@skip{#1}% \mst@prime@muskip\mst@prime@skip\relax} \let\Mathastextexistsskip\MTexistsskip \let\Mathastextforallskip\MTforallskip \let\Mathastextprimeskip\MTprimeskip \let\mathastextexistsskip\MTexistsskip \let\mathastextforallskip\MTforallskip \let\mathastextprimeskip\MTprimeskip % \end{macrocode} % \end{macro}\end{macro} % \end{macro} % \begin{macro}{\resetMathstrut@} % 2012/12/31: The |amsmath| macro \cs{resetMathstrut@} is not compatible % with a % mathematically active opening parenthesis: it does \\ % \null\hspace{1cm}|\mathchardef\@tempa\mathcode`\(\relax|\\ % and is made a part of the hook \cs{every@math@size} inside % \cs{glb@settings}. % This is called from \cs{check@mathfonts} which is done in % particular in \cs{frozen@everymath}, hence \emph{before} (but wait) % what \mst puts in \cs{everymath}. Also, \cs{glb@settings} is triggered % by \cs{mathversion} which must be done outside of math mode. % % Alas, with things such as |$...\hbox{...$..$..}...$| \mst will have % already made the parenthesis (mathematically) active. And % \cs{boldsymbol} from |amsbsy| disables the \cs{@nomath} switch and % executes \cs{mathversion\{bold\}} directly in math mode. So we have a % problem with \cs{resetMathstrut@}. % % |lualatex-math| replaces \cs{resetMathstrut@} with its own version % (which also looks at |)|) and no error is signaled when \mst has done % |\mathcode`(="8000|, but the \cs{Mathstrutbox@} created by \mst is then % wrong. % % The replacement macro avoids a potentially math active |(|. It % assumes that there is still some appropriate glyph in slot |40| of % |operators| and it sets the height and depth of \cs{Mathstrutbox@} % to be large enough to accomodate both this glyph and the one from the % mathastext font (both in the current math version). If option % |noparenthesis| was used, we leave everything untouched. % % In |1.3a|, [2013/09/04], the modification is done only at the time of % \cs{MTnonlettersobeymathxx}. It is cancelled by % \cs{MTnonlettersdonotobeymathxx}. So the code has been moved to these % macros and here we just store at the begin document the then meaning of % \cs{resetMathstrut@}, and check also if \cs{MTnonlettersobeymathxx} has % been invoked in the preamble. % \begin{macrocode} \ifmst@noparen\else \AtBeginDocument{% \@ifundefined{resetMathstrut@}{% nothing to do, no amsmath }{% amsmath loaded, and possibly patched by things such as lualatex-math \let\mst@savedresetMathstrut@\resetMathstrut@ \PackageWarning{mathastext}{current meaning of amsmath \string\resetMathstrut@\space saved}% \ifx\mst@the\the % means that \MTnonlettersobeymathxx was used in preamble \let\mst@the\@gobble\MTnonlettersobeymathxx \fi}} \fi % \end{macrocode} % \end{macro} % % |1.2| [2012/12/20] does some rather daring \emph{math} activation of % \verb$; , : ! ? + - = < > ( ) [ ]$ in % math mode to achieve something I wanted to do since a long time: overcome % the mutually excluding relation between the variable-family concept and % the automatic spacing concept. After loading \mst, these characters now % obey the math alphabets commands but still have the automatic spacing. % The use as delimiters for those concerned is also ok. % % The activation is done via setting the \cs{mathcode} to |"8000| through the % macro \cs{mst@mathactivate} which in turn is put into the \cs{everymath} % and \cs{everydisplay} token lists. No character is made active in the sense % of the \cs{catcode} (the issues with catcode active characters at % the entrance of the math mode are discussed later),\\ % \null\hspace{1cm}\fbox{but the concerned characters will now expand in math % mode to \emph{two} tokens.}\\ % |1.2c| [2012/12/31]: hence, this current % implementation puts constraints on the input: |$x^?$| or |$x\mathrel?y$| % now create errors. They must be input % |$x^{?}$|, respectively |$x\mathrel{?}y$|.\\ % \null\hspace{1cm} \fbox{The disactivating % macro \cs{MTnonlettersdonotobeymathxx} is made the default.} % % The mechanism is (even more) off by default for |\{| and |\}| as this % is not compatible with their use as delimiters (|\lbrace| and |\rbrace| % should be used instead) but it can be activated for them too. % % % \begin{macro}{\mst@mathactivate} % |1.2b| [2012/12/30]: there were bad oversights in the |1.2| code % for \cs{mst@mathactivate} related to the possibility for some % characters to have been made active (in the sense of the catcode) % elsewhere (something which often is done by language definition % files of the |babel| system). The code from |v1.2b| tried to % provide correct behavior using a prefix called \cs{mst@fork} (its % definition and its use has since been modified) which let the % active character expand to the \mst re-definition \emph{only} in % math mode and \emph{only} if \cs{protect} was % \cs{@typeset@protect}. This indeed took care of situations such as % |$\hbox{?}$| with an active |?| or |$\label{eq:1}$| with an active % |:| (assuming for the latter that things would have worked ok before % the twiddling by \mst). % % |1.2e| [2013/01/09]: alas |$\ref{eq:1}$| still was a problem. % Indeed in that case the \mst prefix had no means to know it was % inside a \cs{ref} so it made the character expand to its \mst % redefinition, which is not acceptable inside a % |\csname...\endcsname|. What happens with Babel is that it patches % things such as \cs{ref}, \cs{newlabel},... we can test the % \cs{if@safe@actives} flag to detect it in that case, but this is % Babel specific. After having thought hard about this I see no % general solution except patching all macros such as \cs{ref}...(in % an imitation of what Babel does). So the final decision is to not % do anything when the character is catcode active \emph{except} it % it seems that Babel is behind the scenes. % % Incidently, Babel and TikZ are buggy with characters which are % mathcode actives. For example the combination of |[french]{babel}| % and |mathtools| with its |centercolon| turns |$:$| into an % \emph{infinite loop} !! % % In the case of Babel the reason is that, generally (but not always, % the right quote |'| is an exception), the % \cs{normal@char}\meta{char} fall-back is \cs{string}\meta{char}. % But this is wrong if the mathcode is |32768|! The fall-back becomes % the default if the user switches to a language where \meta{char} is % `normal' and then an infinite loop arises. % % As a further example (I am not familiar with other languages from % the Babel system) with |frenchb| the active |!?;:| expand in math % mode to \cs{string}|! or ? or ; or :|. This creates an infinite % loop if the mathcode is |32768|. % % For the special case of the right quote |'| when it is made active % by Babel, its fall-back does not invoke |\string'| so being still % of mathcode |32768| is not a problem. % % I have posted on TeX StackExchange how Babel should possibly modify % its definitions and I use this here. I simplify a bit my proposed % replacement of \cs{normal@char}\meta{char} as the check for % \cs{protect} is superfluous, I think, having been % done already at the level of the Babel prefix. % % Replacing \cs{user@active}\meta{char} is indeed not enough, and % \cs{normal@char}\meta{char} also must be changed, because when the % user switches back to a language where the character is `normal' it % remains catcode active. The crucial thing is the test of % \cs{if@safe@actives} in the replacement of the % \cs{normal@char}\meta{char}, besides of course the test for math % mode in both replacements. % % When the character is not catcode active, then \mst uses the math % activation method. As the mathcode is not looked at in \cs{edef}, % \cs{write} or inside |\csname...\endcsname| nothing special needs % to be done, I think, in terms of protection against premature % expansion. (I did not know that initially). % % So, to recapitulate, \mst will use the mechanism of the active % |mathcode| if the character is not |catcode| active, and in the % opposite case will do something only in the context of Babel, % modifying directly its \cs{user@active}\meta{char} and its % \cs{normal@char}\meta{char} macros and \fbox{it does NOT then set % the mathcode to 32768!!}, rather it makes \emph{sure} the character % is not mathematically active. % % As |1.2e| is a bit paranoid it takes precautions against % the possibility of characters it treats being active at % the time of its loading. Excepted from the scope of the % paranoia are the latin letters (that would be crazy!) and % also |*|, |"| and the left quote |`|. % % |1.2f| [2013/01/21] with earlier versions (*) it was important not % to do twice the business of \cs{mst@mathactivate} (think % |$\hbox{$?$}$|), so I used (this was a bit wasteful) some sort of % boolean macro for each character. But now that there are the % |\mst@the..| prefixes, let's just use them! (don't know why I did % not think of that earlier; perhaps I had in mind some more general % character per character customization initially, which I just dropped.) % % (*) it is still important to not do twice the thing when the % character is active, in which case the |babel| macros are patched. % % As an aside, |$\hbox{\catcode`?=\active $?$}$| for an |?| which was % unactive at the first |$| will just make \mst overwrite the % definition (assumed here to have been done earlier) of an active % |?|, but the result is that the inner |?| can not be used in % |\label| or |\ref|. So testing for active characters should be done % always... many things should be done always... I leave as is. % % \begin{macro}{\mst@do@az} % \begin{macro}{\mst@do@AZ} % \begin{macro}{\mst@addtodo@az} % \begin{macro}{\mst@addtodo@AZ} % \begin{macro}{\MTicinmath} % \begin{macro}{\MTICinmath} % \begin{macro}{\MTnoicinmath} % \begin{macro}{\MTicalsoinmathxx} % \begin{macro}{\mst@the} % |1.2b| [2012/12/28] now that we understand the great advantages of |"8000| % we do it also for all letters a-z and A-Z to insert automatically the % italic corrections. See the \hyperref[sec:ic]{discussion} in the user % manual. Ironically I wrote the code initially for the |italic| option only % to realize later it was more suitable to using an \emph{upright} text font % in math mode! So this mathematical activation of the letters is not done if % the font shape is detected to be |it| or |sl|; to bypass this the command % \cs{MTicinmath} is provided. % % |1.2e| [2013/01/10] corrects a bad oversight of |1.2b| in % \cs{mst@mathactivate} which made the reproduction of the user % manual illustrations with |$f_i^i$| impossible. As % \cs{mst@mathactivate} was used also to get the non-letters obey % math alphabet while maintaining the \TeX{} spacings, I could not % use group braces. I should have added them later in the case of % letters but then forgot. Fixed. (the group braces do not prevent % ligatures when the letters are arguments to the math alphabet % commands, the added macro \cs{mst@itcorr} then expands to nothing). % % \cs{MTnoicinmath} can also be used from inside math mode. % % \cs{MTicalsoinmathxx} is destined to be used inside % \cs{mathnormalbold} as I didn't want to add the complication of % extracting the family number used inside \cs{mathnormalbold} (will % perhaps come back if I have time to spend on % |source2e|). % % \cs{MTicinmath} can also be used inside math mode, to revert an % earlier \cs{MTnoicinmath} from inside the same math group: the math mode % had to be entered with the math activation of letters allowed. % \begin{macro}{\MTmath-}\begin{macro}{activeletters} % \begin{macro}{\MTmath-}\begin{macro}{standardletters} % |1.3| [2013/09/02] extends the use of mathematically active letters to % allow the user to specify muglue before and after the letter itself (see % \cs{MTsetmathskips}, below). % Mathematically active letters were previously used only to add the italic % correction; the math activation has now been separated and put in % \cs{MTmathactiveletters}. There is also \cs{MTmathactiveLetters} to allow % math activation only for the uppercase letters. To cancel the (now default, % even with option |italic|) math % activation of letters, there is \cs{MTmathstandardletters}. Version |1.3a| % removes some silly |\string|'s from the code, which prevented to pass % macros as first argument to the command. % \begin{macro}{\MTnonletters-}\begin{macro}{obeymathxx} % \begin{macro}{\MTnonletters-}\begin{macro}{donotobeymathxx} % \begin{macro}{\resetMathstrut@} % These macros are modified in version |1.3a| [2013/09/04] in order to % cleverly adjust, or not, the |amsmath| \cs{resetMathstrut@}. When used in % the preamble, they just modify \cs{mst@the}. And there is code at begin % document to check the status there of \cs{mst@the} and if its meaning is % \cs{the}, then \cs{MTnonlettersobeymathxx} is activated again to do the % patch. When used in the body they adjust \cs{resetMathstrut@}. Notice % that the saved meaning is the one at begin document (thus, possibly % patched by |lualatex-math|) but modifications done after that would not % be seen in |\mst@savedresetMathstrut@|. % \begin{macrocode} \newtoks\mst@do@nonletters \newtoks\mst@do@easynonletters \newtoks\mst@do@az \newtoks\mst@do@AZ \let\mst@the\@gobble \newcommand*\MTnonlettersdonotobeymathxx{% \ifx\mst@the\@gobble \else \@ifundefined{mst@savedresetMathstrut@}{}{% \PackageWarning{mathastext}{restoring (for this group or environment) amsmath \string\resetMathstrut@}% \let\resetMathstrut@\mst@savedresetMathstrut@}% \fi \let\mst@the\@gobble } \newcommand*\MTnonlettersobeymathxx{% \ifx\mst@the\the \else \@ifundefined{mst@savedresetMathstrut@}{}{% \ifmst@symboldelimiters \def\resetMathstrut@{% \setbox\z@\hbox{\the\textfont\symmtpsymbol\char40 \the\textfont\symmtoperatorfont\char40 \the\textfont\symoperators\char40}% \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@}% \else \def\resetMathstrut@{% \setbox\z@\hbox{\the\textfont\symmtoperatorfont\char40 \the\textfont\symoperators\char40}% \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@}% \fi \PackageWarning{mathastext}{\string\resetMathstrut@\space from amsmath replaced (for this group or environment)}}% \fi \let\mst@the\the } \newcommand*\MTeasynonlettersdonotobeymathxx{\let\mst@theeasy\@gobble} \newcommand*\MTeasynonlettersobeymathxx{\let\mst@theeasy\the} \MTeasynonlettersobeymathxx \newcommand*\MTmathactiveletters{\let\mst@thef\the \let\mst@theF\the} \newcommand*\MTmathactiveLetters{\let\mst@theF\the} \newcommand*\MTmathstandardletters{\let\mst@thef\@gobble \let\mst@theF\@gobble} \newcommand*\MTicinmath{% \MTmathactiveletters \def\mst@itcorr{\ifnum\fam=\m@ne\/\else\ifnum\fam=\symmtletterfont\/\fi\fi}% \let\mst@ITcorr\mst@itcorr} \newcommand*\MTICinmath{% \MTmathactiveLetters \def\mst@ITcorr{\ifnum\fam=\m@ne\/\fi}} \newcommand*\MTnoicinmath{\def\mst@itcorr{}\def\mst@ITcorr{}} \newcommand*\MTnoICinmath{\def\mst@ITcorr{}} \newcommand*\MTicalsoinmathxx{% \ifx\mst@itcorr\@empty\else\def\mst@itcorr{\/}\fi \ifx\mst@ITcorr\@empty\else\def\mst@ITcorr{\/}\fi} \AtBeginDocument{ \everymath\expandafter{\the\everymath \mst@the\mst@do@nonletters \let\mst@the\@gobble \mst@theeasy\mst@do@easynonletters \let\mst@theeasy\@gobble \mst@thef\mst@do@az \let\mst@thef\@gobble \mst@theF\mst@do@AZ \let\mst@theF\@gobble} \everydisplay\expandafter{\the\everydisplay \mst@the\mst@do@nonletters \let\mst@the\@gobble \mst@theeasy\mst@do@easynonletters \let\mst@theeasy\@gobble \mst@thef\mst@do@az \let\mst@thef\@gobble \mst@theF\mst@do@AZ \let\mst@theF\@gobble} } % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{\MTsetmathskips} % \begin{macro}{\MTunsetmathskips} % |1.3| [2013/09/02]: user level command to specify extra spaces in math mode % around the letters (only the 7bit a,b,..,z and A,B,..,Z). First parameter is % the letter, second is the math skip to be inserted before, and third the % skip to be inserted after; for example \cs{thickmuskip} or explicitely % |0.1mu| or |0.1mu plus 0.1mu minus 0.1mu|. % % For this, letters are made mathematically active. This is now the package % default (version |1.2| did this only in the absence of option |italic|, or % more precisely when the font used was not of shape |it| or |sl|). But if % \cs{MTsetmathskips} has not been used for that letter, the only effect of % the math activation is, as in |1.2|, to add the italic correction % automatically, except when the font shape is detected to be |it| or |sl|; in % these latter cases, although mathematically active, the letter acts in the % standard way. % % The command \cs{MTmathstandardletters} turns off math activation and its % effects for all letters. % % Ligatures within the argument of a math alphabet command are impeached by % skips; so \cs{MTunsetmathskips} is provided to cancel the skips for one % specific letter (|f| for example). % % |1.3a| [2013/09/04]: I strangely had |\string#1| inside \cs{MTsetmathskips}. % Phobic of catcode active letters... but with |\string| one needs some % |\expandafter| to use \cs{MTsetmathskips} in an |\@for| loop for example. It % is better to allow the first argument to be a macro or anything expanding to % a letter, and to not be paranoid about improbable catcode active letters % (the user just has to tame them at the time of the \cs{MTsetmathskip}) so I % take out these |\string|'s. % \begin{macrocode} \newcommand*\MTsetmathskips[3]{% \@namedef{mst@before#1}{\mskip#2\relax}% \@namedef{mst@after#1}{\mskip#3\relax}% } \newcommand*\MTunsetmathskips[1]{% \@namedef{mst@before#1}{\relax}% \@namedef{mst@after#1}{\relax}% } % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{\mst@mathactivate} % \begin{macro}{\mst@addtodo@nonletters} % \begin{macro}{\mst@addtodo@easynonletters} % \begin{macro}{\mst@addtodo@az} % \begin{macro}{\mst@addtodo@AZ} % \begin{macrocode} \def\mst@magic@v #1#2#3#4#5{#1#3#4} \def\mst@magic@vi #1#2#3#4#5#6{#1#2#4#5} \def\mst@fork{\ifmmode\mst@magic@v\fi\@thirdofthree} \def\mst@safefork{\ifmmode\if@safe@actives\else\mst@magic@vi\fi\fi\@thirdofthree} \def\mst@do@activecase#1#2#3{% #1 is a category 11 or 12 character token \@ifundefined{active@char#1}{}{% \ifcat #1a\mathcode`#1=#2\else \ifx\relax #2\relax\mathcode`#1=`#1 \else\mathcode`#1=#3\fi\fi \expandafter\expandafter\expandafter\let\expandafter\expandafter \csname mst@orig@user@active#1\endcsname \csname user@active#1\endcsname \expandafter\expandafter\expandafter\let\expandafter\expandafter \csname mst@orig@normal@char#1\endcsname \csname normal@char#1\endcsname \ifcat #1a% \expandafter\edef\csname user@active#1\endcsname {\noexpand\mst@fork {{#2\noexpand#3}}{}\expandafter \noexpand\csname mst@orig@user@active#1\endcsname }% \expandafter\edef\csname normal@char#1\endcsname {\noexpand\mst@safefork {{#2\noexpand#3}}{}\expandafter \noexpand\csname mst@orig@normal@char#1\endcsname }% \else \expandafter\edef\csname user@active#1\endcsname {\noexpand\mst@fork {#2}\noexpand#3\expandafter \noexpand\csname mst@orig@user@active#1\endcsname }% \expandafter\edef\csname normal@char#1\endcsname {\noexpand\mst@safefork {#2}\noexpand#3\expandafter \noexpand\csname mst@orig@normal@char#1\endcsname }% \fi}} \begingroup \catcode`\~=\active \def\x{\endgroup \def\mst@mathactivate##1##2##3{% ##1 guaranteed of cat 11 or 12 \begingroup \lccode`~=`##1 \lccode`##1=`##1 \lowercase{\endgroup \ifnum\catcode`##1=\active \mst@do@activecase ##1{##2}##3 % careful as ##2 is empty in the asterisk and % prime case! \else \mathcode`##1="8000 % version 1.3 adds the possibility of extra skips around letters, % (only if non catcode active at the time of use). \ifcat##1a\def~{{\csname mst@before##1\endcsname ##2##3% \csname mst@after##1\endcsname}}% \else\def~{##2##3}\fi \fi}}} \x \def\mst@addtodo@nonletters#1#2#3{% % #1 will be of cat 11 or 12. % #2 is empty for asterisk and right quote \mst@do@nonletters\expandafter {\the\mst@do@nonletters \mst@mathactivate#1{#2}#3}% } \def\mst@addtodo@easynonletters#1#2{% #1 is a one char control sequence \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters\mathcode`#1=#2}% } \def\mst@addtodo@az#1#2#3{% \mst@do@az\expandafter{\the\mst@do@az\mst@mathactivate#1#2#3} } \def\mst@addtodo@AZ#1#2#3{% \mst@do@AZ\expandafter{\the\mst@do@AZ\mst@mathactivate#1#2#3}% } % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{\newmcodes@} % |1.15d|: this amsmath macro causes an error in Unicode engines as soon % someone assigns a Unicode mathcode to the minus sign, and then makes a % \cs{DeclareMathOperator} declaration. Furthermore it hard-codes the % font family 0 as being the one to be used. Moreover just putting the % concerned signs -,:,.,\,' inside braces emulates enough the % behavior (although the tick will give a prime). % % |1.3|: now tests if `basic' option was used. % % |1.3d|: I should re-examine the situation with |\newmcodes@|. In the % meantime its relaxification will not be done if lualatex-math is % loaded. And the whole thing is put at begin document. % \begin{macrocode} \ifmst@basic\else \AtBeginDocument {% \@ifpackageloaded{amsmath} {\@ifpackageloaded{lualatex-math} {\@ifpackagelater{lualatex-math}{2013/08/03}{}{\let\newmcodes@\relax}} {\let\newmcodes@\relax}} {}} \fi % \end{macrocode} % \end{macro} % \begin{macro}{subdued} % |1.15|: The subdued code was initiated in May 2011. I returned to % |mathastext| on Sep 24, 2012, and decided to complete what I had started % then, but in the mean time I had forgotten almost all of the little I knew % about \LaTeX{} macro programming. % % The point was to extract the data about how are `letters' and % `operators' in the normal and bold versions, through obtaining the % math families of `a' and `1', respectively$^1$. Due to the % reassignements done for characters by |mathastext| I also had % decided in 2011 that the OT1 encoding, if detected, should be % replaced by T1 ($(1)$: but the \emph{euler} package for example % assigns the digits to the \emph{letters} symbol font...) % % |1.15d|: Oct 13, 2012. The \cs{mathcode} thing has to be used with care % under Unicode engines. Unfortunately the \cs{luatexUmathcode} macro is % helpless as it is not possible to know if it will return a legacy mathcode % or a Unicode mathcode. On the other hand the much saner % \cs{XeTeXmathcodenum} always return a Unicode mathcode. % % {UPDATE for \mst\ 1.3 (2013/09/02): since the release of lualatex as % included in % TL2013, \cs{luatexUmathcodenum} behaves as \cs{XeTeXmathcodenum} so \mst 1.3 % treats identically under both unicode engines the equal and minus signs (and % the vertical bar).} % % |1.15e|: Oct 22, 2012. I add the necessary things to also subdue the % \cs{mathbf}, \cs{mathit}, \cs{mathsf} and \cs{mathtt} macros (previous % version only took care of the symbol alphabets \cs{mathnormal} and % \cs{mathrm}.) [update: |1.15f| does that in a completely different and much % simpler way] Notice that the package defines a \cs{mathnormalbold} macro, % but it will not be subdued in the normal and bold math versions. % % |1.15f|: Oct 23, 2012. The previous version of the code queried the math % family of a, respectively 1, to guess and then extract the fonts to be % reassigned to mtletterfont and mtoperatorfont (which is done at the end of % this .sty file). The present code simply directly uses letters and operators % (so mathastext could not subdue itself... if it was somehow cloned), but % obtains indeed the corresponding font specifications in normal and bold in a % cleaner manner. But it is so much shorter (and avoids the \LuaLaTeX{} % problem with \cs{luatexUmathcode}). Anyhow, for example the euler package % puts the digits in the letters math family! so the previous method was also % error prone. In fact there is no way to do this subdued mechanism on the % basis of the legacy code of mathastext. The only way is to rewrite entirely % the package to query all mathcodes of things it changes in order to be able % to revert these changes (and one would have to do even more hacking for % |\mathversion{normal}| and not only |\MTversion{normal}| to work). % % |1.15f|: and also I take this opportunity to do the subdued math % alphabets things in a much much easier way, see below. % \begin{macrocode} \ifmst@subdued \def\mst@reserved#1\getanddefine@fonts\symletters#2#3\@nil{% \def\mst@normalmv@letter{#2}} \expandafter\mst@reserved\mv@normal\@nil \def\mst@reserved#1\getanddefine@fonts\symletters#2#3\@nil{% \def\mst@boldmv@letter{#2}} \expandafter\mst@reserved\mv@bold\@nil \def\mst@reserved#1\getanddefine@fonts\symoperators#2#3\@nil{% \def\mst@normalmv@operator{#2}} \expandafter\mst@reserved\mv@normal\@nil \def\mst@reserved#1\getanddefine@fonts\symoperators#2#3\@nil{% \def\mst@boldmv@operator{#2}} \expandafter\mst@reserved\mv@bold\@nil %% \edef\mst@tmp{\encodingdefault} \def\mst@reserved#1/#2/#3/#4/{\gdef\mst@debut{#1}\gdef\mst@reste{#2/#3/#4}} \begingroup\escapechar\m@ne \xdef\mst@funnyoti{\expandafter\string\csname OT1\endcsname} \expandafter\expandafter\expandafter \mst@reserved\expandafter\string\mst@normalmv@operator/ \endgroup \ifx\mst@debut\mst@funnyoti\ifx\mst@tmp\mst@oti\def\mst@tmp{T1}\fi\fi \edef\mst@normalmv@operator{\expandafter\noexpand\csname \mst@tmp/\mst@reste\endcsname} \begingroup\escapechar\m@ne \expandafter\expandafter\expandafter \mst@reserved\expandafter\string\mst@boldmv@operator/ \endgroup \ifx\mst@debut\mst@funnyoti\ifx\mst@tmp\mst@oti\def\mst@tmp{T1}\fi\fi \edef\mst@boldmv@operator{\expandafter\noexpand\csname \mst@tmp/\mst@reste\endcsname} \AtEndOfPackage{ \typeout{** ...entering subdued mode...} \expandafter\SetSymbolFont@ \expandafter\mv@normal\mst@normalmv@letter\symmtletterfont \expandafter\SetSymbolFont@ \expandafter\mv@bold\mst@boldmv@letter\symmtletterfont \expandafter\SetSymbolFont@ \expandafter\mv@normal\mst@normalmv@operator\symmtoperatorfont \expandafter\SetSymbolFont@ \expandafter\mv@bold\mst@boldmv@operator\symmtoperatorfont \typeout{** ...done.} } \fi % fin de ce \ifmst@subdued % \end{macrocode} % In the short-lived |1.15e| I was doing the following for alphabets:\\ % |\def\mst@reservedc#1#2#3#4{\def\mst@normalmv@mathbf{#4#3}}|\\ % |\def\mst@reserveda#1{%|\\ % |\def\mst@reservedb##1\install@mathalphabet#1##2##3\@nil{\mst@reservedc##2}%|\\ % |\expandafter\mst@reservedb\mv@normal\@nil}|\\ % |\expandafter\mst@reserveda\csname mathbf\space\endcsname|\\ % and later in the code:\\ % |\expandafter\expandafter\expandafter\SetMathAlphabet@|\\ % |\expandafter\expandafter\expandafter\mv@normal|\\ % |\expandafter\mst@normalmv@mathbf\csname Mathbf\space \endcsname\Mathbf|\\ % It does work! but |\let\mst@original@bf\mathbf| is so % much simpler. And also safer, because \cs{mathbf} could have been % redefined using \cs{DeclareSymbolFontAlphabet}... (I could have % provided the necessary check to the already bloated code...) % \end{macro} % \begin{macro}{mtoperatorfont} % Declaration of the current default font as our math % font. The characteristics of the used font can be % changed by a user call to the macros \cs{Mathastext} or % \cs{Mathastextwilluse}, which will be defined next. We % will also make one internal call to \cs{Mathastext} to % set up the normal and bold math versions, so we will % also employ \cs{SetSymbolFont} later. % \begin{macrocode} \DeclareSymbolFont{mtoperatorfont}{\mst@enc}{\mst@fam}{\mst@ser}{\mst@opsh} % \end{macrocode} % \end{macro} % \begin{macro}{\operator@font} % We modify this \LaTeX{} internal variable in order for the % predefined \cs{cos}, \cs{sin}, etc\dots to be typeset with the % |mathastext| font. This will also work for things declared % through the |amsmath| package command % \cs{DeclareMathOperator}. The alternative would have been to % redefine the `operators' Math Symbol Font. Obviously people % who expect that \cs{operator@font} will always refer to the % `operators' math font might be in for a surprise\dots{} well, % we'll see. % \begin{macro}{\MTmathoperators-}\begin{macro}{obeymathxx} % \begin{macro}{\MTmathoperators-}\begin{macro}{donot-}\begin{macro}{obeymathxx} % |1.2|: rather than just replacing \cs{symoperators} by % \cs{symmtoperatorfont} I add a modification which makes the % declared operator names sensitive to the math alphabets... ouh le % vilain! % \begin{macrocode} \newcommand*{\MTmathoperatorsobeymathxx} {\def\operator@font{\mathgroup\ifnum\fam=\m@ne\symmtoperatorfont\else\fam\fi}} \newcommand*{\MTmathoperatorsdonotobeymathxx} {\def\operator@font{\mathgroup\symmtoperatorfont}} \MTmathoperatorsobeymathxx % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{mtletterfont} % In version |1.1|, we add the possibility to mimick the standard % behavior, that is to have italic letters and upright % digits. Thanks to Tariq~\textsc{Perwez} and % Kevin~\textsc{Klement} who asked for such a feature. % \begin{macrocode} \DeclareSymbolFont{mtletterfont}{\mst@enc}{\mst@fam}{\mst@ser}{\mst@ltsh} % \end{macrocode} % \end{macro} % \begin{macro}{\Mathnormal} % \begin{macro}{\Mathrm} % \begin{macro}{\Mathbf} % \begin{macro}{\Mathit} % \begin{macro}{\Mathsf} % \begin{macro}{\Mathtt} % \begin{macro}{\mathnormalbold} % We redefine the default normal, rm, bf, it, sf, and tt alphabets, % but this will be done via |\renewcommand{\mathrm}{\Mathrm}| etc\dots % and (|1.15f|) the previous status of the math alphabets is recorded for the % sake of the |subdued| option. % % We follow the standard \LaTeX{} behavior for \cs{mathbf}, which is % to pick up the bold series of the roman font (digits and operator % names). % % We will access (if no option is passed for Greek) the \cs{omicron} % via \cs{mathnormal}. But unfortunately the |fourier| package with the % upright option does not have an upright omicron obtainable by simply % typing \cs{mathnormal}|{o}|. So if |fourier| is loaded we use % \cs{mathrm} and not \cs{mathnormal}. % \begin{macrocode} \let\mst@alph@omicron\mathnormal \@ifpackageloaded{fourier}{\ifsloped\else\let\mst@alph@omicron\mathrm\fi}{} \DeclareSymbolFontAlphabet{\Mathnormal}{mtletterfont} \DeclareSymbolFontAlphabet{\Mathrm}{mtoperatorfont} \ifmst@nonormalbold\else \DeclareMathAlphabet{\mathnormalbold}{\mst@enc}{\mst@fam}{\mst@bold}{\mst@ltsh} \fi \ifmst@defaultbf\else \DeclareMathAlphabet{\Mathbf}{\mst@enc}{\mst@fam}{\mst@bold}{\mst@opsh} \fi \ifmst@defaultit\else \DeclareMathAlphabet{\Mathit}{\mst@enc}{\mst@fam}{\mst@ser}{\itdefault} \fi \ifmst@defaultsf\else \DeclareMathAlphabet{\Mathsf}{\mst@enc}{\sfdefault}{\mst@ser}{\mst@opsh} \fi \ifmst@defaulttt\else \DeclareMathAlphabet{\Mathtt}{\mst@enc}{\ttdefault}{\mst@ser}{\mst@opsh} \fi \let\mst@original@normal\mathnormal \let\mst@original@rm\mathrm \let\mst@original@bf\mathbf \let\mst@original@it\mathit \let\mst@original@sf\mathsf \let\mst@original@tt\mathtt \def\mst@restorealphabets{% for subdued \let\mathnormal\mst@original@normal \let\mathrm\mst@original@rm \let\mathbf\mst@original@bf \let\mathit\mst@original@it \let\mathsf\mst@original@sf \let\mathtt\mst@original@tt} \def\mst@setalphabets{% \ifmst@defaultnormal\else\renewcommand{\mathnormal}{\Mathnormal}\fi \ifmst@defaultrm\else\renewcommand{\mathrm}{\Mathrm}\fi \ifmst@defaultbf\else\renewcommand{\mathbf}{\Mathbf}\fi \ifmst@defaultit\else\renewcommand{\mathit}{\Mathit}\fi \ifmst@defaultsf\else\renewcommand{\mathsf}{\Mathsf}\fi \ifmst@defaulttt\else\renewcommand{\mathtt}{\Mathtt}\fi} \ifmst@subdued\else\mst@setalphabets\fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{LGRgreek} % \begin{macro}{selfGreek} % \begin{macro}{mtlgrfontupper} % \begin{macro}{mtlgrfontlower} % \begin{macro}{mtselfGreekfont} % |1.14b|: We can not move the \cs{DeclareSymbolFont} to the % \cs{Mathastext} macro because it resets the font family in *all* % math versions, and some could have been defined by the user with % previous calls to \cs{Mathastext}. So we have to have them here. % The problem is that at this stage it is impossible to know if we % really need (in the case of LGRgreek) two separate shapes for % upper and lowercase, and (in the case of selfGreek) a shape % distinct from the one used in |mtoperatorfont|. So I opted in the % end for declaring possibly one too many font. To achieve more % economy the only way would be to keep cumulative track of all % previously declared math versions and to redeclare appropriately % the LGR or self greek fonts at each call to \cs{Mathastext} (with % no optional argument): a bit painful, and as I am possibly the % sole user in the world of this possibility of multiple math % versions with this package. Also the advantage to systematically % allocate a font for the selfGreek option is that we can force the % use of the OT1 encoding. % % First we establish the cumulative effect of the greek related options. % % |1.15c| introduces some possibilities to change the shapes of Greek letters % in each math versions, and even the Greek font (in LGR encoding). The % commands \cs{MTitgreek} etc... will be used in-between calls to % \cs{Mathastext} and re-adjust the shapes. And the command \cs{MTgreekfont} % changes the Greek font family. % \begin{macrocode} \def\mst@update@greeksh{ \def\mst@greek@lsh{\mst@ltsh} %% default behavior \def\mst@greek@ush{\mst@opsh} \ifmst@itgreek\def\mst@greek@lsh{\itdefault} \def\mst@greek@ush{\itdefault}\fi \ifmst@upgreek\def\mst@greek@lsh{\updefault} \def\mst@greek@ush{\updefault}\fi \ifmst@frenchmath \ifmst@itgreek\else \ifmst@upgreek\else \def\mst@greek@lsh{\mst@opsh} \def\mst@greek@ush{\mst@opsh} \fi\fi \fi \ifcase\mst@greek@select \or\def\mst@greek@ush{\itdefault} \or\def\mst@greek@ush{\updefault} \fi} \mst@update@greeksh \ifmst@LGRgreek \DeclareFontEncoding{LGR}{}{} \DeclareSymbolFont{mtlgrfontlower}{LGR}{\mst@fam}{\mst@ser}{\mst@greek@lsh} \DeclareSymbolFont{mtlgrfontupper}{LGR}{\mst@fam}{\mst@ser}{\mst@greek@ush} \else \ifmst@selfGreek \DeclareSymbolFont{mtselfGreekfont}{OT1}{\mst@fam}{\mst@ser}{\mst@greek@ush} \fi\fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{mteulervm} % \begin{macro}{\MathEuler} % \begin{macro}{\MathEulerBold} % In case we need the Euler font, we declare it here. It will use % |uzeur.fd| from the |eulervm| package of Walter~\textsc{Schmidt} % \begin{macrocode} \ifmst@needeuler\typeout{** will use Euler font; command \string\MTEulerScale} \DeclareSymbolFont{mteulervm}{U}{zeur}{m}{n} \DeclareSymbolFontAlphabet{\MathEuler}{mteulervm} \DeclareMathAlphabet{\MathEulerBold}{U}{zeur}{\mst@bold}{n} \fi \newcommand*\MTEulerScale[1]{\edef\zeu@Scale{#1}} \let\MathastextEulerScale\MTEulerScale % \end{macrocode} % \LaTeXe{} has a strange initial configuration where the % capital Greek letters are of type |mathalpha|, but the % lower Greek letters of type |mathord|, so that \cs{mathbf} % does not act on them, although lowercase Greek letters and % Latin letters are from the same font. This is because % \cs{mathbf} is set up to be like a bold version of % \cs{mathrm}, and \cs{mathrm} uses the `operators' font, by % default |cmr|, where there are NO lowercase greek % letters. This set-up is ok for the Capital Greek letters % which are together with the Latin letters in both |cmmi| % and |cmr|. % % The package eulervm sets the lowercase Greek letters to be % of type |mathalpha|, the default \cs{mathbf} and % \cs{mathrm} will act wierdly on them, but a \cs{mathbold} % is defined which will use the bold series of the Euler % roman font, it gives something coherent for Latin and % Greek \emph{lowercase} letters, and this is possible % because the same font contains upright forms for them all. % % Here in |mathastext|, Latin letters and Greek letters (lower and upper case) % must be (generally) assumed to come from two different fonts, as a result the % standard \cs{mathbf} (and \cs{mathrm}) will give weird results when used for % Greek letters. We could coerce \cs{mathbf} to do something reasonable (cf % |http://tug.org/pipermail/texhax/2011-January/016605.html|) but at this time % |30-01-2011 09:42:27 CET| I decided I would not try to implement it here. I % prefer to respect the default things. % % I followed the simpler idea of the |eulervm| package and % defineed \cs{MathEuler} and \cs{MathEulerBold} alphabet % commands (the |eulervm| package does this only for the % bold font). % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{mtpsymbol} % \begin{macro}{\MathPSymbol} % In case we need the Symbol font, we declare it here. The macro % \cs{psy@scale} will be used to scale the font (see at the % very end of this file). % \begin{macrocode} \ifmst@needsymbol\typeout{** will use Symbol font; command \string\MTSymbolScale} \def\psy@scale{1} \DeclareSymbolFont{mtpsymbol}{U}{psy}{m}{n} \DeclareSymbolFontAlphabet{\MathPSymbol}{mtpsymbol} \AtBeginDocument{ \DeclareFontFamily{U}{psy}{} \DeclareFontShape{U}{psy}{m}{n}{<->s*[\psy@scale] psyr}{} } \fi \newcommand*\MTSymbolScale[1]{\edef\psy@scale{#1}} \let\MathastextSymbolScale\MTSymbolScale % \end{macrocode} % I did not choose for name \cs{MathSymbol} as this may % be defined somewhere for another thing. There is no bold % for the postscript Symbol font distributed with the % \LaTeXe{} |psnffs| core package. % \end{macro} % \end{macro} % \begin{macro}{\pmvec} % Definition of a poor man version of the \cs{vec} accent % \begin{macrocode} \DeclareRobustCommand*\pmvec[1]{\mathord{\stackrel{\raisebox{-.5ex}% {\tiny\boldmath$\mathord{\rightarrow}$}}{{}#1}}} % \end{macrocode} % \end{macro} % \begin{macro}{\fouriervec} % The glyph is taken from the Fourier font of % Michel~\textsc{Bovani}. Note: (oct 2012) I should not allocate an % entire symbol font just for one glyph! But I have not given any % serious thought to what one can do to simulate a math accent % without doing such a wasteful thing. % \begin{macrocode} \ifmst@fouriervec \DeclareFontEncoding{FML}{}{} \DeclareFontSubstitution{FML}{futm}{m}{it} \DeclareSymbolFont{mathastextfourier}{FML}{futm}{m}{it} \SetSymbolFont{mathastextfourier}{bold}{FML}{futm}{b}{it} \DeclareMathAccent{\fouriervec}{\mathord}{mathastextfourier}{"7E} \fi % \end{macrocode} % \end{macro} % \begin{macro}{\MTencoding} % \begin{macro}{\MTfamily} % \begin{macro}{\MTseries} % \begin{macro}{\MTshape} % \begin{macro}{\MTboldvariant} % \begin{macro}{\MTlettershape} % Some public macros to modify our private internals, and % we will use them also ourself. % % In version |1.1| we add the possibility to have two % distinct font shapes for letters and digits. So in fact % we could as well have two really unrelated fonts but % this is really not the spirit of the package. % % Note that using these macros in the preamble allows \cs{Mathastext} % to set up math versions with a given font for math mode, and at the % same time not modifying the \cs{familydefault} or \cs{romandefault} % etc\dots % \begin{macrocode} \newcommand*\MTencoding[1]{\def\mst@enc{#1}} \newcommand*\MTfamily[1]{\def\mst@fam{#1}} \newcommand*\MTseries[1]{\def\mst@ser{#1}} \newcommand*\MTshape[1]{\def\mst@opsh{#1} \ifmst@italic\else\def\mst@ltsh{#1}\fi} \newcommand*\MTboldvariant[1]{\def\mst@bold{#1}} \newcommand*\MTlettershape[1]{\def\mst@ltsh{#1}} \let\Mathastextencoding\MTencoding \let\Mathastextfamily\MTfamily \let\Mathastextseries\MTseries \let\Mathastextshape\MTshape \let\Mathastextboldvariant\MTboldvariant \let\Mathastextlettershape\MTlettershape % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{\MTitgreek} % \begin{macro}{\MTupgreek} % \begin{macro}{\MTitGreek} % \begin{macro}{\MTupGreek} % \begin{macro}{\MTgreekfont} % |1.15c|: These new macros can be used in-between calls to \cs{Mathastext}. % They reset the shapes for Greek letters (applies to LGRgreek(s) and % selfGreek(s) options). The \cs{MTgreekfont} presupposes either LGRgreek or % selfGreek. |\MTgreekfont{\familydefault}| acts like turning on LGRgreeks or % selfGreeks. % \begin{macrocode} \newcommand*\MTitgreek{% \mst@itgreektrue\mst@upgreekfalse\def\mst@greek@select{0}} \newcommand*\MTupgreek{% \mst@upgreektrue\mst@itgreekfalse\def\mst@greek@select{0}} \newcommand*\MTitGreek{\def\mst@greek@select{1}} \newcommand*\MTupGreek{\def\mst@greek@select{2}} \let\Mathastextitgreek\MTitgreek \let\Mathastextupgreek\MTupgreek \let\MathastextitGreek\MTitGreek \let\MathastextupGreek\MTupGreek \@onlypreamble\MTitgreek \@onlypreamble\MTupgreek \@onlypreamble\MTitGreek \@onlypreamble\MTitGreek \@onlypreamble\Mathastextitgreek \@onlypreamble\Mathastextupgreek \@onlypreamble\MathastextitGreek \@onlypreamble\MathastextitGreek \newcommand*\MTgreekfont[1]{\def\mst@greekfont{#1}} \let\Mathastextgreekfont\MTgreekfont \@onlypreamble\MTgreekfont \@onlypreamble\Mathastextgreekfont % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{\MTWillUse} % This is a preamble-only command, which can be used more than once, only the % latest one counts. Sets up the math fonts in the normal and bold % versions, as does \cs{Mathastext}. % \begin{macrocode} \newcommand*\MTWillUse[5][]{ \MTencoding{#2} \MTfamily{#3} \MTseries{#4} \MTshape{#5} \ifmst@italic\MTlettershape{\itdefault}\fi % was missing in v 1.14 and prior \edef\mst@tmp{#1} \ifx\mst@tmp\empty\else\MTlettershape{#1}\fi \Mathastext} \let\MathastextWillUse\MTWillUse \let\Mathastextwilluse\MTWillUse \@onlypreamble\MTWillUse \@onlypreamble\MathastextWillUse \@onlypreamble\Mathastextwilluse % \end{macrocode} % \end{macro} % \begin{macro}{\Mathastext} % The command \cs{Mathastext} can be used anywhere in the % preamble and any number of time, the last one is the % one that counts. % % In version |1.1| we have two fonts: they only differ in % shape. The |mtletterfont| is for letters, and the % |mtoperatorfont| for digits and log-like operator % names. The default is that both are upright. % % Starting with version |1.12|, an optional argument makes % \cs{Mathastext} act as the declaration of a math % version, to be later used in the document. % % Versions |1.15x| brought some adaptations related to the subdued % option. % % |1.3c| adds a second optional parameter to inherit previous settings % from another version; mostly done to inherit the bold version fonts for % symbols and large symbols. This is done in |\MTDeclareVersion|. % \begin{macrocode} \def\Mathastext {\@ifnextchar [\Mathastext@declare\Mathastext@ } \def\Mathastext@declare [#1]{% \edef\mst@tmp{#1}% \ifx\mst@tmp\empty \expandafter\@firstoftwo \else\expandafter\@secondoftwo \fi \Mathastext@ {\MTDeclareVersion[\mst@ltsh]{#1}{\mst@enc}{\mst@fam}{\mst@ser}{\mst@opsh}}% } \def\Mathastext@ {% \mst@update@greeksh \edef\mst@encoding@normal{\mst@enc}% \edef\mst@family@normal{\mst@fam}% \edef\mst@series@normal{\mst@ser}% \edef\mst@shape@normal{\mst@opsh}% \edef\mst@ltshape@normal{\mst@ltsh}% \edef\mst@itdefault@normal{\itdefault}% \edef\mst@rmdefault@normal{\rmdefault}% \edef\mst@sfdefault@normal{\sfdefault}% \edef\mst@ttdefault@normal{\ttdefault}% \edef\mst@boldvariant@normal{\mst@bold}% \edef\mst@exists@skip@normal{\mst@exists@skip}% \edef\mst@forall@skip@normal{\mst@forall@skip}% \edef\mst@prime@skip@normal{\mst@prime@skip}% \edef\mst@encoding@bold{\mst@enc}% \edef\mst@family@bold{\mst@fam}% \edef\mst@series@bold{\mst@bold}% \edef\mst@shape@bold{\mst@opsh}% \edef\mst@ltshape@bold{\mst@ltsh}% \edef\mst@boldvariant@bold{\mst@bold}% \edef\mst@itdefault@bold{\itdefault}% \edef\mst@rmdefault@bold{\rmdefault}% \edef\mst@sfdefault@bold{\sfdefault}% \edef\mst@ttdefault@bold{\ttdefault}% \edef\mst@exists@skip@bold{\mst@exists@skip}% \edef\mst@forall@skip@bold{\mst@forall@skip}% \edef\mst@prime@skip@bold{\mst@prime@skip}% \MTicinmath % does \MTmathactiveletters, \MTnoicinmath only cancels ics \@for\mst@tmp:=it,sl\do{\ifx\mst@tmp\mst@ltshape@normal\MTnoicinmath\fi}% \ifmst@frenchmath \MTICinmath \@for\mst@tmp:=it,sl\do{\ifx\mst@tmp\mst@shape@normal\MTnoICinmath\fi}% \fi \ifmst@subdued \MTeasynonlettersdonotobeymathxx \MTnonlettersdonotobeymathxx \MTmathoperatorsdonotobeymathxx \MTmathstandardletters % prior to 1.3, was \MTnoicinmath \ifmst@asterisk\let\mst@doasterisk\relax\fi \def\mst@exists@skip@normal{0mu}% \def\mst@forall@skip@normal{0mu}% \def\mst@prime@skip@normal{0mu}% \def\mst@exists@skip@bold{0mu}% \def\mst@forall@skip@bold{0mu}% \def\mst@prime@skip@bold{0mu}% \else % not subdued \ifmst@italic \ifmst@frenchmath \mst@exists@muskip\mst@exists@skip\relax \mst@forall@muskip\mst@forall@skip\relax \mst@prime@muskip\mst@prime@skip\relax \else \def\mst@exists@skip@normal{0mu}% \def\mst@forall@skip@normal{0mu}% \def\mst@prime@skip@normal{0mu}% \def\mst@exists@skip@bold{0mu}% \def\mst@forall@skip@bold{0mu}% \def\mst@prime@skip@bold{0mu}% \fi \else \mst@exists@muskip\mst@exists@skip\relax \mst@forall@muskip\mst@forall@skip\relax \mst@prime@muskip\mst@prime@skip\relax \fi \fi %% v1.15f \ifmst@nonormalbold\else \SetMathAlphabet{\mathnormalbold}{normal}{\mst@encoding@normal}% {\mst@family@normal}% {\mst@boldvariant@normal}% {\mst@ltshape@normal}% \SetMathAlphabet{\mathnormalbold}{bold}{\mst@encoding@bold}% {\mst@family@bold}% {\mst@boldvariant@bold}% {\mst@ltshape@bold}% \fi %% v1.15f adds \ifmst@default.. checks \ifmst@subdued\else \SetSymbolFont{mtletterfont}{normal}{\mst@encoding@normal}% {\mst@family@normal}% {\mst@series@normal}% {\mst@ltshape@normal}% \SetSymbolFont{mtletterfont}{bold} {\mst@encoding@bold}% {\mst@family@bold}% {\mst@series@bold}% {\mst@ltshape@bold}% \SetSymbolFont{mtoperatorfont}{normal}{\mst@encoding@normal}% {\mst@family@normal}% {\mst@series@normal}% {\mst@shape@normal}% \SetSymbolFont{mtoperatorfont}{bold} {\mst@encoding@bold}% {\mst@family@bold}% {\mst@series@bold}% {\mst@shape@bold}% \ifmst@defaultbf\else \SetMathAlphabet{\Mathbf}{normal}{\mst@encoding@normal}% {\mst@family@normal}% {\mst@series@bold}% {\mst@shape@normal}% \SetMathAlphabet{\Mathbf}{bold}{\mst@encoding@bold}% {\mst@family@bold}% {\mst@series@bold}% {\mst@shape@bold}% \fi \ifmst@defaultit\else \SetMathAlphabet{\Mathit}{normal}{\mst@encoding@normal}% {\mst@family@normal}% {\mst@series@normal}% {\mst@itdefault@normal}% \SetMathAlphabet{\Mathit}{bold}{\mst@encoding@bold}% {\mst@family@bold}% {\mst@series@bold}% {\mst@itdefault@bold}% \fi \ifmst@defaultsf\else \SetMathAlphabet{\Mathsf}{normal}{\mst@encoding@normal}% {\mst@sfdefault@normal}% {\mst@series@normal}% {\mst@shape@normal}% \SetMathAlphabet{\Mathsf}{bold}{\mst@encoding@bold}% {\mst@sfdefault@bold}% {\mst@series@bold}% {\mst@shape@bold}% \fi \ifmst@defaulttt\else \SetMathAlphabet{\Mathtt}{normal}{\mst@encoding@normal}% {\mst@ttdefault@normal}% {\mst@series@normal}% {\mst@shape@normal}% \SetMathAlphabet{\Mathtt}{bold}{\mst@encoding@bold}% {\mst@ttdefault@bold}% {\mst@series@bold}% {\mst@shape@bold}% \fi \fi % de \ifmst@subdued % \end{macrocode} % \begin{macro}{\MathEulerBold} % |1.14c|: We reset |mteulervm| and \cs{MathEulerBold} here as the % variant for bold may have been changed by the user via % \cs{Mathastextboldvariant}|{m}|; and we should keep this local to % math versions. % \begin{macrocode} \ifmst@needeuler \SetSymbolFont{mteulervm}{bold}{U}{zeur}{\mst@boldvariant@normal}{n}% \SetMathAlphabet{\MathEulerBold}{normal}% {U}{zeur}{\mst@boldvariant@normal}{n}% \SetMathAlphabet{\MathEulerBold}{bold}% {U}{zeur}{\mst@boldvariant@normal}{n}% \fi % \end{macrocode} % \end{macro} % \begin{macrocode} \ifmst@needsymbol\SetSymbolFont{mtpsymbol}{bold}% {U}{psy}{\mst@boldvariant@normal}{n}% \fi % \end{macrocode} % \begin{macro}{LGRgreek*} % \begin{macro}{selfGreek*} % LGRgreek, LGRgreeks, selfGreek, and selfGreeks options. % \begin{macrocode} \ifmst@subdued\else \ifmst@LGRgreek \SetSymbolFont{mtlgrfontlower}{normal}{LGR}% {\mst@greekfont}{\mst@series@normal}{\mst@greek@lsh}% \SetSymbolFont{mtlgrfontlower}{bold}{LGR}% {\mst@greekfont}{\mst@boldvariant@normal}{\mst@greek@lsh}% \SetSymbolFont{mtlgrfontupper}{normal}{LGR}% {\mst@greekfont}{\mst@series@normal}{\mst@greek@ush}% \SetSymbolFont{mtlgrfontupper}{bold}{LGR}% {\mst@greekfont}{\mst@boldvariant@bold}{\mst@greek@ush}% \else \ifmst@selfGreek \SetSymbolFont{mtselfGreekfont}{normal}{OT1}% {\mst@greekfont}{\mst@series@normal}{\mst@greek@ush}% \SetSymbolFont{mtselfGreekfont}{bold}{OT1}% {\mst@greekfont}{\mst@boldvariant@bold}{\mst@greek@ush}% \fi \fi \fi % \end{macrocode} % \end{macro} % \end{macro} % \begin{macrocode} \ifmst@subdued \typeout{** subdued mode will be activated for the normal and bold math versions}% \else \typeout{** Latin letters in the normal (resp. bold) math versions are now^^J% ** set up to use the fonts \mst@encoding@normal/\mst@family@normal/\mst@series@normal% (\mst@boldvariant@normal)/\mst@ltshape@normal}% \ifmst@LGRgreek\typeout{** Greek letters (\mst@greek@lsh/\mst@greek@ush) will use LGR/\mst@greekfont}% \fi \ifmst@nodigits\else \typeout{** Other characters (digits, ...) and \protect\log-like names will be^^J% ** typeset with the \mst@shape@normal\space shape.}% \fi \fi } \let\mathastext\Mathastext \@onlypreamble\Mathastext \@onlypreamble\mathastext % \end{macrocode} % \end{macro} % \begin{macro}{\MTDeclareVersion} % The \cs{MTDeclareVersion} command is to be used in the preamble % to declare a math version. A more complicated variant would also % specify a choice of series for the Euler and Symbol font: anyhow % Symbol only has the medium series, and Euler has medium and bold, % so what is lacking is the possibility to create a version with a % bold Euler. There is already one such version: the default |bold| % one. And there is always the possibility to add to the preamble % \cs{SetSymbolFont}|{mteulervm}||{versionname}||{U}{zeur}{bx}{n}| if % one wants to have a math version with bold Euler characters. % % For version |1.1| we add an optional parameter specifying the shape % to be used for letters. % % Note: (|2012/10/24|) I really should check whether the user attempts to % redefine the `normal' and `bold' versions and issue a warning in % that case! % % |1.3c| (|2013/12/14|) adds an extra optional parameter after all % previous ones, to inherit the settings from another version. Typically % to be used with [bold]. I take this opportunity to sanitize a bit some % line endings to avoid generating (in the preamble, document macros were % already careful of course) too many space % tokens, at least inside macros. And I modifiy (correct? perhaps it was on % purpose) the strange way I used |\@onlypreamble| in earlier version. % \begin{macrocode} \newcommand*\MTDeclareVersion[6][]{% \def\mst@declareversionargs{{#1}{#2}{#3}{#4}{#5}{#6}}% \edef\mst@version{#2}% \DeclareMathVersion{\mst@version}% \MTDeclareVersion@ } \newcommand*\MTDeclareVersion@[1][]{% \edef\mst@tmp{#1}% \ifx\mst@tmp\empty\else \global\expandafter\let\csname mv@\mst@version\expandafter\endcsname \csname mv@#1\endcsname \typeout{** Math version `\mst@version\string' inherits from `#1\string'.}% \fi \expandafter\MTDeclareVersion@@\mst@declareversionargs } \newcommand*\MTDeclareVersion@@[6]{% \edef\mst@tmp{#1}% \expandafter\edef\csname mst@encoding@\mst@version\endcsname{#3}% \expandafter\edef\csname mst@family@\mst@version\endcsname{#4}% \expandafter\edef\csname mst@series@\mst@version\endcsname{#5}% \expandafter\edef\csname mst@shape@\mst@version\endcsname{#6}% \expandafter\edef\csname mst@boldvariant@\mst@version\endcsname{\mst@bold}% \expandafter\edef\csname mst@itdefault@\mst@version\endcsname{\itdefault}% \expandafter\edef\csname mst@rmdefault@\mst@version\endcsname{\rmdefault}% \expandafter\edef\csname mst@sfdefault@\mst@version\endcsname{\sfdefault}% \expandafter\edef\csname mst@ttdefault@\mst@version\endcsname{\ttdefault}% \expandafter\edef\csname mst@exists@skip@\mst@version\endcsname {\mst@exists@skip}% \expandafter\edef\csname mst@forall@skip@\mst@version\endcsname {\mst@forall@skip}% \expandafter\edef\csname mst@prime@skip@\mst@version\endcsname {\mst@prime@skip}% \ifx\mst@tmp\empty \ifmst@italic \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{\mst@ltsh}% \typeout{** Latin letters in math version `#2\string' will use the font #3/#4/#5/\mst@ltsh^^J% ** Other characters (digits, ...) and \protect\log-like names will be in #6 shape.}% \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{\mst@ltsh}% \else \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#6}% \typeout{** Latin letters in math version `#2\string' will use the fonts #3/#4/#5(\mst@bold)/#6}% \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{#6}% \fi \else \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#1}% \typeout{** Latin letters in math version `#2\string' will use the font #3/#4/#5/#1^^J% ** Other characters (digits, ...) and \protect\log-like names will be in #6 shape.}% \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{#1}% \fi \ifmst@nonormalbold\else \SetMathAlphabet{\mathnormalbold}{#2}{#3}{#4}{\mst@bold}% {\csname mst@ltshape@\mst@version\endcsname}% \fi \SetSymbolFont{mtoperatorfont}{#2}{#3}{#4}{#5}{#6}% \ifmst@defaultbf\else\SetMathAlphabet{\Mathbf}{#2}{#3}{#4}{\mst@bold}{#6}\fi \ifmst@defaultit\else\SetMathAlphabet{\Mathit}{#2}{#3}{#4}{#5}{\itdefault}\fi \ifmst@defaultsf\else\SetMathAlphabet{\Mathsf}{#2}{#3}{\sfdefault}{#5}{#6}\fi \ifmst@defaulttt\else\SetMathAlphabet{\Mathtt}{#2}{#3}{\ttdefault}{#5}{#6}\fi \ifmst@needeuler \SetMathAlphabet{\MathEulerBold}{#2}{U}{zeur}{\mst@bold}{n}% \fi % \end{macrocode} % \begin{macro}{LGRgreeks} % \begin{macro}{selfGreeks} % In the case of option LGRgreeks (selfGreeks), it is expected that % the fonts used in each math versions exist in LGR (OT1) encoding. We % first recalculate the shapes to be used for lowercase and uppercase % Greek letters depending on the frenchmath and [it/up][g/G]reek % options as well as on the (local to this version) shapes for letters % and digits. % \begin{macrocode} \def\mst@greek@lsh@loc{\csname mst@ltshape@\mst@version\endcsname}% \def\mst@greek@ush@loc{\csname mst@shape@\mst@version\endcsname}% \ifmst@itgreek\def\mst@greek@lsh@loc{\itdefault}% \def\mst@greek@ush@loc{\itdefault}\fi \ifmst@upgreek\def\mst@greek@lsh@loc{\updefault}% \def\mst@greek@ush@loc{\updefault}\fi \ifmst@frenchmath \ifmst@itgreek\else \ifmst@upgreek\else \def\mst@greek@lsh@loc{\csname mst@shape@\mst@version\endcsname}% \def\mst@greek@ush@loc{\csname mst@shape@\mst@version\endcsname}% \fi\fi \fi \ifcase\mst@greek@select \or\def\mst@greek@ush@loc{\itdefault}% \or\def\mst@greek@ush@loc{\updefault}% \fi \ifmst@LGRgreeks \SetSymbolFont{mtlgrfontlower}{#2}{LGR}{#4}{#5}{\mst@greek@lsh@loc}% \SetSymbolFont{mtlgrfontupper}{#2}{LGR}{#4}{#5}{\mst@greek@ush@loc}% \typeout{** Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc) will use LGR font #4\ifmst@subdued ^^J** (in non subdued versions)\fi}% \else \ifmst@selfGreeks \SetSymbolFont{mtselfGreekfont}{#2}{OT1}{#4}{#5}{\mst@greek@ush@loc}% \typeout{** Capital Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc) will use OT1 font #4\ifmst@subdued ^^J** (in non subdued versions)\fi}% \else \ifmst@LGRgreek \SetSymbolFont{mtlgrfontlower}{#2}{LGR}{\mst@greekfont}{#5}{\mst@greek@lsh@loc}% \SetSymbolFont{mtlgrfontupper}{#2}{LGR}{\mst@greekfont}{#5}{\mst@greek@ush@loc}% \typeout{** Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc) will use LGR font \mst@greekfont\ifmst@subdued ^^J** (in non subdued versions)\fi}% \else \ifmst@selfGreek \SetSymbolFont{mtselfGreekfont}{#2}{OT1}{\mst@greekfont}{#5}{\mst@greek@ush@loc}% \typeout{** Capital Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc) will use OT1 font \mst@greekfont\ifmst@subdued ^^J** (in non subdued versions)\fi}% \fi \fi \fi \fi } % \end{macrocode} % \end{macro} % \end{macro} % \begin{macrocode} \let\MathastextDeclareVersion\MTDeclareVersion \@onlypreamble\MTDeclareVersion \@onlypreamble\MathastextDeclareVersion % \end{macrocode} % \end{macro} % \begin{macro}{\MTversion} % \begin{macro}{\MTversion@} % \begin{macro}{\MTversion@s} % \begin{macro}{\MTversion@@} % This is a wrapper around \LaTeX{}'s \cs{mathversion}: here we have an % optional argument allowing a quick and easy change of the text fonts % additionally to the math fonts. Present already in the initial % version of the package (January 2011.) % % |1.15|: some modifications for the subdued option vs LGRgreek and % for the math muskips after \cs{exists} and \cs{forall}. % % |1.2|: with the subdued option sets the math alphabets in the % normal and bold math versions do not apply to operator % names and non-alphabetical symbols. The switch for braces % is left as it is. % % |1.2b|: with the subdued option, the italic corrections are not added. % Else, we check the shape of letters in this version. Also, there was a bug % since |1.15|: the values of the math skips were taken not from the % settings for the math version (\#2) but from those of the optional argument % (\#1), if present... % % |1.3|: activation of italic corrections is now separated from actual math % activation of letters. % % |1.3c|: a starred variant is added which does not modify the text fonts, % only the math set-tup. % % |1.3d|: replaced in |\MTversion@| things like |\edef\mst@encoding{...}| and % |\renewcommand{\encodingdefault}{\mst@@encoding}| by % |\edef\encodingdefault{...}| etc\dots All those |\mst@@...| things were % useless. I also redefine |\seriesdefault| rather than |\mddefault|. % % |1.3d|: mechanism of restoration of Greek in subdued normal and bold % versions has been to all cases, and not only for the |LGRgreek| option. % \begin{macrocode} \newcommand*\MTversion {\@ifstar\MTversion@s\MTversion@ } \newcommand*\MTversion@s [1]{\mathversion{#1}\MTversion@@ {#1}} \newcommand*\MTversion@ [2][]{% \mathversion{#2}% \edef\mst@tmpa{#1}% \ifx\mst@tmpa\empty \edef\mst@tmp{#2}% \else \let\mst@tmp\mst@tmpa \fi \edef\encodingdefault {\csname mst@encoding@\mst@tmp\endcsname}% \edef\familydefault {\csname mst@family@\mst@tmp\endcsname}% \edef\seriesdefault {\csname mst@series@\mst@tmp\endcsname}% \edef\shapedefault {\csname mst@shape@\mst@tmp\endcsname}% \edef\bfdefault {\csname mst@boldvariant@\mst@tmp\endcsname}% \edef\itdefault {\csname mst@itdefault@\mst@tmp\endcsname}% \edef\rmdefault {\csname mst@rmdefault@\mst@tmp\endcsname}% \edef\sfdefault {\csname mst@sfdefault@\mst@tmp\endcsname}% \edef\ttdefault {\csname mst@ttdefault@\mst@tmp\endcsname}% \usefont{\encodingdefault}{\familydefault}{\seriesdefault}{\shapedefault}% \MTversion@@ {#2}% } \newcommand*\MTversion@@ [1]{% \edef\mst@tmp{#1}% %% v1.15e: muskips \expandafter \mst@exists@muskip\csname mst@exists@skip@\mst@tmp\endcsname\relax \expandafter \mst@forall@muskip\csname mst@forall@skip@\mst@tmp\endcsname\relax %% v1.2: muskip for \cs{prime} \expandafter \mst@prime@muskip\csname mst@prime@skip@\mst@tmp\endcsname\relax %% v1.2b: italic corrections except for italic/slanted (sic) letters, and of %% course except in the subdued normal and bold math versions %% v1.3: by default, letters are made mathematically active, even if italic %% corrections are not used, to allow the action of \MTsetmathskips. \edef\mst@tmpa{\csname mst@ltshape@\mst@tmp\endcsname}% \edef\mst@tmpb{\csname mst@shape@\mst@tmp\endcsname}% \MTicinmath \@for\mst@tmpc:=it,sl\do{\ifx\mst@tmpc\mst@tmpa\MTnoicinmath\fi}% \ifmst@frenchmath \MTICinmath \@for\mst@tmpc:=it,sl\do{\ifx\mst@tmpc\mst@tmpb\MTnoICinmath\fi}% \fi %% v1.15c: extending subdued to LGRgreek %% v1.15f: subdueing math alphabets in a simpler way than in 1.15e %% v1.2b: subdueing the activation of characters in math mode %% v1.2d: special treatment of the asterisk %% v1.3d: extended LGRgreek mechanism of activation/restoration of Greek to all %% cases \MTmathoperatorsobeymathxx \MTeasynonlettersobeymathxx \ifmst@asterisk\let\mst@doasterisk\mst@@doasterisk\fi \ifmst@subdued \def\mst@tmpa{normal}% \ifx\mst@tmp\mst@tmpa \mst@restorealphabets \MTstandardgreek \MTmathoperatorsdonotobeymathxx \MTnonlettersdonotobeymathxx \MTeasynonlettersdonotobeymathxx \MTmathstandardletters \ifmst@asterisk\let\mst@doasterisk\relax\fi \else \def\mst@tmpa{bold}% \ifx\mst@tmp\mst@tmpa \mst@restorealphabets \MTstandardgreek \MTmathoperatorsdonotobeymathxx \MTnonlettersdonotobeymathxx \MTeasynonlettersdonotobeymathxx \MTmathstandardletters \ifmst@asterisk\let\mst@doasterisk\relax\fi \else \mst@setalphabets \MTcustomgreek \fi \fi \else \MTcustomgreek % new with 1.3d \fi } \let\MathastextVersion\MTversion \let\Mathastextversion\MTversion \let\MTVersion\MTversion \let\mathastextversion\MTversion % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{\Mathastext} % Initialization call: % \begin{macrocode} \Mathastext % \end{macrocode} % \end{macro} % Additional appropriate messages to the terminal and the log. % \begin{macrocode} \ifmst@eulergreek \typeout{** Greek letters will use the Euler font. Use \protect\MathastextEulerScale{} to scale the font.}% \ifmst@subdued{\typeout{** (subdued mode: normal and bold math version with default Greek letters.)}}\fi \else \ifmst@symbolgreek \typeout{** Greek letters will use the PostScript Symbol font. Use^^J% ** \protect\MathastextSymbolScale{} to scale the font.}% \ifmst@subdued{\typeout{** (subdued mode: normal and bold math version with default Greek letters.)}}\fi \fi\fi % \end{macrocode} % At (long...) last we now change the font for the letters of the % latin alphabet. In version |1.1|, Latin letters have their own font % (shape). % % |1.2b| initiated the use of mathematically active letters to insert the italic % corrections. With version |1.3| the use of math active letters is also for % extra muglue added before and after the letters. Use of |\@for| to shorten the % code initiated with release |1.3|. % \begin{macrocode} \def\mst@DeclareMathLetter #1{% \DeclareMathSymbol {#1}{\mathalpha}{mtletterfont}{`#1}% \expandafter \DeclareMathSymbol \csname mst@#1\endcsname{\mathalpha}{mtletterfont}{`#1}% \expandafter\mst@addtodo@az \expandafter #1\csname mst@#1\endcsname\mst@itcorr }% \@for\mst@tmp:=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\do {\expandafter\mst@DeclareMathLetter\mst@tmp}% \ifmst@frenchmath \def\mst@font@tbu{mtoperatorfont}% \else \def\mst@font@tbu{mtletterfont}% \fi \def\mst@DeclareMathLetter #1{% \DeclareMathSymbol {#1}{\mathalpha}{\mst@font@tbu}{`#1}% \expandafter \DeclareMathSymbol \csname mst@#1\endcsname{\mathalpha}{\mst@font@tbu}{`#1}% \expandafter\mst@addtodo@AZ \expandafter #1\csname mst@#1\endcsname\mst@ITcorr}% \@for\mst@tmp:=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\do {\expandafter\mst@DeclareMathLetter\mst@tmp}% \let\mst@DeclareMathLetter\relax %% \ifmst@nodigits\else \def\mst@font@tbu{mtoperatorfont}% % \end{macrocode} % In version |1.1|, we have now separated digits from letters, so paradoxically % it is less problematic to give them the |mathalpha| type. % \begin{macrocode} \ifmst@symboldigits \def\mst@font@tbu{mtpsymbol} \fi \ifmst@eulerdigits \def\mst@font@tbu{mteulervm} \fi \DeclareMathSymbol{0}{\mathalpha}{\mst@font@tbu}{`0}% \DeclareMathSymbol{1}{\mathalpha}{\mst@font@tbu}{`1}% \DeclareMathSymbol{2}{\mathalpha}{\mst@font@tbu}{`2}% \DeclareMathSymbol{3}{\mathalpha}{\mst@font@tbu}{`3}% \DeclareMathSymbol{4}{\mathalpha}{\mst@font@tbu}{`4}% \DeclareMathSymbol{5}{\mathalpha}{\mst@font@tbu}{`5}% \DeclareMathSymbol{6}{\mathalpha}{\mst@font@tbu}{`6}% \DeclareMathSymbol{7}{\mathalpha}{\mst@font@tbu}{`7}% \DeclareMathSymbol{8}{\mathalpha}{\mst@font@tbu}{`8}% \DeclareMathSymbol{9}{\mathalpha}{\mst@font@tbu}{`9}% \fi % \end{macrocode} % When |symboldelimiters| is passed as an option, we use the % Symbol font for the printable characters other than % letters and digits. % \begin{macrocode} \ifmst@symboldelimiters \def\mst@font@tbu{mtpsymbol}% \mst@endashfalse \mst@emdashfalse \else \def\mst@font@tbu{mtoperatorfont}% \fi % \end{macrocode} % |1.2| adds the tricks to let non letters/digits obey math alphabets. We have % to double the definitions for easy switch on-off of the mechanism, via a token % list which is put into \cs{everymath} and \cs{everydisplay}. % \begin{macrocode} \ifmst@noexclam\else\typeout{** \string! and \string?}% \DeclareMathSymbol{!}{\mathclose}{\mst@font@tbu}{"21}% \DeclareMathSymbol{\mst@varfam@exclam}{\mathalpha}{\mst@font@tbu}{"21}% \expandafter\mst@addtodo@nonletters\string!\mathclose\mst@varfam@exclam \DeclareMathSymbol{?}{\mathclose}{\mst@font@tbu}{"3F}% \DeclareMathSymbol{\mst@varfam@question}{\mathalpha}{\mst@font@tbu}{"3F}% \expandafter\mst@addtodo@nonletters\string?\mathclose\mst@varfam@question \fi % \end{macrocode} % \begin{macro}{\MTlowerast} % \begin{macro}{\mst@doasterisk} % \begin{macro}{\mst@@doasterisk} % |1.12d| The \cs{ast} or |*| is defined in |fontmath.ltx| as a binary % operator from the |symbols| font. Usually the asterisk from the text % font is in a raised position. Previous versions of \mst did nothing % with \cs{ast} but strangely defined |*| to be the one from the text % font, with type \cs{mathalpha}. The package now leaves by default % both |*| and |\ast| untouched, and if passed option |asterisk| % replaces both of them with a lowered text asterisk (or the one from % the Symbol font), and of type \cs{mathbin}. A trick is used to % optionally get both |*| and \cs{ast} obey the math alphabets. % % The user macro \cs{MTlowerast} sets the amount % of lowering to be applied to the text asterisk. % % |1.12e| Somehow there was a big omission in |1.12d|, the % command \cs{MTlowerast} as described in the manual was missing! % % nota bene: it is assumed that |*| is of type |other| when \mst % is loaded... it should neither be active, nor of type |letter|! % \begin{macrocode} \def\mst@@doasterisk{\let\ast\mst@ast\mst@mathactivate*{}\mst@ast}% \ifmst@asterisk\typeout{** asterisk: \string\ast\space and *} \ifmst@symbolmisc \def\mst@bin@ast{% \mathbin{\mathchoice{\raisebox{-.1\height}% {\the\textfont\symmtpsymbol\char42}}% {\raisebox{-.1\height}% {\the\textfont\symmtpsymbol\char42}}% {\raisebox{-.1\height}% {\the\scriptfont\symmtpsymbol\char42}}% {\raisebox{-.1\height}% {\the\scriptscriptfont\symmtpsymbol\char42}}}}% \else \def\mst@bin@ast{% \mathbin{\mathchoice{\raisebox{-\mst@lowerast}% {\the\textfont\symmtoperatorfont\char42}}% {\raisebox{-\mst@lowerast}% {\the\textfont\symmtoperatorfont\char42}}% {\raisebox{-\mst@lowerast}% {\the\scriptfont\symmtoperatorfont\char42}}% {\raisebox{-\mst@lowerast}% {\the\scriptscriptfont\symmtoperatorfont\char42}}}}% \fi \def\mst@varfam@ast{\ifnum\fam=\m@ne\mst@bin@ast\else \mathbin{\mathchoice{\raisebox{-\mst@lowerast}% {\the\textfont\fam\char42}}% {\raisebox{-\mst@lowerast}% {\the\textfont\fam\char42}}% {\raisebox{-\mst@lowerast}% {\the\scriptfont\fam\char42}}% {\raisebox{-\mst@lowerast}% {\the\scriptscriptfont\fam\char42}}}\fi}% \let\mst@doasterisk\mst@@doasterisk \DeclareRobustCommand*{\mst@ast}{\mst@bin@ast} \newcommand*\MTlowerast[1]{\def\mst@lowerast{#1}} \MTlowerast{.3\height} \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters \expandafter\def\csname mst@ast \endcsname{\mst@varfam@ast}} \fi % \end{macrocode} % \end{macro}\end{macro}\end{macro} % (2011) I renounced to try to do things with all the various dots, they are % defined in many different ways, and there is the amsmath also. Dealing with % this issue would mean a lot a time for a minuscule result. Better to leave the % user use the |mathdots| package and accept that we can not avoid the default % fonts in that case. So here I just treat |.| (in the hope to really lessen by % 1 the number of fonts embedded at the end in the PDF). % % [(Dec. 2012) should I reexamine these definitive sounding remarks?] % \begin{macrocode} \ifmst@nopunct\else\typeout{** punctuation\string: \string, \string. \string: \string; and \string\colon} \DeclareMathSymbol{,}{\mathpunct}{\mst@font@tbu}{"2C} \DeclareMathSymbol{\mst@varfam@comma}{\mathalpha}{\mst@font@tbu}{"2C} \expandafter\mst@addtodo@nonletters\string,\mathpunct\mst@varfam@comma \DeclareMathSymbol{.}{\mathord}{\mst@font@tbu}{"2E} \DeclareMathSymbol{\mst@varfam@dot}{\mathalpha}{\mst@font@tbu}{"2E} \mst@addtodo@easynonletters\.\mst@varfam@dot \DeclareMathSymbol{:}{\mathrel}{\mst@font@tbu}{"3A} % relation spacing \DeclareMathSymbol{\mst@varfam@colon}{\mathalpha}{\mst@font@tbu}{"3A} \expandafter\mst@addtodo@nonletters\string:\mathrel\mst@varfam@colon \@ifpackageloaded{amsmath} {} % \colon defined in amsmath.sty in terms of : with some enlarged explicit % spacing. No need to intervene. {% no amsmath, use standard punctuation spacing \let\colon\undefined % the reason is if some package has redefined \colon which then % can not be used in \cs{DeclareMathSymbol} anymore (we % shamelessly overwrite...) \DeclareMathSymbol{\colon}{\mathpunct}{\mst@font@tbu}{"3A} \mst@do@nonletters\expandafter{\the\mst@do@nonletters \def\colon{\mathpunct{\mst@varfam@colon}}}} \DeclareMathSymbol{;}{\mathpunct}{\mst@font@tbu}{"3B} \DeclareMathSymbol{\mst@varfam@pointvirgule}{\mathalpha}{\mst@font@tbu}{"3B} \expandafter\mst@addtodo@nonletters\string;\mathpunct\mst@varfam@pointvirgule \fi % \end{macrocode} % \begin{macro}{\relbar} % Due to the way = and - are used by \LaTeX{} in arrows, we will % have to redefine \cs{Relbar} and \cs{relbar} in order for % them to preserve their original meanings. % % |1.15d|: Oct 13, 2012. Belated amendment of the code to be compatible % with Unicode engines in case someone changed the mathcode of -. % However, for the time being I can do it in an easy way only for % XeTeX, not for LuaLatex. Also I do my modifications to \cs{relbar} % in a manner testing for the presence of amsmath. % \begin{macrocode} \ifmst@nominus\else \ifmst@XeTeX \XeTeXmathcharnumdef\mst@minus@sign=\XeTeXmathcodenum`\-\relax \else \ifmst@LuaTeX \luatexUmathcharnumdef\mst@minus@sign=\luatexUmathcodenum`\-\relax %% I used this prior to the new \luatexUmathcodenum, as available with TL2013: %% \mathchardef\mst@minus@sign=8704\relax % "2200 \else \mathchardef\mst@minus@sign=\mathcode`\-\relax \fi\fi \@ifpackageloaded{amsmath} {\def\relbar{\mathrel{\mathpalette\mathsm@sh\mst@minus@sign}}} {\DeclareRobustCommand\relbar{\mathrel{\smash\mst@minus@sign}}} \def\rightarrowfill{$\m@th\mathord{\relbar}\mkern-7mu% \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill \mkern-7mu\mathord\rightarrow$} \def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu% \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill \mkern-7mu\mathord{\relbar}$} \fi % \end{macrocode} % \end{macro} % \begin{macro}{endash} % 2011/01/29, |1.1|: Producing this next piece of code was not a piece % of cake for a novice like myself!\\ % 2011/02/05, |1.11|: Compatibility with Unicode (via use of fontspec % encodings EU1 and EU2)\\ % 2011/02/07, |1.12|: Improved dealing of Unicode possibility.\\ % 2011/04/02, |1.14b|: Corrected some very irresponsible bug in the % Unicode part which caused a problem when 10 or more math families have % been allocated.\\ % 2012/09/24, |1.15|: Added AtBeginDocument to circumvent some amsmath % problem with unicode engines. % \begin{macrocode} \def\do@the@endashstuff{\edef\mst@tmp@enc{\encodingdefault} \ifx\mst@tmp@enc\mst@eui % xetex+fontspec \AtBeginDocument{% \XeTeXmathcode`\-="2 \symmtoperatorfont "2013\relax \XeTeXmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2013\relax } \else \ifx\mst@tmp@enc\mst@euii % luatex+fontspec \AtBeginDocument{% \luatexUmathcode`\-="2 \symmtoperatorfont "2013\relax \luatexUmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2013\relax } \else \ifx\mst@tmp@enc\mst@ti % T1 \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{21} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{21} \else \ifx\mst@tmp@enc\mst@oti % OT1 \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{123} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{123} \else \ifx\mst@tmp@enc\mst@lyi % LY1 \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{150} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{150} \else % make sure we have neither xetex nor luatex \ifmst@XeTeX\mst@aborttrue\else\ifmst@LuaTeX\mst@aborttrue\else \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont} {\expandafter\the\expandafter\csname\mst@tmp@enc\string\textendash\endcsname} \fi\fi \fi\fi\fi\fi\fi} \def\do@the@emdashstuff{\edef\mst@tmp@enc{\encodingdefault} \ifx\mst@tmp@enc\mst@eui % xetex+fontspec \AtBeginDocument{% \XeTeXmathcode`\-="2 \symmtoperatorfont "2014\relax \XeTeXmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2014\relax } \else \ifx\mst@tmp@enc\mst@euii % luatex+fontspec \AtBeginDocument{% \luatexUmathcode`\-="2 \symmtoperatorfont "2014\relax \luatexUmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2014\relax } \else \ifx\mst@tmp@enc\mst@ti % T1 \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{22} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{22} \else \ifx\mst@tmp@enc\mst@oti % OT1 \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{124} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{124} \else \ifx\mst@tmp@enc\mst@lyi % LY1 \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{151} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{151} \else % make sure we have neither xetex nor luatex \ifmst@XeTeX\mst@aborttrue\else\ifmst@LuaTeX\mst@aborttrue\else \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont} {\expandafter\the\expandafter\csname\mst@tmp@enc\string\textemdash\endcsname} \fi\fi \fi\fi\fi\fi\fi} \ifmst@nominus\else\typeout{** minus as endash} \mst@abortfalse \ifmst@endash\do@the@endashstuff\else \ifmst@emdash\do@the@emdashstuff\else \DeclareMathSymbol{-}{\mathbin}{\mst@font@tbu}{"2D} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{\mst@font@tbu}{"2D} \fi\fi \ifmst@abort \DeclareMathSymbol{-}{\mathbin}{\mst@font@tbu}{"2D} \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{\mst@font@tbu}{"2D} \fi \expandafter\mst@addtodo@nonletters\string-\mathbin\mst@varfam@minus \fi % \end{macrocode} % \end{macro} % \begin{macro}{\hbar} % \begin{macro}{\mst@ltbar} % 2011/01/31, |1.1| I decide to settle the question of the |\hbar|. First, the % \LaTeX{} definition % \begin{macrocode} %%\def\hbar{{\mathchar'26\mkern-9muh}} % (original definition from latex.ltx) % \end{macrocode} % Well, the fact is that there is a \cs{DeclareMathSymbol} in |amsfonts.sty|, so % I can not always rely on the original which had the advantage that at least % |h| would be in the correct font. But of course not the macron character % (|\=|, |\bar|). And there is also the issue of the kern whose length is given % in a way which depends on |cmsy| (18mu=1em and em taken from info in |cmsy|). % The first problem is that I don't know how to get the slot position of the % macron, given the encoding. So I found another way. I will need an |rlap| % adapted to math mode, and this is provided by code from % Alexander~R.~\textsc{Perlis} in his TugBoat article 22 (2001), 350--352, which % I found by googling |rlap|. (as an aside, I am only now (April 2, 2011) aware % that the package |mathtools| provides the |mathrlap| etc... ) % % \begin{macrocode} % \def\mst@mathrlap{\mathpalette\mst@mathrlapinternal} \def\mst@mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}} \def\do@the@hbarstuff{\edef\mst@tmp@enc{\encodingdefault} \ifx\mst@tmp@enc\mst@eui % xetex and unicode font \XeTeXmathchardef\hbar="7 \symmtletterfont "0127 \relax \else \ifx\mst@tmp@enc\mst@euii % luatex and unicode font \luatexUmathchardef\hbar="7 \symmtletterfont "0127 \relax %% or 210F? \else % I must leave open the T1, OT1 possibility also for XeTeX or LuaTeX \ifx\mst@ti\mst@tmp@enc \DeclareMathAccent{\mst@ltbar}{\mathalpha}{mtletterfont}{9} \else %% assume OT1. Bad idea? Should not provoke an error anyhow \DeclareMathAccent{\mst@ltbar}{\mathalpha}{mtletterfont}{22} \fi \def\hbar{\mst@mathrlap{\mst@ltbar{\ }}h} \fi\fi} \ifmst@nohbar\else\typeout{** \string\hbar}\do@the@hbarstuff\fi % \end{macrocode} % \end{macro} % \end{macro} % As |h| is from |mtletterfont|, the accent \cs{mst@ltbar} is the % \cs{bar} accent from that same font. Of course, if the user % defines math versions with other encodings than the default one % when loading the package this will probably not work there (if I % knew how to do for accents what I did for the endash I could do % it for all encodings. Surely easy for a \TeX{}pert.) Not to % mention if he/she changes the letter shape... one never should % give so much freedom to users ;-) Well this construction gives % an acceptable result for some of the fonts I have tested, % whether upright or in italics. % % |1.15d|: Oct 13, 2012. The \cs{mathcode} thing with = is (belatedly, % sorry!) made Unicode compatible. % \begin{macro}{+,=,\Relbar} % \begin{macrocode} \ifmst@noplus\else\typeout{** \string+ and \string=} \DeclareMathSymbol{+}{\mathbin}{\mst@font@tbu}{"2B} \DeclareMathSymbol{\mst@varfam@plus}{\mathalpha}{\mst@font@tbu}{"2B} \expandafter\mst@addtodo@nonletters\string+\mathbin\mst@varfam@plus \fi \ifmst@noequal\else \ifmst@XeTeX \XeTeXmathcharnumdef\mst@equal@sign=\XeTeXmathcodenum`\=\relax \else \ifmst@LuaTeX \luatexUmathcharnumdef\mst@equal@sign=\luatexUmathcodenum`\=\relax \else \mathchardef\mst@equal@sign=\mathcode`\=\relax \fi\fi \@ifpackageloaded{amsmath} {\def\Relbar{\mathrel\mst@equal@sign}} {\DeclareRobustCommand\Relbar{\mathrel{\mst@equal@sign}}} \DeclareMathSymbol{=}{\mathrel}{\mst@font@tbu}{"3D} \DeclareMathSymbol{\mst@varfam@equal}{\mathalpha}{\mst@font@tbu}{"3D} % \end{macrocode} % \begin{macro}{\nfss@catcodes} % 2012/12/18: Activating = (only in math mode actually) seems very bad but % surprisingly works well. However I had a problem with |eu2lmtt.fd| which % should not be loaded with an active =. % 2012/12/25: Since then I had switched to only math activation. And in fact % the problematic = from |eu2lmtt.fd| end up in \cs{csname}...\cs{endcsname} % and I have % learnt since that \TeX{} does not look at the |mathcode| inside a % \cs{csname}...\cs{endcsname}. Example: % \begin{verbatim} % \mathcode`x="8000 % \begingroup % \catcode`x=\active % \global\everymath{\defx{Hello}} % \endgroup % \def\foox{World!} % $x \csname foox\endcsname$ % \end{verbatim} % We need nevertheless to inactivate the =, for the following reason. Imagine % someone did |\catcode`==\active\def={\string=}|, or another definition which % would not lead to a tragedy in a \cs{csname}...\cs{endcsname}. Then the = is % active and the re-definition done by |mathastext| will not be compatible with % loading |eu2lmtt.fd| (for the first time) from math mode, as this % re-definition can not be expanded inside a % \cs{csname}...\cs{endcsname}. % % 2012/12/28: to be on the safe side, I add also |;| and |+| and do it % without discriminating between engines % \begin{macrocode} \typeout{** adding \string= \string; and \string+ to \string\nfss@catcodes} \g@addto@macro\nfss@catcodes{% \@makeother\=% \@makeother\;% \@makeother\+% } \expandafter\mst@addtodo@nonletters\string=\mathrel\mst@varfam@equal \fi % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{noparenthesis} % \begin{macro}{(,),[,],/} % \cs{lbrack} and \cs{rbrack} are defined in |latex.ltx| by % |\def\lbrack{[}\def\rbrack{]}| so this fits well with what we do here. % \cs{lparen} and \cs{rparen} are similarly defined in |mathtools|. On the % other hand in |latex.ltx| with |\{| and |\}| are defined (in math mode) in % terms of the control sequences \cs{lbrace} and \cs{rbrace}. % \begin{macrocode} \ifmst@noparen\else\typeout{** parentheses \string( \string) \string[ \string] and slash \string/} \ifmst@nosmalldelims \DeclareMathSymbol{(}{\mathopen}{\mst@font@tbu}{"28} \DeclareMathSymbol{)}{\mathclose}{\mst@font@tbu}{"29} \DeclareMathSymbol{[}{\mathopen} {\mst@font@tbu}{"5B} \DeclareMathSymbol{]}{\mathclose}{\mst@font@tbu}{"5D} \DeclareMathSymbol{/}{\mathord}{\mst@font@tbu}{"2F} \else \DeclareMathDelimiter{(}{\mathopen}{\mst@font@tbu}{"28}{largesymbols}{"00} \DeclareMathDelimiter{)}{\mathclose}{\mst@font@tbu}{"29}{largesymbols}{"01} \DeclareMathDelimiter{[}{\mathopen} {\mst@font@tbu}{"5B}{largesymbols}{"02} \DeclareMathDelimiter{]}{\mathclose}{\mst@font@tbu}{"5D}{largesymbols}{"03} \DeclareMathDelimiter{/}{\mathord}{\mst@font@tbu}{"2F}{largesymbols}{"0E} \fi \DeclareMathSymbol{\mst@varfam@lparen}{\mathalpha}{\mst@font@tbu}{40} \DeclareMathSymbol{\mst@varfam@rparen}{\mathalpha}{\mst@font@tbu}{41} \DeclareMathSymbol{\mst@varfam@lbrack}{\mathalpha}{\mst@font@tbu}{"5B} \DeclareMathSymbol{\mst@varfam@rbrack}{\mathalpha}{\mst@font@tbu}{"5D} \DeclareMathSymbol{\mst@varfam@slash}{\mathalpha}{\mst@font@tbu}{"2F} \expandafter\mst@addtodo@nonletters\string(\mathopen\mst@varfam@lparen \expandafter\mst@addtodo@nonletters\string)\mathclose\mst@varfam@rparen \expandafter\mst@addtodo@nonletters\string[\mathopen\mst@varfam@lbrack \expandafter\mst@addtodo@nonletters\string]\mathclose\mst@varfam@rbrack \mst@addtodo@easynonletters\/\mst@varfam@slash \fi % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{alldelims} % \begin{macro}{<,>,\}\begin{macro}{\setminus}\begin{macro}{\backslash} % \begin{macrocode} \ifmst@alldelims\typeout{** alldelims: \string< \string> \string\backslash\space\string\setminus\space\string| \string\vert\space\string\mid\space\string\{\space and \string\}} \ifmst@nosmalldelims % \end{macrocode} % Dec 18, 2012. We then want |\let\backslash\mst@varfam@backslash| to do nothing % when the \cs{backslash} is used as a delimiter. So here the original % definition from |latex.ltx| is copied, generally speaking when people use % other math symbol fonts they do respect the encoding of the CM symbols and % largesymbols, so this is 90\% safe. But in truth I should extract from the % meaning of \cs{backslash} the |delcode|. % \begin{macrocode} \DeclareMathDelimiter{\mst@varfam@backslash} {\mathalpha}{symbols}{"6E}{largesymbols}{"0F} \else \DeclareMathDelimiter{<}{\mathopen}{\mst@font@tbu}{"3C}{largesymbols}{"0A} \DeclareMathDelimiter{>}{\mathclose}{\mst@font@tbu}{"3E}{largesymbols}{"0B} % \end{macrocode} % There is no backslash in the Symbol font hence |mtoperatorfont| here. % \begin{macrocode} \DeclareMathDelimiter{\backslash} {\mathord}{mtoperatorfont}{"5C}{largesymbols}{"0F} \DeclareMathDelimiter{\mst@varfam@backslash} {\mathalpha}{mtoperatorfont}{"5C}{largesymbols}{"0F} \fi \DeclareMathSymbol{<}{\mathrel}{\mst@font@tbu}{"3C} \DeclareMathSymbol{>}{\mathrel}{\mst@font@tbu}{"3E} \DeclareMathSymbol{\mst@varfam@less}{\mathalpha}{\mst@font@tbu}{"3C} \DeclareMathSymbol{\mst@varfam@more}{\mathalpha}{\mst@font@tbu}{"3E} \expandafter\mst@addtodo@nonletters\string<\mathrel\mst@varfam@less \expandafter\mst@addtodo@nonletters\string>\mathrel\mst@varfam@more \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters \let\backslash\mst@varfam@backslash} \DeclareMathSymbol{\setminus}{\mathbin}{mtoperatorfont}{"5C} \DeclareMathSymbol{\mst@varfam@setminus}{\mathalpha}{mtoperatorfont}{"5C} \mst@do@nonletters\expandafter{\the\mst@do@nonletters \def\setminus{\mathbin{\mst@varfam@setminus}}} % \end{macrocode} % \end{macro}\end{macro}\end{macro} % \begin{macro}{\models} % |1.15d|: 13 oct 2012. Before modifying \string| we must preserve \cs{models}. % \begin{macrocode} \ifmst@XeTeX \XeTeXmathcharnumdef\mst@vert@bar=\XeTeXmathcodenum`\|\relax \else \ifmst@LuaTeX \luatexUmathcharnumdef\mst@vert@bar=\luatexUmathcodenum`\|\relax \else\mathchardef\mst@vert@bar=\mathcode`\|\relax \fi\fi \DeclareRobustCommand\models{\mathrel{\mst@vert@bar}\joinrel\Relbar} % \end{macrocode} % \end{macro} % \begin{macro}{|,\mid,\vert} % (2011) I did not do anything then to try to emulate \cs{Vert} with the % vertical bar from the text font... and now (2012) \mst is not as radical as % it used to be anyhow, so it is too late. % \begin{macrocode} \ifmst@nosmalldelims \DeclareMathSymbol{|}{\mathord}{\mst@font@tbu}{124} \else \DeclareMathDelimiter{|}{\mathord}{\mst@font@tbu}{124}{largesymbols}{"0C} \fi \def\vert{|} \DeclareMathSymbol{\mst@varfam@vbar}{\mathalpha}{\mst@font@tbu}{124} \mst@addtodo@easynonletters\|\mst@varfam@vbar \let\mid\undefined % 1.3: to avoid problems with some packages \DeclareMathSymbol{\mid}{\mathrel}{\mst@font@tbu}{124} \mst@do@nonletters\expandafter{\the\mst@do@nonletters \def\mid{\mathrel\mst@varfam@vbar}} % \end{macrocode} % \begin{macro}{\MTexplicitbraces-}\begin{macro}{obeymathxx} % \begin{macro}{\MTexplicitbraces-}\begin{macro}{donotobeymathxx} % Braces. With version |1.2|, |\{| and |\}| will not be acceptable as % delimiters anymore if the redefinitions below in \cs{mst@dobraces} are % enacted. But they will obey math alphabets. Improvements in |1.2a|, to % preserve robustness. % % For |1.3| I make |\lbrace| and |\rbrace| undefined first, else problems % may arise with some packages. % \begin{macrocode} \let\lbrace\undefined \let\rbrace\undefined \ifmst@nosmalldelims \DeclareMathSymbol{\lbrace}{\mathopen}{\mst@font@tbu}{123} \DeclareMathSymbol{\rbrace}{\mathclose}{\mst@font@tbu}{125} \else \DeclareMathDelimiter{\lbrace} {\mathopen}{\mst@font@tbu}{123}{largesymbols}{"08} \DeclareMathDelimiter{\rbrace} {\mathclose}{\mst@font@tbu}{125}{largesymbols}{"09} \fi \DeclareMathSymbol{\mst@varfam@lbrace}{\mathalpha}{\mst@font@tbu}{123} \DeclareMathSymbol{\mst@varfam@rbrace}{\mathalpha}{\mst@font@tbu}{125} \DeclareRobustCommand*{\mst@lbrace} {\ifmmode\mathopen\mst@varfam@lbrace\else\textbraceleft\fi} \DeclareRobustCommand*{\mst@rbrace} {\ifmmode\mathclose\mst@varfam@rbrace\else\textbraceright\fi} \mst@do@nonletters\expandafter{\the\mst@do@nonletters \mst@dobraces{\let\{\mst@lbrace\let\}\mst@rbrace}} \fi % end of \ifmst@alldelims \newcommand*{\MTexplicitbracesobeymathxx}{\let\mst@dobraces\@firstofone} \newcommand*{\MTexplicitbracesdonotobeymathxx}{\let\mst@dobraces\@gobble} \MTexplicitbracesdonotobeymathxx % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} % \end{macro}\end{macro} % \begin{macro}{specials} % \leavevmode\kern\parindent |1.14b| [2011/04/02]: the redefinitions of % \#, \$, \% and \& were buggy (this showed up when 10 or more math % families had been created). % % |1.15f| [2012/10/23]: the code, although working, was perhaps a bit insane % and % had definitions which could surprise other packages. For example, it did:\\ % \null\hspace{1cm}|\renewcommand{\%}{\ifmmode\mt@mmode@percent\else\char37\relax\fi}|\\ % But it seems this provokes a problem with |microtype|. Perhaps the problem % was that the command was not declared robust? For the dollar \LaTeX{} itself does\\ % \null\hspace{1cm}|\DeclareRobustCommand{\$}{\ifmmode\mathdollar\else\textdollar\fi}|\\ % So here I just modify \cs{mathdollar}. Then we have in % |latex.ltx| the same definitions as in |plain.tex|: % |\chardef\%=`\%|, % |\chardef\&=`\&|, and % |\chardef\#=`\#|. It turns out that we can just adjust the mathcodes of these % characters and achieve exactly what is wanted for the corresponding one char % control sequences. In math mode the control sequence will use the specified % mathcode. So here it is \emph{not} a redefinition of the control sequences, % purely an adjustment of mathcodes. % % |1.2d| [2013/01/01]: previous versions imposed the variable family type. I % hereby make it possible to de-activate this feature with the macro % \cs{MTeasynonlettersdonotobeymathxx}. Besides, I have absolutely no idea % why I had different looking code depending on the engine XeTeX, LuaTeX or % default. Removed. % % |1.3c| [2013/12/14]: I have absolutely no idea why I removed the XeTeX and % LuaTeX code at the time of |1.2d|! the code for tex/pdftex engine could not % accomodate more than 16 math families. Code for XeTeX and LuaTeX again added. % (and since TL2013 no more problems with |\luatexUmathcode|.) % \begin{macrocode} \ifmst@nospecials\else \typeout{** \string\#\space\string\mathdollar\space \string\%\space\string\&\space} \ifmst@XeTeX \XeTeXmathcode`\#="0 \symmtoperatorfont "0023 \relax \XeTeXmathchardef\mathdollar="0 \symmtoperatorfont "0024 \relax \XeTeXmathcode`\%="0 \symmtoperatorfont "0025 \relax \XeTeXmathcode`\&="0 \symmtoperatorfont "0026 \relax \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters \XeTeXmathcode`\#="7 \symmtoperatorfont "0023 \relax \XeTeXmathchardef\mathdollar="7 \symmtoperatorfont "0024 \relax \XeTeXmathcode`\%="7 \symmtoperatorfont "0025 \relax \XeTeXmathcode`\&="7 \symmtoperatorfont "0026 \relax } \else \ifmst@LuaTeX \luatexUmathcode`\#="0 \symmtoperatorfont "0023 \relax \luatexUmathchardef\mathdollar="0 \symmtoperatorfont "0024 \relax \luatexUmathcode`\%="0 \symmtoperatorfont "0025 \relax \luatexUmathcode`\&="0 \symmtoperatorfont "0026 \relax \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters \luatexUmathcode`\#="7 \symmtoperatorfont "0023 \relax \luatexUmathchardef\mathdollar="7 \symmtoperatorfont "0024 \relax \luatexUmathcode`\%="7 \symmtoperatorfont "0025 \relax \luatexUmathcode`\&="7 \symmtoperatorfont "0026 \relax } \else \count255=\symmtoperatorfont \multiply\count255 by 256 \advance\count255 by 35 \mathcode`\#\count255 \advance\count255 by 1 \mathchardef\mathdollar\count255 \advance\count255 by 1 \mathcode`\%\count255 \advance\count255 by 1 \mathcode`\&\count255 \count255=\symmtoperatorfont \multiply\count255 by 256 \advance\count255 by 28707 % = "7023 \mathchardef\mst@varfam@mathhash\count255 \advance\count255 by 1 \mathchardef\mst@varfam@mathdollar\count255 \advance\count255 by 1 \mathchardef\mst@varfam@mathpercent\count255 \advance\count255 by 1 \mathchardef\mst@varfam@mathampersand\count255 \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters \mathcode`\#=\mst@varfam@mathhash \let\mathdollar\mst@varfam@mathdollar \mathcode`\%=\mst@varfam@mathpercent \mathcode`\&=\mst@varfam@mathampersand} \fi\fi\fi % \end{macrocode} % \end{macro} % \begin{macro}{symbolmisc} % We construct (with some effort) some long arrows from the Symbol glyphs, of % almost the same lengths as the standard ones. By the way, I always found the % \cs{iff} to be too wide, but I follow here the default. Also, although % there is a \cs{longmapsto} in standard \LaTeX{}, if I am not mistaken, there % is no \cs{longto}. So I define one here. I could not construct in the same % manner \cs{Longrightarrow} etc\dots{} as the = sign from Symbol does not % combine easily with the logical arrows, well, I could have done some box % manipulations, but well, life is finite. % \begin{macro}{\prod} % \begin{macro}{\sum} % |1.13b|: I correct the brutal re-definitions of \cs{prod} and \cs{sum} from % the earlier versions of the package; most of the time the Symbol glyphs do % appear to be too small in display mode. The new redefinitions do have some % defects: |$\displaystyle\prod_1^2$| changes the position of limits but not % the glyph itself, and |$$\textstyle\prod_1^2$$| change the limits but % switches to the CM inline math glyph. So I tried\\ % |\renewcommand{\prod}{\mathchoice{\mst@prod}{\prodpsy}{\prodpsy}{\prodpsy}}|\\ % but this did not go well with subscripts and exponents. % % Note oct 2012: maybe I should re-examine what I did? % |1.3c| ([2013/12/14]) renames |\defaultprod| to |\MToriginalprod| and % |\defaultsum| to % |\MToriginalsum|. % \begin{macrocode} \ifmst@symbolmisc\typeout{** symbolmisc: miscellaneous math symbols from Symbol font} \let\mst@prod\prod \let\MToriginalprod\prod \DeclareMathSymbol{\prodpsy}{\mathop}{mtpsymbol}{213} \renewcommand*{\prod}{\ifinner\prodpsy\else\mst@prod\fi} \let\mst@sum\sum \let\MToriginalsum\sum \DeclareMathSymbol{\sumpsy}{\mathop}{mtpsymbol}{229} \renewcommand*{\sum}{\ifinner\sumpsy\else\mst@sum\fi} % \end{macrocode} % \end{macro} % \end{macro} % \begin{macrocode} \DeclareMathSymbol{\mst@implies}{\mathrel}{mtpsymbol}{222} \DeclareRobustCommand*{\implies}{\;\mst@implies\;} \DeclareMathSymbol{\mst@impliedby}{\mathrel}{mtpsymbol}{220} \DeclareRobustCommand*{\impliedby}{\;\mst@impliedby\;} \DeclareRobustCommand*{\iff}{\;\mst@impliedby\mathrel{\mkern-3mu}\mst@implies\;} \DeclareMathSymbol{\mst@iff}{\mathrel}{mtpsymbol}{219} \DeclareRobustCommand*{\shortiff}{\;\mst@iff\;} \DeclareMathSymbol{\mst@to}{\mathrel}{mtpsymbol}{174} \DeclareMathSymbol{\mst@trait}{\mathrel}{mtpsymbol}{190} \DeclareRobustCommand*\to{\mst@to} \DeclareRobustCommand*\longto{\mkern2mu\mst@trait\mathrel{\mkern-10mu}\mst@to} \DeclareRobustCommand*\mapsto{\mapstochar\mathrel{\mkern0.2mu}\mst@to} \DeclareRobustCommand*\longmapsto{% \mapstochar\mathrel{\mkern2mu}\mst@trait\mathrel{\mkern-10mu}\mst@to} \DeclareMathSymbol{\aleph}{\mathord}{mtpsymbol}{192} \DeclareMathSymbol{\inftypsy}{\mathord}{mtpsymbol}{165} \DeclareMathSymbol{\emptyset}{\mathord}{mtpsymbol}{198} \let\varnothing\emptyset \DeclareMathSymbol{\nabla}{\mathord}{mtpsymbol}{209} \DeclareMathSymbol{\surd}{\mathop}{mtpsymbol}{214} \let\angle\undefined \DeclareMathSymbol{\angle}{\mathord}{mtpsymbol}{208} \DeclareMathSymbol{\forall}{\mathord}{mtpsymbol}{34} \DeclareMathSymbol{\exists}{\mathord}{mtpsymbol}{36} \DeclareMathSymbol{\neg}{\mathord}{mtpsymbol}{216} \DeclareMathSymbol{\clubsuit}{\mathord}{mtpsymbol}{167} \DeclareMathSymbol{\diamondsuit}{\mathord}{mtpsymbol}{168} \DeclareMathSymbol{\heartsuit}{\mathord}{mtpsymbol}{169} \DeclareMathSymbol{\spadesuit}{\mathord}{mtpsymbol}{170} \DeclareMathSymbol{\smallint}{\mathop}{mtpsymbol}{242} \DeclareMathSymbol{\wedge}{\mathbin}{mtpsymbol}{217} \DeclareMathSymbol{\vee}{\mathbin}{mtpsymbol}{218} \DeclareMathSymbol{\cap}{\mathbin}{mtpsymbol}{199} \DeclareMathSymbol{\cup}{\mathbin}{mtpsymbol}{200} \DeclareMathSymbol{\bullet}{\mathbin}{mtpsymbol}{183} \DeclareMathSymbol{\div}{\mathbin}{mtpsymbol}{184} \DeclareMathSymbol{\otimes}{\mathbin}{mtpsymbol}{196} \DeclareMathSymbol{\oplus}{\mathbin}{mtpsymbol}{197} \DeclareMathSymbol{\pm}{\mathbin}{mtpsymbol}{177} \DeclareMathSymbol{\times}{\mathbin}{mtpsymbol}{180} \DeclareMathSymbol{\proptopsy}{\mathrel}{mtpsymbol}{181} \DeclareMathSymbol{\mid}{\mathrel}{mtpsymbol}{124} \DeclareMathSymbol{\leq}{\mathrel}{mtpsymbol}{163} \DeclareMathSymbol{\geq}{\mathrel}{mtpsymbol}{179} \DeclareMathSymbol{\approx}{\mathrel}{mtpsymbol}{187} \DeclareMathSymbol{\supset}{\mathrel}{mtpsymbol}{201} \DeclareMathSymbol{\subset}{\mathrel}{mtpsymbol}{204} \DeclareMathSymbol{\supseteq}{\mathrel}{mtpsymbol}{202} \DeclareMathSymbol{\subseteq}{\mathrel}{mtpsymbol}{205} \DeclareMathSymbol{\in}{\mathrel}{mtpsymbol}{206} \DeclareMathSymbol{\sim}{\mathrel}{mtpsymbol}{126} \let\cong\undefined \DeclareMathSymbol{\cong}{\mathrel}{mtpsymbol}{64} \DeclareMathSymbol{\perp}{\mathrel}{mtpsymbol}{94} \DeclareMathSymbol{\equiv}{\mathrel}{mtpsymbol}{186} \let\notin\undefined \DeclareMathSymbol{\notin}{\mathrel}{mtpsymbol}{207} \DeclareMathDelimiter{\rangle} {\mathclose}{mtpsymbol}{241}{largesymbols}{"0B} \DeclareMathDelimiter{\langle} {\mathopen}{mtpsymbol}{225}{largesymbols}{"0A} \fi % \end{macrocode} % \end{macro} % \begin{macro}{symbolre} % I like the \cs{Re} and \cs{Im} from Symbol, so I overwrite the CM ones. % \begin{macrocode} \ifmst@symbolre\typeout{** symbolre: \string\Re\space and \string\Im\space from Symbol font} \DeclareMathSymbol{\Re}{\mathord}{mtpsymbol}{"C2} \DeclareMathSymbol{\Im}{\mathord}{mtpsymbol}{"C1} \DeclareMathSymbol{\DotTriangle}{\mathord}{mtpsymbol}{92} \fi % \end{macrocode} % \end{macro} % \begin{macro}{Greek letters} % LGRgreek $>$ selfGreek $>$ eulergreek $>$ symbolgreek % % |1.11| I correct some bugs on how eulergreek and % symbolgreek interacted. % % |1.12b| more bug fixes. % % |1.13| % % * Option LGRgreek. % % * Also, a behavior has been changed: it regards the selfGreek case, % the default shape is now the one for letters, not for operator-names % and digits. This complies to the ISO standard. % % * bugfix: version |1.12b| did not define the \cs{omicron} in the % case when no Greek-related option was passed to the package. % % |1.13d| has new macros |\MTstandardgreek| and |\MTcustomgreek|. % And in the subdued case |\MTstandardgreek| is done when switching to % the normal or bold math versions (previously something like this % was only done in case of |LGRgreek| option. ) % \begin{macrocode} \let\mst@mathord\mathalpha \mst@goaheadtrue \ifmst@selfGreek \def\mst@font@tbu{mtselfGreekfont} \else \ifmst@eulergreek \def\mst@font@tbu{mteulervm} \else \ifmst@symbolgreek \def\mst@font@tbu{mtpsymbol} \let\mst@mathord\mathord \else \ifmst@LGRgreek \mst@goaheadfalse \else % \end{macrocode} % The \cs{omicron} requires special treatment. By default we use the o from the % (original) normal alphabet, if eulergreek or symbolgreek we adapt. There is % also a special adjustment if the package |fourier| was loaded in its % |upright| variant: we then take \cs{omicron} from the (original) rm alphabet. % \begin{macrocode} \mst@goaheadfalse \def\mst@omicron {\mst@alph@omicron{o}} \fi \fi \fi \fi \ifmst@goahead \DeclareMathSymbol{\mst@Alpha}{\mst@mathord}{\mst@font@tbu}{"41} \DeclareMathSymbol{\mst@Beta}{\mst@mathord}{\mst@font@tbu}{"42} \DeclareMathSymbol{\mst@Epsilon}{\mst@mathord}{\mst@font@tbu}{"45} \DeclareMathSymbol{\mst@Zeta}{\mst@mathord}{\mst@font@tbu}{"5A} \DeclareMathSymbol{\mst@Eta}{\mst@mathord}{\mst@font@tbu}{"48} \DeclareMathSymbol{\mst@Iota}{\mst@mathord}{\mst@font@tbu}{"49} \DeclareMathSymbol{\mst@Kappa}{\mst@mathord}{\mst@font@tbu}{"4B} \DeclareMathSymbol{\mst@Mu}{\mst@mathord}{\mst@font@tbu}{"4D} \DeclareMathSymbol{\mst@Nu}{\mst@mathord}{\mst@font@tbu}{"4E} \DeclareMathSymbol{\mst@Omicron}{\mst@mathord}{\mst@font@tbu}{"4F} \DeclareMathSymbol{\mst@Rho}{\mst@mathord}{\mst@font@tbu}{"50} \DeclareMathSymbol{\mst@Tau}{\mst@mathord}{\mst@font@tbu}{"54} \DeclareMathSymbol{\mst@Chi}{\mst@mathord}{\mst@font@tbu}{"58} % \end{macrocode} % When we in fact use Symbol, we have to correct \cs{Rho} and % \cs{Chi}. And \cs{Digamma} is non-existent in fact (no F % in Symbol, F codes a \cs{Phi}). % \begin{macrocode} \ifx\mst@mathord\mathord % \end{macrocode} % symbolgreek but neither eulergreek nor selfGreek % \begin{macrocode} %% attention le P de Symbol est un \Pi pas un \Rho \DeclareMathSymbol{\mst@Rho}{\mathord}{mtpsymbol}{"52} %% attention le X de Symbol est un \Xi pas un \Chi \DeclareMathSymbol{\mst@Chi}{\mathord}{mtpsymbol}{"43} %% attention le F de Symbol est un \Phi. Il n'y a pas de \Digamma \DeclareMathSymbol{\mst@Gamma}{\mathord}{mtpsymbol}{"47} \DeclareMathSymbol{\mst@Delta}{\mathord}{mtpsymbol}{"44} \DeclareMathSymbol{\mst@Theta}{\mathord}{mtpsymbol}{"51} \DeclareMathSymbol{\mst@Lambda}{\mathord}{mtpsymbol}{"4C} \DeclareMathSymbol{\mst@Xi}{\mathord}{mtpsymbol}{"58} \DeclareMathSymbol{\mst@Pi}{\mathord}{mtpsymbol}{"50} \DeclareMathSymbol{\mst@Sigma}{\mathord}{mtpsymbol}{"53} \DeclareMathSymbol{\mst@Upsilon}{\mathord}{mtpsymbol}{"A1} \DeclareMathSymbol{\mst@Phi}{\mathord}{mtpsymbol}{"46} \DeclareMathSymbol{\mst@Psi}{\mathord}{mtpsymbol}{"59} \DeclareMathSymbol{\mst@Omega}{\mathord}{mtpsymbol}{"57} \else % de \mst@mathord=\mathord % \end{macrocode} % not symbolgreek but eulergreek or selfGreek or both % \begin{macrocode} \DeclareMathSymbol\mst@Digamma {\mathalpha}{\mst@font@tbu}{"46} \DeclareMathSymbol\mst@Gamma {\mathalpha}{\mst@font@tbu}{"00} \DeclareMathSymbol\mst@Delta {\mathalpha}{\mst@font@tbu}{"01} \DeclareMathSymbol\mst@Theta {\mathalpha}{\mst@font@tbu}{"02} \DeclareMathSymbol\mst@Lambda {\mathalpha}{\mst@font@tbu}{"03} \DeclareMathSymbol\mst@Xi {\mathalpha}{\mst@font@tbu}{"04} \DeclareMathSymbol\mst@Pi {\mathalpha}{\mst@font@tbu}{"05} \DeclareMathSymbol\mst@Sigma {\mathalpha}{\mst@font@tbu}{"06} \DeclareMathSymbol\mst@Upsilon {\mathalpha}{\mst@font@tbu}{"07} \DeclareMathSymbol\mst@Phi {\mathalpha}{\mst@font@tbu}{"08} \DeclareMathSymbol\mst@Psi {\mathalpha}{\mst@font@tbu}{"09} \DeclareMathSymbol\mst@Omega {\mathalpha}{\mst@font@tbu}{"0A} \fi % de \mst@mathord=\mathord \fi % fin de goahead % \end{macrocode} % There are differences regarding Euler and Symbol with respect to the % available var-letters. We include one or two things like the |wp| and the % |partial|. % % The lower case Greek letters in default \LaTeX{} are of type |mathord|. If % we use the Euler font it is perhaps better to have them be of type % |mathalpha| % \begin{macrocode} \ifmst@goahead \ifmst@eulergreek \DeclareMathSymbol{\mst@alpha} {\mathalpha}{mteulervm}{"0B} \DeclareMathSymbol{\mst@beta} {\mathalpha}{mteulervm}{"0C} \DeclareMathSymbol{\mst@gamma} {\mathalpha}{mteulervm}{"0D} \DeclareMathSymbol{\mst@delta} {\mathalpha}{mteulervm}{"0E} \DeclareMathSymbol{\mst@epsilon}{\mathalpha}{mteulervm}{"0F} \DeclareMathSymbol{\mst@zeta} {\mathalpha}{mteulervm}{"10} \DeclareMathSymbol{\mst@eta} {\mathalpha}{mteulervm}{"11} \DeclareMathSymbol{\mst@theta} {\mathalpha}{mteulervm}{"12} \DeclareMathSymbol{\mst@iota} {\mathalpha}{mteulervm}{"13} \DeclareMathSymbol{\mst@kappa} {\mathalpha}{mteulervm}{"14} \DeclareMathSymbol{\mst@lambda} {\mathalpha}{mteulervm}{"15} \DeclareMathSymbol{\mst@mu} {\mathalpha}{mteulervm}{"16} \DeclareMathSymbol{\mst@nu} {\mathalpha}{mteulervm}{"17} \DeclareMathSymbol{\mst@xi} {\mathalpha}{mteulervm}{"18} \DeclareMathSymbol{\mst@omicron}{\mathalpha}{mteulervm}{"6F} \DeclareMathSymbol{\mst@pi} {\mathalpha}{mteulervm}{"19} \DeclareMathSymbol{\mst@rho} {\mathalpha}{mteulervm}{"1A} \DeclareMathSymbol{\mst@sigma} {\mathalpha}{mteulervm}{"1B} \DeclareMathSymbol{\mst@tau} {\mathalpha}{mteulervm}{"1C} \DeclareMathSymbol{\mst@upsilon}{\mathalpha}{mteulervm}{"1D} \DeclareMathSymbol{\mst@phi} {\mathalpha}{mteulervm}{"1E} \DeclareMathSymbol{\mst@chi} {\mathalpha}{mteulervm}{"1F} \DeclareMathSymbol{\mst@psi} {\mathalpha}{mteulervm}{"20} \DeclareMathSymbol{\mst@omega} {\mathalpha}{mteulervm}{"21} \let\mst@varrho=\mst@rho \let\mst@varsigma=\mst@sigma \DeclareMathSymbol{\mst@varepsilon}{\mathalpha}{mteulervm}{"22} \DeclareMathSymbol{\mst@vartheta}{\mathalpha}{mteulervm}{"23} \DeclareMathSymbol{\mst@varpi} {\mathalpha}{mteulervm}{"24} \DeclareMathSymbol{\mst@varphi} {\mathalpha}{mteulervm}{"27} \DeclareMathSymbol{\mst@partial}{\mathalpha}{mteulervm}{"40} \DeclareMathSymbol{\mst@wp}{\mathalpha}{mteulervm}{"7D} \DeclareMathSymbol{\mst@ell}{\mathalpha}{mteulervm}{"60} \else \ifmst@symbolgreek \DeclareMathSymbol{\mst@alpha}{\mathord}{mtpsymbol}{"61} \DeclareMathSymbol{\mst@beta}{\mathord}{mtpsymbol}{"62} \DeclareMathSymbol{\mst@gamma}{\mathord}{mtpsymbol}{"67} \DeclareMathSymbol{\mst@delta}{\mathord}{mtpsymbol}{"64} \DeclareMathSymbol{\mst@epsilon}{\mathord}{mtpsymbol}{"65} \DeclareMathSymbol{\mst@zeta}{\mathord}{mtpsymbol}{"7A} \DeclareMathSymbol{\mst@eta}{\mathord}{mtpsymbol}{"68} \DeclareMathSymbol{\mst@theta}{\mathord}{mtpsymbol}{"71} \DeclareMathSymbol{\mst@iota}{\mathord}{mtpsymbol}{"69} \DeclareMathSymbol{\mst@kappa}{\mathord}{mtpsymbol}{"6B} \DeclareMathSymbol{\mst@lambda}{\mathord}{mtpsymbol}{"6C} \DeclareMathSymbol{\mst@mu}{\mathord}{mtpsymbol}{"6D} \DeclareMathSymbol{\mst@nu}{\mathord}{mtpsymbol}{"6E} \DeclareMathSymbol{\mst@xi}{\mathord}{mtpsymbol}{"78} \DeclareMathSymbol{\mst@omicron}{\mathord}{mtpsymbol}{"6F} \DeclareMathSymbol{\mst@pi}{\mathord}{mtpsymbol}{"70} \DeclareMathSymbol{\mst@rho}{\mathord}{mtpsymbol}{"72} \DeclareMathSymbol{\mst@sigma}{\mathord}{mtpsymbol}{"73} \DeclareMathSymbol{\mst@tau}{\mathord}{mtpsymbol}{"74} \DeclareMathSymbol{\mst@upsilon}{\mathord}{mtpsymbol}{"75} \DeclareMathSymbol{\mst@phi}{\mathord}{mtpsymbol}{"66} \DeclareMathSymbol{\mst@chi}{\mathord}{mtpsymbol}{"63} \DeclareMathSymbol{\mst@psi}{\mathord}{mtpsymbol}{"79} \DeclareMathSymbol{\mst@omega}{\mathord}{mtpsymbol}{"77} \let\mst@varepsilon=\mst@epsilon \DeclareMathSymbol{\mst@vartheta}{\mathord}{mtpsymbol}{"4A} \DeclareMathSymbol{\mst@varpi}{\mathord}{mtpsymbol}{"76} \let\mst@varrho=\mst@rho \DeclareMathSymbol{\mst@varsigma}{\mathord}{mtpsymbol}{"56} \DeclareMathSymbol{\mst@varphi}{\mathord}{mtpsymbol}{"6A} \DeclareMathSymbol{\mst@partial}{\mathord}{mtpsymbol}{"B6} \DeclareMathSymbol{\mst@wp}{\mathord}{mtpsymbol}{"C3} \fi \fi \fi \ifmst@LGRgreek % cf http://milde.users.sourceforge.net/LGR/lgrxenc.def.html % et greek.ldf du package babel \DeclareMathSymbol{\mst@Alpha}{\mathalpha}{mtlgrfontupper}{65} \DeclareMathSymbol{\mst@Beta}{\mathalpha}{mtlgrfontupper}{66} \DeclareMathSymbol{\mst@Gamma}{\mathalpha}{mtlgrfontupper}{71} \DeclareMathSymbol{\mst@Delta}{\mathalpha}{mtlgrfontupper}{68} \DeclareMathSymbol{\mst@Epsilon}{\mathalpha}{mtlgrfontupper}{69} \DeclareMathSymbol{\mst@Zeta}{\mathalpha}{mtlgrfontupper}{90} \DeclareMathSymbol{\mst@Eta}{\mathalpha}{mtlgrfontupper}{72} \DeclareMathSymbol{\mst@Theta}{\mathalpha}{mtlgrfontupper}{74} \DeclareMathSymbol{\mst@Iota}{\mathalpha}{mtlgrfontupper}{73} \DeclareMathSymbol{\mst@Kappa}{\mathalpha}{mtlgrfontupper}{75} \DeclareMathSymbol{\mst@Lambda}{\mathalpha}{mtlgrfontupper}{76} \DeclareMathSymbol{\mst@Mu}{\mathalpha}{mtlgrfontupper}{77} \DeclareMathSymbol{\mst@Nu}{\mathalpha}{mtlgrfontupper}{78} \DeclareMathSymbol{\mst@Xi}{\mathalpha}{mtlgrfontupper}{88} \DeclareMathSymbol{\mst@Omicron}{\mathalpha}{mtlgrfontupper}{79} \DeclareMathSymbol{\mst@Pi}{\mathalpha}{mtlgrfontupper}{80} \DeclareMathSymbol{\mst@Rho}{\mathalpha}{mtlgrfontupper}{82} \DeclareMathSymbol{\mst@Sigma}{\mathalpha}{mtlgrfontupper}{83} \DeclareMathSymbol{\mst@Tau}{\mathalpha}{mtlgrfontupper}{84} \DeclareMathSymbol{\mst@Upsilon}{\mathalpha}{mtlgrfontupper}{85} \DeclareMathSymbol{\mst@Phi}{\mathalpha}{mtlgrfontupper}{70} \DeclareMathSymbol{\mst@Chi}{\mathalpha}{mtlgrfontupper}{81} \DeclareMathSymbol{\mst@Psi}{\mathalpha}{mtlgrfontupper}{89} \DeclareMathSymbol{\mst@Omega}{\mathalpha}{mtlgrfontupper}{87} % \DeclareMathSymbol{\mst@alpha}{\mathalpha}{mtlgrfontlower}{97} \DeclareMathSymbol{\mst@beta}{\mathalpha}{mtlgrfontlower}{98} \DeclareMathSymbol{\mst@gamma}{\mathalpha}{mtlgrfontlower}{103} \DeclareMathSymbol{\mst@delta}{\mathalpha}{mtlgrfontlower}{100} \DeclareMathSymbol{\mst@epsilon}{\mathalpha}{mtlgrfontlower}{101} \DeclareMathSymbol{\mst@zeta}{\mathalpha}{mtlgrfontlower}{122} \DeclareMathSymbol{\mst@eta}{\mathalpha}{mtlgrfontlower}{104} \DeclareMathSymbol{\mst@theta}{\mathalpha}{mtlgrfontlower}{106} \DeclareMathSymbol{\mst@iota}{\mathalpha}{mtlgrfontlower}{105} \DeclareMathSymbol{\mst@kappa}{\mathalpha}{mtlgrfontlower}{107} \DeclareMathSymbol{\mst@lambda}{\mathalpha}{mtlgrfontlower}{108} \DeclareMathSymbol{\mst@mu}{\mathalpha}{mtlgrfontlower}{109} \DeclareMathSymbol{\mst@nu}{\mathalpha}{mtlgrfontlower}{110} \DeclareMathSymbol{\mst@xi}{\mathalpha}{mtlgrfontlower}{120} \DeclareMathSymbol{\mst@omicron}{\mathalpha}{mtlgrfontlower}{111} \DeclareMathSymbol{\mst@pi}{\mathalpha}{mtlgrfontlower}{112} \DeclareMathSymbol{\mst@rho}{\mathalpha}{mtlgrfontlower}{114} \DeclareMathSymbol{\mst@varsigma}{\mathalpha}{mtlgrfontlower}{99} \DeclareMathSymbol{\mst@sigma}{\mathalpha}{mtlgrfontlower}{115} \DeclareMathSymbol{\mst@tau}{\mathalpha}{mtlgrfontlower}{116} \DeclareMathSymbol{\mst@upsilon}{\mathalpha}{mtlgrfontlower}{117} \DeclareMathSymbol{\mst@phi}{\mathalpha}{mtlgrfontlower}{102} \DeclareMathSymbol{\mst@chi}{\mathalpha}{mtlgrfontlower}{113} \DeclareMathSymbol{\mst@psi}{\mathalpha}{mtlgrfontlower}{121} \DeclareMathSymbol{\mst@omega}{\mathalpha}{mtlgrfontlower}{119} \DeclareMathSymbol{\mst@digamma}{\mathalpha}{mtlgrfontlower}{147} \DeclareMathSymbol{\mst@Digamma}{\mathalpha}{mtlgrfontlower}{195} \fi % \end{macrocode} % \end{macro} % \begin{macro}{\MTstandardgreek} % \begin{macro}{\MTcustomgreek} % \begin{macro}{\MTrecordstandardgreek} % 1.3d defines the commands |\MTstandardgreek| and |\MTcustomgreek| % for package and user. I leave |\MTrecordstandardgreek| undocumented % as I don't want to encourage people to load math packages after % \mst. % \begin{macrocode} \newcommand*{\MTstandardgreek}{} \newcommand*{\MTcustomgreek}{} \newcommand*{\MTrecordstandardgreek}{} \ifmst@customgreek \renewcommand*{\MTrecordstandardgreek}{% \let\mst@origAlpha\Alpha \let\mst@origBeta\Beta \let\mst@origGamma\Gamma \let\mst@origDelta\Delta \let\mst@origEpsilon\Epsilon \let\mst@origZeta\Zeta \let\mst@origEta\Eta \let\mst@origTheta\Theta \let\mst@origIota\Iota \let\mst@origKappa\Kappa \let\mst@origLambda\Lambda \let\mst@origMu\Mu \let\mst@origNu\Nu \let\mst@origXi\Xi \let\mst@origOmicron\Omicron \let\mst@origPi\Pi \let\mst@origRho\Rho \let\mst@origSigma\Sigma \let\mst@origTau\Tau \let\mst@origUpsilon\Upsilon \let\mst@origPhi\Phi \let\mst@origChi\Chi \let\mst@origPsi\Psi \let\mst@origOmega\Omega % \let\mst@origalpha\alpha \let\mst@origbeta\beta \let\mst@origgamma\gamma \let\mst@origdelta\delta \let\mst@origepsilon\epsilon \let\mst@origvarepsilon\varepsilon \let\mst@origzeta\zeta \let\mst@origeta\eta \let\mst@origtheta\theta \let\mst@origvartheta\vartheta \let\mst@origiota\iota \let\mst@origkappa\kappa \let\mst@origlambda\lambda \let\mst@origmu\mu \let\mst@orignu\nu \let\mst@origxi\xi \let\mst@origomicron\omicron \let\mst@origpi\pi \let\mst@origvarpi\varpi \let\mst@origrho\rho \let\mst@origvarrho\varrho \let\mst@origsigma\sigma \let\mst@origvarsigma\varsigma \let\mst@origtau\tau \let\mst@origupsilon\upsilon \let\mst@origphi\phi \let\mst@origvarphi\varphi \let\mst@origchi\chi \let\mst@origpsi\psi \let\mst@origomega\omega \let\mst@origDigamma\Digamma \let\mst@origdigamma\digamma % \let\mst@origpartial\partial \let\mst@origwp\wp \let\mst@origell\ell } \MTrecordstandardgreek \renewcommand*{\MTstandardgreek}{% \let\Alpha\mst@origAlpha \let\Beta\mst@origBeta \let\Gamma\mst@origGamma \let\Delta\mst@origDelta \let\Epsilon\mst@origEpsilon \let\Zeta\mst@origZeta \let\Eta\mst@origEta \let\Theta\mst@origTheta \let\Iota\mst@origIota \let\Kappa\mst@origKappa \let\Lambda\mst@origLambda \let\Mu\mst@origMu \let\Nu\mst@origNu \let\Xi\mst@origXi \let\Omicron\mst@origOmicron \let\Pi\mst@origPi \let\Rho\mst@origRho \let\Sigma\mst@origSigma \let\Tau\mst@origTau \let\Upsilon\mst@origUpsilon \let\Phi\mst@origPhi \let\Chi\mst@origChi \let\Psi\mst@origPsi \let\Omega\mst@origOmega % \let\alpha\mst@origalpha \let\beta\mst@origbeta \let\gamma\mst@origgamma \let\delta\mst@origdelta \let\epsilon\mst@origepsilon \let\varepsilon\mst@origvarepsilon \let\zeta\mst@origzeta \let\eta\mst@origeta \let\theta\mst@origtheta \let\vartheta\mst@origvartheta \let\iota\mst@origiota \let\kappa\mst@origkappa \let\lambda\mst@origlambda \let\mu\mst@origmu \let\nu\mst@orignu \let\xi\mst@origxi \let\omicron\mst@origomicron \let\pi\mst@origpi \let\varpi\mst@origvarpi \let\rho\mst@origrho \let\varrho\mst@origvarrho \let\sigma\mst@origsigma \let\varsigma\mst@origvarsigma \let\tau\mst@origtau \let\upsilon\mst@origupsilon \let\phi\mst@origphi \let\varphi\mst@origvarphi \let\chi\mst@origchi \let\psi\mst@origpsi \let\omega\mst@origomega \let\Digamma\mst@origDigamma \let\digamma\mst@origdigamma % \let\partial\mst@origpartial \let\wp\mst@origwp \let\ell\mst@origell } \renewcommand*{\MTcustomgreek}{% \let\Alpha\mst@Alpha \let\Beta\mst@Beta \let\Gamma\mst@Gamma \let\Delta\mst@Delta \let\Epsilon\mst@Epsilon \let\Zeta\mst@Zeta \let\Eta\mst@Eta \let\Theta\mst@Theta \let\Iota\mst@Iota \let\Kappa\mst@Kappa \let\Lambda\mst@Lambda \let\Mu\mst@Mu \let\Nu\mst@Nu \let\Xi\mst@Xi \let\Omicron\mst@Omicron \let\Pi\mst@Pi \let\Rho\mst@Rho \let\Sigma\mst@Sigma \let\Tau\mst@Tau \let\Upsilon\mst@Upsilon \let\Phi\mst@Phi \let\Chi\mst@Chi \let\Psi\mst@Psi \let\Omega\mst@Omega % \let\alpha\mst@alpha \let\beta\mst@beta \let\gamma\mst@gamma \let\delta\mst@delta \let\epsilon\mst@epsilon \let\varepsilon\mst@varepsilon \let\zeta\mst@zeta \let\eta\mst@eta \let\theta\mst@theta \let\vartheta\mst@vartheta \let\iota\mst@iota \let\kappa\mst@kappa \let\lambda\mst@lambda \let\mu\mst@mu \let\nu\mst@nu \let\xi\mst@xi \let\omicron\mst@omicron \let\pi\mst@pi \let\varpi\mst@varpi \let\rho\mst@rho \let\varrho\mst@varrho \let\sigma\mst@sigma \let\varsigma\mst@varsigma \let\tau\mst@tau \let\upsilon\mst@upsilon \let\phi\mst@phi \let\varphi\mst@varphi \let\chi\mst@chi \let\psi\mst@psi \let\omega\mst@omega \let\Digamma\mst@Digamma \let\digamma\mst@digamma % \let\partial\mst@partial \let\wp\mst@wp \let\ell\mst@ell } \fi \let\Mathastextstandardgreek\MTstandardgreek \let\Mathastextcustomgreek\MTcustomgreek \ifmst@subdued\else\MTcustomgreek\fi % \end{macrocode} % \end{macro}\end{macro}\end{macro} % \begin{macro}{\inodot} % \begin{macro}{\jnodot} % In |1.0|, I had them of type |mathord|, here I choose |mathalpha|. If I % used \cs{i} and \cs{j} from the text font the problem would be with the % fontsize, if in scriptstyle. The amsmath \cs{text} would do the trick. % % |1.14b| [2011/04/02]: again this bug in the EU1/EU2 encoding part, as in the % code redefining \$ etc in math mode (see above). Fixed. % \begin{macrocode} \edef\mst@tmp@enc{\encodingdefault} \mst@goaheadtrue \ifx\mst@tmp@enc\mst@eui % xetex and unicode font \XeTeXmathchardef\inodot="7 \symmtletterfont "0131 \relax \XeTeXmathchardef\jnodot="7 \symmtletterfont "0237 \relax \else \ifx\mst@tmp@enc\mst@euii % luatex and unicode font \luatexUmathchardef\inodot="7 \symmtletterfont "0131 \relax \luatexUmathchardef\jnodot="7 \symmtletterfont "0237 \relax \else \ifx\mst@tmp@enc\mst@ti % T1 \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{25} \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{26} \else \ifx\mst@tmp@enc\mst@oti % OT1 \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{16} \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{17} \else \ifx\mst@tmp@enc\mst@lyi % LY1 \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{16} \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{17} \else \ifmst@XeTeX\mst@goaheadfalse\else\ifmst@LuaTeX\mst@goaheadfalse\else \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont} {\expandafter\the\expandafter\csname\mst@tmp@enc\string\i\endcsname} \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont} {\expandafter\the\expandafter\csname\mst@tmp@enc\string\j\endcsname} \fi\fi \fi\fi\fi\fi\fi \ifmst@defaultimath\else\typeout{** \string\i\space and \string\j\space} \ifmst@goahead \renewcommand*{\imath}{\inodot} \renewcommand*{\jmath}{\jnodot} \let\mst@oldi\i \let\mst@oldj\j \DeclareRobustCommand*{\i}{\ifmmode\inodot\else\mst@oldi\fi} \DeclareRobustCommand*{\j}{\ifmmode\jnodot\else\mst@oldj\fi} \fi \fi % \end{macrocode} % \end{macro} % \end{macro} % \begin{macro}{math accents} % I don't know how to get from the encoding to the slot % positions of the accents (apart from going to look at % all possible encodings definition files and putting this % info here). In standard \LaTeX{}, the mathaccents are % taken from the `operators' font. So we do the same % here. Of course there is the problem that the user can % define math versions with different encodings. Here I % take T1 if it was the default at the time of loading the % package, else OT1. % |1.12b|: I add LY1 which is quasi like OT1 % \begin{macrocode} \edef\mst@tmp@enc{\encodingdefault} %% rather one too many than sorry \ifmst@mathaccents\typeout{** math accents} \ifx\mst@ti\mst@tmp@enc \DeclareMathAccent{\acute}{\mathalpha}{mtoperatorfont}{1} \DeclareMathAccent{\grave}{\mathalpha}{mtoperatorfont}{0} \DeclareMathAccent{\ddot}{\mathalpha}{mtoperatorfont}{4} \DeclareMathAccent{\tilde}{\mathalpha}{mtoperatorfont}{3} \DeclareMathAccent{\bar}{\mathalpha}{mtoperatorfont}{9} \DeclareMathAccent{\breve}{\mathalpha}{mtoperatorfont}{8} \DeclareMathAccent{\check}{\mathalpha}{mtoperatorfont}{7} \DeclareMathAccent{\hat}{\mathalpha}{mtoperatorfont}{2} \DeclareMathAccent{\dot}{\mathalpha}{mtoperatorfont}{10} \DeclareMathAccent{\mathring}{\mathalpha}{mtoperatorfont}{6} \else \DeclareMathAccent{\acute}{\mathalpha}{mtoperatorfont}{19} \DeclareMathAccent{\grave}{\mathalpha}{mtoperatorfont}{18} \DeclareMathAccent{\ddot}{\mathalpha}{mtoperatorfont}{127} \DeclareMathAccent{\tilde}{\mathalpha}{mtoperatorfont}{126} \DeclareMathAccent{\bar}{\mathalpha}{mtoperatorfont}{22} \DeclareMathAccent{\breve}{\mathalpha}{mtoperatorfont}{21} \DeclareMathAccent{\check}{\mathalpha}{mtoperatorfont}{20} \DeclareMathAccent{\hat}{\mathalpha}{mtoperatorfont}{94} \DeclareMathAccent{\dot}{\mathalpha}{mtoperatorfont}{95} \DeclareMathAccent{\mathring}{\mathalpha}{mtoperatorfont}{23} \ifx\mst@lyi\mst@tmp@enc % LY1 encoding \DeclareMathAccent{\dot}{\mathalpha}{mtoperatorfont}{5} \else \ifx\mst@oti\mst@tmp@enc\else \typeout{** mathastext: math accents have been assumed to be^^J% ** as in OT1 encoding.} \fi \fi \fi\fi % \end{macrocode} % \end{macro} % \begin{macro}{Math sizes} % I took the code for \cs{Huge} and \cs{HUGE} from the |moresize| package of % Christian~\textsc{Cornelssen} % \begin{macrocode} \ifmst@defaultsizes\else \providecommand\@xxxpt{29.86} \providecommand\@xxxvipt{35.83} \ifmst@twelve \def\Huge{\@setfontsize\Huge\@xxxpt{36}} \def\HUGE{\@setfontsize\HUGE\@xxxvipt{43}} \typeout{** \protect\Huge\space and \protect\HUGE\space have been (re)-defined.} \else \def\HUGE{\@setfontsize\HUGE\@xxxpt{36}} \typeout{** \protect\HUGE\space has been (re)-defined.} \fi % \end{macrocode} % I choose rather big subscripts. % \begin{macrocode} \def\defaultscriptratio{.8333} \def\defaultscriptscriptratio{.7} \DeclareMathSizes{9}{9}{7}{5} \DeclareMathSizes{\@xpt}{\@xpt}{8}{6} \DeclareMathSizes{\@xipt}{\@xipt}{9}{7} \DeclareMathSizes{\@xiipt}{\@xiipt}{10}{8} \DeclareMathSizes{\@xivpt}{\@xivpt}{\@xiipt}{10} \DeclareMathSizes{\@xviipt}{\@xviipt}{\@xivpt}{\@xiipt} \DeclareMathSizes{\@xxpt}{\@xxpt}{\@xviipt}{\@xivpt} \DeclareMathSizes{\@xxvpt}{\@xxvpt}{\@xxpt}{\@xviipt} \DeclareMathSizes{\@xxxpt}{\@xxxpt}{\@xxvpt}{\@xxpt} \DeclareMathSizes{\@xxxvipt}{\@xxxvipt}{\@xxxpt}{\@xxvpt} \typeout{** mathastext has declared larger sizes for subscripts.^^J% ** To keep LaTeX defaults, use option `defaultmathsizes\string'.} \fi % \end{macrocode} % \end{macro} % \DeleteShortVerb{\|} % \MakePercentComment % %<*dtx> \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 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) \# Dollar \$ Percent \% Ampersand \& Acute accent \' Left paren \( Right paren \) Asterisk \* Plus \+ Comma \, Minus \- Point \. Solidus \/ Colon \: Semicolon \; Less than \< Equals \= Greater than \> Question mark \? Commercial at \@ Left bracket \[ Backslash \\ Right bracket \] Circumflex \^ Underscore \_ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} \CheckSum{5184} \makeatletter\check@checksum\makeatother \Finale %% %% End of file `mathastext.dtx'.