summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mathfam256
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/mathfam256
Initial commit
Diffstat (limited to 'macros/latex/contrib/mathfam256')
-rw-r--r--macros/latex/contrib/mathfam256/LICENSE27
-rw-r--r--macros/latex/contrib/mathfam256/README.md39
-rw-r--r--macros/latex/contrib/mathfam256/mathfam256.pdfbin0 -> 81838 bytes
-rw-r--r--macros/latex/contrib/mathfam256/mathfam256.sty495
-rw-r--r--macros/latex/contrib/mathfam256/mathfam256.tex145
5 files changed, 706 insertions, 0 deletions
diff --git a/macros/latex/contrib/mathfam256/LICENSE b/macros/latex/contrib/mathfam256/LICENSE
new file mode 100644
index 0000000000..8f03f674db
--- /dev/null
+++ b/macros/latex/contrib/mathfam256/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2016-2018 Hironobu Yamashita
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of platex nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/macros/latex/contrib/mathfam256/README.md b/macros/latex/contrib/mathfam256/README.md
new file mode 100644
index 0000000000..b23ebf214f
--- /dev/null
+++ b/macros/latex/contrib/mathfam256/README.md
@@ -0,0 +1,39 @@
+# mathfam256
+
+LaTeX2e kernel 2015/01/01 increased the upper limit of math alphabets from 16
+to 256 for XeTeX/LuaTeX. Also, pLaTeX2e kernel 2016/11/29 introduced the similar
+change for e-pTeX/e-upTeX. However, the upper limit for math symbol families
+remains unchanged, so only 16 symbol fonts are available.
+
+This package increases the upper limit of math symbols from 16 (LaTeX2e default)
+to 256, using `\omath...` primitives. These primitives are originally introduced
+in Omega, and are currently available in the followings:
+
+- e-pTeX/e-upTeX (Japanese TeX engine)
+- Aleph (successor of Omega)
+
+## Supported formats
+
+The package mathfam256.sty works on the following formats:
+
+- pLaTeX (run on e-pTeX)
+- upLaTeX (run on e-upTeX)
+- Lamed (run on Aleph)
+
+All of these are enabled in TeX Live by default.
+
+## Repository
+
+This package is maintained on GitHub:
+ https://github.com/aminophen/mathfam256
+
+## License
+
+This package may be distributed and/or modified under the terms of
+the 3-clause BSD license (see [LICENSE](./LICENSE)).
+
+## Release Date
+
+2018-01-22
+
+Hironobu Yamashita
diff --git a/macros/latex/contrib/mathfam256/mathfam256.pdf b/macros/latex/contrib/mathfam256/mathfam256.pdf
new file mode 100644
index 0000000000..0427fd08d1
--- /dev/null
+++ b/macros/latex/contrib/mathfam256/mathfam256.pdf
Binary files differ
diff --git a/macros/latex/contrib/mathfam256/mathfam256.sty b/macros/latex/contrib/mathfam256/mathfam256.sty
new file mode 100644
index 0000000000..9749f8f897
--- /dev/null
+++ b/macros/latex/contrib/mathfam256/mathfam256.sty
@@ -0,0 +1,495 @@
+%
+% mathfam256.sty
+% 2018/01/22 v0.2 Hironobu Yamashita (aminophen)
+% 2016/12/26 v0.1 Hironobu Yamashita (aminophen)
+% 2009/02/20 v0.01 Kazuyoshi Yamamoto (ymt)
+%
+% This package, originally written by Kazuyoshi Yamamoto
+% (as ofamex1.sty, ofamex2.sty, ofamex3.sty)
+% and renamed/modified by Hironobu Yamashita, is distributed
+% at GitHub repository:
+% https://github.com/aminophen/mathfam256
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{mathfam256}
+ [2018/01/22 v0.2 Extend math family up to 256]
+
+%% engine check
+\ifx\omathchar\@undefined
+ \PackageError{mathfam256}{%
+ Sorry, this package requires Omega-like engine features.\MessageBreak
+ Currently only the following formats are known:\MessageBreak
+ * pLaTeX (run on e-pTeX)\MessageBreak
+ * upLaTeX (run on e-upTeX)\MessageBreak
+ * Lamed (run on Aleph)\MessageBreak
+ It seems you are running unsupported engine}\@ehc
+\fi
+\ifx\numexpr\@undefined
+ \PackageError{mathfam256}{This package requires e-TeX features}\@ehc
+\fi
+
+%% engine check has been done, so always 256
+\mathchardef\e@mathgroup@top=\@cclvi
+
+%% patch LaTeX2e internal only if older than 2015/01/01
+\@ifl@t@r\fmtversion{2015/01/01}{}{%
+ %% Increase math alphabet up to 256
+ \PackageInfo{mathfam256}{Patch for \noexpand\document@select@group applied}%
+ \def\document@select@group#1#2#3#4{%
+ \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
+ {%
+ \ifmmode
+ \ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
+ \begingroup
+ \escapechar\m@ne
+ \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
+ \globaldefs\@ne \math@fonts
+ \endgroup
+ \expandafter\extract@alph@from@version
+ \csname mv@\math@version\expandafter\endcsname
+ \expandafter{\number\csname
+ c@mv@\math@version\endcsname}%
+ #1%
+ \global\advance\csname c@mv@\math@version\endcsname\@ne
+ \else
+ \let#1\relax
+ \@latex@error{Too many math alphabets used
+ in version \math@version}%
+ \@eha
+ \fi
+ \else \expandafter\non@alpherr\fi
+ #1{#4}%
+ }%
+ }%
+ \PackageInfo{mathfam256}{Patch for \noexpand\select@group applied}%
+ \def\select@group#1#2#3#4{%
+ \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
+ {%
+ \ifmmode
+ \ifnum\csname c@mv@\math@version\endcsname<\e@mathgroup@top
+ \begingroup
+ \escapechar\m@ne
+ \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
+ \globaldefs\@ne \math@fonts
+ \endgroup
+ \init@restore@version
+ \xdef#1{\noexpand\use@mathgroup\noexpand#2%
+ {\number\csname c@mv@\math@version\endcsname}}%
+ \global\advance\csname c@mv@\math@version\endcsname\@ne
+ \else
+ \let#1\relax
+ \@latex@error{Too many math alphabets used in
+ version \math@version}%
+ \@eha
+ \fi
+ \else \expandafter\non@alpherr\fi
+ #1{#4}%
+ }%
+ }%
+ %% Increase math symbol up to 256
+ \PackageInfo{mathfam256}{Patch for \noexpand\new@mathgroup applied}%
+ \def\new@mathgroup
+ {\e@alloc\mathgroup\chardef{\count18}\m@ne\e@mathgroup@top}%
+}
+
+%% use \omath... primitives for low-level commands
+\def\set@mathchar#1#2#3#4{%
+ \ifnum#1<\sixt@@n
+ \global\mathcode`#2="\mathchar@type#3\hexnumber@#1#4\relax
+ \else
+ \global\omathcode`#2="\mathchar@type#3\hexnumber@@#100#4\relax
+ \fi
+}
+\def\set@mathsymbol#1#2#3#4{%
+ \ifnum#1<\sixt@@n
+ \global\mathchardef#2"\mathchar@type#3\hexnumber@#1#4\relax
+ \else
+ \global\omathchardef#2"\mathchar@type#3\hexnumber@@#100#4\relax
+ \fi
+}
+\def\set@mathaccent#1#2#3#4{%
+ \ifnum#1<\sixt@@n
+ \xdef#2{\mathaccent"\mathchar@type#3\hexnumber@#1#4\relax}%
+ \else
+ \xdef#2{\omathaccent"\mathchar@type#3\hexnumber@@#100#4\relax}%
+ \fi
+}
+\def\set@mathdelimiter#1#2#3#4#5#6{%
+ \@tempswatrue
+ \ifnum#1<\sixt@@n\relax\else\@tempswafalse\fi
+ \ifnum#2<\sixt@@n\relax\else\@tempswafalse\fi
+ \if@tempswa
+ \xdef#3{\delimiter"\mathchar@type#4\hexnumber@#1#5\hexnumber@#2#6\relax}%
+ \else
+ \xdef#3{\odelimiter"\mathchar@type#4\hexnumber@@#100#5%
+ "\hexnumber@@#200#6\relax}%
+ \fi
+}
+\def\set@@mathdelimiter#1#2#3#4#5{%
+ \@tempswatrue
+ \ifnum#1<\sixt@@n\relax\else\@tempswafalse\fi
+ \ifnum#2<\sixt@@n\relax\else\@tempswafalse\fi
+ \if@tempswa
+ \global\delcode`#3="\hexnumber@#1#4\hexnumber@#2#5\relax
+ \else
+ \global\odelcode`#3="\hexnumber@@#100#4"\hexnumber@@#200#5\relax
+ \fi
+}
+\def\DeclareMathRadical#1#2#3#4#5{%
+ \expandafter\ifx
+ \csname\expandafter\@gobble\string#1\endcsname
+ \relax
+ \let#1\radical
+ \fi
+ \edef\reserved@a{\noexpand\in@
+ {\expandafter\@gobble\string\radical}{\meaning#1}}%
+ \reserved@a
+ \ifin@
+ \expandafter\in@\csname sym#2\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \expandafter\in@\csname sym#4\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \begingroup
+ \count\z@=#3\relax
+ \count\tw@\count\z@
+ \divide\count\z@\sixt@@n
+ \count@\count\z@
+ \multiply\count@\sixt@@n
+ \advance\count\tw@-\count@
+ \edef\reserved@c{%
+ \hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
+ \count\z@=#5\relax
+ \count\tw@\count\z@
+ \divide\count\z@\sixt@@n
+ \count@\count\z@
+ \multiply\count@\sixt@@n
+ \advance\count\tw@-\count@
+ \edef\reserved@d{%
+ \hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
+ \expandafter\set@mathradical
+ \csname sym#2\expandafter\endcsname
+ \csname sym#4\endcsname
+ #1\reserved@c\reserved@d
+ \endgroup
+ \else
+ \@latex@error{Symbol font `#4' is not defined}\@eha
+ \fi
+ \else
+ \@latex@error{Symbol font `#2' is not defined}\@eha
+ \fi
+ \else
+ \@latex@error{Command `\string#1' already defined}\@eha
+ \fi
+}
+\def\set@mathradical#1#2#3#4#5{%
+ \@tempswatrue
+ \ifnum#1<\sixt@@n\relax\else\@tempswafalse\fi
+ \ifnum#2<\sixt@@n\relax\else\@tempswafalse\fi
+ \if@tempswa
+ \xdef#3{\radical"\hexnumber@#1#4\hexnumber@#2#5\relax}%
+ \else
+ \xdef#3{\oradical"\hexnumber@@#100#4"\hexnumber@@#200#5\relax}%
+ \fi
+}
+\@onlypreamble\set@mathradical
+
+%% patch for \hexnumber@ (e.g. amsfonts.sty contains some codes like
+%% \edef\yen{\noexpand\mathhexbox{\hexnumber@\symAMSa}55}
+%% this should work as well)
+\def\mathhexbox#1#2#3{%
+ \ifnum"#1<\sixt@@n
+ \mbox{$\m@th \mathchar"#1#2#3$}%
+ \else
+ \mbox{$\m@th \omathchar"#100#2#3$}%
+ \fi
+}
+\def\org@hexnumber@#1{\ifcase\number#1
+ 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or
+ 9\or A\or B\or C\or D\or E\or F\fi}
+\def\hexnumber@#1{%
+ \ifnum\number#1<\sixt@@n
+ \org@hexnumber@{#1}%
+ \else
+ \hexnumber@@{#1}%
+ \fi
+}
+\def\hexnumber@@#1{\ifcase\number#1
+ 00\or 01\or 02\or 03\or 04\or 05\or 06\or 07\or 08\or
+ 09\or 0A\or 0B\or 0C\or 0D\or 0E\or 0F\or
+ 10\or 11\or 12\or 13\or 14\or 15\or 16\or 17\or 18\or
+ 19\or 1A\or 1B\or 1C\or 1D\or 1E\or 1F\or
+ 20\or 21\or 22\or 23\or 24\or 25\or 26\or 27\or 28\or
+ 29\or 2A\or 2B\or 2C\or 2D\or 2E\or 2F\or
+ 30\or 31\or 32\or 33\or 34\or 35\or 36\or 37\or 38\or
+ 39\or 3A\or 3B\or 3C\or 3D\or 3E\or 3F\or
+ 40\or 41\or 42\or 43\or 44\or 45\or 46\or 47\or 48\or
+ 49\or 4A\or 4B\or 4C\or 4D\or 4E\or 4F\or
+ 50\or 51\or 52\or 53\or 54\or 55\or 56\or 57\or 58\or
+ 59\or 5A\or 5B\or 5C\or 5D\or 5E\or 5F\or
+ 60\or 61\or 62\or 63\or 64\or 65\or 66\or 67\or 68\or
+ 69\or 6A\or 6B\or 6C\or 6D\or 6E\or 6F\or
+ 70\or 71\or 72\or 73\or 74\or 75\or 76\or 77\or 78\or
+ 79\or 7A\or 7B\or 7C\or 7D\or 7E\or 7F\or
+ 80\or 81\or 82\or 83\or 84\or 85\or 86\or 87\or 88\or
+ 89\or 8A\or 8B\or 8C\or 8D\or 8E\or 8F\or
+ 90\or 91\or 92\or 93\or 94\or 95\or 96\or 97\or 98\or
+ 99\or 9A\or 9B\or 9C\or 9D\or 9E\or 9F\or
+ A0\or A1\or A2\or A3\or A4\or A5\or A6\or A7\or A8\or
+ A9\or AA\or AB\or AC\or AD\or AE\or AF\or
+ B0\or B1\or B2\or B3\or B4\or B5\or B6\or B7\or B8\or
+ B9\or BA\or BB\or BC\or BD\or BE\or BF\or
+ C0\or C1\or C2\or C3\or C4\or C5\or C6\or C7\or C8\or
+ C9\or CA\or CB\or CC\or CD\or CE\or CF\or
+ D0\or D1\or D2\or D3\or D4\or D5\or D6\or D7\or D8\or
+ D9\or DA\or DB\or DC\or DD\or DE\or DF\or
+ E0\or E1\or E2\or E3\or E4\or E5\or E6\or E7\or E8\or
+ E9\or EA\or EB\or EC\or ED\or EE\or EF\or
+ F0\or F1\or F2\or F3\or F4\or F5\or F6\or F7\or F8\or
+ F9\or FA\or FB\or FC\or FD\or FE\or FF
+ \fi
+}
+
+%% patch LaTeX2e internal only if newer than (or equal to) 2015/01/01
+%% since the error code was introduced at that time
+\@ifl@t@r\fmtversion{2015/01/01}{%
+ \PackageInfo{mathfam256}{Patch for \noexpand\DeclareSymbolFont applied}%
+ \def\DeclareSymbolFont#1#2#3#4#5{%
+ \@tempswafalse
+ \edef\reserved@b{#2}%
+ \def\cdp@elt##1##2##3##4{\def\reserved@c{##1}%
+ \ifx\reserved@b\reserved@c \@tempswatrue\fi}%
+ \cdp@list
+ \if@tempswa
+ \@ifundefined{sym#1}{%
+ \ifnum\count18<\e@mathgroup@top
+ \expandafter\new@mathgroup\csname sym#1\endcsname
+ \expandafter\new@symbolfont\csname sym#1\endcsname
+ {#2}{#3}{#4}{#5}%
+ \else
+ \@latex@error{Too many symbol fonts declared}\@eha
+ \fi
+ }%
+ {%
+ \@font@info{Redeclaring symbol font `#1'}%
+ \def\group@elt##1##2{%
+ \noexpand\group@elt\noexpand##1%
+ \expandafter\ifx\csname sym#1\endcsname##1%
+ \expandafter\noexpand\csname#2/#3/#4/#5\endcsname
+ \else
+ \noexpand##2%
+ \fi}%
+ \xdef\group@list{\group@list}%
+ \def\version@elt##1{%
+ \expandafter
+ \SetSymbolFont@\expandafter##1\csname#2/#3/#4/#5\expandafter
+ \endcsname \csname sym#1\endcsname
+ }%
+ \version@list
+ }%
+ \else
+ \@latex@error{Encoding scheme `#2' unknown}\@eha
+ \fi
+ }%
+}{}
+
+%% use \omath... primitives for high-level commands
+\def\DeclareMathSymbol#1#2#3#4{%
+ \expandafter\in@\csname sym#3\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \begingroup
+ \if\relax\noexpand#1% is command?
+ \edef\reserved@a{\noexpand\in@{\string\mathchar}{\meaning#1}}%
+ \reserved@a
+ \ifin@
+ \oset@mathsymbol{#1}{#2}{#3}{#4}%
+ \@font@info{Redeclaring math symbol \string#1}%
+ \else
+ \expandafter\ifx
+ \csname\expandafter\@gobble\string#1\endcsname
+ \relax
+ \oset@mathsymbol{#1}{#2}{#3}{#4}%
+ \else
+ \@latex@error{Command `\string#1' already defined}\@eha
+ \fi
+ \fi
+ \else
+ \oset@mathchar{#1}{#2}{#3}{#4}%
+ \fi
+ \endgroup
+ \else
+ \@latex@error{Symbol font `#3' is not defined}\@eha
+ \fi
+}
+%\@onlypreamble\DeclareMathSymbol
+\def\oset@mathsymbol#1#2#3#4{%
+ \global\omathchardef#1%
+ \number
+ \numexpr"1000000*\mathchar@type#2+"10000*\csname sym#3\endcsname+#4}
+\@onlypreamble\oset@mathsymbol
+\def\oset@mathchar#1#2#3#4{%
+ \global\omathcode`#1=%
+ \number
+ \numexpr"1000000*\mathchar@type#2+"10000*\csname sym#3\endcsname+#4}
+\@onlypreamble\oset@mathchar
+\def\DeclareMathAccent#1#2#3#4{%
+ \expandafter\in@\csname sym#3\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \begingroup
+ \if\relax\noexpand#1% is command?
+ \edef\reserved@a{\noexpand\in@{\string\mathaccent}{\meaning#1}}%
+ \reserved@a
+ \ifin@
+ \oset@mathaccent{#1}{#2}{#3}{#4}%
+ \@font@info{Redeclaring math accent \string#1}%
+ \else
+ \expandafter\ifx
+ \csname\expandafter\@gobble\string#1\endcsname
+ \relax
+ \oset@mathaccent{#1}{#2}{#3}{#4}%
+ \else
+ \@latex@error{Command `\string#1' already defined}\@eha
+ \fi
+ \fi
+ \else
+ \@latex@error{Not a command name: `\noexpand#1'}\@eha
+ \fi
+ \endgroup
+ \else
+ \@latex@error{Symbol font `#3' is not defined}\@eha
+ \fi
+}
+%\@onlypreamble\DeclareMathAccent
+\def\oset@mathaccent#1#2#3#4{%
+ \xdef#1{\omathaccent%
+ \number
+ \numexpr"1000000*\mathchar@type#2+"10000*\csname sym#3\endcsname+#4}}
+\@onlypreamble\oset@mathaccent
+%\def\DeclareMathDelimiter#1{%
+% \if\relax\noexpand#1%
+% \expandafter\@DeclareMathDelimiter
+% \else
+% \expandafter\@xxDeclareMathDelimiter
+% \fi
+% #1}
+%\@onlypreamble\DeclareMathDelimiter
+%\def\@xxDeclareMathDelimiter#1#2#3#4{%
+% \begingroup
+% \let\mathalpha\mathord
+% \ifnum7=\mathchar@type{#2}%
+% \endgroup
+% \expandafter\@firstofone
+% \else
+% \endgroup
+% \DeclareMathSymbol#1{#2}{#3}{#4}%
+% \expandafter\@firstoftwo
+% \fi
+% {\@xDeclareMathDelimiter#1}{#2}{#3}{#4}}
+%\@onlypreamble\@xxDeclareMathDelimiter
+\def\@DeclareMathDelimiter#1#2#3#4#5#6{%
+ \expandafter\in@\csname sym#3\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \expandafter\in@\csname sym#5\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \begingroup
+ \edef\reserved@a{\noexpand\in@{\string\delimiter}{\meaning#1}}%
+ \reserved@a
+ \ifin@
+ \oset@mathdelimiter{#1}{#2}{#3}{#4}{#5}{#6}%
+ \@font@info{Redeclaring math delimiter \string#1}%
+ \else
+ \expandafter\ifx
+ \csname\expandafter\@gobble\string#1\endcsname
+ \relax
+ \oset@mathdelimiter{#1}{#2}{#3}{#4}{#5}{#6}%
+ \else
+ \@latex@error{Command `\string#1' already defined}\@eha
+ \fi
+ \fi
+ \endgroup
+ \else
+ \@latex@error{Symbol font `#5' is not defined}\@eha
+ \fi
+ \else
+ \@latex@error{Symbol font `#3' is not defined}\@eha
+ \fi
+}
+%\@onlypreamble\@DeclareMathDelimiter
+\def\@xDeclareMathDelimiter#1#2#3#4#5{%
+ \expandafter\in@\csname sym#2\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \expandafter\in@\csname sym#4\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \oset@@mathdelimiter{#1}{#2}{#3}{#4}{#5}%
+ \else
+ \@latex@error{Symbol font `#4' is not defined}\@eha
+ \fi
+ \else
+ \@latex@error{Symbol font `#2' is not defined}\@eha
+ \fi
+}
+%\@onlypreamble\@xDeclareMathDelimiter
+\def\oset@mathdelimiter#1#2#3#4#5#6{%
+ \begingroup
+ \count\z@
+ \numexpr"1000000*\mathchar@type#2+"10000*\csname sym#3\endcsname+#4%
+ \count\tw@
+ \numexpr"10000*\csname sym#5\endcsname+#6%
+ \xdef#1{\odelimiter\number\count\z@\space \number\count\tw@}%
+ \endgroup
+}
+\@onlypreamble\oset@mathdelimiter
+\def\oset@@mathdelimiter#1#2#3#4#5{%
+ \begingroup
+ \count\z@\numexpr"10000*\csname sym#2\endcsname+#3%
+ \count\tw@\numexpr"10000*\csname sym#4\endcsname+#5%
+ \global\odelcode`#1=\number\count\z@\space \number\count\tw@
+ \endgroup
+}
+\@onlypreamble\oset@@mathdelimiter
+\def\DeclareMathRadical#1#2#3#4#5{%
+ \expandafter\ifx
+ \csname\expandafter\@gobble\string#1\endcsname
+ \relax
+ \let#1\radical
+ \fi
+ \edef\reserved@a{\noexpand\in@{\string\radical}{\meaning#1}}%
+ \reserved@a
+ \ifin@
+ \expandafter\in@\csname sym#2\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \expandafter\in@\csname sym#4\expandafter\endcsname
+ \expandafter{\group@list}%
+ \ifin@
+ \oset@mathradical{#1}{#2}{#3}{#4}{#5}%
+ \else
+ \@latex@error{Symbol font `#4' is not defined}\@eha
+ \fi
+ \else
+ \@latex@error{Symbol font `#2' is not defined}\@eha
+ \fi
+ \else
+ \@latex@error{Command `\string#1' already defined}\@eha
+ \fi
+}
+%\@onlypreamble\DeclareMathRadical
+\def\oset@mathradical#1#2#3#4#5{%
+ \begingroup
+ \count\z@\numexpr"10000*\csname sym#2\endcsname+#3%
+ \count\tw@\numexpr"10000*\csname sym#4\endcsname+#5%
+ \xdef#1{\oradical\number\count\z@\space \number\count\tw@}%
+ \endgroup
+}
+\@onlypreamble\oset@mathradical
+
+%% all done
+\endinput
diff --git a/macros/latex/contrib/mathfam256/mathfam256.tex b/macros/latex/contrib/mathfam256/mathfam256.tex
new file mode 100644
index 0000000000..6685c5babf
--- /dev/null
+++ b/macros/latex/contrib/mathfam256/mathfam256.tex
@@ -0,0 +1,145 @@
+%# -*- coding: utf-8 -*-
+\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016)
+ \epTeXinputencoding utf8 % ensure utf-8 encoding for platex
+\fi
+
+\documentclass[a4paper]{jsarticle}
+\usepackage{doc}
+\usepackage{mathfam256}
+\GetFileInfo{mathfam256.sty}
+\usepackage{array}
+\usepackage{url}
+\newcommand{\OMEGA}{$\Omega$}
+\def\pTeX{p\kern-.15em\TeX}
+\def\upTeX{u\pTeX}
+\def\eTeX{$\varepsilon$-\TeX}
+\def\epTeX{$\varepsilon$-\pTeX}
+\def\eupTeX{$\varepsilon$-\upTeX}
+\title{Package \textsf{mathfam256} \fileversion}
+\author{Hironobu Yamashita}
+\date{\filedate}
+\begin{document}
+
+\maketitle
+
+\parindent15pt
+
+In classic \TeX\ and \eTeX, the upper limit of math groups (\verb+\fam+)
+is limited to 16. However, these days some \TeX\ variants support
+math groups up to 256.
+
+In light of this situation, the \LaTeXe\ kernel 2015/01/01 increased
+the upper limit of math alphabets to 256 for
+Xe\TeX\ and Lua\TeX\ (Unicode \TeX\ variants).
+Also, the \pLaTeXe/\upLaTeXe\ kernel 2016/11/29 introduced the similar
+change for \epTeX/\eupTeX\ (``FAM256'' patch based on \OMEGA\ is applied).
+
+However, the ``native'' kernel support is limited:
+\begin{itemize}
+\item Lamed (\LaTeX\ on Aleph) is not supported at all.
+\item The upper limit for math symbol families is still limited to 16.
+\end{itemize}
+
+The package \textsf{mathfam256} is an attempt to resolve this situation;
+increases the upper limit of math symbols from 16 (\LaTeXe\ default)
+to 256, using \verb+\omath...+ primitives.
+
+The package is maintained on GitHub:
+\begin{quote}
+ \url{https://github.com/aminophen/mathfam256}
+\end{quote}
+
+\section*{Requirements}
+
+The \verb+\omath...+ primitives are originally introduced in
+\OMEGA\ (Omega), and are currently available in the followings.
+Without one of these, the package causes an error.
+\begin{itemize}
+\item \pLaTeX/\upLaTeX, run on \epTeX/\eupTeX\ (Japanese TeX engine)
+\item Lamed, run on Aleph (successor of \OMEGA)
+\end{itemize}
+
+\section*{Usage}
+
+Load it in the preamble; it is recommended to load it as fast as
+possible.
+\begin{verbatim}
+ \documentclass[a4paper]{article}
+ \usepackage{mathfam256}
+ \usepackage{...}% other packages
+ \begin{document}
+ The content
+ \end{document}
+\end{verbatim}
+
+\bigskip
+
+\parindent1zw
+
+オリジナルの\TeX や“素”の\eTeX では、数式ファミリ(\verb+\fam+)の
+上限が16個に制限されていました。しかし、最近の新しい\TeX エンジンの中には、
+256個までの数式ファミリをサポートするものが現れています。
+
+この状況を鑑み、\LaTeXe カーネル(2015/01/01以降)では、
+Unicode対応のXe\TeX とLua\LaTeX について、数式ファミリ(正確には
+\verb+\DeclareMathAlphebet+で使われる数式アルファベット)の上限を256に
+増やしています。同様に、\pLaTeXe/\upLaTeXe カーネル(2016/11/29以降)も、
+\OMEGA ベースのいわゆる「FAM256パッチ」が適用された\epTeX/\eupTeX について、
+数式ファミリの上限を256に増やしています。これらにより
+\begin{verbatim}
+ ! LaTeX Error: Too many math alphabets used in version normal.
+\end{verbatim}
+というエラーが発生しにくくなっています。
+
+しかし、この“ネイティブな”カーネルのサポートには限界があります:
+\begin{itemize}
+\item Lamed (\LaTeX\ on Aleph)は全く考慮されていない。
+\item 数式シンボルフォントの上限は依然として16のままである(安全のため)。
+\end{itemize}
+
+この\textsf{mathfam256}パッケージは、この状況を改善する試みです。
+すなわち、\OMEGA 由来の\verb+\omath...+プリミティブを用いて、
+数式シンボルフォントの上限を256に増やします。
+
+\section*{動作条件}
+
+もともと\OMEGA\ (Omega)に導入された\verb+\omath...+プリミティブが
+必要です。これが実装されているのは、以下のフォーマット(エンジン)です。
+これ以外でパッケージが使われて場合はエラー終了します。
+\begin{itemize}
+\item \pLaTeX/\upLaTeX (\epTeX/\eupTeX 上で動作)
+\item Lamed(\OMEGA の後継であるAleph上で動作)
+\end{itemize}
+
+\section*{使い方}
+
+プリアンブルで読み込みます。なるべく早めに読み込むことをお勧めします。
+\begin{verbatim}
+ \documentclass[a4paper]{article}
+ \usepackage{mathfam256}
+ \usepackage{...}% other packages
+ \begin{document}
+ …本文…
+ \end{document}
+\end{verbatim}
+
+\section*{謝辞}
+
+本パッケージは\cite{yamamoto}〜\cite{yamamoto3}を元に、
+新しい\LaTeX に対応させることで作られました。
+
+\begin{thebibliography}{99}
+ \bibitem{yamamoto} 山本 和義,「数式famの制限とluatex」,
+ 掲示板「\TeX\ Q\ \&\ A」,2009/02/12.\\
+ \url{http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/52744.html}
+ \bibitem{yamamoto2} 山本 和義,「Re: 数式famの制限とluatex」,
+ 掲示板「\TeX\ Q\ \&\ A」,2009/02/16.\\
+ \url{http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/52767.html}
+ \bibitem{yamamoto3} 山本 和義,「数式fam拡張マクロ for e-pTeX等」,
+ 掲示板「\TeX\ Q\ \&\ A」,2009/02/21.\\
+ \url{http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/52799.html}
+ \bibitem{eptexdoc} 北川 弘典,「\epTeX について」.\\
+ \verb+$TEXMFDIST/doc/ptex/ptex-base/etex_man.pdf+
+\end{thebibliography}
+
+\end{document}