texlive[48752] Master: bxwareki (24sep18)

commits+karl at tug.org commits+karl at tug.org
Mon Sep 24 22:25:07 CEST 2018


Revision: 48752
          http://tug.org/svn/texlive?view=revision&revision=48752
Author:   karl
Date:     2018-09-24 22:25:06 +0200 (Mon, 24 Sep 2018)
Log Message:
-----------
bxwareki (24sep18)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-langjapanese.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/bxwareki/
    trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE
    trunk/Master/texmf-dist/doc/latex/bxwareki/README.md
    trunk/Master/texmf-dist/tex/latex/bxwareki/
    trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
    trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
    trunk/Master/tlpkg/tlpsrc/bxwareki.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE	2018-09-24 20:25:06 UTC (rev 48752)
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2018 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.

Added: trunk/Master/texmf-dist/doc/latex/bxwareki/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxwareki/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/bxwareki/README.md	2018-09-24 20:25:06 UTC (rev 48752)
@@ -0,0 +1,176 @@
+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
+----------------------------
+
+Note: The modern (post-1873) Japanese calendar (*wareki*; 和暦) 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 *Western calendar*, which
+corresponds to the Japanese term *seireki* (西暦).
+
+### Package Loading
+
+    \usepackage{bxwareki}
+
+### Usage
+
+#### Conversion from the given date
+
+  * `\warekisetdate{<year>}{<month>}{<day>}`: 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 *kaigen* (改元;
+    change of gengo) occurs depends on months and days.
+
+  * `\warekisettoday`: Does `\warekisetdate` with the current date.
+
+  * Counter `warekiyear`: The year number (within the gengo); e.g. 30.
+
+    Note: Unlike ordinary counters, the assignment to `warekiyear` by
+    `\warekisetdate` is *local*. Moreover, manual assignment to this
+    counter is not supported.
+
+  * `\warekigengo`: The gengo in kanji, e.g. “平成”.
+
+  * `\warekiyear`: The full notation of the year (without ‘年’),
+    e.g. “平成30”.
+
+    Note: When the year number is one, the kanji ‘元’ is used instead
+    of the numeral ‘1’.
+
+  * `\warekidate`: The date string, e.g. “平成30年8月28日”.
+
+  * `\warekikanjidate`: The date string using kansuji (kanji numerals),
+    e.g. “平成三〇年八月二八日”.
+
+  * `\warekijkanjidate`: The date string using “kansuji-by-reading”
+    (that is, kanji rendering of numbers in the Japanese language),
+    e.g. “平成三十年八月二十八日”.
+
+  * `\warekicustomdate{<option>}`: 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 “2018年8月28日” (using the Western
+    calendar). The available option letters are:
+
+      - `w`: uses Japanese calendar (2018年 → 平成30年)
+      - `k`: uses kansuji (28 → 二八)
+      - `j`: uses kansuji-by-reading (28 → 二十八)  
+        Note: Western years does not support kansuji-by-reading and thus
+        `k` will be applied instead (二〇一八, not 二千十八)
+      - `J`: variant of `j` where “ten’s multiple” kanji characters
+        (廿 and 卅) are employed (28 → 廿八)
+      - `o`: uses *imyo* (異名) for months (8月 → 葉月)  
+        (Don’t ask me if this form is ever used in LaTeX document!)
+
+    Note: This command is supported only on pdfLaTeX, XeLaTeX, LuaLaTeX,
+    upLaTeX, ApLaTeX and recent versions of pLaTeX. On other engines it
+    simply falls back to `\warekidate`.
+
+  * `\WarekiIfCustomDateAvailable{<true>}{<false>}`: Tests if the command
+    `\warekicustomdate` is supported on the engine in use.
+
+#### Current date
+
+These commands always represent the current date, and are not affected
+by `\warekisetdate` (or `\warekisettoday`).
+
+  * `\warekitoday`: The `\warekidate` form of the current date.
+  * `\warekikanjitoday`: The `\warekikanjidate` form.
+  * `\warekijkanjitoday`: The `\warekijkanjidate` form.
+
+#### Inter-alphabet-kanji glues
+
+In quality Japanese typesetting, a thin space (*shibuaki*; 四分空き)
+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.
+
+  * On pLaTeX, upLaTeX and ApLaTeX: Nothing is inserted, since the engine
+    can automatically insert shibuaki spaces.
+  * On LuaLaTeX and XeLaTeX: Nothing is inserted, on the assumption that
+    the package for Japanese typesetting (such as LuaTeXja and xeCJK)
+    will automatically insert shibuaki spaces.
+  * On LaTeX and pdfLaTeX: `~` is inserted, on the assumption that the
+    CJK package is employed and `\CJKtilde` is in effect.
+
+On the engines with e-TeX extension, the command for shibuaki can be
+changed with the following commands:
+
+  * `\WarekiUseCustomInterGlue{<text>}`: Uses `<text>` for making shibuaki
+    spaces.
+  * `\WarekiUseNormalInterGlue`: Reverts `\WarekiUseCustomInterGlue` and
+    uses the normal setting.
+
+### Support for the kaigen planned in 2019
+
+In Japan a kaigen (due to the abdication of the Emperor) is planned on
+2019/05/01, but the new gengo is not yet announced. Thus in the current
+version of the package, the date of the day or later is not supported
+(the Western year will be printed instead).
+.
+This package will be updated to support the new gengo and uploaded to
+CTAN, as soon as the new gengo is announced.
+
+### Notices for TeX programmers
+
+  * On the engines with support for native kanji/Unicode characters
+    (i.e. LuaLaTeX, XeLaTeX, pLaTeX, upLaTeX, and ApLaTeX), 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.
+  * 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 item above.
+  * The use of `\WarekiUseCustomInterGlue` does not break the full
+    expandability of `\wareki…date` and `\wareki…today` on the engines
+    with native kanji/Unicode support.
+
+
+Revision History
+----------------
+
+  * Version 0.3  ‹2018/09/24›
+      - The total rewrite.
+  * Version 0.2  ‹2018/04/08›
+      - The first public version.
+
+--------------------
+Takayuki YATO (aka. "ZR")  
+http://zrbabbler.sp.land.to/


