diff options
author | Karl Berry <karl@freefriends.org> | 2011-03-12 23:55:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-03-12 23:55:50 +0000 |
commit | aca3c88c6c3ea09b39b5ecaea2d97e4c5b3cfc77 (patch) | |
tree | b3ac124c6e73789511061db220394f50f21bf910 /Master/texmf-dist/source | |
parent | 7b0a4c0345bd3b1608762f4eb480ef33e7d640a9 (diff) |
mathastext (12mar11)
git-svn-id: svn://tug.org/texlive/trunk@21699 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/mathastext/mathastext.dtx | 1240 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mathastext/mathastext.ins | 10 |
2 files changed, 821 insertions, 429 deletions
diff --git a/Master/texmf-dist/source/latex/mathastext/mathastext.dtx b/Master/texmf-dist/source/latex/mathastext/mathastext.dtx index ce5e9f43cb9..c3070bbba7c 100644 --- a/Master/texmf-dist/source/latex/mathastext/mathastext.dtx +++ b/Master/texmf-dist/source/latex/mathastext/mathastext.dtx @@ -1,14 +1,10 @@ % \iffalse meta-comment -% Time-stamp: <09-02-2011 23:34:54 CET JF> +% Time-stamp: <12-03-2011 10:58:48 CET JF> % File `mathastext.dtx' % % Copyright (C) 2011 by Jean-Francois Burnol % -% Please report errors to jfbu at free . fr -% Illustrative examples available at -% http://jf.burnol.free.fr/mathastext.html -% -% This file be distributed and/or modified under the +% This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, % either version 1.3 of this license or (at your % option) any later version. The latest version of @@ -16,11 +12,16 @@ % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of % LaTeX version 2003/12/01 or later. +% +% Please report errors to jfbu (at) free.fr +% Numerous examples are available at +% http://jf.burnol.free.fr/mathastext.html +% % \fi % \iffalse %<*dtx> \ProvidesFile{mathastext.dtx} - [2011/02/09 1.12b Use the text font in simple mathematics] + [2011/03/11 1.13 Use the text font in simple mathematics] %</dtx> % %<*driver> @@ -33,11 +34,12 @@ \setlength{\textwidth}{360pt} \setlength{\oddsidemargin}{46pt} \setlength{\marginparwidth}{100pt} -%% glyphs from the Symbol font +%% The Symbol font will be used in the text \DeclareSymbolFont{mtpsymbol}{U}{psy}{m}{n} \makeatletter \DeclareFontFamily{U}{psy}{} \DeclareFontShape{U}{psy}{m}{n}{<-> psyr}{} +%% the following is taken from the package itself \let\prod\undefined \DeclareMathSymbol{\prod}{\mathop}{mtpsymbol}{213} \let\sum\undefined @@ -110,20 +112,25 @@ \DeclareMathSymbol{\Im}{\mathord}{mtpsymbol}{"C1} \DeclareMathSymbol{\DotTriangle}{\mathord}{mtpsymbol}{92} %\RecordChanges -\OnlyDescription +%\OnlyDescription \begin{document} \DocInput{mathastext.dtx} \end{document} %</driver> % \fi -% +% \changes{1.13}{2011/03/11}{ +% * option LGRgreek: for fonts also available in LGR-encoding +% * internal changes: systematic use of `if' conditionals +% for better readability of the code and easier error-checking +% (done a bit late for that aspect, though... ) +% } +% % \changes{1.12b}{2011/02/09}{ % * a completely stupid bug regarding uppercase Greek is % corrected -% * I take this opportunity to add LY1 as supported +% * I take this opportunity to add LY1 as one of the supported % encoding for math accents -% * and I correct an orthographical mistake in the -% README +% * and I correct an orthographical mistake in the README % } % % \changes{1.12}{2011/02/07}{ @@ -219,22 +226,30 @@ % \end{center} % % \begin{abstract} -% The |mathastext| package\footnote{This document describes |mathastext| -% version \fileversion\ (\filedate).} propagates the document {\em text} -% font to {\em mathematical} mode, for the letters and digits of the Latin -% alphabet and, optionally, some further characters. The idea is to produce -% handouts or research papers with a less book-like typography than what is -% typical of standard \TeX\ with the Computer Modern fonts. Hopefully, this -% will force the reader to concentrate more on the contents ;-). It also -% makes it possible (for a document with simple mathematics) to use a quite -% arbitrary font without worrying too much that it does not have specially -% designed accompanying math fonts. Also, |mathastext| provides a simple -% mechanism in order to use many different choices of (text hence, now, -% math) fonts in the same document (not that we recommend it!). A final -% aspect is that |mathastext| helps sometimes produce smaller PDF files. +% The |mathastext| package\footnote{This document +% describes |mathastext| version \fileversion\ +% (\filedate).} propagates the document {\em text} font +% to {\em mathematical} mode, for the letters and digits +% of the Latin alphabet and a few further +% characters. Various possibilities are provided for +% Greek letters, including picking them up in the font +% itself, if the font is available in LGR-encoding. The +% initial idea was to produce handouts or research papers +% with a less book-like typography than what is typical +% of standard \TeX-\LaTeX{} with the Computer Modern +% fonts, but equipped with a very uniform look (with the +% hope to coerce the reader into concentrating more onto +% the contents ;-).) A side-effect is that 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, |mathastext| +% provides a simple mechanism in order to use more than +% one math-as-text font in the same document (not that we +% recommend it!). A final aspect is that |mathastext| +% helps sometimes produce smaller PDF files. % % \begin{center} -% Further documentation, and examples, are available here:\\ +% Numerous examples are available here:\\ % |http://jf.burnol.free.fr/mathastext.html| % \end{center} % \end{abstract} @@ -263,160 +278,265 @@ % \DeleteShortVerb{\|} % \centerline{!\,?\,*\,,\,.\,:\,;\,+\,\textendash\,=\,(\,)\,[\,]\,/\,\#\,% % \$\,\%\,\&\,$\mathord{<}\,\mathord{>}\,\mathord{|}$\,\{\,\} -% and $\backslash$} If the package detects at the time of -% being loaded that the default encoding is OT1, it takes -% out from the list +% and $\backslash$} +% +% Note: if the package detects OT1 as default encoding it +% will take out from the list % $\mathord{<}\,\mathord{>}\,\mathord{|}$\,\{\,\} and -% $\backslash$. \MakeShortVerb{\|} The option -% |alldelims| will force re-integration in case one wants -% to use a fixed-width OT1 font. +% $\backslash$\MakeShortVerb{\|} as they are not available +% in OT1, except for the typewriter fonts; the option +% |alldelims| forces re-integration in this case. % % The commands \cs{mathnormal}, \cs{mathrm} and -% \cs{mathbf} are modified but nothing is changed to -% \cs{mathit} and to the other math alphabet commands which -% will use the default math fonts, not the text font. -% -% A very short list of further glyphs will be also picked -% up in or constructed from the text font: the dotless i -% and j, the hbar and the math accents. By default the -% en-dash \textendash{} is used for the minus sign and -% not the hyphen character -. Version |1.12| brings a -% better compatibility with a Unicode setting (assuming -% that |fontspec| is made use of), but the scope of -% |mathastext| does not include letters with diacritics -% such as \'e, \`a, \"o in math mode. Users of Xe\TeX{} -% are advised to look at the |mathspec| package which has -% a much wider scope than |mathastext|. +% \cs{mathbf} are modified to now make use of the text +% font; but nothing is changed to \cs{mathit} and the +% other math alphabet commands which will use the default +% math fonts, not the text font. +% +% The en-dash (\textendash{}) is used for the minus sign, +% rather than the hyphen (-) character. Additionally, +% some further glyphs will also be picked up in the text +% font: the dotless i and j, the hbar and the math +% accents. Version |1.12| brought a better compatibility +% with a Unicode setting (assuming that |fontspec| is +% made use of), but the scope of |mathastext| does not +% include letters with diacritics such as \'e, \`a, \"o +% in math mode. Users of Unicode engines and fonts are +% advised to look at the |mathspec| and |unicode-math| +% packages which have a much wider scope than +% |mathastext|. % % Even when typesetting simple mathematics, some glyphs -% may have to be taken from the default math fonts, for -% example the prime ${}'$. +% (almost) must be taken from the default math fonts: in +% particular the prime ${}'$ for derivatives, as the text +% font {}'{} is not, as a rule, a satisfying +% alternative. Also, the package does nothing special +% regarding the large math symbols (except for $\prod$ +% and $\sum$ whose ``non-large'' versions may be taken +% from the Symbol Font). % % \subsection{The italic option} % -% In the initial version |1.0|, the package gave the same -% shape to both letters and digits, either the one given -% by \cs{shapedefault} at the time of loading the -% package, or another one specified by the user, and this -% was deliberate. This gives a very uniform look to the -% document, so that one has to make an effort and read it -% with attention, I explained above why I did this on -% purpose. -% -% Nevertheless, soon after I posted the package to CTAN, I was overwhelmed -% by numerous\footnote{this means ``more then one.''} questions\footnote{I -% thank in particular Tariq~\textsc{Perwez} and Kevin~\textsc{Klement} for -% their kind remarks (chronological order).} on how to have -% the letters be in italic shape. -% -% The version |1.1| provided precisely this feature. 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|. There is now also an option |frenchmath| to -% make the uppercase letters nevertheless upright, because this -% is the way of traditional French mathematical typography. +% 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, I explained above +% why I did this on purpose. +% +% 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 +% Tariq~\textsc{Perwez} and Kevin~\textsc{Klement} for +% their kind remarks (chronological order).} on how to +% have the letters be in italic shape. +% +% Starting with version |1.1| 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 italic Latin letters in math +% mode. There is also an option |frenchmath|\footnote{in +% versions of the package prior to |1.13|, it was +% necessary to also pass the option |italic| to enable +% |frenchmath|. This is now superfluous.} to make the uppercase letters +% nevertheless upright, because this is the way of +% traditional French mathematical typography. % % \subsection{Greek letters} % -% Regarding the Greek letters: the default (lowercase) -% ones from Computer Modern are slanted, hence, if the -% |italic| option just mentioned is not made use of, they -% will not mix well with upright letters (besides, the -% Computer Modern typefaces are very light in comparison -% to many text fonts). So there are options to take these -% glyphs either from the Euler font or from the -% Postscript Symbol font. Both are included in all -% \LaTeX{} distributions. Although no package loading is -% necessary for the user, nor done internally by -% |mathastext|, the file |uzeur.fd| from the |eulervm| -% package must be accessible to \LaTeX{} as it provides a -% mechanism to scale by an arbitrary factor the Euler -% font. For the Postscript Symbol font (which is included -% in the basic \LaTeX{} distribution), |mathastext| does -% internally what is necessary, so that in both cases -% commands are provided so that the user can scale the -% font with respect to nominal size. -% -% Of course, it is also possible to access upright Greek -% letters via loading first specific packages providing math -% fonts, for example the |fourier| package (with option -% `upright'). One just has to make sure to load |mathastext| as -% the last one of the font-related packages. -% -% \subsection{Math versions} -% -% \LaTeX{} has two math versions (|normal| and |bold|): -% |mathastext| provides a straightforward mechanism to define -% many more. The encodings of the various |mathastext|-defined versions -% can be arbitrary; but as |mathastext| decides at the time -% when it is loaded where to look for things like the en-dash, -% or the dotless i and j, or the math accents, which are -% encoding-dependent, there are obviously some limitations to -% the use of these things in more than one math -% version. Here is an example of how this goes: +% The Computer Modern fonts are very light 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 |mathastext|: +% \begin{description} +% \item[$<$\textemdash$>$:] 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.\footnote{among examples known to the author are +% the Comfortaa and the Droid (serif and sans) fonts, +% and of course the Greek Font Society fonts such as +% GFS Didot.} The letters (but see below) will be in +% the same shape as the Latin letters, or upright in +% case of the option |frenchmath|. +% \item[eulergreek:] the Greek letters will be taken from +% the Euler font which is included in all \LaTeX{} +% distributions (although no package loading is +% necessary for the user, nor done by |mathastext|, the +% file |uzeur.fd| from the |eulervm| package must be +% accessible to \LaTeX{} 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) Symbol font. A command is provided +% so that the user can scale the Symbol font to let it +% better mix with the text font. The letters are upright. +% \item[selfGreek:] this option has limited use; it is +% for OT1-encoded text fonts which do provide the +% glyphs for the capital Greek letters. It does nothing +% for the lowercase Greek letters. +% \end{description} +% +% \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 font are not available in italic +% shape, so this raises issues only in the case of the +% options |LGRgreek| and |selfGreek|. The |mathastext| +% default is to let the Greek letters have the same shape +% as the Latin letters (and be upright in the case of +% option |frenchmath|.) +% +% A finer control is provided by options |upgreek|, +% |itgreek|, |upGreek|, |itGreek|: the former first two +% control both lower- and uppercase, the latter control +% only the uppercase shape. So classic \TeX{} is +% |itgreek|+|upGreek|, ISO is |itgreek|, and French is +% |upgreek|. +% +% Note that, as mentioned before, the options |italic| +% and |frenchmath| act on both Latin and Greek letters, +% so |italic| gives ISO behavior, and |frenchmath| gives +% French behavior,\footnote{In fact, |frenchmath| confers +% to the Greek letters and uppercase Latin letters the +% same shape as to the operator-names and digits, so +% generally speaking this will be the \cs{shapedefault} +% at the time of loading the package. If this shape is +% not the upright one and one still wants upright Greek, +% then it is thus necessary to use |upgreek|.} without +% need to use the \DeleteShortVerb{|}\MakeShortVerb{*} +% *[up|it][g|G]reek*\DeleteShortVerb{*}\MakeShortVerb{|} +% options. +% +% Again, all of this applies only in case of option +% |LGRgreek| and to a lesser extent, |selfGreek|. And to +% recapitulate, people wanting the classic \TeX{} +% behavior will use |italic|+|upGreek|, or +% |itgreek|+|upGreek| in the absence of |italic|. +% +% +% +% \subsection{Advanced use: math versions} +% +% +% It is not infrequent to use two different text fonts in +% the same document. In the context of the |mathastext| +% design goals it was thus necessary to find a way to let +% changes of the text font also propagate to math +% mode. For this the package extends the \LaTeX{} +% mechanism of math versions. However this is only for +% Latin letters, digits, and the other characters +% mentioned above, but not for Greek letters: the choice +% of a Greek-related option (or none) at the time of +% loading the package will affect all math versions. This +% does mean though that in the case of the |LGRgreek| +% option changing the text font will also change the font +% for the Greek letters. But it is not possible (in the +% current version of the package) to have one part of the +% document use the Euler font for Greek letters and +% another part use the Symbol font (it is possible to +% use both fonts simultaneously but Symbol will then be +% employed for various mathematical symbols, not for +% Greek, see option |symbolmax|). +% +% Let us now see a small document using four math versions: % \begin{verbatim} +% \documentclass{minimal} % \usepackage[T1]{fontenc} % \usepackage{mathastext} -% % Latin Modern Typewriter Proportional +% % declares Latin Modern Typewriter Proportional: % \MTDeclareVersion{lmvtt}{T1}{lmvtt}{m}{n} -% % Baskervald, letters in italics +% % declares Baskervald, italic letters in math: % \MTDeclareVersion[it]{baskervald}{T1}{ybv}{m}{n} -% % Bold Helvetica, digits and operator names slanted -% % and letters (in math mode only) upright +% % declares Helvetica-Bold-Slanted, but upright +% % letters in math mode: % \MTDeclareVersion[n]{helvetica}{T1}{phv}{b}{sl} % \begin{document} % \MTVersion{helvetica} -% Hello $world!$. +% Bold-slanted Helvetica in text, +% $bold\ upright\ Helvetica\ in\ math$.\\ % \MTVersion[lmvtt]{baskervald} -% Here lmvtt but $here\ baskervald$. +% Text in lmvtt but $math\ in\ Baskervald-Italic$.\\ % \MTVersion{normal} -% Default font when loading mathastext, $in\ math\ also$. +% The normal version uses the default text font at +% the time of loading mathastext, $in\ math\ also\ of\ course$. % \end{document} % \end{verbatim} -% Other ways to achieve the same result: +% The encodings of the various |mathastext|-defined versions +% can be arbitrary; but as |mathastext| decides at the time +% when it is loaded where to look for things like the en-dash, +% or the dotless i and j, or the math accents, which are +% encoding-dependent, there are obviously some limitations to +% the use of these things in more than one math +% version. +% +% +% The package provides various macros to interface with +% its `math versions' functionalities. These commands are +% detailed in a later section. As an example, here is an +% equivalent manner to set up our small document: % \begin{verbatim} +% \documentclass{minimal} % \usepackage[T1]{fontenc} % \usepackage{mathastext} % \renewcommand{\rmdefault}{lmvtt} -% \Mathastext[lmvtt] +% \Mathastext[lmvtt] % Declares the `lmvtt' version % \renewcommand{\rmdefault}{ybv} % \MTlettershape{it} -% \Mathastext[baskervald] +% \Mathastext[baskervald] % Declares the `baskervald' version % \renewcommand{\shapedefault}{sl} % \renewcommand{\rmdefault}{phv} % \renewcommand{\mddefault}{b} % \MTlettershape{n} -% \Mathastext[helvetica] +% \Mathastext[helvetica] % Declares the `helvetica' version % \begin{document} -% \MTVersion{helvetica} -% Hello $world!$. +% \MTVersion{helvetica} % use `helvetica' both in text and math +% Bold-slanted Helvetica in text, $bold\ upright\ Helvetica\ in\ math$.\\ % \MTVersion[lmvtt]{baskervald} -% Here lmvtt but $here\ baskervald$. +% Text in lmvtt but $math\ in\ Baskervald-Italic$.\\ % \MTVersion{normal} -% Default font when loading mathastext, $in\ math\ also$. +% The normal version uses the default text font at +% the time of loading mathastext, $in\ math\ also\ of\ course$. % \end{document} % \end{verbatim} % Unicode \TeX{} engines and fonts can also be % accomodated. It is recommended to load the package -% |fontspec|. Here is an example (a bit schizophrenic) -% for a Xe\TeX{} or Lua\LaTeX{} user. Of course -% |mathastext| does not really define a math font, as it -% applies basically only to a subset of the 32-127 ascii -% range: the package |mathspec| has a far wider scope and -% is recommended to Xe\TeX{} users. +% |fontspec|. Of course |mathastext| is extremely far +% from really defining a math font, as it applies +% basically only to a subset of the 32-127 ascii +% range. And it does not know how to use a given Unicode font +% simultaneously for Latin and Greek letters: interested people are +% advised to look at packages |mathspec| and +% |unicode-math|. Here is an example (a bit +% schizophrenic) of a document with mathastext-versions +% for a Xe\TeX{} or Lua\LaTeX{} user: % \begin{verbatim} +% \documentclass{minimal} % \usepackage[no-math]{fontspec} % \setmainfont{comfortaa} % \usepackage{mathastext} % the normal version uses Comfortaa % \setmainfont{TeX Gyre Pagella} -% \Mathastext[pagella] % the pagella version uses Pagella +% \Mathastext[pagella] % the pagella version uses +% % TeX Gyre Pagella % \MTDeclareVersion{times}{T1}{ptm}{m}{n} -% % this is a T1-times. Do not try to use this -% % command for a Unicode font, use rather the -% % \setmainfont command of |fontspec|, -% % followed by \Mathastext +% % this is a T1-encoded URW Times. +% % Do not use this interface for a Unicode font, +% % use rather as above the \setmainfont +% % command of |fontspec|, followed by \Mathastext % \setmainfont{TeX Gyre Schola} -% \Mathastext[schola] % and unicode TeX Gyre Schola +% \Mathastext[schola] % and the schola version uses +% % unicode TeX Gyre Schola % \begin{document} % \MTVersion{pagella} % This is in TeX Gyre Pagella $and\ this\ also$ (unicode font). @@ -430,22 +550,22 @@ % % \subsection{Main options} % \begin{description} -% \item[{\tt italic, frenchmath:}] were described above (new in |1.1|). -% \item[{\tt symbolgreek:}] the Greek letters will be taken from the -% Postscript Symbol font. -% \item[{\tt eulergreek:}] the Greek letters will be taken from the Euler -% font. -% \item[{\tt symbolmax:}] all characters other than -% letters and digits will be taken from the Symbol -% font. This option also makes a number of further -% glyphs available, including some basic mathematical -% arrows, as well as the sum and product signs. For -% documents with very simple needs in mathematical -% symbols, the options |symbolmax| may give in the end -% a quite smaller PDF file, as the Computer Modern -% fonts, or whatever mathematical fonts initially -% loaded by packages for use in the document, may sometimes -% be avoided altogether. +% \item[{\tt italic, frenchmath:}] italic letters in +% math, upright uppercase if |frenchmath|. +% \item[{\tt 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[{\tt symbolmax:}] all characters listed supra, +% other than letters and digits, are taken from the +% Symbol font. This option also makes a number of +% further glyphs available, including some basic +% mathematical arrows, as well as the sum and product +% signs. For documents with very simple needs in +% mathematical symbols, |mathastext| with option +% |symbolmax| may give in the end a PDF file quite +% smaller than the one one would get without the +% package. % \item[{\tt defaultmathsizes:}] the package |mathastext| opts for bigger % subscripts (and, copied from the |moresize| package, redefines % \cs{Huge} and defines \cs{HUGE}). Use this option to prevent it from @@ -459,10 +579,10 @@ % 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. In version |1.12| of the package this -% `en-dash as minus' should work in all encodings, -% including Unicode (if |fontspec| -% has been loaded). +% 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[hbar:] The definition of \cs{hbar} inherited from @@ -578,7 +698,7 @@ % is the Helvetica font in T1-encoding, regular % (medium) series, upright shape, and the letters % will be in italic shape. -% \item with version |1.12| \cs{Mathastext} accepts an +% \item starting with version |1.12| \cs{Mathastext} accepts an % optional argument, which will serve as a name to % designate the corresponding math version. Without % optional argument \cs{Mathastext} redefines the default @@ -630,12 +750,14 @@ % \subsection{Body Text and Math commands} % % \begin{itemize} -% \item |\MTVersion|\oarg{nametext}\marg{namemath}: in -% the absence of the optional argument changes -% simultaneously the text and the math font to be the -% font corresponding to the version \meta{namemath}. If -% there is an optional argument then the text font will -% use \meta{nametext} and the math mode will use +% \item +% |\MTVersion|\oarg{nametext}\marg{namemath}:\footnote{\cs{MTVersion} +% is also available as \cs{MTversion}.} in the absence +% of the optional argument changes simultaneously the +% text and the math font to be the font corresponding +% to the version \meta{namemath}. If there is an +% optional argument then the text font will use +% \meta{nametext} and the math mode will use % \meta{namemath}. To change only the math font, use % the \LaTeX{} command \cs{mathversion}. % \end{itemize} @@ -679,6 +801,15 @@ % |eulergreek| or |selfGreek| was passed to the % package. Also an \cs{omicron} control sequence is % provided. +% \item LGR Greek and `var'-letters: only the +% \cs{varsigma} is from the font, others such as +% \cs{varphi} will load the previous default math +% font. So when re-compiling a previously written +% document it might be suitable to +% \cs{let}\cs{varphi}$=$\cs{phi}, +% \cs{let}\cs{varepsilon}$=$\cs{epsilon}, etc\dots, +% when only the `variant' form of the letter was used +% therein. % \item Miscelleneous mathematical symbols from the % postscript Symbol font are made available (or % replaced) when option |symbolmisc| is passed. They @@ -719,10 +850,13 @@ % \item |basic|: only mathastextify letters and digits. % \item |italic|: the letters will default to italic shape in % math mode. -% \item |frenchmath|: uppercase Latin letters in the same font as for digits -% and operator names. In general this means that they will be upright. -% \item |endash|, |emdash|: use the text font en-dash \textendash\ or even -% the em-dash \textemdash\ (but this seems crazy) for the minus sign +% \item |frenchmath|: |italic|, 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 |LGRgreek| option, this generally upright shape will +% be applied also to 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 |noendash|: the minus sign will be the - from the % text font, not the en-dash \textendash. @@ -759,8 +893,13 @@ % \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. % \item |selfGreek|: this is for a font which has the capital Greek % letters at the OT1 slot positions. +% \item |upgreek|, |itgreek|, |upGreek|, |itGreek|: +% optional specification of the shapes of the Greek +% letters, or only of the uppercase Greek letters. Only operant +% in the case of the |LGRgreek| and |selfGreek| 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 @@ -770,21 +909,23 @@ % \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. -% \item |fouriervec|: provides a \cs{fouriervec} command. +% \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{itemize} % % Thanks to Kevin~\textsc{Klement}, Tariq~\textsc{Perwez} % and Ricard~\textsc{Torres} for bug reports and feature requests. % % \StopEventually{} -% +% % \section{Commented source code} % % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathastext.sty} - [2011/02/09 1.12b Use the text font in simple mathematics] + [2011/03/11 1.13 Use the text font in simple mathematics] % \end{macrocode} % I copied these macros from the |iftex| package of Vafa~\textsc{Khalighi}. % Perhaps I should rather require the package? @@ -830,6 +971,8 @@ \edef\m@stextsh{\shapedefault} \edef\m@stextbold{\bfdefault} \edef\m@stextshletter{\shapedefault} +\newif\ifmt@proceed +\newif\ifmt@failed % \end{macrocode} % \end{macro} % \end{macro} @@ -837,104 +980,114 @@ % \end{macro} % \end{macro} % \end{macro} -% A number of ifs for treating (some among) the options -% \begin{macrocode} -\newif\ifmt@need@euler\mt@need@eulerfalse -\newif\ifmt@need@symbol\mt@need@symbolfalse -\newif\ifmt@defaultnormal\mt@defaultnormalfalse -\newif\ifmt@defaultrm\mt@defaultrmfalse -\newif\ifmt@defaultbf\mt@defaultbffalse -\newif\ifmt@defaultsizes\mt@defaultsizesfalse -\newif\ifmt@twelve\mt@twelvefalse -%% new behavior in v1.11: -\newif\ifmt@endash\mt@endashtrue -\newif\ifmt@emdash\mt@emdashfalse +% March 9, 2011: v1.13 introduces the option LGRgreek; and I +% make systematic use of \cs{if...} conditionals, for better +% readability of the code and error checking (too late for +% that!), although this means using a bit more of TeX +% resources. +% \begin{macrocode} \def\mt@oti{OT1}\def\mt@ti{T1} \def\mt@eui{EU1}\def\mt@euii{EU2} -\newif\ifmt@alldelims -\ifx\mt@oti\m@stextenc\mt@alldelimsfalse\else\mt@alldelimstrue\fi -%% new in v1.12b: \def\mt@lyi{LY1} % \end{macrocode} -% The options: +% \begin{macro}{Package options} % \begin{macrocode} -%% new or modified in v1.11: -\DeclareOption{fouriervec}{\let\mt@fouriervec\@empty} -\DeclareOption{nolessnomore}{\mt@alldelimsfalse} +\newif\ifmt@italic\DeclareOption{italic}{\mt@italictrue + \edef\m@stextshletter{\itdefault}} +\newif\ifmt@frenchmath +\DeclareOption{frenchmath}{\mt@frenchmathtrue + \ExecuteOptions{italic}} +%% +\newif\ifmt@endash\mt@endashtrue \DeclareOption{endash}{\mt@endashtrue} -\DeclareOption{emdash}{\mt@emdashtrue\mt@endashfalse} \DeclareOption{noendash}{\mt@endashfalse} -\DeclareOption{symboldelimiters}{\mt@need@symboltrue - \let\mt@symboldelimiters\@empty} -%% new in v1.1: -\DeclareOption{italic}{\let\mt@italic\@empty\edef\m@stextshletter{\itdefault}} -\DeclareOption{frenchmath}{\let\mt@frenchmath\@empty} -\DeclareOption{noplus}{\let\mtno@plus\@empty} -\DeclareOption{nominus}{\let\mtno@minus\@empty} -\DeclareOption{nohbar}{\let\mtno@hbar\@empty} +\newif\ifmt@emdash\DeclareOption{emdash}{\mt@emdashtrue\mt@endashfalse} %% -\DeclareOption{noparenthesis}{\let\mtno@paren\@empty} -\DeclareOption{nopunctuation}{\let\mtno@punct\@empty} +\newif\ifmt@alldelims +\DeclareOption{alldelims}{\mt@alldelimstrue} +\ifx\mt@oti\m@stextenc\else\mt@alldelimstrue\fi +\DeclareOption{nolessnomore}{\mt@alldelimsfalse} +%% +\newif\ifmt@noplus\DeclareOption{noplus}{\mt@noplustrue} +\newif\ifmt@nominus\DeclareOption{nominus}{\mt@nominustrue} \DeclareOption{noplusnominus}{\ExecuteOptions{noplus,nominus}} -\DeclareOption{noequal}{\let\mtno@equal\@empty} -\DeclareOption{noexclam}{\let\mtno@exclam\@empty} -\DeclareOption{noasterisk}{\let\mtno@ast\@empty} -\DeclareOption{nospecials}{\let\mtno@specials\@empty} +%% +\newif\ifmt@noparen\DeclareOption{noparenthesis}{\mt@noparentrue} +\newif\ifmt@nopunct\DeclareOption{nopunctuation}{\mt@nopuncttrue} +\newif\ifmt@noequal\DeclareOption{noequal}{\mt@noequaltrue} +\newif\ifmt@noexclam\DeclareOption{noexclam}{\mt@noexclamtrue} +\newif\ifmt@noast\DeclareOption{noasterisk}{\mt@noasttrue} +\newif\ifmt@nospecials\DeclareOption{nospecials}{\mt@nospecialstrue} \DeclareOption{basic}{\ExecuteOptions{noparenthesis,nopunctuation,% noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} -\DeclareOption{nodigits}{\let\mtno@digits\@empty} -\DeclareOption{defaultimath}{\let\mt@defaultimath\@empty} -\DeclareOption{alldelims}{\mt@alldelimstrue} -\DeclareOption{mathaccents}{\let\mt@mathaccents\@empty} -\DeclareOption{selfGreek}{\let\mt@selfGreek\@empty} -\DeclareOption{selfgreek}{\let\mt@selfGreek\@empty} -\DeclareOption{symboldigits}{\mt@need@symboltrue - \let\mt@symboldigits\@empty} -\DeclareOption{symbolgreek}{\mt@need@symboltrue - \let\mt@symbolgreek\@empty} -\DeclareOption{symbolre}{\mt@need@symboltrue - \let\mt@symbolre\@empty} -\DeclareOption{symbolmisc}{\mt@need@symboltrue - \let\mt@symbolmisc\@empty} +%% +\newif\ifmt@nohbar\DeclareOption{nohbar}{\mt@nohbartrue} +\newif\ifmt@nodigits\DeclareOption{nodigits}{\mt@nodigitstrue} +\newif\ifmt@defaultimath\DeclareOption{defaultimath}{\mt@defaultimathtrue} +\newif\ifmt@mathaccents\DeclareOption{mathaccents}{\mt@mathaccentstrue} +%% +\newif\ifmt@selfGreek + \DeclareOption{selfGreek}{\mt@selfGreektrue} + \DeclareOption{selfgreek}{\mt@selfGreektrue} +\newif\ifmt@LGRgreek\DeclareOption{LGRgreek}{\mt@LGRgreektrue} +%% +\newif\ifmt@needsymbol +\newif\ifmt@symboldelimiters +\DeclareOption{symboldelimiters}{\mt@needsymboltrue\mt@symboldelimiterstrue} +\newif\ifmt@symboldigits +\DeclareOption{symboldigits}{\mt@needsymboltrue\mt@symboldigitstrue} +\newif\ifmt@symbolgreek +\DeclareOption{symbolgreek}{\mt@needsymboltrue\mt@symbolgreektrue} +\newif\ifmt@symbolre +\DeclareOption{symbolre}{\mt@needsymboltrue\mt@symbolretrue} +\newif\ifmt@symbolmisc +\DeclareOption{symbolmisc}{\mt@needsymboltrue\mt@symbolmisctrue} \DeclareOption{symbol}{\ExecuteOptions{symbolgreek,symbolmisc,symbolre}} \DeclareOption{symbolmax}{\ExecuteOptions{symbol,symboldelimiters}} -\DeclareOption{eulerdigits}{\mt@need@eulertrue\let\mt@eulerdigits\@empty} -\DeclareOption{eulergreek}{\mt@need@eulertrue\let\mt@eulergreek\@empty} +%% +\newif\ifmt@needeuler +\newif\ifmt@eulerdigits +\DeclareOption{eulerdigits}{\mt@needeulertrue\mt@eulerdigitstrue} +\newif\ifmt@eulergreek +\DeclareOption{eulergreek}{\mt@needeulertrue\mt@eulergreektrue} +%% +\newif\ifmt@twoshapesforgreek +\newif\ifmt@upgreek +\newif\ifmt@itgreek +\newif\ifmt@upGreek +\newif\ifmt@itGreek +\DeclareOption{upgreek}{\mt@upgreektrue} +\DeclareOption{itgreek}{\mt@itgreektrue} +\DeclareOption{upGreek}{\mt@twoshapesforgreektrue\mt@upGreektrue} +\DeclareOption{itGreek}{\mt@twoshapesforgreektrue\mt@itGreektrue} +%% +\newif\ifmt@defaultnormal \DeclareOption{defaultnormal}{\mt@defaultnormaltrue} +\newif\ifmt@defaultrm \DeclareOption{defaultrm}{\mt@defaultrmtrue} +\newif\ifmt@defaultbf \DeclareOption{defaultbf}{\mt@defaultbftrue} % \end{macrocode} % We intend to change the default script and scriptscript sizes, and also to % declare a \cs{HUGE} size and modify the \cs{Huge} one at 12pt (taken from % the |moresize| package). So we have an option to maintain default situation. % \begin{macrocode} -\DeclareOption{defaultmathsizes}{\mt@defaultsizestrue} -\DeclareOption{12pt}{\mt@twelvetrue} +\newif\ifmt@defaultsizes\DeclareOption{defaultmathsizes}{\mt@defaultsizestrue} +\newif\ifmt@twelve\DeclareOption{12pt}{\mt@twelvetrue} +\newif\ifmt@fouriervec\DeclareOption{fouriervec}{\mt@fouriervectrue} \DeclareOption*{\PackageWarning{mathastext}{Unknown option `\CurrentOption'}} -\ProcessOptions\relax -% \end{macrocode} %% -% \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}. -% \begin{macrocode} -\ifx\mt@fouriervec\@empty - \DeclareFontEncoding{FML}{}{} - \DeclareFontSubstitution{FML}{futm}{m}{it} - \DeclareSymbolFont{mtfourierpourvec}{FML}{futm}{m}{it} - \SetSymbolFont{mtfourierpourvec}{bold}{FML}{futm}{b}{it} - \DeclareMathAccent{\fouriervec}{\mathord}{mtfourierpourvec}{"7E} -\fi +\ProcessOptions\relax % \end{macrocode} % \end{macro} % \begin{macro}{mtoperatorfont} -% Declaration of the current default font as our math font. +% 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} {\m@stextenc}{\m@stextfam}{\m@stextser}{\m@stextsh} @@ -951,36 +1104,85 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareSymbolFontAlphabet{\Mathnormal}{mtletterfont} \DeclareSymbolFontAlphabet{\Mathrm}{mtoperatorfont} % \end{macrocode} -% Our internal variables redefined without expansion. They will get expanded -% inside the \cs{Mathastext} macro. +% \end{macro} +% \begin{macro}{LGRgreek} +% \begin{macro}{mtlgrfont} +% \begin{macro}{mtlgrfontupper} +% The LGRgreek option necessitates to define at least one +% additional symbol font |mtlgrfont|, and possibly a further +% one |mtlgrfontupper| for uppercase Greek. % \begin{macrocode} - \def\m@stextenc{\encodingdefault} - \def\m@stextfam{\familydefault} - \def\m@stextser{\seriesdefault} - \def\m@stextsh{\shapedefault} - \def\m@stextbold{\bfdefault} - \def\m@stextshletter{\shapedefault} - \ifx\mt@italic\@empty\def\m@stextshletter{\itdefault}\fi +\ifmt@LGRgreek + \DeclareFontEncoding{LGR}{}{} + \DeclareSymbolFont{mtlgrfont}{LGR} + {\m@stextfam}{\m@stextser}{\m@stextshletter} + \def\mtlgrfontupper{mtlgrfont} + \ifmt@twoshapesforgreek + \ifmt@upGreek + \DeclareSymbolFont{mtlgrfontupper}{LGR}{\m@stextfam}{\m@stextser}{n} + \else + \DeclareSymbolFont{mtlgrfontupper}{LGR}{\m@stextfam}{\m@stextser}{it} + \fi + \def\mtlgrfontupper{mtlgrfontupper} + \fi +\else % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{selfGreek} +% \begin{macro}{mtselffontupper} +% \begin{macro}{\mt@uppergreekfont} +% We must also make provisions for a possible additional +% font for uppercase Greek, in the case of the option +% selfGreek, when the shape is not necessarily +% \cs{m@stextsh} (that is \cs{shapedefault}). +% \begin{macrocode} +\ifmt@selfGreek\mt@proceedfalse + \ifmt@upGreek\def\mt@tmp{n}\mt@proceedtrue\else + \ifmt@upgreek\def\mt@tmp{n}\mt@proceedtrue\else + \ifmt@itGreek\def\mt@tmp{it}\mt@proceedtrue\else + \ifmt@itgreek\def\mt@tmp{it}\mt@proceedtrue + \fi\fi\fi\fi + \ifmt@proceed + \def\mt@uppergreekfont{mtselffontupper} + \DeclareSymbolFont{mtselffontupper}{\m@stextenc} % should be OT1! + {\m@stextfam}{\m@stextser}{\mt@tmp} + \else + \ifmt@frenchmath + \def\mt@uppergreekfont{mtoperatorfont} + \else + \def\mt@uppergreekfont{mtletterfont} + \fi +% \end{macrocode} +% Used to be mtoperatorfont in versions prior to 1.13, so typically +% upright. Not the case anymore (in the case of option italic for +% example), to comply to ISO standard. Use upGreek if necessary. +% \begin{macrocode} + \fi +\fi\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % \begin{macro}{mteulervm} % \begin{macro}{\MathEuler} % 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} -\ifmt@need@euler +\ifmt@needeuler \DeclareSymbolFont{mteulervm}{U}{zeur}{m}{n} \DeclareSymbolFontAlphabet{\MathEuler}{mteulervm} -%% \SetSymbolFont{mteulervm}{bold}{U}{zeur}{\m@stextbold}{n} \fi \newcommand\MTEulerScale[1]{\edef\zeu@Scale{#1}} \let\MathastextEulerScale\MTEulerScale % \end{macrocode} % \end{macro} % \end{macro} -% In the end, I moved the bold stuff to \cs{Mathastext} as the user may want -% his choice of |boldvariant| to have effect on the Euler font (it is -% possible to use \cs{Mathastextboldvariant}|{m}|). +% In the end, I moved the bold stuff to \cs{Mathastext} as +% the user may want his choice of |boldvariant| to have +% effect on the Euler font (it is possible to use +% \cs{Mathastextboldvariant}|{m}|). % % \LaTeXe{} has a strange initial configuration where the % capital Greek letters are of type |mathalpha|, but the @@ -989,30 +1191,31 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % 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 +% 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 also the lowercase Greek letters -% to be of type |mathalpha|, the default \cs{mathbf} and -% \cs{mathrm} will act wierdly on them, but a new -% \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 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. It would be tricky -% but not impossible to coerce \cs{mathbf} to do something -% reasonable. I posted the method I have in mind to the texhax -% mailing list -% (|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. +% 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. It would be tricky but not +% impossible to coerce \cs{mathbf} to do something +% reasonable. I posted the method I have in mind to the +% texhax mailing list +% (|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 follow the simpler idea of the |eulervm| package and % define \cs{MathEuler} and \cs{MathEulerBold} alphabet @@ -1024,25 +1227,38 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \cs{psy@scale} will be used to scale the font (see at the % very end of this file). % \begin{macrocode} -\ifmt@need@symbol +\ifmt@needsymbol \def\psy@scale{1} \DeclareSymbolFont{mtpsymbol}{U}{psy}{m}{n} -%% \SetSymbolFont{mtpsymbol}{bold}{U}{psy}{\m@stextbold}{n} \DeclareSymbolFontAlphabet{\MathPSymbol}{mtpsymbol} \fi \newcommand\MTSymbolScale[1]{\edef\psy@scale{#1}} \let\MathastextSymbolScale\MTSymbolScale % \end{macrocode} -% In v1.0 the math alphabet was called \cs{MathastextSymbol}. I did not -% choose the name \cs{MathSymbol} as this name may be -% defined somewhere for another thing. +% I did not choose the name \cs{MathSymbol} as this name 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} -% There is no bold for the postscript Symbol font -% distributed with the \LaTeXe{} |psnffs|. In v1.0 I -% included some code ready for an eventual bold, one never -% knows which might come in an update to the |psnfss| -% package, but, if this day arrives, I or someone else shall -% simply upgrade the package. +% \begin{macro}{\fouriervec} +% The glyph is taken from the Fourier font of Michel~\textsc{Bovani}. +% \begin{macrocode} +\ifmt@fouriervec + \DeclareFontEncoding{FML}{}{} + \DeclareFontSubstitution{FML}{futm}{m}{it} + \DeclareSymbolFont{mtfourierpourvec}{FML}{futm}{m}{it} + \SetSymbolFont{mtfourierpourvec}{bold}{FML}{futm}{b}{it} + \DeclareMathAccent{\fouriervec}{\mathord}{mtfourierpourvec}{"7E} +\fi +% \end{macrocode} % \end{macro} % \begin{macro}{\MTencoding} % \begin{macro}{\MTfamily} @@ -1050,23 +1266,19 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \begin{macro}{\MTshape} % \begin{macro}{\MTboldvariant} % \begin{macro}{\MTlettershape} -% We declare 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, already making -% italic letters easy for the user was only made possible by a moment of -% weakness of the package author. +% Some public macros to modify our private internals, and +% we will use them also ourself. % -% In version 1.11 I fix bugs in the way this was all set -% up. I change the macro names for brevity sake. +% 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. % \begin{macrocode} \DeclareRobustCommand\MTencoding[1]{\def\m@stextenc{#1}} \DeclareRobustCommand\MTfamily[1]{\def\m@stextfam{#1}} \DeclareRobustCommand\MTseries[1]{\def\m@stextser{#1}} \DeclareRobustCommand\MTshape[1]{\def\m@stextsh{#1} - \ifx\mt@italic\@empty\else\def\m@stextshletter{#1}\fi} + \ifmt@italic\else\def\m@stextshletter{#1}\fi} \DeclareRobustCommand\MTboldvariant[1]{\def\m@stextbold{#1}} \DeclareRobustCommand\MTlettershape[1]{\def\m@stextshletter{#1}} \let\Mathastextencoding\MTencoding @@ -1099,15 +1311,22 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \fi \Mathastext} \let\MathastextWillUse\MTWillUse +\let\Mathastextwilluse\MTWillUse % \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. +% 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. +% 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. % \begin{macrocode} \DeclareRobustCommand\Mathastext[1][\@empty]{ \mt@font@info@off @@ -1137,7 +1356,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} {\mt@family@normal} {\mt@series@normal} {\mt@shape@normal} - \SetSymbolFont{mtoperatorfont}{bold} {\mt@encoding@bold} + \SetSymbolFont{mtoperatorfont}{bold} {\mt@encoding@bold} {\mt@family@bold} {\mt@series@bold} {\mt@shape@bold} @@ -1162,23 +1381,68 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \end{macrocode} % \end{macro} % \begin{macro}{\MathEulerBold} -% We define it here as we leave open the possibility to deactivate it via -% using \cs{Mathastextboldvariant}|{m}|. +% We define it here as we leave open the possibility for the +% user to type \cs{Mathastextboldvariant}|{m}|. % \begin{macrocode} - \ifmt@need@euler + \ifmt@needeuler \SetSymbolFont{mteulervm}{bold}{U}{zeur}{\mt@boldvariant@normal}{n} \DeclareMathAlphabet{\MathEulerBold}{U}{zeur}{\mt@boldvariant@normal}{n} \fi % \end{macrocode} % \end{macro} % \begin{macrocode} - \ifmt@need@symbol\SetSymbolFont{mtpsymbol}{bold} - {U}{psy}{\mt@boldvariant@normal}{n}\fi - \typeout{** Latin letters in math versions normal (resp. bold) are now^^J% + \ifmt@needsymbol\SetSymbolFont{mtpsymbol}{bold} + {U}{psy}{\mt@boldvariant@normal}{n} + \fi +% \end{macrocode} +% \begin{macro}{LGRgreek} +% LGRgreek option. +% \begin{macrocode} + \ifmt@LGRgreek + \ifmt@upgreek\def\mt@tmp{n} + \else\ifmt@itgreek\def\mt@tmp{it} + \else\ifmt@frenchmath\def\mt@tmp{\mt@shape@normal} + \else\def\mt@tmp{\mt@ltshape@normal} + \fi\fi\fi + \SetSymbolFont{mtlgrfont}{normal}{LGR} + {\mt@family@normal}{\mt@series@normal}{\mt@tmp} + \SetSymbolFont{mtlgrfont}{bold}{LGR} + {\mt@family@bold}{\mt@boldvariant@normal}{\mt@tmp} + \ifmt@twoshapesforgreek + \ifmt@upGreek\def\mt@tmp{n}\else\def\mt@tmp{it}\fi + \SetSymbolFont{mtlgrfontupper}{normal}{LGR} + {\mt@family@normal}{\mt@series@normal}{\mt@tmp} + \SetSymbolFont{mtlgrfontupper}{bold}{LGR} + {\mt@family@bold}{\mt@boldvariant@bold}{\mt@tmp} + \fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{selfGreek} +% selfGreek option. +% \begin{macrocode} + \else + \ifmt@selfGreek + \mt@proceedfalse + \ifmt@upGreek\def\mt@tmp{n}\mt@proceedtrue\else + \ifmt@upgreek\def\mt@tmp{n}\mt@proceedtrue\else + \ifmt@itGreek\def\mt@tmp{it}\mt@proceedtrue\else + \ifmt@itgreek\def\mt@tmp{it}\mt@proceedtrue + \fi\fi\fi\fi + \ifmt@proceed + \SetSymbolFont{mtselffontupper}{normal}{\mt@encoding@normal} + {\mt@family@normal}{\mt@series@normal}{\mt@tmp} + \SetSymbolFont{mtselffontupper}{bold}{\mt@encoding@bold} + {\mt@family@bold}{\mt@boldvariant@bold}{\mt@tmp} + \fi +\fi\fi +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\typeout{** Latin letters in math versions normal (resp. bold) are now^^J% ** set up to use the fonts \mt@encoding@normal/\mt@family@normal/\mt@series@normal% (\mt@boldvariant@normal)/\mt@ltshape@normal} -\ifx\mtno@digits\@empty\else +\ifmt@nodigits\else \typeout{** Other characters (digits, ...) and \protect\log-like names will be^^J% ** typeset with the \expandafter`\mt@shape@normal' shape.} @@ -1214,13 +1478,13 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \begin{macrocode} \DeclareRobustCommand\MTDeclareVersion[6][\@empty]{ \mt@font@info@off - \edef\mt@tmp{#2} - \DeclareMathVersion{\mt@tmp} - \expandafter\edef\csname mt@encoding@\mt@tmp\endcsname{#3} - \expandafter\edef\csname mt@family@\mt@tmp\endcsname{#4} - \expandafter\edef\csname mt@series@\mt@tmp\endcsname{#5} - \expandafter\edef\csname mt@shape@\mt@tmp\endcsname{#6} - \expandafter\edef\csname mt@boldvariant@\mt@tmp\endcsname{\m@stextbold} + \edef\mt@version{#2} + \DeclareMathVersion{\mt@version} + \expandafter\edef\csname mt@encoding@\mt@version\endcsname{#3} + \expandafter\edef\csname mt@family@\mt@version\endcsname{#4} + \expandafter\edef\csname mt@series@\mt@version\endcsname{#5} + \expandafter\edef\csname mt@shape@\mt@version\endcsname{#6} + \expandafter\edef\csname mt@boldvariant@\mt@version\endcsname{\m@stextbold} \newif\ifmt@reallynoopt\mt@reallynoopttrue \ifx\@empty#1 \else % we check nevertheless for [] situation, will not work with [ ] @@ -1228,36 +1492,95 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \ifx\mt@@tmp\mt@empty\else\mt@reallynooptfalse\fi \fi \ifmt@reallynoopt - \ifx\mt@italic\@empty + \ifmt@italic \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{\m@stextshletter} \typeout{** Latin letters in math version `#2' will use the font #3/#4/#5/\m@stextshletter^^J% ** Other characters (digits, ...) and \protect\log-like names will be in `#6' shape.} - \expandafter\def\csname mt@ltshape\mt@tmp\endcsname{\m@stextshletter} + \expandafter\edef\csname mt@ltshape@\mt@version\endcsname{\m@stextshletter} \else \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#6} \typeout{** Latin letters in math version `#2' will use the fonts #3/#4/#5(\m@stextbold)/#6} - \expandafter\edef\csname mt@ltshape\mt@tmp\endcsname{#6} + \expandafter\edef\csname mt@ltshape@\mt@version\endcsname{#6} \fi \else \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#1} \typeout{** Latin letters in math version `#2' 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 mt@ltshape\mt@tmp\endcsname{#1} + ** Other characters (digits, ...) and \protect\log-like + names will be in `#6' shape.} + \expandafter\edef\csname mt@ltshape@\mt@version\endcsname{#1} \fi \SetMathAlphabet{\Mathbf}{#2}{#3}{#4}{\m@stextbold}{#6} \SetSymbolFont{mtoperatorfont}{#2}{#3}{#4}{#5}{#6} - \ifmt@need@euler + \ifmt@needeuler \SetMathAlphabet{\MathEulerBold}{#2}{U}{zeur}{\m@stextbold}{n} \fi +% \end{macrocode} +% \begin{macro}{mtlgrfont} +% In the case of option LGRgreek, it is expected that the +% fonts used in each math versions exist in LGR encoding. +% \begin{macrocode} + \ifmt@LGRgreek + \ifmt@upgreek\def\mt@tmp{n} + \else\ifmt@itgreek\def\mt@tmp{it} + \else\ifmt@frenchmath\def\mt@tmp{\csname mt@shape@\mt@version\endcsname} + \else\def\mt@tmp{\csname mt@ltshape@\mt@version\endcsname} + \fi\fi\fi + \SetSymbolFont{mtlgrfont}{#2}{LGR}{#4}{#5}{\mt@tmp} +%% \typeout{** Greek letters in math version `#2' will use the font +%% LGR/#4/#5/\mt@tmp} + \ifmt@twoshapesforgreek + \ifmt@upGreek\def\mt@tmp{n}\else\def\mt@tmp{it}\fi + \SetSymbolFont{mtlgrfontupper}{#2}{LGR}{#4}{#5}{\mt@tmp} +%% \typeout{** Uppercase Greek letters in math version `#2' will use the font +%% LGR/#4/#5/\mt@tmp} + \fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{mtlgrfont} +% selfGreek +% \begin{macrocode} +\else + \ifmt@selfGreek + \mt@proceedfalse + \ifmt@upGreek\def\mt@tmp{n}\mt@proceedtrue\else + \ifmt@upgreek\def\mt@tmp{n}\mt@proceedtrue\else + \ifmt@itGreek\def\mt@tmp{it}\mt@proceedtrue\else + \ifmt@itgreek\def\mt@tmp{it}\mt@proceedtrue + \fi\fi\fi\fi + \ifmt@proceed + \SetSymbolFont{mtselffontupper}{#2}{#3}{#4}{#5}{\mt@tmp} + \fi +\fi\fi +% \end{macrocode} +% \end{macro} +% \begin{macrocode} \mt@font@info@on } \let\MathastextDeclareVersion\MTDeclareVersion % \end{macrocode} % \end{macro} +% We redefine our internal variables without expansion +% so that they get a chance to be also (indirectly or +% directly) modified by user later choices regarding +% \cs{encodingdefault}, etc\dots, previous to a user call to +% \cs{Mathastext} or \cs{Mathastextwilluse}. +% \begin{macrocode} + \def\m@stextenc{\encodingdefault} + \def\m@stextfam{\familydefault} + \def\m@stextser{\seriesdefault} + \def\m@stextsh{\shapedefault} + \def\m@stextbold{\bfdefault} + \def\m@stextshletter{\shapedefault} + \ifmt@italic\def\m@stextshletter{\itdefault}\fi +% \end{macrocode} +% Initialization call: +% \begin{macrocode} +\Mathastext +% \end{macrocode} % \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 @@ -1272,21 +1595,21 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \def\operator@font{\mathgroup\symmtoperatorfont} % \end{macrocode} % \end{macro} -% Initialization call: -% \begin{macrocode} -\Mathastext -% \end{macrocode} +% \begin{macro}{\mathnormal} +% \begin{macro}{\mathrm} +% \begin{macro}{\mathbf} % We redefine the normal, rm and bf alphabets. In version 1.1 we % follow the standard: normal gives the font for letters, rm gives % the font for digits and log-like names, bf for the bold series % of the font for digits and log-like names. % -% We will access by default the \cs{omicron} via -% \cs{mathnormal}. So we save it for future use. But -% unfortunately the Fourier package with the upright option does -% not have an upright omicron obtainable by simply typing -% \cs{mathnormal}|{o}|. So in this case we shall use \cs{mathrm} -% and not \cs{mathnormal}. +% We will access by default (if no option is passed for +% Greek) the \cs{omicron} via \cs{mathnormal}. So we save it +% for future use. But unfortunately the Fourier package +% with the upright option does not have an upright omicron +% obtainable by simply typing \cs{mathnormal}|{o}|. So in +% this case we shall use \cs{mathrm} and not +% \cs{mathnormal}. % \begin{macrocode} \let\mt@saved@mathnormal\mathnormal \@ifpackageloaded{fourier}{\ifsloped\else\let\mt@saved@mathnormal\mathrm\fi}{} @@ -1294,20 +1617,29 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \ifmt@defaultrm\else\renewcommand{\mathrm}{\Mathrm}\fi \ifmt@defaultbf\else\renewcommand{\mathbf}{\Mathbf}\fi % \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % We write appropriate messages to the terminal and the log. % \begin{macrocode} -\ifx\mt@symbolgreek\@empty -\typeout{** Greek letters will use the PostScript Symbol font. Use^^J% -** \protect\MathastextSymbolScale{factor} to scale the font by <factor>.} -\fi -\ifx\mt@eulergreek\@empty -\typeout{** Greek letters will use the Euler font. Use^^J% -** \protect\MathastextEulerScale{factor} to scale the font by <factor>.} -\fi -\ifx\mt@selfGreek\@empty -\typeout{** Capital Greek letters from the fonts declared for latin letters:^^J% +%% \ifmt@LGRgreek +%% \typeout{** Greek letters will use the font +%% LGR/\mt@family@normal/\mt@series@normal/\mt@ltshape@normal} +%% \else +\ifmt@selfGreek + \typeout{** Capital Greek letters will be taken from the fonts + declared for latin letters:^^J% ** only for OT1 or compatible encodings; glyphs may be unavailable.} -\fi +\else +\ifmt@eulergreek + \typeout{** Greek letters will use the Euler font. Use^^J% +** \protect\MathastextEulerScale{<factor>} to scale the font.} +\else +\ifmt@symbolgreek + \typeout{** Greek letters will use the PostScript Symbol font. Use^^J% +** \protect\MathastextSymbolScale{<factor>} to scale the font.} +\fi\fi\fi +%%\fi % \end{macrocode} % \begin{macro}{\MTVersion} % This is a wrapper around \LaTeX{}'s \cs{mathversion}: here we have an @@ -1316,28 +1648,30 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareRobustCommand\MTVersion[2][\@empty]{% \mathversion{#2}% \ifx\@empty#1% no optional argument - \edef\mt@tmp{@#2} + \edef\mt@tmp{#2} \else% we check nevertheless for [] situation, will not work with [ ] \def\mt@@tmp{#1}\def\mt@empty{}% - \ifx\mt@@tmp\mt@empty\edef\mt@tmp{@#2}% - \else\edef\mt@tmp{@#1}% + \ifx\mt@@tmp\mt@empty\edef\mt@tmp{#2}% + \else\edef\mt@tmp{#1}% \fi% \fi% - \usefont{\csname mt@encoding\mt@tmp\endcsname}% - {\csname mt@family\mt@tmp\endcsname}% - {\csname mt@series\mt@tmp\endcsname}% - {\csname mt@shape\mt@tmp\endcsname}% - \edef\mt@@encoding{\csname mt@encoding\mt@tmp\endcsname}% + \usefont{\csname mt@encoding@\mt@tmp\endcsname}% + {\csname mt@family@\mt@tmp\endcsname}% + {\csname mt@series@\mt@tmp\endcsname}% + {\csname mt@shape@\mt@tmp\endcsname}% + \edef\mt@@encoding{\csname mt@encoding@\mt@tmp\endcsname}% \renewcommand{\encodingdefault}{\mt@@encoding}% - \edef\mt@@family{\csname mt@family\mt@tmp\endcsname}% + \edef\mt@@family{\csname mt@family@\mt@tmp\endcsname}% \renewcommand{\rmdefault}{\mt@@family}% - \edef\mt@@series{\csname mt@series\mt@tmp\endcsname}% + \edef\mt@@series{\csname mt@series@\mt@tmp\endcsname}% \renewcommand{\mddefault}{\mt@@series}% - \edef\mt@@shape{\csname mt@shape\mt@tmp\endcsname}% + \edef\mt@@shape{\csname mt@shape@\mt@tmp\endcsname}% \renewcommand{\updefault}{\mt@@shape}% - \edef\mt@@boldvariant{\csname mt@boldvariant\mt@tmp\endcsname}% + \edef\mt@@boldvariant{\csname mt@boldvariant@\mt@tmp\endcsname}% \renewcommand{\bfdefault}{\mt@@boldvariant}} \let\MathastextVersion\MTVersion +\let\Mathastextversion\MTVersion +\let\MTversion\MTVersion % \end{macrocode} % \end{macro} % At last we now change the font for the letters of the latin alphabet. @@ -1369,7 +1703,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareMathSymbol{x}{\mathalpha}{mtletterfont}{`x} \DeclareMathSymbol{y}{\mathalpha}{mtletterfont}{`y} \DeclareMathSymbol{z}{\mathalpha}{mtletterfont}{`z} -\ifx\mt@frenchmath\@empty\def\mt@font@tbu{mtoperatorfont} +\ifmt@frenchmath\def\mt@font@tbu{mtoperatorfont} \else\def\mt@font@tbu{mtletterfont}\fi \DeclareMathSymbol{A}{\mathalpha}{\mt@font@tbu}{`A} \DeclareMathSymbol{B}{\mathalpha}{\mt@font@tbu}{`B} @@ -1398,14 +1732,14 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareMathSymbol{Y}{\mathalpha}{\mt@font@tbu}{`Y} \DeclareMathSymbol{Z}{\mathalpha}{\mt@font@tbu}{`Z} %% -\ifx\mtno@digits\@empty\else +\ifmt@nodigits\else \def\mt@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} -\ifx\mt@symboldigits\@empty \def\mt@font@tbu{mtpsymbol} \fi -\ifx\mt@eulerdigits\@empty \def\mt@font@tbu{mteulervm} \fi +\ifmt@symboldigits \def\mt@font@tbu{mtpsymbol} \fi +\ifmt@eulerdigits \def\mt@font@tbu{mteulervm} \fi \DeclareMathSymbol{0}{\mathalpha}{\mt@font@tbu}{`0} \DeclareMathSymbol{1}{\mathalpha}{\mt@font@tbu}{`1} \DeclareMathSymbol{2}{\mathalpha}{\mt@font@tbu}{`2} @@ -1422,7 +1756,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % Symbol font for the printable characters other than % letters and digits. % \begin{macrocode} -\ifx\mt@symboldelimiters\@empty +\ifmt@symboldelimiters \def\mt@font@tbu{mtpsymbol} \mt@endashfalse \mt@emdashfalse @@ -1430,12 +1764,12 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \def\mt@font@tbu{mtoperatorfont} \fi %% -\ifx\mtno@exclam\@empty\else +\ifmt@noexclam\else \DeclareMathSymbol{!}{\mathclose}{\mt@font@tbu}{"21} \DeclareMathSymbol{?}{\mathclose}{\mt@font@tbu}{"3F} \fi %% -\ifx\mtno@ast\@empty\else +\ifmt@noast\else \DeclareMathSymbol{*}{\mathalpha}{\mt@font@tbu}{"2A} \fi % \end{macrocode} @@ -1446,14 +1780,14 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % 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). % \begin{macrocode} -\ifx\mtno@punct\@empty\else +\ifmt@nopunct\else \DeclareMathSymbol{,}{\mathpunct}{\mt@font@tbu}{"2C} \DeclareMathSymbol{.}{\mathord}{\mt@font@tbu}{"2E} -\DeclareMathSymbol{:}{\mathrel}{\mt@font@tbu}{"3A} +\DeclareMathSymbol{:}{\mathrel}{\mt@font@tbu}{"3A} % relation spacing \@ifpackageloaded{amsmath} - {} - {\let\colon\undefined - \DeclareMathSymbol{\colon}{\mathpunct}{\mt@font@tbu}{"3A}} + {} %\colon defined in amsmath.sty (enlarged punctuation spacing) + {\let\colon\undefined % no amsmath, use punctuation spacing + \DeclareMathSymbol{\colon}{\mathpunct}{\mt@font@tbu}{"3A}} \DeclareMathSymbol{;}{\mathpunct}{\mt@font@tbu}{"3B} \fi % \end{macrocode} @@ -1462,7 +1796,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % have to redefine \cs{Relbar} and \cs{relbar} in order for % them to preserve their original meanings. % \begin{macrocode} -\ifx\mtno@minus\@empty\else +\ifmt@nominus\else \edef\mt@minus@sign{\mathord{\expandafter\mathchar\number\mathcode`\-}} \def\relbar{\mathrel{\smash\mt@minus@sign}} \def\rightarrowfill{$\m@th\mt@minus@sign\mkern-7mu% @@ -1484,7 +1818,6 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % fontspec encodings EU1 and EU2) % 2011/02/07, v1.12. Improved dealing of unicode engines. % \begin{macrocode} -\newif\ifmt@failed \def\do@the@endashstuff{\edef\mt@enc{\m@stextenc} \ifx\mt@enc\mt@eui % xetex+fontspec \XeTeXmathcode`\-="2 "\the\symmtoperatorfont "2013 \relax @@ -1527,7 +1860,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} {\expandafter\the\expandafter\csname\mt@enc\string\textemdash\endcsname} \fi\fi \fi\fi\fi\fi\fi} -\ifx\mtno@minus\@empty\else +\ifmt@nominus\else \mt@failedfalse \ifmt@endash\do@the@endashstuff\else \ifmt@emdash\do@the@emdashstuff\else @@ -1572,7 +1905,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \fi \def\hbar{\mathrlap{\mt@ltbar{\ }}h} \fi\fi} -\ifx\mtno@hbar\@empty\else\do@the@hbarstuff\fi +\ifmt@nohbar\else\do@the@hbarstuff\fi % \end{macrocode} % \end{macro} % \end{macro} @@ -1588,10 +1921,10 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % whether upright or in italics. % \begin{macro}{+,=,\Relbar} % \begin{macrocode} -\ifx\mtno@plus\@empty\else +\ifmt@noplus\else \DeclareMathSymbol{+}{\mathbin}{\mt@font@tbu}{"2B} \fi -\ifx\mtno@equal\@empty\else +\ifmt@noequal\else \edef\mt@equal@sign{{\expandafter\mathchar\number\mathcode`\=}} \DeclareRobustCommand\Relbar{\mathrel{\mt@equal@sign}} \DeclareMathSymbol{=}{\mathrel}{\mt@font@tbu}{"3D} @@ -1600,7 +1933,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \end{macro} % \begin{macro}{(,),[,],/} % \begin{macrocode} -\ifx\mtno@paren\@empty\else +\ifmt@noparen\else \DeclareMathDelimiter{(}{\mathopen} {\mt@font@tbu}{"28}{largesymbols}{"00} \DeclareMathDelimiter{)}{\mathclose}{\mt@font@tbu}{"29}{largesymbols}{"01} \DeclareMathDelimiter{[}{\mathopen} {\mt@font@tbu}{"5B}{largesymbols}{"02} @@ -1613,7 +1946,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \begin{macro}{alldelims} % \begin{macrocode} \ifmt@alldelims -%% \ifx\mt@symboldelimiters\@empty\else +%% \ifmt@symboldelimiters\else %% \ifx\mt@ti\mt@enc\else %% \typeout{** mathastext: `alldelims'. Characters <,>,{,},| will be assumed %% to^^J% @@ -1650,7 +1983,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % We never take the specials from the Symbol (Adobe) font, as they are not all % available there. % \begin{macrocode} -\ifx\mtno@specials\@empty\else +\ifmt@nospecials\else \renewcommand{\#}{\ifmmode\edef\ms@tmp{7\the\symmtoperatorfont23}% \mathchar\expandafter"\ms@tmp\relax\else\char"23\relax\fi} \renewcommand{\$}{\ifmmode\edef\ms@tmp{7\the\symmtoperatorfont24}% @@ -1672,7 +2005,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % combine easily with the logical arrows, well, I could have done some box % manipulations, but well, life is finite. % \begin{macrocode} -\ifx\mt@symbolmisc\@empty +\ifmt@symbolmisc \let\prod\undefined \DeclareMathSymbol{\prod}{\mathop}{mtpsymbol}{213} \let\sum\undefined @@ -1746,7 +2079,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \begin{macro}{symbolre} % I like the \cs{Re} and \cs{Im} from Symbol, so I overwrite the CM ones. % \begin{macrocode} -\ifx\mt@symbolre\@empty +\ifmt@symbolre \DeclareMathSymbol{\Re}{\mathord}{mtpsymbol}{"C2} \DeclareMathSymbol{\Im}{\mathord}{mtpsymbol}{"C1} \DeclareMathSymbol{\DotTriangle}{\mathord}{mtpsymbol}{92} @@ -1754,22 +2087,12 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % \end{macrocode} % \end{macro} % \begin{macro}{Greek letters} -% selfGreek $>$ eulergreek $>$ symbolgreek -% -% v1.1 We declare control sequences for the capital Greek letters -% which look like their latin counterparts. If \cs{digamma} is -% defined, presumably some package has been loaded for greek -% letters and we do not change anything (except if option -% symbolgreek or eulergreek or selfgreek was passed). I took -% motivation for this from the Xe\LaTeX{} package |mathspec|, -% which I didn't know about when writing up the version |1.0| of -% the present package. The goals of |mathastext| are much more -% restricted than those achieved by |mathspec|. +% LGRgreek $>$ selfGreek $>$ eulergreek $>$ symbolgreek % % v1.11 I correct some bugs on how eulergreek and % symbolgreek interacted. % -% v.12b I introduced another very stupid bug (regarding +% v1.12b I introduced another very stupid bug (regarding % uppercase Greek) in v1.1. This is corrected here. All this % business of checking for \cs{digamma} was truly stupid as % some package might well have defined the font for Greek @@ -1778,20 +2101,41 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % started redefining uppercase Greek, and it is even worse % than that as I was redefining not only relatively benign % things such as \cs{Alpha} but also \cs{Phi} etc\dots -% +% +% v1.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. +% * version 1.12b did not define the \cs{omicron} in the case when no +% Greek-related option was passed to the package. This was a bug. % \begin{macrocode} -\newif\ifmt@dogreek\mt@dogreektrue \let\mt@mathord\mathalpha -\ifx\mt@selfGreek\@empty \def\mt@font@tbu{mtoperatorfont} - \else -\ifx\mt@eulergreek\@empty \def\mt@font@tbu{mteulervm} - \else -\ifx\mt@symbolgreek\@empty \def\mt@font@tbu{mtpsymbol} - \let\mt@mathord\mathord - \else - \mt@dogreekfalse -\fi\fi\fi -\ifmt@dogreek +\mt@proceedtrue +\ifmt@selfGreek + \def\mt@font@tbu{\mt@uppergreekfont} + \else +\ifmt@eulergreek + \def\mt@font@tbu{mteulervm} + \else +\ifmt@symbolgreek + \def\mt@font@tbu{mtpsymbol} + \let\mt@mathord\mathord + \else +\ifmt@LGRgreek + \mt@proceedfalse + \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} + \mt@proceedfalse + \ifx\omicron\undefined + \newcommand{\omicron}{\mt@saved@mathnormal{o}} + \fi +\fi\fi\fi\fi +\ifmt@proceed \DeclareMathSymbol{\Alpha}{\mt@mathord}{\mt@font@tbu}{"41} \DeclareMathSymbol{\Beta}{\mt@mathord}{\mt@font@tbu}{"42} \DeclareMathSymbol{\Epsilon}{\mt@mathord}{\mt@font@tbu}{"45} @@ -1823,7 +2167,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareMathSymbol{\Delta}{\mathord}{mtpsymbol}{"44} \DeclareMathSymbol{\Theta}{\mathord}{mtpsymbol}{"51} \DeclareMathSymbol{\Lambda}{\mathord}{mtpsymbol}{"4C} -\DeclareMathSymbol{\Xi}{\mathord}{mtpsymbol}{"58} %% was "59 in v10 +\DeclareMathSymbol{\Xi}{\mathord}{mtpsymbol}{"58} \DeclareMathSymbol{\Pi}{\mathord}{mtpsymbol}{"50} \DeclareMathSymbol{\Sigma}{\mathord}{mtpsymbol}{"53} \DeclareMathSymbol{\Upsilon}{\mathord}{mtpsymbol}{"A1} @@ -1849,11 +2193,6 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \fi \fi % \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 needed if the package |fourier| was loaded in its -% |upright| variant: we then take \cs{omicron} from the (original) rm alphabet. -% % 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|. @@ -1861,11 +2200,9 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % 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| -% -% v1.12b: I define \cs{omicron} only if (eulergreek or -% symbolgreek) OR it was not defined % \begin{macrocode} -\ifx\mt@eulergreek\@empty +\ifmt@proceed +\ifmt@eulergreek \DeclareMathSymbol{\alpha} {\mathalpha}{mteulervm}{"0B} \DeclareMathSymbol{\beta} {\mathalpha}{mteulervm}{"0C} \DeclareMathSymbol{\gamma} {\mathalpha}{mteulervm}{"0D} @@ -1901,7 +2238,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareMathSymbol{\wp}{\mathalpha}{mteulervm}{"7D} \DeclareMathSymbol{\ell}{\mathalpha}{mteulervm}{"60} \else -\ifx\mt@symbolgreek\@empty +\ifmt@symbolgreek \DeclareMathSymbol{\alpha}{\mathord}{mtpsymbol}{"61} \DeclareMathSymbol{\beta}{\mathord}{mtpsymbol}{"62} \DeclareMathSymbol{\gamma}{\mathord}{mtpsymbol}{"67} @@ -1935,10 +2272,64 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareMathSymbol{\varphi}{\mathord}{mtpsymbol}{"6A} \DeclareMathSymbol{\partial}{\mathord}{mtpsymbol}{"B6} \DeclareMathSymbol{\wp}{\mathord}{mtpsymbol}{"C3} -\else -\ifx\omicron\undefined -\newcommand{\omicron}{\mt@saved@mathnormal{o}}\fi -\fi\fi +\fi\fi\fi +%% +\ifmt@LGRgreek +\DeclareMathSymbol{\Alpha}{\mathalpha}{\mtlgrfontupper}{65} +\DeclareMathSymbol{\Beta}{\mathalpha}{\mtlgrfontupper}{66} +\DeclareMathSymbol{\Gamma}{\mathalpha}{\mtlgrfontupper}{71} +\DeclareMathSymbol{\Delta}{\mathalpha}{\mtlgrfontupper}{68} +\DeclareMathSymbol{\Epsilon}{\mathalpha}{\mtlgrfontupper}{69} +\DeclareMathSymbol{\Zeta}{\mathalpha}{\mtlgrfontupper}{90} +\DeclareMathSymbol{\Eta}{\mathalpha}{\mtlgrfontupper}{72} +\DeclareMathSymbol{\Theta}{\mathalpha}{\mtlgrfontupper}{74} +\DeclareMathSymbol{\Iota}{\mathalpha}{\mtlgrfontupper}{73} +\DeclareMathSymbol{\Kappa}{\mathalpha}{\mtlgrfontupper}{75} +\DeclareMathSymbol{\Lambda}{\mathalpha}{\mtlgrfontupper}{76} +\DeclareMathSymbol{\Mu}{\mathalpha}{\mtlgrfontupper}{77} +\DeclareMathSymbol{\Nu}{\mathalpha}{\mtlgrfontupper}{78} +\DeclareMathSymbol{\Xi}{\mathalpha}{\mtlgrfontupper}{88} +\DeclareMathSymbol{\Omicron}{\mathalpha}{\mtlgrfontupper}{79} +\DeclareMathSymbol{\Pi}{\mathalpha}{\mtlgrfontupper}{80} +\DeclareMathSymbol{\Rho}{\mathalpha}{\mtlgrfontupper}{82} +\DeclareMathSymbol{\Sigma}{\mathalpha}{\mtlgrfontupper}{83} +\DeclareMathSymbol{\Tau}{\mathalpha}{\mtlgrfontupper}{84} +\DeclareMathSymbol{\Upsilon}{\mathalpha}{\mtlgrfontupper}{85} +\DeclareMathSymbol{\Phi}{\mathalpha}{\mtlgrfontupper}{70} +\DeclareMathSymbol{\Chi}{\mathalpha}{\mtlgrfontupper}{81} +\DeclareMathSymbol{\Psi}{\mathalpha}{\mtlgrfontupper}{89} +\DeclareMathSymbol{\Omega}{\mathalpha}{\mtlgrfontupper}{87} +% +\DeclareMathSymbol{\alpha}{\mathalpha}{mtlgrfont}{97} +\DeclareMathSymbol{\beta}{\mathalpha}{mtlgrfont}{98} +\DeclareMathSymbol{\gamma}{\mathalpha}{mtlgrfont}{103} +\DeclareMathSymbol{\delta}{\mathalpha}{mtlgrfont}{100} +\DeclareMathSymbol{\epsilon}{\mathalpha}{mtlgrfont}{101} +\DeclareMathSymbol{\zeta}{\mathalpha}{mtlgrfont}{122} +\DeclareMathSymbol{\eta}{\mathalpha}{mtlgrfont}{104} +\DeclareMathSymbol{\theta}{\mathalpha}{mtlgrfont}{106} +\DeclareMathSymbol{\iota}{\mathalpha}{mtlgrfont}{105} +\DeclareMathSymbol{\kappa}{\mathalpha}{mtlgrfont}{107} +\DeclareMathSymbol{\lambda}{\mathalpha}{mtlgrfont}{108} +\DeclareMathSymbol{\mu}{\mathalpha}{mtlgrfont}{109} +\DeclareMathSymbol{\nu}{\mathalpha}{mtlgrfont}{110} +\DeclareMathSymbol{\xi}{\mathalpha}{mtlgrfont}{120} +\DeclareMathSymbol{\omicron}{\mathalpha}{mtlgrfont}{111} +\DeclareMathSymbol{\pi}{\mathalpha}{mtlgrfont}{112} +\DeclareMathSymbol{\rho}{\mathalpha}{mtlgrfont}{114} +\DeclareMathSymbol{\varsigma}{\mathalpha}{mtlgrfont}{99} +\DeclareMathSymbol{\sigma}{\mathalpha}{mtlgrfont}{115} +\DeclareMathSymbol{\tau}{\mathalpha}{mtlgrfont}{116} +\DeclareMathSymbol{\upsilon}{\mathalpha}{mtlgrfont}{117} +\DeclareMathSymbol{\phi}{\mathalpha}{mtlgrfont}{102} +\DeclareMathSymbol{\chi}{\mathalpha}{mtlgrfont}{113} +\DeclareMathSymbol{\psi}{\mathalpha}{mtlgrfont}{121} +\DeclareMathSymbol{\omega}{\mathalpha}{mtlgrfont}{119} +\DeclareMathSymbol{\digamma}{\mathalpha}{mtlgrfont}{147} +\DeclareMathSymbol{\Digamma}{\mathalpha}{mtlgrfont}{195} +% cf http://milde.users.sourceforge.net/LGR/lgrxenc.def.html +% et greek.ldf du package babel +\fi % \end{macrocode} % \end{macro} % \begin{macro}{\inodot} @@ -1947,7 +2338,8 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % 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. % \begin{macrocode} -\edef\mt@enc{\m@stextenc}\newif\ifmt@goon\mt@goontrue +\edef\mt@enc{\m@stextenc} +\mt@proceedtrue \ifx\mt@enc\mt@eui % xetex and unicode font \XeTeXmathchardef\inodot="7 "\the\symmtletterfont "0131 \relax \XeTeXmathchardef\jnodot="7 "\the\symmtletterfont "0237 \relax @@ -1968,15 +2360,15 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{16} \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{17} \else - \ifXeTeX\mt@goonfalse\else\ifLuaTeX\mt@goonfalse\else + \ifXeTeX\mt@proceedfalse\else\ifLuaTeX\mt@proceedfalse\else \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont} {\expandafter\the\expandafter\csname\mt@enc\string\i\endcsname} \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont} {\expandafter\the\expandafter\csname\mt@enc\string\j\endcsname} \fi\fi \fi\fi\fi\fi\fi -\ifx\mt@defaultimath\@empty\else - \ifmt@goon +\ifmt@defaultimath\else + \ifmt@proceed \renewcommand{\imath}{\inodot} \renewcommand{\jmath}{\jnodot} \let\mt@oldi\i \let\mt@oldj\j @@ -2000,7 +2392,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % v1.12b: I add LY1 which is quasi like OT1 % \begin{macrocode} \edef\mt@enc{\m@stextenc} %% rather one too many than sorry -\ifx\mt@mathaccents\@empty +\ifmt@mathaccents \ifx\mt@ti\mt@enc \DeclareMathAccent{\acute}{\mathalpha}{mtoperatorfont}{1} \DeclareMathAccent{\grave}{\mathalpha}{mtoperatorfont}{0} @@ -2072,7 +2464,7 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} % Scaling mechanism for the Symbol font. % \begin{macrocode} \AtBeginDocument{ - \ifmt@need@symbol + \ifmt@needsymbol \DeclareFontFamily{U}{psy}{} \DeclareFontShape{U}{psy}{m}{n}{<->s*[\psy@scale] psyr}{} \fi @@ -2108,6 +2500,6 @@ noplusnominus,noequal,noexclam,noasterisk,nospecials,nolessnomore}} %</dtx> % \fi % -% \CheckSum{2387} +% \CheckSum{2757} % \Finale \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/mathastext/mathastext.ins b/Master/texmf-dist/source/latex/mathastext/mathastext.ins index adf7b68c453..e65095bb939 100644 --- a/Master/texmf-dist/source/latex/mathastext/mathastext.ins +++ b/Master/texmf-dist/source/latex/mathastext/mathastext.ins @@ -4,8 +4,8 @@ %% %% Copyright (C) 2011 by Jean-Francois Burnol %% -%% Please report errors to jfbu at free dot fr -%% Illustrative examples at +%% Please report errors to jfbu (at) free.fr +%% Numerous examples at %% http://jf.burnol.free.fr/mathastext.html %% %% This file be distributed and/or modified under the @@ -19,7 +19,7 @@ %% %% --------------- start of docstrip commands ------------------ %% -\def\filedate{2011/02/09} +\def\filedate{2011/03/11} \def\batchfile{mathastext.ins} \input docstrip.tex @@ -43,8 +43,8 @@ This is a generated file. Copyright (C) 2011 by Jean-Francois Burnol - Please report errors to jfbu at free dot fr - Illustrative examples at + Please report errors to jfbu (at) free.fr + Numerous examples at http://jf.burnol.free.fr/mathastext.html This file may be distributed and/or modified under the |