summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sansmath
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/sansmath
Initial commit
Diffstat (limited to 'macros/latex/contrib/sansmath')
-rw-r--r--macros/latex/contrib/sansmath/miscdoc.sty115
-rw-r--r--macros/latex/contrib/sansmath/sansmath.pdfbin0 -> 185988 bytes
-rw-r--r--macros/latex/contrib/sansmath/sansmath.sty228
-rw-r--r--macros/latex/contrib/sansmath/sansmath.tex65
4 files changed, 408 insertions, 0 deletions
diff --git a/macros/latex/contrib/sansmath/miscdoc.sty b/macros/latex/contrib/sansmath/miscdoc.sty
new file mode 100644
index 0000000000..6b87603c99
--- /dev/null
+++ b/macros/latex/contrib/sansmath/miscdoc.sty
@@ -0,0 +1,115 @@
+\ProvidesPackage{miscdoc}[2010/01/20 v1.2 documentation macros misc latex pkgs]
+
+% miscdoc.sty
+% Copyright 2010 Robin Fairbairns
+%
+% This work 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 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.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Robin Fairbairns.
+%
+% This work consists of the file miscdoc.sty (only)
+
+\setcounter{errorcontextlines}{1274}
+
+% The package arose from a small exercise to document packages whose
+% previous documentation consisted solely of comments in the package files.
+% The macros here defined are lifted from the author's faq.sty
+% (written for the UK TeX FAQ, CTAN:help/uk-tex-faq) or are inspired
+% by others' work (credited where the author is known) ... except
+% where they came as a flash of inspiration while actually writing the
+% documentation.
+
+% this option suggested by Heiko Oberdiek, 2010-01-29
+\DeclareOption{hyper}{%
+ \AtEndOfPackage{%
+ \RequirePackage[pdfusetitle]{hyperref}
+ \RequirePackage{bookmark}
+ \bookmarksetup{numbered,open,openlevel=1}
+ }
+}
+\ProcessOptions\relax
+
+% note: T1 encoding assumed
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage{booktabs}
+
+% from faq.sty
+\newcommand\cs[1]{\texttt{\char`\\#1}}
+\let\csx\cs
+\def\bsbs{\cs{\char`\\}}
+
+% \cmdinvoke\cs<argument sequence>
+% \cs typeset as above
+% <argument sequence> may consist of optional or mandatory arguments;
+%
+% the `arguments' are simply typesett \texttt, as yet -- if something
+% fancier is needed, there's a bunch of code needs rewriting here...
+\DeclareRobustCommand\cmdinvoke{\@ifstar
+ {\let\@tempa\emph\@scmdinvoke}%
+ {\let\@tempa\relax\@scmdinvoke}%
+}
+\def\@scmdinvoke#1{\texttt{\symbol{92}#1}%
+ \futurelet\@let@token\@cmdinvoke
+}
+\def\@cmdinvoke{\ifx\@let@token\bgroup
+ \let\@tempb\@cmdinvoke@lbrace
+ \else
+ \ifx\@let@token[% ]
+ \let\@tempb\@cmdinvoke@lbrack
+ \else
+ \ifx\@let@token(% )
+ \let\@tempb\@cmdinvoke@lparen
+ \else
+ \let\@tempb\@empty
+ \fi
+ \fi
+ \fi
+ \@tempb
+}
+\def\@cmdinvoke@lbrace#1{\penalty0\hskip0pt\relax
+ \texttt{\symbol{123}\@tempa{#1}\symbol{125}}%
+ \futurelet\@let@token\@cmdinvoke
+}
+\def\@cmdinvoke@lbrack[#1]{\penalty-150\hskip0pt\relax
+ \texttt{[\@tempa{#1}]}%
+ \futurelet\@let@token\@cmdinvoke
+}
+\def\@cmdinvoke@lparen(#1){\penalty-150\hskip0pt\relax
+ \texttt{(\@tempa{#1})}%
+ \futurelet\@let@token\@cmdinvoke
+}
+% and extension -- versions that take a single extra (delimiter)
+% argument, such as \delcmdinvoke{lscrunge}( ... awful syntax, but...
+\DeclareRobustCommand\delcmdinvoke{\@ifstar
+ {\let\@tempa\emph\@sdelcmdinvoke}%
+ {\let\@tempa\relax\@sdelcmdinvoke}%
+}
+\def\@sdelcmdinvoke#1#2{\texttt{\symbol{92}#1#2}%
+ \futurelet\@let@token\@cmdinvoke
+}
+
+% sui generis
+\newcommand\newitem{\par\addvspace{1ex}\noindent}
+
+% inspired by doc.sty in latex distribution
+\newcommand\meta[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}}
+
+% meaningful names, as in faq.sty
+\newcommand\environment[1]{\texttt{#1}}
+\newcommand\pkgoption[1]{\texttt{#1}}
+\newcommand\extension[1]{\texttt{.#1}}
+\newcommand\Package[1]{\textsf{#1}}
+\def\option{\@ifnextchar[\@optionb\@option}% ]
+\def\@optionb[#1]{[{\normalfont\ttfamily#1}]}
+\def\@option#1{\texttt{#1}}
+
+\let\FontName\textsf \ No newline at end of file
diff --git a/macros/latex/contrib/sansmath/sansmath.pdf b/macros/latex/contrib/sansmath/sansmath.pdf
new file mode 100644
index 0000000000..0701047bc3
--- /dev/null
+++ b/macros/latex/contrib/sansmath/sansmath.pdf
Binary files differ
diff --git a/macros/latex/contrib/sansmath/sansmath.sty b/macros/latex/contrib/sansmath/sansmath.sty
new file mode 100644
index 0000000000..cca8373709
--- /dev/null
+++ b/macros/latex/contrib/sansmath/sansmath.sty
@@ -0,0 +1,228 @@
+% LaTeX package sansmath: typeset sans-serif math using `text' fonts.
+%
+\ProvidesPackage{sansmath}[2007/02/28 \space ver 1.1 Donald Arseneau]
+%
+% Donald Arseneau, asnd@triumf.ca, Vancouver, Canada.
+%
+% This package is released to the public domain by me, Donald Arseneau,
+% the original author, who disclaims all rights. I do not support it,
+% and request that it be adopted and supported by someone who knows
+% more about math font issues in LaTeX.
+%
+% The point of this package is to allow sans-serif math in the absence
+% of proper sans math fonts.
+%
+% The author was persuaded to use the name `sansmath' in hopes of
+% working with various text sans fonts (indicated by \sfdefault)
+% but the only good results seen were with Computer Modern and cmss.
+% (Helvetica with the `pslatex' package was very poor!)
+%
+% INSTRUCTIONS
+% ~~~~~~~~~~~~
+% Load this package by inserting `\usepackage{sansmath}' in the
+% document preamble. This will define a new math version `sans'
+% and a command `\sansmath', much like `\boldmath'. There is also
+% an `\unsansmath' defined, but if math is to be sans-serif for
+% a region of a document, one should declare `\sansmath' in a local
+% group (perhaps with \begin{sansmath}...\end{sansmath}).
+% Within the scope of the \sansmath declaration, math characters
+% will be taken from the text sans-serif family as much as possible.
+% The actual sans fonts are OT1 encodings of those indicated by the
+% meaning of \sfdefault WHEN THE PACKAGE WAS LOADED -- not the
+% meaning at each math environment!
+%
+% Since the (OT1) text fonts do not provide the lower-case greek
+% letters, there is a package option [eulergreek] to take the
+% lowercase greek from the Euler math fonts.
+% Since some (many) sans fonts have no uppercase greek letters either
+% (missing characters from the OT1 encoding), there is an option
+% [EULERGREEK] to take ALL greek letters from the euler fonts.
+% One should also investigate using Euler for ALL MATH in the document,
+% using package `euler' instead of this one!
+%
+% OT1 encoding is normally required to get the uppercase greek letters,
+% but if you use the [EULERGREEK] option or don't use any uppercase greek
+% letters, then you are welcome to define \sansmathencoding *before*
+% loading this package. There is also a package option [T1] to perform
+% that particuler definition. Note the comment above about only cmms
+% being good; even the T1-encoded ec fonts are poor substitutes.
+%
+% This package achieves math-italic by reloading the slanted version
+% of the text sans-serif font, and changing a fontdimen parameter
+% (spaceskip). This causes the italic correction to be applied between
+% letters (good) but does not break up the `fi' and `fl' ligatures (bad)
+% (Why does a sans font have these ligatures anyway?) At this point,
+% nothing is done about this bug.
+
+\providecommand\sansmathencoding{OT1}
+\DeclareOption{T1}{
+ \def\sansmathencoding{T1}
+}
+
+\let\EulGreek\relax
+\let\EuUCGreek\relax
+\let\NonEulGreek\relax
+\DeclareOption{EULERGREEK}{
+ \ExecuteOptions{eulergreek}
+ \def\EuUCGreek{%
+ \@euG\Gamma \@euG\Delta \@euG\Theta \@euG\Lambda \@euG\Xi \@euG\Pi
+ \@euG\Sigma \@euG\Upsilon \@euG\Phi \@euG\Psi \@euG\Omega
+}}
+\DeclareOption{eulergreek}{
+ \def\EulGreek{%
+ \ifnum\alpha<\@eugreekOffset % avoid multi-mapping when repeated
+ \EulGreekList
+ \EuUCGreek
+ \let\varrho\rho \let\varsigma\sigma % Euler's missing variants
+ \fi
+}
+\def\EulGreekList{\@eug\alpha \@eug\beta \@eug\gamma \@eug\delta
+ \@eug\epsilon \@eug\zeta \@eug\eta \@eug\theta \@eug\iota \@eug\kappa
+ \@eug\lambda
+ \@eug\mu \@eug\nu \@eug\xi \@eug\pi \@eug\rho \@eug\sigma \@eug\tau
+ \@eug\upsilon \@eug\phi \@eug\chi \@eug\psi \@eug\omega
+ \@eug\varepsilon \@eug\vartheta \@eug\varpi \@eug\varphi
+}
+\def\NonEulGreek{% Reverse previous mapping
+ \ifnum\alpha>\@eugreekOffset % avoid multi-mapping when repeated
+ \@eugreekOffset=-\@eugreekOffset \@euGREEKOffset=-\@euGREEKOffset
+ \EulGreekList
+ \EuUCGreek
+ \@eugreekOffset=-\@eugreekOffset \@euGREEKOffset=-\@euGREEKOffset
+ \fi
+}}
+
+\ProcessOptions
+
+\DeclareMathAlphabet{\mathsfsl}{\sansmathencoding}{\sfdefault}{m}{sl}
+\DeclareOldFontCommand{\sfsl}{\normalfont\sffamily\slshape}{\mathsfsl}
+\DeclareMathAlphabet{\mathsfbf}{\sansmathencoding}{\sfdefault}{bx}{sl}
+\DeclareOldFontCommand{\sfbf}{\normalfont\sffamily\bfseries}{\mathsfbf}
+
+\DeclareMathVersion{sans}
+\SetMathAlphabet{\mathrm} {sans}{\sansmathencoding}{\sfdefault}{m}{n}
+\SetMathAlphabet{\mathsfsl}{sans}{\sansmathencoding}{\sfdefault}{m}{sl}
+\SetSymbolFont {operators}{sans}{OT1}{\sfdefault}{m}{n}
+
+% The cmm and cmsy are too light for cmss. I tried {b} for the next
+% two lines, but it did not work well (unbold +, bold greek, bad \neq)
+\SetSymbolFont {letters} {sans}{OML}{cmm} {m}{it}
+\SetSymbolFont {symbols} {sans}{OMS}{cmsy}{m}{n}
+
+\SetMathAlphabet{\mathsfbf}{sans}{\sansmathencoding}{\sfdefault}{bx}{n}
+
+\DeclareMathSymbol{0}{\mathord}{operators}{`0}
+\DeclareMathSymbol{1}{\mathord}{operators}{`1}
+\DeclareMathSymbol{2}{\mathord}{operators}{`2}
+\DeclareMathSymbol{3}{\mathord}{operators}{`3}
+\DeclareMathSymbol{4}{\mathord}{operators}{`4}
+\DeclareMathSymbol{5}{\mathord}{operators}{`5}
+\DeclareMathSymbol{6}{\mathord}{operators}{`6}
+\DeclareMathSymbol{7}{\mathord}{operators}{`7}
+\DeclareMathSymbol{8}{\mathord}{operators}{`8}
+\DeclareMathSymbol{9}{\mathord}{operators}{`9}
+\DeclareMathSymbol{!}{\mathclose}{operators}{"21}
+\DeclareMathSymbol{,}{\mathpunct}{operators}{`\,}
+\DeclareMathSymbol{.}{\mathord}{operators}{`\.}
+\DeclareMathSymbol{:}{\mathrel}{operators}{`\:}
+\DeclareMathSymbol{;}{\mathpunct}{operators}{`\;}
+\DeclareMathSymbol{?}{\mathclose}{operators}{`\?}
+%\DeclareMathSymbol{+}{\mathbin}{operators}{"2B}
+%\DeclareMathSymbol{=}{\mathrel}{operators}{`\=}
+
+
+\ifx\EulGreek\relax\else
+ \DeclareSymbolFont{EulerGreek}{U}{eur}{m}{n}
+ \SetSymbolFont{EulerGreek}{sans}{U}{eur}{m}{n}
+ \DeclareSymbolFontAlphabet\matheug{EulerGreek}
+
+ \newcount\@eugreekOffset
+ \let\@tempa\relax
+ \DeclareMathSymbol{\@tempa}{\mathord}{EulerGreek}{11}
+ \@eugreekOffset\@tempa
+ \advance\@eugreekOffset-\alpha
+
+ \def\@eug#1{\@tempcnta#1\advance\@tempcnta\@eugreekOffset
+ %\message{Change \string#1 from \number#1 to \number\@tempcnta}%
+ \mathchardef#1\@tempcnta}
+
+ \ifx\EuUCGreek\relax\else
+
+ \newcount\@euGREEKOffset
+ \let\@tempa\relax
+ \DeclareMathSymbol{\@tempa}{\mathord}{EulerGreek}{1}
+ \@euGREEKOffset\@tempa
+ \advance\@euGREEKOffset-\Delta
+
+ \def\@euG#1{\@tempcnta#1\advance\@tempcnta\@euGREEKOffset
+ \mathchardef#1\@tempcnta}
+ \fi
+\fi
+
+\def\sfMathSwitch{\sfsl
+ \make@math@version@font \textfont \fam \tf@size
+ \make@math@version@font \scriptfont \fam \sf@size
+ \make@math@version@font \scriptscriptfont \fam \ssf@size
+}
+
+\def\make@math@version@font #1#2#3{%
+ \begingroup
+ \escapechar\m@ne
+ \xdef\sansm@name{\expandafter\string\the#1#2+}%
+ \endgroup
+ \@ifundefined{\sansm@name}{%
+ \@load@variant@font \sansm@name{#1#2}{#3\p@}}{}%
+ #1#2\csname \sansm@name\endcsname
+}
+
+\begingroup
+\catcode`\A=12 \catcode`\T=12
+\lowercase{% necessary because \fontname\font produces "at" in catcode 12.
+\endgroup
+%
+\def\@load@variant@font #1#2#3{\expandafter\@do@load@varfont
+ \csname #1\expandafter\endcsname \fontname#2 AT #3 AT \relax }
+%
+\def\@do@load@varfont #1#2 AT #3 AT #4\relax{%
+ \dimen@#3\advance\dimen@ 1sp
+ \global\font #1=#2 at \dimen@
+ \fontdimen\tw@#1=\z@}
+}
+
+\def\sansmath{%
+ \ifx\mnorm@mathbf\mathbf\else \let\mnorm@mathbf\mathbf \fi
+ \mathversion{sans}%
+ \let\mathbf\mathsfbf
+ \let\sansm@every@math\sfMathSwitch
+ \EulGreek
+}
+
+\def\unsansmath{%
+ \mathversion{normal}%
+ \let\mathbf\mnorm@mathbf
+ \let\sansm@every@math\relax
+ \NonEulGreek
+}
+
+\expandafter\def\expandafter\check@mathfonts\expandafter{\check@mathfonts
+ \sansm@every@math}
+
+\let\sansm@every@math\relax
+\let\mnorm@mathbf\mathbf
+
+% Repair of a LaTeX bug that has not been fixed in 6 years.
+% Latex bug: latex/3357
+
+\def \@fontswitch #1#2{%
+ \ifmmode
+ \let \math@bgroup \relax
+ \def \math@egroup ##1{%
+ \let \math@bgroup \@@math@bgroup
+ \let \math@egroup \@@math@egroup
+ ##1}%
+ #2\relax
+ \else
+ #1%
+ \fi
+}
+
diff --git a/macros/latex/contrib/sansmath/sansmath.tex b/macros/latex/contrib/sansmath/sansmath.tex
new file mode 100644
index 0000000000..ce89962389
--- /dev/null
+++ b/macros/latex/contrib/sansmath/sansmath.tex
@@ -0,0 +1,65 @@
+\documentclass[a4paper]{article}
+\usepackage[a4paper]{geometry}
+\usepackage{miscdoc}
+\usepackage[scaled=0.85]{luximono}
+\begin{document}
+\title{The \Package{sansmath} package}
+\author{Donald Arseneau\thanks{Documentation file assembled by Robin
+ Fairbairns}}
+\date{2003-08-13, version 1.0}
+\maketitle
+
+\section{Outline}
+The package is designed to offer sans-serif mathematics in the absence
+of proper sans maths fonts.
+
+The package's name could be misconstrued: there was an ambition to
+do the job for ``non-standard'' sans fonts (as indicated by the value
+of \cs{sfdefault}), but the only good results have been with Computer
+Modern and \FontName{cmss}.
+
+\section{Use}
+
+After \cmdinvoke{usepackage}{sansmath}, a new ``math version''
+\texttt{sans} is defined, together with a command \cs{sansmath}, which
+behaves as \cs{boldmath} does.
+
+There is also a command \cs{unsansmath} (which does what you might
+imagine), but if maths are to be sans-serif for a limited area of
+document, it is better to limit it to a local group, for example by
+\cmdinvoke{begin}{sansmath} \texttt{\dots} \cmdinvoke{end}{sansmath}
+
+Within the scope of the \cs{sansmath} declaration, maths characters
+will be taken from the text sans-serif family as much as possible.
+The actual sans fonts are OT1 encodings of those indicated by the
+meaning of \cs{sfdefault} \emph{WHEN THE PACKAGE WAS LOADED}, not the
+meaning at each maths environment!
+
+Since the \texttt{OT1} text fonts do not provide the lower-case greek letters,
+there is a package option \option[eulergreek] to take the lowercase
+greek from the Euler maths fonts.
+
+Since some (many) sans fonts have no uppercase greek letters either
+(missing characters from the \texttt{OT1} encoding), there is an
+option \option[EULERGREEK] to take \emph{all} greek letters from the
+euler fonts. In this case one should also investigate using
+\FontName{Euler} fonts for \emph{all maths} in the document, using
+package \Package{euler} instead of this one!
+
+\texttt{OT1} encoding is normally required to get the uppercase greek
+letters, but if you use the \option[EULERGREEK] option or don't use
+any uppercase greek letters, then you are welcome to define
+\cs{sansmathencoding} \emph{before} loading this package. There is
+also a package option \option[T1] to perform that particuler
+definition. Note the comment above about only \FontName{cmss} being
+good~--- even the \texttt{T1}-encoded \FontName{ec} fonts are poor
+substitutes.
+
+The package achieves maths-italic by reloading the slanted version of
+the text sans-serif font, and changing a \texttt{fontdimen} parameter
+(spaceskip). This causes the italic correction to be applied between
+letters (good) but does not break up the `fi' and `fl' ligatures
+(bad). (Why does a sans font have these ligatures anyway?) As yet,
+nothing is done about this bug.
+
+\end{document}