summaryrefslogtreecommitdiff
path: root/language/japanese/BX/bxwareki
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 /language/japanese/BX/bxwareki
Initial commit
Diffstat (limited to 'language/japanese/BX/bxwareki')
-rw-r--r--language/japanese/BX/bxwareki/LICENSE21
-rw-r--r--language/japanese/BX/bxwareki/README.md53
-rw-r--r--language/japanese/BX/bxwareki/bxwareki-cd.def126
-rw-r--r--language/japanese/BX/bxwareki/bxwareki.pdfbin0 -> 182364 bytes
-rw-r--r--language/japanese/BX/bxwareki/bxwareki.sty513
-rw-r--r--language/japanese/BX/bxwareki/bxwareki.tex240
-rw-r--r--language/japanese/BX/bxwareki/bxwareki2019.def3
7 files changed, 956 insertions, 0 deletions
diff --git a/language/japanese/BX/bxwareki/LICENSE b/language/japanese/BX/bxwareki/LICENSE
new file mode 100644
index 0000000000..c4443b644c
--- /dev/null
+++ b/language/japanese/BX/bxwareki/LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/language/japanese/BX/bxwareki/README.md b/language/japanese/BX/bxwareki/README.md
new file mode 100644
index 0000000000..b02a5bc205
--- /dev/null
+++ b/language/japanese/BX/bxwareki/README.md
@@ -0,0 +1,53 @@
+BXwareki Package
+================
+
+LaTeX: Support for Japanese calendar
+
+This package provides commands to convert from the Gregorian calendar
+(2018/8/28) to the Japanese rendering of the Japanese calendar (Heisei
+30 nen 8 gatsu 28 nichi; actually with kanji characters). You can choose
+whether the numbers are written in Western numerals or kanji numerals.
+
+Note that the package only deals with dates in the year 1873 or later,
+where the Japanese calendar is really a Gregorian calendar with the
+different notation of years.
+
+### System requirement
+
+ * TeX format: LaTeX.
+ * TeX engine: pdfTeX, LuaTeX, XeTeX, pTeX, upTeX, ApTeX (pTeX-ng),
+ and NTT-jTeX. (The e-TeX extension is not needed.)
+
+### Installation
+
+ - `*.sty`, `*.def` → $TEXMF/tex/latex/BXwareki
+
+### License
+
+This package is distributed under the MIT License.
+
+
+The bxwareki Package ― main
+----------------------------
+
+See the manual `bxwareki.pdf` for detail.
+
+
+Revision History
+----------------
+
+ * Version 0.6 ‹2019/06/01›
+ - The file `bxwareki2019.def` is no longer required.
+ * Version 0.5 ‹2019/04/01›
+ - Support for the new gengo “令和”.
+ * Version 0.4 ‹2018/10/01›
+ - Add `\warekigengoinitial`.
+ - Add option `download2019`.
+ * Version 0.3 ‹2018/09/24›
+ - The total rewrite.
+ * Version 0.2 ‹2018/04/08›
+ - The first public version.
+
+--------------------
+Takayuki YATO (aka. "ZR")
+https://github.com/zr-tex8r
diff --git a/language/japanese/BX/bxwareki/bxwareki-cd.def b/language/japanese/BX/bxwareki/bxwareki-cd.def
new file mode 100644
index 0000000000..695a4c2460
--- /dev/null
+++ b/language/japanese/BX/bxwareki/bxwareki-cd.def
@@ -0,0 +1,126 @@
+%%
+%% This is file 'bxwareki-cd.def'.
+%%
+%% Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
+%% GitHub: https://github.com/zr-tex8r
+%% Twitter: @zr_tex8r
+%%
+%% This package is distributed under the MIT License.
+%%
+
+% Note: This file must be encoded in UTF-8.
+
+%% file declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{bxwareki-cd.def}[2019/06/01 v0.6]
+
+\ifbxwy@epTeXinputencoding@ok
+ \epTeXinputencoding utf8
+\fi
+
+%--------------------------------------- helpers
+
+%% \bxwy@burst-`>...
+\let\bxwy@burst\romannumeral
+
+%% \bxwy@cond\ifXXX...\fi{<true>}{<false>}
+\@gobbletwo\if\if \def\bxwy@cond#1\fi{%
+ #1\expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi}
+
+%% \bxwy@catch@mk...\bxwy@mk
+\def\bxwy@catch@mk#1\bxwy@mk{#1}
+
+%--------------------------------------- kanji numerals
+
+%% \bxwy@Jkansuji{<number>}
+% The kansuji-by-reading with use of ten-composites (廿, 卅).
+% NB. Only valid in range 0..99; otherwise fallback to \bxwy@jkansuji.
+\def\bxwy@Jkansuji#1{%
+ \expandafter\bxwy@Jkansuji@a\number#1\bxwy@mk}
+\def\bxwy@Jkansuji@a#1\bxwy@mk{%
+ \ifnum#1<\bxwy@jk@x
+ \bxwy@jkansuji@a#1\bxwy@mk
+ \else\ifnum#1<\bxwy@jk@c
+ \bxwy@Jkansuji@b#1%
+ \else
+ \bxwy@jkansuji@a#1\bxwy@mk
+ \fi\fi}
+\def\bxwy@Jkansuji@b#1#2{%
+ \ifcase#1\relax \or 十\or 廿\or 卅%
+ \else \csname bxwy@jcd/#1\endcsname 十%
+ \fi
+ \ifnum#2>\z@ \csname bxwy@jcd/#2\endcsname \fi}
+
+%--------------------------------------- custom date format
+
+%% \warekicustomdate{<options>}
+% Renders the date in the form specified by the options.
+% [calendar] def. seireki; w = wareki;
+% [numerals] def. western numerals; k = kansuji; j = kansuji-by-reading;
+% J = kansuji-by-reading, with ten-composites (廿, 卅);
+% [month names] def. by numbers; o = 異名 (old month names);
+% O = Izumo-style 異名 (use 神在月 instead of 神無月);
+\def\warekicustomdate#1{%
+ \bxwy@custom@date@parse@opt{#1}\bxwy@custom@date@a}
+\def\bxwy@custom@date@a#1{%
+ \expandafter\bxwy@custom@date@b\bxwy@date#1}
+\def\bxwy@custom@date@b#1#2#3#4#5#6{%
+ % y,m,d,calendar,numerals,monthname
+ \if \ifx\warekigengo\@empty-\else#4\fi w% wareki
+ \warekigengo
+ \ifnum\c@warekiyear=\@ne 元%
+ \else \bxwy@custom@date@number#5\c@warekiyear
+ \fi
+ \else % seireki
+ \if#5-#1\bxwy@S% western
+ \else \bxwy@kansuji{#1}% kansuji/-j/-J
+ \fi
+ \fi
+ 年%
+ \if#6-\bxwy@custom@date@number#5{#2}月% month by number
+ \else \bxwy@custom@date@month#6{#2}% month name
+ \fi
+ \bxwy@custom@date@number#5{#3}日}
+\def\bxwy@custom@date@number#1#2{%
+ \if#1k\bxwy@kansuji{#2}% kansuji
+ \else\if#1j\bxwy@jkansuji{#2}% kansuji-j
+ \else\if#1J\bxwy@Jkansuji{#2}% kansuji-J
+ \else % western
+ \bxwy@S \expandafter\bxwy@catch@mk\number#2\bxwy@mk \bxwy@S
+ \fi\fi\fi}
+\def\bxwy@custom@date@month#1#2{%
+ \ifnum#2=\z@\else\ifcase#2\relax
+ \or 睦月\or 如月\or 弥生\or 卯月\or 皐月\or 水無月%
+ \or 文月\or 葉月\or 長月%
+ \or \if#1O神在月\else 神無月\fi
+ \or 霜月\or 師走%
+ \fi\fi}
+
+%% \bxwy@custom@date@parse@opt{<options>}\CScont
+\def\bxwy@custom@date@parse@opt#1{%
+ \bxwy@cd@parse@opt@a#1\bxwy@mk---}
+\def\bxwy@cd@parse@opt@a{%
+ \expandafter\bxwy@cd@parse@opt@b\bxwy@burst-`>}
+\def\bxwy@cd@parse@opt@b#1{%
+ \bxwy@cond\ifx#1\bxwy@mk\fi{\bxwy@cd@parse@opt@f}{%
+ \expandafter\bxwy@cd@parse@opt@c\csname bxwy@cdpo@@#1\endcsname}}
+\def\bxwy@cd@parse@opt@c#1{%
+ \bxwy@cond\ifx#1\relax\fi{\bxwy@cd@parse@opt@a}{%
+ \bxwy@cd@parse@opt@d#1}}
+\def\bxwy@cd@parse@opt@d#1#2\bxwy@mk#3#4#5{%
+ \expandafter\bxwy@cd@parse@opt@e\bxwy@burst-`>#1#3#4#5{#2}}
+\def\bxwy@cd@parse@opt@e#1#2#3#4{%
+ \bxwy@cd@parse@opt@a#4\bxwy@mk#1#2#3}
+\def\bxwy@cd@parse@opt@f#1#2#3#4{%
+ #4{#1#2#3}}
+%
+\def\bxwy@cdpo@@w#1#2#3{w#2#3}
+\def\bxwy@cdpo@@k#1#2#3{#1k#3}
+\def\bxwy@cdpo@@j#1#2#3{#1j#3}
+\def\bxwy@cdpo@@J#1#2#3{#1J#3}
+\def\bxwy@cdpo@@o#1#2#3{#1#2o}
+\def\bxwy@cdpo@@O#1#2#3{#1#2O}
+
+%--------------------------------------- all done
+\endinput
+%% EOF
diff --git a/language/japanese/BX/bxwareki/bxwareki.pdf b/language/japanese/BX/bxwareki/bxwareki.pdf
new file mode 100644
index 0000000000..5bfcc6272d
--- /dev/null
+++ b/language/japanese/BX/bxwareki/bxwareki.pdf
Binary files differ
diff --git a/language/japanese/BX/bxwareki/bxwareki.sty b/language/japanese/BX/bxwareki/bxwareki.sty
new file mode 100644
index 0000000000..d3dab98aca
--- /dev/null
+++ b/language/japanese/BX/bxwareki/bxwareki.sty
@@ -0,0 +1,513 @@
+%%
+%% This is file 'bxwareki.sty'.
+%%
+%% Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
+%% GitHub: https://github.com/zr-tex8r
+%% Twitter: @zr_tex8r
+%%
+%% This package is distributed under the MIT License.
+%%
+
+% Note: This file is encoded entirely in us-ascii.
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bxwareki}[2019/06/01 v0.6]
+
+%% preparation
+\def\bxwy@pkgname{bxwareki}
+\providecommand\bxDebug[1]{}
+
+%--------------------------------------- general
+
+%% unique tokens
+\def\bxwy@end{\noexpand\bxwy@end@}
+\def\bxwy@mt{\noexpand\bxwy@mt@}
+\let\bxwy@mk\indent
+
+%% \bxwy@engine : engine type
+%% \ifbxwy@eTeX@ok : have e-TeX extension?
+%% \ifbxwy@epTeXinputencoding@ok : have \epTeXinputencoding?
+\def\bxwy@next#1#2{%
+ \edef\bxwy@tmpa{\string#1}\edef\bxwy@tmpb{\meaning#1}%
+ \ifx\bxwy@tmpa\bxwy@tmpb #2\fi}
+\chardef\bxwy@engine=0 % 8-bit TeX
+\bxwy@next\kanjiskip {\chardef\bxwy@engine=1 }% pTeX (or upTeX)
+\bxwy@next\jintercharskip{\chardef\bxwy@engine=2 }% NTT-jTeX
+\bxwy@next\Omegaversion {\chardef\bxwy@engine=3 }% Aleph
+\bxwy@next\XeTeXversion {\chardef\bxwy@engine=4 }% XeTeX
+\bxwy@next\luatexversion {\chardef\bxwy@engine=5 }% LuaTeX
+\newif\ifbxwy@eTeX@ok
+\bxwy@next\eTeXversion{\bxwy@eTeX@oktrue}
+\newif\ifbxwy@upTeX@ok
+\bxwy@next\forcecjktoken{\bxwy@upTeX@oktrue}
+\newif\ifbxwy@epTeXinputencoding@ok
+\bxwy@next\epTeXinputencoding{\bxwy@epTeXinputencoding@oktrue}
+
+%% switch 'bxwy@customdate@ok'
+% NB. It is "whether or not UTF-8 files can be safely loaded".
+\newif\ifbxwy@customdate@ok
+\ifcase\bxwy@engine \bxwy@customdate@oktrue % 8-bit
+\or % pTeX
+ \ifbxwy@epTeXinputencoding@ok \bxwy@customdate@oktrue
+ \else\ifbxwy@upTeX@ok \bxwy@customdate@oktrue
+ \fi\fi
+\or % jTeX
+\else \bxwy@customdate@oktrue
+\fi
+
+%% \bxwy@oncex{...}
+% The once-expander, used in \edef.
+%% \bxwy@twicex{...}
+% The twice-expander, used in \edef.
+\ifbxwy@eTeX@ok
+ \def\bxwy@oncex#1{\unexpanded\expandafter{#1}}
+ \def\bxwy@twicex#1{\unexpanded\expandafter\expandafter\expandafter{#1}}
+\else
+ % Here it is assumed that the engine is (u)pTeX or JTeX.
+ \def\bxwy@oncex#1{#1}
+ \def\bxwy@twicex#1{#1}
+\fi
+
+%% \bxwy@newcounter{<name>}
+%% \bxwy@setcounter{<name>}{<value>}
+% Declares a pseudo-counter (if not on e-TeX).
+\@onlypreamble\bxwy@newcounter
+\ifbxwy@eTeX@ok
+ \let\bxwy@newcounter\newcounter
+ \def\bxwy@setcounter#1#2{% assign locally
+ \csname c@#1\endcsname#2\relax}
+\else
+ \def\bxwy@newcounter#1{%
+ \expandafter\@ifdefinable\csname c@#1\endcsname{%
+ \expandafter\mathchardef\csname c@#1\endcsname\z@
+ \expandafter\gdef\csname the#1\expandafter\endcsname\expandafter{%
+ \expandafter\@arabic\csname c@#1\endcsname}}}
+ \def\bxwy@setcounter#1#2{% assign locally
+ \expandafter\mathchardef\csname c@#1\endcsname#2\relax}
+\fi
+
+%--------------------------------------- options
+
+%% 'download'
+\DeclareOption{download2019}{}% now no-op
+% dispatch
+\ProcessOptions\relax
+
+%--------------------------------------- Japanese string maker
+
+% The "combo-code" represents a single Japanese character and has
+% the form such like:
+% E698AD:662D:3E3C:f3F
+% where
+% - E698AD is hex dump of UTF-8 bytes;
+% - 662D is hex of Unicode point;
+% - 3E3C is hex dump of JIS-encoding bytes;
+% - f3F is something for jTeX.
+
+%% \bxwy@S : inter-ascii-kanji skip
+\let\bxwy@S\@empty
+%% \bxwy@normal@S : the normal definition of \bxwy@S
+\let\bxwy@normal@S\relax
+%% \bxwy@C : Japanese character printer for JTeX
+\let\bxwy@C\relax
+
+%% \bxwy@freeze@fragile : make fragile cs unexpandable
+\let\bxwy@freeze@fragile\relax
+%% \bxwy@restore@fragile : revoke \bxwy@freeze@fragile
+\let\bxwy@restore@fragile\relax
+
+%% \bxwy@add@jchar\CS{<combo-code>}
+% Adds a character with given combo-code to the macro \CS.
+\@onlypreamble\bxwy@add@jchar
+\def\bxwy@add@jchar#1#2{%
+ \begingroup
+ \bxwy@freeze@fragile
+ \def\bxwy@next##1{\xdef#1{\bxwy@oncex#1\bxwy@oncex{##1}}}%
+ \edef\bxwy@tmpa{#2}%
+ \expandafter\bxwy@add@jchar@dec\bxwy@tmpa::::\bxwy@end
+ \endgroup}
+\@onlypreamble\bxwy@add@jchar@dec
+\@onlypreamble\bxwy@add@jchar@dec@a
+\@onlypreamble\bxwy@add@jchar@dec@b
+% engine-dependent parts
+\ifcase\bxwy@engine %8-bit
+ \def\bxwy@add@jchar@dec#1:#2:#3:#4:#5\bxwy@end{%
+ \bxwy@add@jchar@dec@a#1000000\bxwy@end}
+ \def\bxwy@add@jchar@dec@a#1#2#3#4#5#6#7\bxwy@end{%
+ \let\do\bxwy@add@jchar@dec@b
+ \do{#1#2}\do{#3#4}\do{#5#6}}
+ \def\bxwy@add@jchar@dec@b#1{%
+ \lccode`\~="#1\relax\lowercase{\bxwy@next{\noexpand~}}}
+ \def\bxwy@S{~}% \bxwy@S expands to ~, and ~ is protected.
+ \let\bxwy@org@tie\relax
+ \def\bxwy@freeze@fragile{\let\bxwy@org@tie=~\let~=\relax}
+ \def\bxwy@restore@fragile{\let~=\bxwy@org@tie}
+\or %pTeX
+ \def\bxwy@add@jchar@dec#1:#2:#3:#4:#5\bxwy@end{%
+ \kansujichar\@ne=\jis"#3\relax \bxwy@next{\kansuji\@ne}}
+\or %jTeX
+ \def\bxwy@add@jchar@dec#1:#2:#3:#4:#5\bxwy@end{%
+ \bxwy@next{\bxwy@C#4}}
+ \def\bxwy@C#1#2#3{%
+ \mbox{\csname j#1\endcsname\char"#2#3}}
+ \def\bxwy@@S{% standard inter-ascii-kanji skip
+ \hskip \ifdim\jasciikanjiskip=\z@ \fontdimen7\ja\@minus\fontdimen9\ja
+ \else \jasciikanjiskip \fi
+ \relax}
+ \def\bxwy@S{\bxwy@@S}% \bxwy@S expands to \bxwy@@S, which is protected.
+ \let\bxwy@org@@S\relax \let\bxwy@org@C\relax
+ \def\bxwy@freeze@fragile{%
+ \let\bxwy@org@@S\bxwy@@S \let\bxwy@@S\relax
+ \let\bxwy@org@C\bxwy@C \let\bxwy@C\relax}
+ \def\bxwy@restore@fragile{%
+ \let\bxwy@@S\bxwy@org@@S \let\bxwy@C\bxwy@org@C}
+\else %Aleph/XeTeX/LuaTeX
+ \def\bxwy@add@jchar@dec#1:#2:#3:#4:#5\bxwy@end{%
+ \lccode`\Z="#2\relax \lowercase{\bxwy@next{\noexpand Z}}}
+\fi
+% set \bxwy@normal@S
+\let\bxwy@normal@S\bxwy@S
+
+\ifbxwy@eTeX@ok %<*eTeX>
+%%<+> \WarekiUseNormalInterGlue
+% Uses the normal definition of inter-ascii-kanji skip.
+\newcommand*\WarekiUseNormalInterGlue{%
+ \let\bxwy@S\bxwy@normal@S
+ \bxwy@render@all}
+%%<+> \WarekiUseCustomInterGlue{<text>}
+% Uses the custom definition of inter-ascii-kanji skip.
+\@ifdefinable\WarekiUseCustomInterGlue{%
+ \def\WarekiUseCustomInterGlue#{%
+ \afterassignment\bxwy@render@all
+ \protected\def\bxwy@S}}
+\fi %</eTeX>
+
+%--------------------------------------- Japanese words
+
+%% \bxwy@@meiji : kanji string 'Meiji'
+\let\bxwy@@meiji\@empty
+\bxwy@add@jchar\bxwy@@meiji{E6988E:660E:4C40:k67}
+\bxwy@add@jchar\bxwy@@meiji{E6B2BB:6CBB:3C23:e6A}
+%% \bxwy@@taisho : kanji string 'Taisho'
+\let\bxwy@@taisho\@empty
+\bxwy@add@jchar\bxwy@@taisho{E5A4A7:5927:4267:gE2}
+\bxwy@add@jchar\bxwy@@taisho{E6ADA3:6B63:4035:fF4}
+%% \bxwy@@showa : kanji string 'Showa'
+\let\bxwy@@showa\@empty
+\bxwy@add@jchar\bxwy@@showa{E698AD:662D:3E3C:f3F}
+\bxwy@add@jchar\bxwy@@showa{E5928C:548C:4F42:l83}
+%% \bxwy@@heisei : kanji string 'Heisei'
+\let\bxwy@@heisei\@empty
+\bxwy@add@jchar\bxwy@@heisei{E5B9B3:5E73:4A3F:jAA}
+\bxwy@add@jchar\bxwy@@heisei{E68890:6210:402E:fED}
+%% \bxwy@@reiwa : kanji string 'Reiwa'
+\let\bxwy@@reiwa\@empty
+\bxwy@add@jchar\bxwy@@reiwa{E4BBA4:4EE4:4E61:l44}
+\bxwy@add@jchar\bxwy@@reiwa{E5928C:548C:4F42:l83}
+%% \bxwy@@nen : kanji for 'year'
+\let\bxwy@@nen\@empty
+\bxwy@add@jchar\bxwy@@nen{E5B9B4:5E74:472F:i80}
+%% \bxwy@@gatsu : kanji for 'month'
+\let\bxwy@@gatsu\@empty
+\bxwy@add@jchar\bxwy@@gatsu{E69C88:6708:376E:cDF}
+%% \bxwy@@nichi : kanji for 'day'
+\let\bxwy@@nichi\@empty
+\bxwy@add@jchar\bxwy@@nichi{E697A5:65E5:467C:i6F}
+%% \bxwy@@gan : kanji for 'origin'
+\let\bxwy@@gan\@empty
+\bxwy@add@jchar\bxwy@@gan{E58583:5143:3835:d04}
+
+%--------------------------------------- kanji numerals
+
+%% \bxwy@set@jchar@digit{<n>}{<combo-code>}
+\@onlypreamble\bxwy@set@jchar@digit
+\def\bxwy@set@jchar@digit#1{%
+ \expandafter\bxwy@set@jchar@digit@a\csname bxwy@jcd/#1\endcsname}
+\@onlypreamble\bxwy@set@jchar@digit@a
+\def\bxwy@set@jchar@digit@a#1#2{%
+ \let#1\@empty \bxwy@add@jchar#1{#2}}
+
+%% \[bxwr@jcd/<n>] : kanji digit for n
+\bxwy@set@jchar@digit{0}{E38087:3007:213B:{sy}1B}
+\bxwy@set@jchar@digit{1}{E4B880:4E00:306C:a4B}
+\bxwy@set@jchar@digit{2}{E4BA8C:4E8C:4673:i66}
+\bxwy@set@jchar@digit{3}{E4B889:4E09:3B30:e19}
+\bxwy@set@jchar@digit{4}{E59B9B:56DB:3B4D:e36}
+\bxwy@set@jchar@digit{5}{E4BA94:4E94:385E:d2D}
+\bxwy@set@jchar@digit{6}{E585AD:516D:4F3B:l7C}
+\bxwy@set@jchar@digit{7}{E4B883:4E03:3C37:e7E}
+\bxwy@set@jchar@digit{8}{E585AB:516B:482C:iDB}
+\bxwy@set@jchar@digit{9}{E4B99D:4E5D:3665:c78}
+\bxwy@set@jchar@digit{X}{E58D81:5341:3D3D:eE2}% ten
+\bxwy@set@jchar@digit{C}{E799BE:767E:4934:j41}% hundred
+
+%%<+> \WarekiKansuji{<counter>}
+%% \bxwy@kansuji{<number>}
+% The kansuji representation of the number.
+\newcommand*\WarekiKansuji[1]{%
+ \expandafter\bxwy@kansuji\csname c@#1\endcsname}
+\def\bxwy@kansuji#1{%
+ \ifnum#1<\z@\else
+ \expandafter\bxwy@kansuji@a\number#1\bxwy@mk
+ \fi}
+\def\bxwy@kansuji@a#1{%
+ \ifx#1\bxwy@mk\else
+ \bxwy@twicex{\csname bxwy@jcd/#1\endcsname}%
+ \expandafter\bxwy@kansuji@a
+ \fi}
+
+%% \bxwy@jkansuji{<number>}
+% The kansuji-by-reading representation of the number.
+% NB. Only valid in range 0..999; otherwise fallback to \bxwy@kansuji.
+\def\bxwy@jkansuji#1{%
+ \expandafter\bxwy@jkansuji@a\number#1\bxwy@mk}
+\chardef\bxwy@jk@x=10
+\chardef\bxwy@jk@c=100
+\def\bxwy@jkansuji@a#1\bxwy@mk{%
+ \ifnum#1<\z@
+ \bxwy@kansuji{#1}%
+ \else\ifnum#1<\bxwy@jk@x
+ \bxwy@twicex{\csname bxwy@jcd/#1\endcsname}%
+ \else\ifnum#1<\bxwy@jk@c
+ \bxwy@jkansuji@b0#1%
+ \else\ifnum#1<\@m
+ \bxwy@jkansuji@b#1%
+ \else
+ \bxwy@kansuji@a#1\bxwy@mk
+ \fi\fi\fi\fi}
+\def\bxwy@jkansuji@b#1#2#3{%
+ \ifnum#1>\@ne \bxwy@twicex{\csname bxwy@jcd/#1\endcsname}\fi
+ \ifnum#1>\z@ \bxwy@twicex{\csname bxwy@jcd/C\endcsname}\fi
+ \ifnum#2>\@ne \bxwy@twicex{\csname bxwy@jcd/#2\endcsname}\fi
+ \ifnum#2>\z@ \bxwy@twicex{\csname bxwy@jcd/X\endcsname}\fi
+ \ifnum#3>\z@ \bxwy@twicex{\csname bxwy@jcd/#3\endcsname}\fi}
+
+%--------------------------------------- calculate wareki year
+
+%% errors
+\def\bxwy@err@ivnum#1{%
+ \PackageError\bxwy@pkgname
+ {Bad number form: #1}{\@ehc}}
+\def\bxwy@err@ivrng#1#2#3#4{%
+ \PackageError\bxwy@pkgname
+ {The #4 value #1 is out of range (#2..#3)}{\@ehc}}
+
+%% variables
+\let\bxwy@g@gengo\relax
+\let\bxwy@g@year\relax
+\let\bxwy@g@date\relax
+
+%% \bxwy@assign@date{<year>}{<month>}{<day>}
+\def\bxwy@assign@date#1#2#3{%
+ \bxwy@assign@date@a\year {#1}{0}{9999}{year}%
+ \bxwy@assign@date@a\month{#2}{1}{99}{}%
+ \bxwy@assign@date@a\day {#3}{1}{99}{}}
+\def\bxwy@assign@date@a#1#2#3#4#5{%
+ \afterassignment\bxwy@assign@date@b\@tempcnta=#2\bxwy@mk{#2}%
+ \@tempswatrue
+ \edef\bxwy@tmpb{\the\@tempcnta}%
+ \ifnum#3>\@tempcnta \@tempswafalse \@tempcnta#3\relax \fi
+ \ifnum#4<\@tempcnta \@tempswafalse \@tempcnta#4\relax \fi
+ \if@tempswa\else \ifx\bxwy@mt#5\bxwy@mt\else
+ \bxwy@err@ivrng\bxwy@tmpb{#3}{#4}{#5}%
+ \fi\fi
+ #1=\ifnum\@tempcnta=\z@ \@ne \else \@tempcnta \fi}
+\def\bxwy@assign@date@b#1\bxwy@mk#2{%
+ \ifx\bxwy@mk#1\bxwy@mk\else
+ \@tempcnta\z@
+ \bxwy@err@ivnum{#2}%
+ \fi}
+
+%% \bxwy@calc@wareki@year
+% Sets \bxwy@g@gengo and \bxwy@g@year.
+\def\bxwy@calc@wareki@year{%
+ \@tempcnta=\the\year\two@digits\month\two@digits\day\relax
+ \let\bxwy@tmpa\@empty \let\bxwy@tmpb\@empty \@tempcntb\year
+ \ifnum\@tempcnta<18730101 % ancient times (non-Gregorian)
+ \else\ifnum\@tempcnta<19120730 % meiji era
+ \let\bxwy@tmpb\bxwy@@meiji
+ \advance\@tempcntb-1867\relax
+ \else\ifnum\@tempcnta<19261225 % taisho era
+ \let\bxwy@tmpb\bxwy@@taisho
+ \advance\@tempcntb-1911\relax
+ \else\ifnum\@tempcnta<19890108 % showa era
+ \let\bxwy@tmpb\bxwy@@showa
+ \advance\@tempcntb-1925\relax
+ \else\ifnum\@tempcnta<20190501 % heisei era
+ \let\bxwy@tmpb\bxwy@@heisei
+ \advance\@tempcntb-1988\relax
+ \else % the new era
+ \let\bxwy@tmpb\bxwy@@reiwa
+ \advance\@tempcntb-2018\relax
+ \fi\fi\fi\fi\fi
+ %
+ \global\let\bxwy@g@gengo\bxwy@tmpb
+ \xdef\bxwy@g@year{\the\@tempcntb}%
+ \xdef\bxwy@g@date{{\the\year}{\the\month}{\the\day}}}
+
+%% \bxwy@gengo@initial@of\CS
+\def\bxwy@gengo@initial@of#1{%
+ \ifx#1\@empty \@empty
+ \else\ifx#1\bxwy@@meiji M%
+ \else\ifx#1\bxwy@@taisho T%
+ \else\ifx#1\bxwy@@showa S%
+ \else\ifx#1\bxwy@@heisei H%
+ \else\ifx#1\bxwy@@reiwa R%
+ \fi\fi\fi\fi\fi\fi}
+
+%--------------------------------------- render wareki date
+
+%% \bxwy@render@for\CSIdate\CSIgengo\CSIyear
+% \CSOyear\CSOdate\CSOkanjidate\CSOjkanjidate
+\def\bxwy@render@for{%
+ \expandafter\bxwy@render@for@a}
+\def\bxwy@render@for@a#1#2#3#4#5#6#7#8#9{%
+ %y,m,d,Igengo,Iyear,Oyaer,Odate,Okanjidate,Ojkanjidate
+ \bxwy@freeze@fragile
+ % \CSOyear
+ \edef#6{%
+ \ifx#4\@empty \number#1%(y)
+ \else
+ \bxwy@oncex{#4}%(\CSIgengo)
+ \ifnum#5=\@ne \bxwy@oncex{\bxwy@@gan}%
+ \else \bxwy@S\number#5%(\CSIyear)
+ \fi
+ \fi}%
+ % \CSOdate
+ \edef#7{%
+ \bxwy@oncex{#6}%(\CSOyear)
+ \ifx#4\@empty \bxwy@S
+ \else\ifnum#5=\@ne %nix
+ \else \bxwy@S
+ \fi\fi
+ \bxwy@oncex{\bxwy@@nen}%
+ \bxwy@S#2\bxwy@S \bxwy@oncex{\bxwy@@gatsu}%(m)
+ \bxwy@S#3\bxwy@S \bxwy@oncex{\bxwy@@nichi}}%(d)
+ % \CSOkanjidate
+ \edef#8{%
+ \ifx#4\@empty \bxwy@kansuji{#1}%(y)
+ \else
+ \bxwy@oncex{#4}%(\CSIgengo)
+ \ifnum#5=\@ne \bxwy@oncex{\bxwy@@gan}%
+ \else \bxwy@kansuji{#5}%
+ \fi
+ \fi
+ \bxwy@oncex{\bxwy@@nen}%
+ \bxwy@kansuji{#2}\bxwy@oncex{\bxwy@@gatsu}%(m)
+ \bxwy@kansuji{#3}\bxwy@oncex{\bxwy@@nichi}}%(d)
+ % \CSOjkanjidate
+ \edef#9{%
+ \ifx#4\@empty \bxwy@jkansuji{#1}%(y)
+ \else
+ \bxwy@oncex{#4}%(\CSIgengo)
+ \ifnum#5=\@ne \bxwy@oncex{\bxwy@@gan}%
+ \else \bxwy@jkansuji{#5}%
+ \fi
+ \fi
+ \bxwy@oncex{\bxwy@@nen}%
+ \bxwy@jkansuji{#2}\bxwy@oncex{\bxwy@@gatsu}%(m)
+ \bxwy@jkansuji{#3}\bxwy@oncex{\bxwy@@nichi}}%(d)
+ % done
+ \bxwy@restore@fragile}
+
+%% \bxwy@render@date
+\def\bxwy@render@date{%
+ \bxwy@render@for\bxwy@date\warekigengo\c@warekiyear
+ \warekiyear\warekidate\warekikanjidate\warekijkanjidate
+ \edef\warekigengoinitial{\bxwy@gengo@initial@of\warekigengo}}
+%% \bxwy@render@today
+\def\bxwy@render@today{%
+ \bxwy@render@for\bxwy@today@date\bxwy@today@gengo\bxwy@today@year
+ \bxwy@today@yearstr\warekitoday\warekikanjitoday\warekijkanjitoday}
+%% \bxwy@render@all
+\def\bxwy@render@all{%
+ \bxwy@render@date
+ \bxwy@render@today}
+
+%--------------------------------------- user interface
+
+%% variables
+\let\bxwy@date\relax
+\let\bxwy@today@date\relax
+\let\bxwy@today@gengo\relax
+\let\bxwy@today@year\relax
+\let\bxwy@today@yearstr\relax
+
+%%<*> counter 'warekiyear' : number of wareki year
+\bxwy@newcounter{warekiyear}
+%%<*> \warekigengo : kanji string of the current gengo
+\newcommand*\warekigengo{}
+%%<*> \warekigengoinitial : initial Latin letter of the current gengo
+\newcommand*\warekigengoinitial{}
+%%<*> \warekiyear : string of the wareki year
+\newcommand*\warekiyear{}
+%%<*> \warekidate : string of the wareki date
+\newcommand*\warekidate{}
+%%<*> \warekikanjidate : string of the wareki date (kansuji)
+\newcommand*\warekikanjidate{}
+%%<*> \warekijkanjidate : string of the wareki date (kansuji-by-reading)
+\newcommand*\warekijkanjidate{}
+%%<*> \warekitoday : \warekidate string of today
+\newcommand*\warekitoday{}
+%%<*> \warekikanjitoday : \warekikanjidate string of today
+\newcommand*\warekikanjitoday{}
+%%<*> \warekijkanjitoday : \warekijkanjidate string of today
+\newcommand*\warekijkanjitoday{}
+
+%%<*> \warekisetdate{<year>}{<month>}{<day>}
+\newcommand*\warekisetdate[3]{%
+ \begingroup
+ \bxwy@assign@date{#1}{#2}{#3}%
+ \bxwy@calc@wareki@year
+ \endgroup
+ \let\warekigengo\bxwy@g@gengo
+ \bxwy@setcounter{warekiyear}{\bxwy@g@year}%
+ \let\bxwy@date\bxwy@g@date
+ \bxwy@render@date}
+
+%%<*> \warekisettoday
+\newcommand*\warekisettoday{%
+ \warekisetdate\year\month\day}
+
+%%<+> \WarekiSetToday
+\newcommand*\WarekiSetToday{%
+ \begingroup
+ \bxwy@assign@date\year\month\day
+ \bxwy@calc@wareki@year
+ \endgroup
+ \let\bxwy@today@gengo\bxwy@g@gengo
+ \let\bxwy@today@year\bxwy@g@year
+ \let\bxwy@today@date\bxwy@g@date
+ \bxwy@render@today}
+
+%%<+> WarekiIfCustomDateAvailable{<true>}{<false>}
+\newcommand*\WarekiIfCustomDateAvailable{%
+ \ifbxwy@customdate@ok \expandafter\@firstoftwo
+ \else \expandafter\@secondoftwo
+ \fi}
+
+%%<*> \warekicustomdate
+\newcommand*\warekicustomdate[1]{%
+ \warekidate}% fallback
+
+%--------------------------------------- start up
+
+%% load submodules
+\ifbxwy@customdate@ok
+ \input{bxwareki-cd.def}
+\fi
+
+%% set 'date' to today
+\warekisettoday
+% copy 'date' to 'today'
+\let\bxwy@today@gengo\warekigengo
+\edef\bxwy@today@year{\the\c@warekiyear}
+\let\bxwy@today@date\bxwy@date
+\let\warekitoday\warekidate
+\let\warekikanjitoday\warekikanjidate
+\let\warekijkanjitoday\warekijkanjidate
+
+%--------------------------------------- all done
+\endinput
+%% EOF
diff --git a/language/japanese/BX/bxwareki/bxwareki.tex b/language/japanese/BX/bxwareki/bxwareki.tex
new file mode 100644
index 0000000000..ac00bc9be7
--- /dev/null
+++ b/language/japanese/BX/bxwareki/bxwareki.tex
@@ -0,0 +1,240 @@
+% LuaLaTeX document; UTF-8
+\documentclass[a4paper]{article}
+\usepackage[scale=0.75]{geometry}
+\usepackage{shortvrb}
+\MakeShortVerb{\|}
+\newcommand{\PkgVersion}{0.6}
+\newcommand{\PkgDate}{2019/06/01}
+\newcommand{\Pkg}[1]{\textsf{#1}}
+\newcommand{\Meta}[1]{$\langle$\textit{#1}$\rangle$}
+\newcommand{\Note}{\par\noindent\emph{Note:}\quad}
+\newcommand{\Ie}{i.\,e.}
+\newcommand{\Eg}{e.\,g.}
+\newcommand{\Means}{~:\quad}
+\usepackage{bxtexlogo}
+\bxtexlogoimport{*,ApTeX,JTeX}
+% Japanese something
+\usepackage{fontspec}
+\newfontfamily{\fIpaex}{IPAexMincho}[Scale=0.95]
+\newcommand*{\Ja}[1]{{\fIpaex#1}}
+\newcommand*{\+}{\hspace{0.25em minus 0.25em}}
+%-----------------------------------------------------------
+\begin{document}
+\title{The \Pkg{bxwareki} package}
+\author{Takayuki YATO\quad (aka.~``ZR'')}
+\date{v\PkgVersion \quad[\PkgDate]}
+\maketitle
+
+%===========================================================
+\section{Overview}
+\label{sec:Overview}
+
+This package provides commands to convert from the Gregorian calendar
+(2018/8/28) to the Japanese rendering of the Japanese calendar
+(\Ja{平成\+30\+年\+8\+月\+28\+日}).
+You can choose whether the numbers are written
+in Western numerals (28) or kanji numerals (\Ja{二八}).
+The package is aware of the current era name,
+\emph{Reiwa}~(\Ja{令和}).
+
+Note that the package only deals with dates in the year 1873 or later,
+where the Japanese calendar is really a Gregorian calendar
+with the different notation of years.
+
+\paragraph{System requirement}
+
+\begin{itemize}
+\item \TeX{} format: \LaTeX.
+\item \TeX{} engine: {\pdfTeX}, {\LuaTeX}, {\XeTeX},
+ {\pTeX}, {\upTeX}, {\ApTeX} ({\pTeX}-ng), NTT-{\JTeX}.
+\end{itemize}
+
+\Note The modern (post-1873) Japanese calendar (\emph{wareki}; \Ja{和暦})
+can be regarded as a variant of Gregorian calendar
+where only the notation of years differs from the original.
+To avoid confusion, this document refers to the original Gregorian
+calendar as the \emph{Western calendar},
+which corresponds to the Japanese term \emph{seireki} (\Ja{西暦}).
+
+%===========================================================
+\section{Package Loading}
+\label{sec:Loading}
+
+No options are available.
+
+\begin{quote}\small\begin{verbatim}
+\usepackage{bxwareki}
+\end{verbatim}\end{quote}
+
+%===========================================================
+\section{Usage}
+\label{sec:Usage}
+
+%-------------------
+\subsection{Conversion from the given date}
+
+\begin{itemize}
+\item |\warekisetdate{|\Meta{year}|}{|\Meta{month}|}{|\Meta{day}|}|\Means
+ Converts from the specified Western date.
+ The result will be rendered by the commands described
+ at the following items, where the result for the invocation
+ |\warekisetdate{2018}{8}{28}|
+ will be shown as example.
+
+ \Note Although the Japanese calendar differs from the Western calendar
+ only in the notation of years,
+ the value of months and days are still required,
+ since the notation of the year in which
+ \emph{kaigen} (\Ja{改元}; change of gengo)
+ occurs depends on months and days.
+
+\item |\warekisettoday|\Means
+ Does |\warekisetdate| with the current date.
+
+\item Counter |warekiyear|\Means
+ The year number (within the gengo); \Eg~``\Ja{30}''.
+
+ \Note Unlike ordinary counters,
+ the assignment to |warekiyear| by |\warekisetdate| is \emph{local}.
+ Moreover, manual assignment to this counter is not supported.
+
+\item |\warekigengo|\Means
+ The gengo in kanji, \Eg~``\Ja{平成}''.
+
+\item |\warekigengoinitial|\Means
+ The initial Latin letter of the gengo, \Eg~``\Ja{H}''.
+
+\item |\warekiyear|\Means
+ The full notation of the year (without `\Ja{年}'),
+ \Eg~``\Ja{平成\+30}''.
+
+ \Note When the year number is one,
+ the kanji `\Ja{元}' is used instead of the numeral `\Ja{1}'.
+
+\item |\warekidate|\Means
+ The date string, \Eg~``\Ja{平成\+30\+年\+8\+月\+28\+日}''.
+
+\item |\warekikanjidate|\Means
+ The date string using kansuji (kanji numerals),
+ \Eg~``\Ja{平成三〇年八月二八日}''.
+
+\item |\warekijkanjidate|\Means
+ The date string using ``kansuji-by-reading''
+ (that is, kanji rendering of numbers in the Japanese language),
+ \Eg.``\Ja{平成三十年八月二十八日}''.
+
+\item |\warekicustomdate{|\Meta{option}|}|\Means
+ The date string in the form specified with the option.
+ The option is a string of letters such as |wk|
+ and each letter means a specific setting.
+ When the option is empty, the date is rendered in the form
+ ``\Ja{2018\+年\+8\+月\+28\+日}'' (using the Western calendar).
+ The available option letters are:
+ \begin{itemize}
+ \item |w|\Means
+ uses Japanese calendar (\Ja{2018\+年} $\to$ \Ja{平成\+30\+年});
+ \item |k|\Means
+ uses kansuji (\Ja{28} $\to$ \Ja{二八});
+ \item |j|\Means
+ uses kansuji-by-reading (\Ja{28} $\to$ \Ja{二十八});
+ \par\smallskip
+ \Note Western years does not support kansuji-by-reading
+ and thus |k| will be applied instead
+ (\Ja{二〇一八}, not \Ja{二千十八}).
+ \item |J|\Means
+ variant of |j| where ``ten's multiple'' kanji characters
+ (\Ja{廿} and \Ja{卅}) are employed (\Ja{28} $\to$ \Ja{廿八});
+ \item |o|\Means
+ uses \emph{imyo} (\Ja{異名}) for months%
+ \footnote{Don't ask me if this form is ever used in {\LaTeX} document!}
+ (\Ja{8\+月} $\to$ \Ja{葉月}).
+ \end{itemize}
+
+ \Note This command is supported only on {\pdfLaTeX}, {\XeLaTeX},
+ {\LuaLaTeX}, {\upLaTeX}, {Ap\LaTeX} and recent versions of {\pLaTeX}.
+ On other engines it simply falls back to |\warekidate|.
+
+\item |\WarekiIfCustomDateAvailable{|\Meta{true}|}{|\Meta{false}|}|\Means
+ Tests if the command |\warekicustomdate| is
+ supported on the engine in use.
+\end{itemize}
+
+%-------------------
+\subsection{Current date}
+
+These commands always represent the current date,
+and are not affected by |\warekisetdate| (or |\warekisettoday|).
+
+\begin{itemize}
+\item |\warekitoday|\Means
+ The |\warekidate| form of the current date.
+\item |\warekikanjitoday|\Means
+ The |\warekikanjidate| form.
+\item |\warekijkanjitoday|\Means
+ The |\warekijkanjidate| form.
+\end{itemize}
+
+%-------------------
+\subsection{Inter-alphabet-kanji glues}
+
+In quality Japanese typesetting, a thin space
+(\emph{shibuaki}; \Ja{四分空き}) must be inserted
+between an alphabet letter and a kanji letter.
+This package by default inserts a command
+suitable for the most prevalent Japanese-typesetting environment
+for the engine in use.
+
+\begin{itemize}
+\item On {\pLaTeX}, {\upLaTeX} and {Ap\LaTeX}:
+ Nothing is inserted,
+ since the engine can automatically insert shibuaki spaces.
+\item On {\LuaLaTeX} and {\XeLaTeX}:
+ Nothing is inserted,
+ on the assumption that the package for Japanese typesetting
+ (such as \Pkg{\LuaTeX-ja} and \Pkg{xeCJK})
+ will automatically insert shibuaki spaces.
+\item On {\LaTeX} and {\pdfLaTeX}:
+ |~| is inserted,
+ on the assumption that the \Pkg{CJK} package is employed
+ and |\CJKtilde| is in effect.
+\end{itemize}
+
+On the engines with {\eTeX} extension,
+the command for shibuaki can be changed with the following commands:
+\begin{itemize}
+\item |\WarekiUseCustomInterGlue{|\Meta{text}|}|\Means
+ Uses \Meta{text} for making shibuaki spaces.
+\item |\WarekiUseNormalInterGlue|\Means
+ Reverts |\WarekiUseCustomInterGlue|
+ and uses the normal setting.
+\end{itemize}
+
+%===========================================================
+\section{Notices for {\TeX} programmers}
+\label{sec:Allez}
+
+\begin{itemize}
+\item On the engines with native kanji/Unicode support
+ (\Ie~{\LuaLaTeX}, {\XeLaTeX}, {\pLaTeX}, {\upLaTeX}, and {Ap\LaTeX}),
+ the content (one-level expansion) of |\wareki...date|
+ (except |\warekicustomdate|) and |\wareki...today|
+ is a simple string of character tokens,
+ unless |\WarekiUseCustomInterGlue| is in effect.
+ The same holds for {\LaTeX} and {\pdfLaTeX},
+ except that each kanji character is
+ represented by the sequence of activated byte tokens
+ and |~| is inserted as shibuaki spaces.
+\item On the engines with native kanji/Unicode support,
+ |\warekicustomdate| fully expands to a simple string
+ of character tokens
+ (again without |\WarekiUseCustomInterGlue|),
+ and the situation on {\LaTeX} and {\pdfLaTeX}
+ is parallel to that described at the previous item.
+\item The use of |\WarekiUseCustomInterGlue|
+ does not break the full expandability
+ of |\wareki...date| and |\wareki...today|
+ on the engines with native kanji/Unicode support.
+\end{itemize}
+
+%===========================================================
+\end{document}
diff --git a/language/japanese/BX/bxwareki/bxwareki2019.def b/language/japanese/BX/bxwareki/bxwareki2019.def
new file mode 100644
index 0000000000..438a5bdba1
--- /dev/null
+++ b/language/japanese/BX/bxwareki/bxwareki2019.def
@@ -0,0 +1,3 @@
+E4BBA4:4EE4:4E61:l44
+E5928C:548C:4F42:l83
+R