Property changes on: trunk/Master/texmf-dist/doc/latex/bxwareki/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def	2018-09-24 20:25:06 UTC (rev 48752)
@@ -0,0 +1,126 @@
+%%
+%% This is file 'bxwareki-cd.def'.
+%%
+%% Copyright (c) 2018 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}[2018/09/24 v0.3]
+
+\ifbxwy at epTeXinputencoding@ok
+  \epTeXinputencoding utf8
+\fi
+
+%--------------------------------------- helpers
+
+%% \bxwy at burst-`>...
+\let\bxwy at burst\romannumeral
+
+%% \bxwy at cond\ifXXX...\fi{<true>}{<false>}
+\@gobbletwo\if\if \def\bxwy at cond#1\fi{%
+  #1\expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi}
+
+%% \bxwy at catch@mk...\bxwy at mk
+\def\bxwy at catch@mk#1\bxwy at mk{#1}
+
+%--------------------------------------- kanji numerals
+
+%% \bxwy at Jkansuji{<number>}
+% The kansuji-by-reading with use of ten-composites (廿, 卅).
+% NB. Only valid in range 0..99; otherwise fallback to \bxwy at jkansuji.
+\def\bxwy at Jkansuji#1{%
+  \expandafter\bxwy at Jkansuji@a\number#1\bxwy at mk}
+\def\bxwy at Jkansuji@a#1\bxwy at mk{%
+  \ifnum#1<\bxwy at jk@x
+    \bxwy at jkansuji@a#1\bxwy at mk
+  \else\ifnum#1<\bxwy at jk@c
+    \bxwy at Jkansuji@b#1%
+  \else
+    \bxwy at jkansuji@a#1\bxwy at mk
+  \fi\fi}
+\def\bxwy at Jkansuji@b#1#2{%
+  \ifcase#1\relax \or 十\or 廿\or 卅%
+  \else \csname bxwy at jcd/#1\endcsname 十%
+  \fi
+  \ifnum#2>\z@ \csname bxwy at 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 at custom@date at parse@opt{#1}\bxwy at custom@date at a}
+\def\bxwy at custom@date at a#1{%
+  \expandafter\bxwy at custom@date at b\bxwy at date#1}
+\def\bxwy at custom@date at 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 at warekiyear=\@ne 元%
+    \else \bxwy at custom@date at number#5\c at warekiyear
+    \fi
+  \else % seireki
+    \if#5-#1\bxwy at S% western
+    \else \bxwy at kansuji{#1}% kansuji/-j/-J
+    \fi
+  \fi
+  年%
+  \if#6-\bxwy at custom@date at number#5{#2}月% month by number
+  \else \bxwy at custom@date at month#6{#2}% month name
+  \fi
+  \bxwy at custom@date at number#5{#3}日}
+\def\bxwy at custom@date at number#1#2{%
+  \if#1k\bxwy at kansuji{#2}% kansuji
+  \else\if#1j\bxwy at jkansuji{#2}% kansuji-j
+  \else\if#1J\bxwy at Jkansuji{#2}% kansuji-J
+  \else % western
+    \bxwy at S \expandafter\bxwy at catch@mk\number#2\bxwy at mk \bxwy at S
+  \fi\fi\fi}
+\def\bxwy at custom@date at 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 at custom@date at parse@opt{<options>}\CScont
+\def\bxwy at custom@date at parse@opt#1{%
+  \bxwy at cd@parse at opt@a#1\bxwy at mk---}
+\def\bxwy at cd@parse at opt@a{%
+  \expandafter\bxwy at cd@parse at opt@b\bxwy at burst-`>}
+\def\bxwy at cd@parse at opt@b#1{%
+  \bxwy at cond\ifx#1\bxwy at mk\fi{\bxwy at cd@parse at opt@f}{%
+    \expandafter\bxwy at cd@parse at opt@c\csname bxwy at cdpo@@#1\endcsname}}
+\def\bxwy at cd@parse at opt@c#1{%
+  \bxwy at cond\ifx#1\relax\fi{\bxwy at cd@parse at opt@a}{%
+    \bxwy at cd@parse at opt@d#1}}
+\def\bxwy at cd@parse at opt@d#1#2\bxwy at mk#3#4#5{%
+  \expandafter\bxwy at cd@parse at opt@e\bxwy at burst-`>#1#3#4#5{#2}}
+\def\bxwy at cd@parse at opt@e#1#2#3#4{%
+  \bxwy at cd@parse at opt@a#4\bxwy at mk#1#2#3}
+\def\bxwy at cd@parse at opt@f#1#2#3#4{%
+  #4{#1#2#3}}
+%
+\def\bxwy at cdpo@@w#1#2#3{w#2#3}
+\def\bxwy at cdpo@@k#1#2#3{#1k#3}
+\def\bxwy at cdpo@@j#1#2#3{#1j#3}
+\def\bxwy at cdpo@@J#1#2#3{#1J#3}
+\def\bxwy at cdpo@@o#1#2#3{#1#2o}
+\def\bxwy at cdpo@@O#1#2#3{#1#2O}
+
+%--------------------------------------- all done
+\endinput
+%% EOF


Property changes on: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty	2018-09-24 20:25:06 UTC (rev 48752)
@@ -0,0 +1,520 @@
+%%
+%% This is file 'bxwareki.sty'.
+%%
+%% Copyright (c) 2018 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}[2018/09/24 v0.3]
+
+%% preparation
+\def\bxwy at pkgname{bxwareki}
+\providecommand\bxDebug[1]{}
+
+%--------------------------------------- general
+
+%% unique tokens
+\def\bxwy at end{\noexpand\bxwy at end@}
+\def\bxwy at mt{\noexpand\bxwy at mt@}
+\let\bxwy at mk\indent
+
+%% \bxwy at engine : engine type
+%% \ifbxwy at eTeX@ok : have e-TeX extension?
+%% \ifbxwy at epTeXinputencoding@ok : have \epTeXinputencoding?
+\def\bxwy at next#1#2{%
+  \edef\bxwy at tmpa{\string#1}\edef\bxwy at tmpb{\meaning#1}%
+  \ifx\bxwy at tmpa\bxwy at tmpb #2\fi}
+\chardef\bxwy at engine=0 % 8-bit TeX
+\bxwy at next\kanjiskip     {\chardef\bxwy at engine=1 }% pTeX (or upTeX)
+\bxwy at next\jintercharskip{\chardef\bxwy at engine=2 }% NTT-jTeX
+\bxwy at next\Omegaversion  {\chardef\bxwy at engine=3 }% Aleph
+\bxwy at next\XeTeXversion  {\chardef\bxwy at engine=4 }% XeTeX
+\bxwy at next\luatexversion {\chardef\bxwy at engine=5 }% LuaTeX
+\newif\ifbxwy at eTeX@ok
+\bxwy at next\eTeXversion{\bxwy at eTeX@oktrue}
+\newif\ifbxwy at upTeX@ok
+\bxwy at next\forcecjktoken{\bxwy at upTeX@oktrue}
+\newif\ifbxwy at epTeXinputencoding@ok
+\bxwy at next\epTeXinputencoding{\bxwy at epTeXinputencoding@oktrue}
+
+%% switch 'bxwy at customdate@ok'
+% NB. It is "whether or not UTF-8 files can be safely loaded".
+\newif\ifbxwy at customdate@ok
+\ifcase\bxwy at engine \bxwy at customdate@oktrue % 8-bit
+\or % pTeX
+  \ifbxwy at epTeXinputencoding@ok \bxwy at customdate@oktrue
+  \else\ifbxwy at upTeX@ok \bxwy at customdate@oktrue
+  \fi\fi
+\or % jTeX
+\else \bxwy at customdate@oktrue
+\fi
+
+%% \bxwy at oncex{...}
+% The once-expander, used in \edef.
+%% \bxwy at twicex{...}
+% The twice-expander, used in \edef.
+\ifbxwy at eTeX@ok
+  \def\bxwy at oncex#1{\unexpanded\expandafter{#1}}
+  \def\bxwy at twicex#1{\unexpanded\expandafter\expandafter\expandafter{#1}}
+\else
+  % Here it is assumed that the engine is (u)pTeX or JTeX.
+  \def\bxwy at oncex#1{#1}
+  \def\bxwy at twicex#1{#1}
+\fi
+
+%% \bxwy at newcounter{<name>}
+%% \bxwy at setcounter{<name>}{<value>}
+% Declares a pseudo-counter (if not on e-TeX).
+\@onlypreamble\bxwy at newcounter
+\ifbxwy at eTeX@ok
+  \let\bxwy at newcounter\newcounter
+  \def\bxwy at setcounter#1#2{% assign locally
+    \csname c@#1\endcsname#2\relax}
+\else
+  \def\bxwy at 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 at setcounter#1#2{% assign locally
+    \expandafter\mathchardef\csname c@#1\endcsname#2\relax}
+\fi
+
+%--------------------------------------- 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 at S : inter-ascii-kanji skip
+\let\bxwy at S\@empty
+%% \bxwy at normal@S : the normal definition of \bxwy at S
+\let\bxwy at normal@S\relax
+%% \bxwy at C : Japanese character printer for JTeX
+\let\bxwy at C\relax
+
+%% \bxwy at freeze@fragile : make fragile cs unexpandable
+\let\bxwy at freeze@fragile\relax
+%% \bxwy at restore@fragile : revoke \bxwy at freeze@fragile
+\let\bxwy at restore@fragile\relax
+
+%% \bxwy at add@jchar\CS{<combo-code>}
+% Adds a character with given combo-code to the macro \CS.
+\@onlypreamble\bxwy at add@jchar
+\def\bxwy at add@jchar#1#2{%
+  \begingroup
+    \bxwy at freeze@fragile
+    \def\bxwy at next##1{\xdef#1{\bxwy at oncex#1\bxwy at oncex{##1}}}%
+    \edef\bxwy at tmpa{#2}%
+    \expandafter\bxwy at add@jchar at dec\bxwy at tmpa::::\bxwy at end
+  \endgroup}
+\@onlypreamble\bxwy at add@jchar at dec
+\@onlypreamble\bxwy at add@jchar at dec@a
+\@onlypreamble\bxwy at add@jchar at dec@b
+% engine-dependent parts
+\ifcase\bxwy at engine %8-bit
+  \def\bxwy at add@jchar at dec#1:#2:#3:#4:#5\bxwy at end{%
+    \bxwy at add@jchar at dec@a#1000000\bxwy at end}
+  \def\bxwy at add@jchar at dec@a#1#2#3#4#5#6#7\bxwy at end{%
+    \let\do\bxwy at add@jchar at dec@b
+    \do{#1#2}\do{#3#4}\do{#5#6}}
+  \def\bxwy at add@jchar at dec@b#1{%
+    \lccode`\~="#1\relax\lowercase{\bxwy at next{\noexpand~}}}
+  \def\bxwy at S{~}% \bxwy at S expands to ~, and ~ is protected.
+  \let\bxwy at org@tie\relax
+  \def\bxwy at freeze@fragile{\let\bxwy at org@tie=~\let~=\relax}
+  \def\bxwy at restore@fragile{\let~=\bxwy at org@tie}
+\or %pTeX
+  \def\bxwy at add@jchar at dec#1:#2:#3:#4:#5\bxwy at end{%
+    \kansujichar\@ne=\jis"#3\relax \bxwy at next{\kansuji\@ne}}
+\or %jTeX
+  \def\bxwy at add@jchar at dec#1:#2:#3:#4:#5\bxwy at end{%
+    \bxwy at next{\bxwy at C#4}}
+  \def\bxwy at 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 at S{\bxwy@@S}% \bxwy at S expands to \bxwy@@S, which is protected.
+  \let\bxwy at org@@S\relax \let\bxwy at org@C\relax
+  \def\bxwy at freeze@fragile{%
+    \let\bxwy at org@@S\bxwy@@S \let\bxwy@@S\relax
+    \let\bxwy at org@C\bxwy at C \let\bxwy at C\relax}
+  \def\bxwy at restore@fragile{%
+    \let\bxwy@@S\bxwy at org@@S \let\bxwy at C\bxwy at org@C}
+\else %Aleph/XeTeX/LuaTeX
+  \def\bxwy at add@jchar at dec#1:#2:#3:#4:#5\bxwy at end{%
+    \lccode`\Z="#2\relax \lowercase{\bxwy at next{\noexpand Z}}}
+\fi
+% set \bxwy at normal@S
+\let\bxwy at normal@S\bxwy at S
+
+\ifbxwy at eTeX@ok       %<*eTeX>
+%%<+> \WarekiUseNormalInterGlue
+% Uses the normal definition of inter-ascii-kanji skip.
+\newcommand*\WarekiUseNormalInterGlue{%
+  \let\bxwy at S\bxwy at normal@S
+  \bxwy at render@all}
+%%<+> \WarekiUseCustomInterGlue{<text>}
+% Uses the custom definition of inter-ascii-kanji skip.
+\@ifdefinable\WarekiUseCustomInterGlue{%
+  \def\WarekiUseCustomInterGlue#{%
+    \afterassignment\bxwy at render@all
+    \protected\def\bxwy at S}}
+\fi                 %</eTeX>
+
+%--------------------------------------- Japanese words
+
+%% \bxwy@@meiji : kanji string 'Meiji'
+\let\bxwy@@meiji\@empty
+\bxwy at add@jchar\bxwy@@meiji{E6988E:660E:4C40:k67}
+\bxwy at add@jchar\bxwy@@meiji{E6B2BB:6CBB:3C23:e6A}
+%% \bxwy@@taisho : kanji string 'Taisho'
+\let\bxwy@@taisho\@empty
+\bxwy at add@jchar\bxwy@@taisho{E5A4A7:5927:4267:gE2}
+\bxwy at add@jchar\bxwy@@taisho{E6ADA3:6B63:4035:fF4}
+%% \bxwy@@showa : kanji string 'Showa'
+\let\bxwy@@showa\@empty
+\bxwy at add@jchar\bxwy@@showa{E698AD:662D:3E3C:f3F}
+\bxwy at add@jchar\bxwy@@showa{E5928C:548C:4F42:l83}
+%% \bxwy@@heisei : kanji string 'Heisei'
+\let\bxwy@@heisei\@empty
+\bxwy at add@jchar\bxwy@@heisei{E5B9B3:5E73:4A3F:jAA}
+\bxwy at add@jchar\bxwy@@heisei{E68890:6210:402E:fED}
+%% \bxwy@@nen : kanji for 'year'
+\let\bxwy@@nen\@empty
+\bxwy at add@jchar\bxwy@@nen{E5B9B4:5E74:472F:i80}
+%% \bxwy@@gatsu : kanji for 'month'
+\let\bxwy@@gatsu\@empty
+\bxwy at add@jchar\bxwy@@gatsu{E69C88:6708:376E:cDF}
+%% \bxwy@@nichi : kanji for 'day'
+\let\bxwy@@nichi\@empty
+\bxwy at add@jchar\bxwy@@nichi{E697A5:65E5:467C:i6F}
+%% \bxwy@@gan : kanji for 'origin'
+\let\bxwy@@gan\@empty
+\bxwy at add@jchar\bxwy@@gan{E58583:5143:3835:d04}
+
+%--------------------------------------- kanji numerals
+
+%% \bxwy at set@jchar at digit{<n>}{<combo-code>}
+\@onlypreamble\bxwy at set@jchar at digit
+\def\bxwy at set@jchar at digit#1{%
+  \expandafter\bxwy at set@jchar at digit@a\csname bxwy at jcd/#1\endcsname}
+\@onlypreamble\bxwy at set@jchar at digit@a
+\def\bxwy at set@jchar at digit@a#1#2{%
+  \let#1\@empty \bxwy at add@jchar#1{#2}}
+
+%% \[bxwr at jcd/<n>] : kanji digit for n
+\bxwy at set@jchar at digit{0}{E38087:3007:213B:{sy}1B}
+\bxwy at set@jchar at digit{1}{E4B880:4E00:306C:a4B}
+\bxwy at set@jchar at digit{2}{E4BA8C:4E8C:4673:i66}
+\bxwy at set@jchar at digit{3}{E4B889:4E09:3B30:e19}
+\bxwy at set@jchar at digit{4}{E59B9B:56DB:3B4D:e36}
+\bxwy at set@jchar at digit{5}{E4BA94:4E94:385E:d2D}
+\bxwy at set@jchar at digit{6}{E585AD:516D:4F3B:l7C}
+\bxwy at set@jchar at digit{7}{E4B883:4E03:3C37:e7E}
+\bxwy at set@jchar at digit{8}{E585AB:516B:482C:iDB}
+\bxwy at set@jchar at digit{9}{E4B99D:4E5D:3665:c78}
+\bxwy at set@jchar at digit{X}{E58D81:5341:3D3D:eE2}% ten
+\bxwy at set@jchar at digit{C}{E799BE:767E:4934:j41}% hundred
+
+%%<+> \WarekiKansuji{<counter>}
+%% \bxwy at kansuji{<number>}
+% The kansuji representation of the number.
+\newcommand*\WarekiKansuji[1]{%
+  \expandafter\bxwy at kansuji\csname c@#1\endcsname}
+\def\bxwy at kansuji#1{%
+  \ifnum#1<\z@\else
+    \expandafter\bxwy at kansuji@a\number#1\bxwy at mk
+  \fi}
+\def\bxwy at kansuji@a#1{%
+  \ifx#1\bxwy at mk\else
+    \bxwy at twicex{\csname bxwy at jcd/#1\endcsname}%
+    \expandafter\bxwy at kansuji@a
+  \fi}
+
+%% \bxwy at jkansuji{<number>}
+% The kansuji-by-reading representation of the number.
+% NB. Only valid in range 0..999; otherwise fallback to \bxwy at kansuji.
+\def\bxwy at jkansuji#1{%
+  \expandafter\bxwy at jkansuji@a\number#1\bxwy at mk}
+\chardef\bxwy at jk@x=10
+\chardef\bxwy at jk@c=100
+\def\bxwy at jkansuji@a#1\bxwy at mk{%
+  \ifnum#1<\z@
+    \bxwy at kansuji{#1}%
+  \else\ifnum#1<\bxwy at jk@x
+    \bxwy at twicex{\csname bxwy at jcd/#1\endcsname}%
+  \else\ifnum#1<\bxwy at jk@c
+    \bxwy at jkansuji@b0#1%
+  \else\ifnum#1<\@m
+    \bxwy at jkansuji@b#1%
+  \else
+    \bxwy at kansuji@a#1\bxwy at mk
+  \fi\fi\fi\fi}
+\def\bxwy at jkansuji@b#1#2#3{%
+  \ifnum#1>\@ne \bxwy at twicex{\csname bxwy at jcd/#1\endcsname}\fi
+  \ifnum#1>\z@  \bxwy at twicex{\csname bxwy at jcd/C\endcsname}\fi
+  \ifnum#2>\@ne \bxwy at twicex{\csname bxwy at jcd/#2\endcsname}\fi
+  \ifnum#2>\z@  \bxwy at twicex{\csname bxwy at jcd/X\endcsname}\fi
+  \ifnum#3>\z@  \bxwy at twicex{\csname bxwy at jcd/#3\endcsname}\fi}
+
+%--------------------------------------- load the new gengo
+
+%% \bxwy at new@gengo at file
+% The external data file for the new gengo.
+\def\bxwy at new@gengo at file{bxwareki2019.def}
+
+%% \bxwy at new@gengo
+% The kanji string for the new gengo if available; otherwise empty.
+\let\bxwy at new@gengo\@empty
+
+%% read the file
+\endlinechar\m at ne
+\openin\@inputcheck=\bxwy at new@gengo at file\relax
+\ifeof\@inputcheck\else % if available
+  \read\@inputcheck to\bxwy at tmpa
+  \ifeof\@inputcheck\else
+    \edef\bxwy at next{\noexpand\bxwy at new@gengo{\bxwy at tmpa}}
+    \expandafter\bxwy at add@jchar\bxwy at next
+    \read\@inputcheck to\bxwy at tmpa
+    \ifeof\@inputcheck
+      \global\let\bxwy at new@gengo\@empty
+    \else
+      \edef\bxwy at next{\noexpand\bxwy at new@gengo{\bxwy at tmpa}}
+      \expandafter\bxwy at add@jchar\bxwy at next
+    \fi
+  \fi
+\fi
+\endlinechar=13 %
+
+%--------------------------------------- calculate wareki year
+
+%% errors
+\def\bxwy at err@ivnum#1{%
+  \PackageError\bxwy at pkgname
+   {Bad number form: #1}{\@ehc}}
+\def\bxwy at err@ivrng#1#2#3#4{%
+  \PackageError\bxwy at pkgname
+   {The #4 value #1 is out of range (#2..#3)}{\@ehc}}
+
+%% variables
+\let\bxwy at g@gengo\relax
+\let\bxwy at g@year\relax
+\let\bxwy at g@date\relax
+
+%% \bxwy at assign@date{<year>}{<month>}{<day>}
+\def\bxwy at assign@date#1#2#3{%
+  \bxwy at assign@date at a\year {#1}{0}{9999}{year}%
+  \bxwy at assign@date at a\month{#2}{1}{99}{}%
+  \bxwy at assign@date at a\day  {#3}{1}{99}{}}
+\def\bxwy at assign@date at a#1#2#3#4#5{%
+  \afterassignment\bxwy at assign@date at b\@tempcnta=#2\bxwy at mk{#2}%
+  \@tempswatrue
+  \edef\bxwy at tmpb{\the\@tempcnta}%
+  \ifnum#3>\@tempcnta \@tempswafalse \@tempcnta#3\relax \fi
+  \ifnum#4<\@tempcnta \@tempswafalse \@tempcnta#4\relax \fi
+  \if at tempswa\else \ifx\bxwy at mt#5\bxwy at mt\else
+    \bxwy at err@ivrng\bxwy at tmpb{#3}{#4}{#5}%
+  \fi\fi
+  #1=\ifnum\@tempcnta=\z@ \@ne \else \@tempcnta \fi}
+\def\bxwy at assign@date at b#1\bxwy at mk#2{%
+  \ifx\bxwy at mk#1\bxwy at mk\else
+    \@tempcnta\z@
+    \bxwy at err@ivnum{#2}%
+  \fi}
+
+%% \bxwy at calc@wareki at year
+% Sets \bxwy at g@gengo and \bxwy at g@year.
+\def\bxwy at calc@wareki at year{%
+  \@tempcnta=\the\year\two at digits\month\two at digits\day\relax
+  \let\bxwy at tmpb\@empty \@tempcntb\year
+  \ifnum\@tempcnta<18730101 % ancient times (non-Gregorian)
+  \else\ifnum\@tempcnta<19120730 % meiji era
+    \let\bxwy at tmpb\bxwy@@meiji
+    \advance\@tempcntb-1867\relax
+  \else\ifnum\@tempcnta<19261225 % taisho era
+    \let\bxwy at tmpb\bxwy@@taisho
+    \advance\@tempcntb-1911\relax
+  \else\ifnum\@tempcnta<19890108 % showa era
+    \let\bxwy at tmpb\bxwy@@showa
+    \advance\@tempcntb-1925\relax
+  \else\ifnum\@tempcnta<20190501 % heisei era
+    \let\bxwy at tmpb\bxwy@@heisei
+    \advance\@tempcntb-1988\relax
+  \else % the new era
+    \ifx\bxwy at new@gengo\@empty\else
+      \let\bxwy at tmpb\bxwy at new@gengo
+      \advance\@tempcntb-2018\relax
+    \fi
+  \fi\fi\fi\fi\fi
+  %
+  \global\let\bxwy at g@gengo\bxwy at tmpb
+  \xdef\bxwy at g@year{\the\@tempcntb}%
+  \xdef\bxwy at g@date{{\the\year}{\the\month}{\the\day}}}
+
+%--------------------------------------- render wareki date
+
+%% \bxwy at render@for\CSIdate\CSIgengo\CSIyear
+%      \CSOyear\CSOdate\CSOkanjidate\CSOjkanjidate
+\def\bxwy at render@for{%
+  \expandafter\bxwy at render@for at a}
+\def\bxwy at render@for at a#1#2#3#4#5#6#7#8#9{%
+  %y,m,d,Igengo,Iyear,Oyaer,Odate,Okanjidate,Ojkanjidate
+  \bxwy at freeze@fragile
+  % \CSOyear
+  \edef#6{%
+    \ifx#4\@empty \number#1%(y)
+    \else
+      \bxwy at oncex{#4}%(\CSIgengo)
+      \ifnum#5=\@ne \bxwy at oncex{\bxwy@@gan}%
+      \else \bxwy at S\number#5%(\CSIyear)
+      \fi
+    \fi}%
+  % \CSOdate
+  \edef#7{%
+    \bxwy at oncex{#6}%(\CSOyear)
+    \ifx#4\@empty \bxwy at S
+    \else\ifnum#5=\@ne %nix
+    \else \bxwy at S
+    \fi\fi
+    \bxwy at oncex{\bxwy@@nen}%
+    \bxwy at S#2\bxwy at S \bxwy at oncex{\bxwy@@gatsu}%(m)
+    \bxwy at S#3\bxwy at S \bxwy at oncex{\bxwy@@nichi}}%(d)
+  % \CSOkanjidate
+  \edef#8{%
+    \ifx#4\@empty \bxwy at kansuji{#1}%(y)
+    \else
+      \bxwy at oncex{#4}%(\CSIgengo)
+      \ifnum#5=\@ne \bxwy at oncex{\bxwy@@gan}%
+      \else \bxwy at kansuji{#5}%
+      \fi
+    \fi
+    \bxwy at oncex{\bxwy@@nen}%
+    \bxwy at kansuji{#2}\bxwy at oncex{\bxwy@@gatsu}%(m)
+    \bxwy at kansuji{#3}\bxwy at oncex{\bxwy@@nichi}}%(d)
+  % \CSOjkanjidate
+  \edef#9{%
+    \ifx#4\@empty \bxwy at jkansuji{#1}%(y)
+    \else
+      \bxwy at oncex{#4}%(\CSIgengo)
+      \ifnum#5=\@ne \bxwy at oncex{\bxwy@@gan}%
+      \else \bxwy at jkansuji{#5}%
+      \fi
+    \fi
+    \bxwy at oncex{\bxwy@@nen}%
+    \bxwy at jkansuji{#2}\bxwy at oncex{\bxwy@@gatsu}%(m)
+    \bxwy at jkansuji{#3}\bxwy at oncex{\bxwy@@nichi}}%(d)
+  % done
+  \bxwy at restore@fragile}
+
+%% \bxwy at render@date
+\def\bxwy at render@date{%
+  \bxwy at render@for\bxwy at date\warekigengo\c at warekiyear
+      \warekiyear\warekidate\warekikanjidate\warekijkanjidate}
+%% \bxwy at render@today
+\def\bxwy at render@today{%
+  \bxwy at render@for\bxwy at today@date\bxwy at today@gengo\bxwy at today@year
+      \bxwy at today@yearstr\warekitoday\warekikanjitoday\warekijkanjitoday}
+%% \bxwy at render@all
+\def\bxwy at render@all{%
+  \bxwy at render@date
+  \bxwy at render@today}
+
+%--------------------------------------- user interface
+
+%% variables
+\let\bxwy at date\relax
+\let\bxwy at today@date\relax
+\let\bxwy at today@gengo\relax
+\let\bxwy at today@year\relax
+\let\bxwy at today@yearstr\relax
+
+%%<*> counter 'warekiyear' : number of wareki year
+\bxwy at newcounter{warekiyear}
+%%<*> \warekigengo : kanji string of the current gengo
+\newcommand*\warekigengo{}
+%%<*> \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 at assign@date{#1}{#2}{#3}%
+    \bxwy at calc@wareki at year
+  \endgroup
+  \let\warekigengo\bxwy at g@gengo
+  \bxwy at setcounter{warekiyear}{\bxwy at g@year}%
+  \let\bxwy at date\bxwy at g@date
+  \bxwy at render@date}
+
+%%<*> \warekisettoday
+\newcommand*\warekisettoday{%
+  \warekisetdate\year\month\day}
+
+%%<+> \WarekiSetToday
+\newcommand*\WarekiSetToday{%
+  \begingroup
+    \bxwy at assign@date\year\month\day
+    \bxwy at calc@wareki at year
+  \endgroup
+  \let\bxwy at today@gengo\bxwy at g@gengo
+  \let\bxwy at today@year\bxwy at g@year
+  \let\bxwy at today@date\bxwy at g@date
+  \bxwy at render@today}
+
+%%<+> WarekiIfCustomDateAvailable{<true>}{<false>}
+\newcommand*\WarekiIfCustomDateAvailable{%
+  \ifbxwy at customdate@ok \expandafter\@firstoftwo
+  \else \expandafter\@secondoftwo
+  \fi}
+
+%%<*> \warekicustomdate
+\newcommand*\warekicustomdate[1]{%
+  \warekidate}% fallback
+
+%--------------------------------------- start up
+
+%% load submodules
+\ifbxwy at customdate@ok
+  \input{bxwareki-cd.def}
+\fi
+
+%% set 'date' to today
+\warekisettoday
+% copy 'date' to 'today'
+\let\bxwy at today@gengo\warekigengo
+\edef\bxwy at today@year{\the\c at warekiyear}
+\let\bxwy at today@date\bxwy at date
+\let\warekitoday\warekidate
+\let\warekikanjitoday\warekikanjidate
+\let\warekijkanjitoday\warekijkanjidate
+
+%--------------------------------------- all done
+\endinput
+%% EOF


Property changes on: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2018-09-24 20:23:52 UTC (rev 48751)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2018-09-24 20:25:06 UTC (rev 48752)
@@ -130,7 +130,7 @@
     bullcntr bundledoc burmese businesscard-qrcode bussproofs
     bxbase bxcalc bxcjkjatype bxdpx-beamer bxdvidriver
     bxjaprnind bxpapersize bxpdfver bxeepic bxenclose
-    bxjalipsum bxjscls bxnewfont bxorigcapt bxtexlogo bytefield 
+    bxjalipsum bxjscls bxnewfont bxorigcapt bxtexlogo bxwareki bytefield 
   c90 c-pascal cabin cachepic caladea calcage calctab calculation calculator
     calligra calligra-type1 callouts calrsfs cals calxxxx-yyyy cancel
     canoniclayout cantarell

Added: trunk/Master/tlpkg/tlpsrc/bxwareki.tlpsrc
===================================================================
Modified: trunk/Master/tlpkg/tlpsrc/collection-langjapanese.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-langjapanese.tlpsrc	2018-09-24 20:23:52 UTC (rev 48751)
+++ trunk/Master/tlpkg/tlpsrc/collection-langjapanese.tlpsrc	2018-09-24 20:25:06 UTC (rev 48752)
@@ -12,6 +12,7 @@
 depend bxjaprnind
 depend bxjscls
 depend bxorigcapt
+depend bxwareki
 depend convbkmk
 depend endnotesj
 depend gentombow



More information about the tex-live-commits mailing list