texlive[67594] Master/texmf-dist: bxwareki (9jul23)
commits+karl at tug.org
commits+karl at tug.org
Sun Jul 9 21:49:38 CEST 2023
Revision: 67594
http://tug.org/svn/texlive?view=revision&revision=67594
Author: karl
Date: 2023-07-09 21:49:38 +0200 (Sun, 09 Jul 2023)
Log Message:
-----------
bxwareki (9jul23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE
trunk/Master/texmf-dist/doc/latex/bxwareki/README.md
trunk/Master/texmf-dist/doc/latex/bxwareki/bxwareki.pdf
trunk/Master/texmf-dist/doc/latex/bxwareki/bxwareki.tex
trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
Removed Paths:
-------------
trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki2019.def
Modified: trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE 2023-07-09 19:49:24 UTC (rev 67593)
+++ trunk/Master/texmf-dist/doc/latex/bxwareki/LICENSE 2023-07-09 19:49:38 UTC (rev 67594)
@@ -1,6 +1,6 @@
The MIT License
-Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
+Copyright (c) 2018-2023 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
Modified: trunk/Master/texmf-dist/doc/latex/bxwareki/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxwareki/README.md 2023-07-09 19:49:24 UTC (rev 67593)
+++ trunk/Master/texmf-dist/doc/latex/bxwareki/README.md 2023-07-09 19:49:38 UTC (rev 67594)
@@ -36,6 +36,10 @@
Revision History
----------------
+ * Version 0.7 ‹2023/07/07›
+ - Support for the fallback mode.
+ - Add `\WarekiUseNoInterGlue`.
+ - Add `\WarekiKansuji` and `\WarekiJKansuji`.
* Version 0.6 ‹2019/06/01›
- The file `bxwareki2019.def` is no longer required.
* Version 0.5 ‹2019/04/01›
Modified: trunk/Master/texmf-dist/doc/latex/bxwareki/bxwareki.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/bxwareki/bxwareki.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxwareki/bxwareki.tex 2023-07-09 19:49:24 UTC (rev 67593)
+++ trunk/Master/texmf-dist/doc/latex/bxwareki/bxwareki.tex 2023-07-09 19:49:38 UTC (rev 67594)
@@ -3,8 +3,8 @@
\usepackage[scale=0.75]{geometry}
\usepackage{shortvrb}
\MakeShortVerb{\|}
-\newcommand{\PkgVersion}{0.6}
-\newcommand{\PkgDate}{2019/06/01}
+\newcommand{\PkgVersion}{0.7}
+\newcommand{\PkgDate}{2023/07/07}
\newcommand{\Pkg}[1]{\textsf{#1}}
\newcommand{\Meta}[1]{$\langle$\textit{#1}$\rangle$}
\newcommand{\Note}{\par\noindent\emph{Note:}\quad}
@@ -30,17 +30,21 @@
\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\+日}).
+(2022/8/28) to the Japanese rendering of the Japanese calendar
+(\Ja{令和\+4\+年\+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{令和}).
+in Western numerals (like 28)
+or kanji numerals (\emph{kansuji}, like \Ja{二八}).
Note that the package only deals with dates in the year 1873 or later,
-where the Japanese calendar is really a Gregorian calendar
+where the Japanese calendar (\emph{wareki}; \Ja{和暦})
+can be regarded as a variant of Gregorian calendar
with the different notation of years.
+\Note 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{西暦}).
+
\paragraph{System requirement}
\begin{itemize}
@@ -49,12 +53,17 @@
{\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{西暦}).
+This package is designed to be very generic,
+and it could work on engines other than those mentioned above.
+Starting from v0.7,
+when the package \emph{knows} that it cannot properly handle
+kanji characters on the engine in use,
+then it will switch to the ``fallback mode'',
+where all kanji characters are replaced with a `?' symbol.
+Users can use |\WarekiIfAvailable| to know
+whether the package really works.
+It is expected
+that this package never fails on load.
%===========================================================
\section{Package Loading}
@@ -76,9 +85,10 @@
\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
+ This command itself prints nothing
+ and the result will be rendered by the commands described
at the following items, where the result for the invocation
- |\warekisetdate{2018}{8}{28}|
+ |\warekisetdate{2022}{8}{28}|
will be shown as example.
\Note Although the Japanese calendar differs from the Western calendar
@@ -92,7 +102,7 @@
Does |\warekisetdate| with the current date.
\item Counter |warekiyear|\Means
- The year number (within the gengo); \Eg~``\Ja{30}''.
+ The year number (within the gengo); \Eg~``\Ja{4}''.
\Note Unlike ordinary counters,
the assignment to |warekiyear| by |\warekisetdate| is \emph{local}.
@@ -99,29 +109,29 @@
Moreover, manual assignment to this counter is not supported.
\item |\warekigengo|\Means
- The gengo in kanji, \Eg~``\Ja{平成}''.
+ The gengo (\Ja{元号}) in kanji, \Eg~``\Ja{令和}''.
\item |\warekigengoinitial|\Means
- The initial Latin letter of the gengo, \Eg~``\Ja{H}''.
+ The initial Latin letter of the gengo, \Eg~``\Ja{R}''.
\item |\warekiyear|\Means
The full notation of the year (without `\Ja{年}'),
- \Eg~``\Ja{平成\+30}''.
+ \Eg~``\Ja{令和\+4}''.
\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\+日}''.
+ The date string, \Eg~``\Ja{令和\+4\+年\+8\+月\+28\+日}''.
\item |\warekikanjidate|\Means
The date string using kansuji (kanji numerals),
- \Eg~``\Ja{平成三〇年八月二八日}''.
+ \Eg~``\Ja{令和四年八月二八日}''.
\item |\warekijkanjidate|\Means
The date string using ``kansuji-by-reading''
(that is, kanji rendering of numbers in the Japanese language),
- \Eg.``\Ja{平成三十年八月二十八日}''.
+ \Eg.``\Ja{令和四年八月二十八日}''.
\item |\warekicustomdate{|\Meta{option}|}|\Means
The date string in the form specified with the option.
@@ -128,11 +138,11 @@
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).
+ ``\Ja{2022\+年\+8\+月\+28\+日}'' (using the Western calendar).
The available option letters are:
\begin{itemize}
\item |w|\Means
- uses Japanese calendar (\Ja{2018\+年} $\to$ \Ja{平成\+30\+年});
+ uses Japanese calendar (\Ja{2022\+年} $\to$ \Ja{令和\+4\+年});
\item |k|\Means
uses kansuji (\Ja{28} $\to$ \Ja{二八});
\item |j|\Means
@@ -162,8 +172,9 @@
%-------------------
\subsection{Current date}
+There are also handy commands solely for printing the current date.
These commands always represent the current date,
-and are not affected by |\warekisetdate| (or |\warekisettoday|).
+and are not affected by |\warekisetdate| or |\warekisettoday|.
\begin{itemize}
\item |\warekitoday|\Means
@@ -175,7 +186,7 @@
\end{itemize}
%-------------------
-\subsection{Inter-alphabet-kanji glues}
+\subsection{Inter-alphabet-kanji spaces}
In quality Japanese typesetting, a thin space
(\emph{shibuaki}; \Ja{四分空き}) must be inserted
@@ -194,25 +205,46 @@
(such as \Pkg{\LuaTeX-ja} and \Pkg{xeCJK})
will automatically insert shibuaki spaces.
\item On {\LaTeX} and {\pdfLaTeX}:
- |~| is inserted,
+ A tie (|~|) 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:
+The command for shibuaki can be changed with the following commands:
\begin{itemize}
+\item |\WarekiUseNormalInterGlue|\Means
+ Uses the normal setting, as mentioned above.
+\item |\WarekiUseNoInterGlue|\Means
+ Disables shibuaki spaces.
\item |\WarekiUseCustomInterGlue{|\Meta{text}|}|\Means
Uses \Meta{text} for making shibuaki spaces.
-\item |\WarekiUseNormalInterGlue|\Means
- Reverts |\WarekiUseCustomInterGlue|
- and uses the normal setting.
+ \Note This command is supported
+ only on engines with {\eTeX} extension.
\end{itemize}
+%-------------------
+\subsection{Counter output commands}
+
+The following commands are intended
+to use with |warekiyear| counter,
+but they can probably be used
+as general-use counter output commands
+(like |\arabic|):
+\begin{itemize}
+\item |\WarekiKansuji{|\Meta{counter}|}|\Means
+ Prints the counter value using kansuji.
+\item |\WarekiJKansuji{|\Meta{counter}|}|\Means
+ Prints the counter value using kansuji-by-reading.
+ Only valid for numbers less than 1000.
+\end{itemize}
+
%===========================================================
\section{Notices for {\TeX} programmers}
\label{sec:Allez}
+%-------------------
+\subsection{Expandability of the commands}
+
\begin{itemize}
\item On the engines with native kanji/Unicode support
(\Ie~{\LuaLaTeX}, {\XeLaTeX}, {\pLaTeX}, {\upLaTeX}, and {Ap\LaTeX}),
@@ -230,9 +262,11 @@
(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|
+\item When |\WarekiUseCustomInterGlue| is used with some argument,
+ the content of |\wareki...date| and |\wareki...today|
+ could contain some occurrences of the argument.
+ If the argument is fully expandable,
+ the commands are still fully expandable
on the engines with native kanji/Unicode support.
\end{itemize}
Modified: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def 2023-07-09 19:49:24 UTC (rev 67593)
+++ trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def 2023-07-09 19:49:38 UTC (rev 67594)
@@ -1,7 +1,7 @@
%%
%% This is file 'bxwareki-cd.def'.
%%
-%% Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
+%% Copyright (c) 2018-2023 Takayuki YATO (aka. "ZR")
%% GitHub: https://github.com/zr-tex8r
%% Twitter: @zr_tex8r
%%
@@ -8,16 +8,18 @@
%% This package is distributed under the MIT License.
%%
-% Note: This file must be encoded in UTF-8.
+% Note: This file contains 日本語 letters and must be encoded in UTF-8.
%% file declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{bxwareki-cd.def}[2019/06/01 v0.6]
+\ProvidesFile{bxwareki-cd.def}[2023/07/07 v0.7]
\ifbxwy at epTeXinputencoding@ok
\epTeXinputencoding utf8
\fi
+%Note: The code in this file does NOT assume e-TeX extension.
+
%--------------------------------------- helpers
%% \bxwy at burst-`>...
Modified: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty 2023-07-09 19:49:24 UTC (rev 67593)
+++ trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty 2023-07-09 19:49:38 UTC (rev 67594)
@@ -1,7 +1,7 @@
%%
%% This is file 'bxwareki.sty'.
%%
-%% Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
+%% Copyright (c) 2018-2023 Takayuki YATO (aka. "ZR")
%% GitHub: https://github.com/zr-tex8r
%% Twitter: @zr_tex8r
%%
@@ -12,7 +12,7 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bxwareki}[2019/06/01 v0.6]
+\ProvidesPackage{bxwareki}[2023/07/07 v0.7]
%% preparation
\def\bxwy at pkgname{bxwareki}
@@ -34,11 +34,18 @@
\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
+\bxwy at next\Omegaversion {\chardef\bxwy at engine=4 }% Omega
+\bxwy at next\XeTeXversion {\chardef\bxwy at engine=5 }% XeTeX
+\bxwy at next\luatexversion {\chardef\bxwy at engine=6 }% LuaTeX
\newif\ifbxwy at eTeX@ok
\bxwy at next\eTeXversion{\bxwy at eTeX@oktrue}
+% if non-e-TeX and non-kanji-aware then fallback
+\ifbxwy at eTeX@ok\else \ifnum\bxwy at engine=0
+ \chardef\bxwy at engine=3 % fallback
+\fi\fi
+\ifx\WarekiForceFallback\@undefined\else
+ \chardef\bxwy at engine=3
+\fi
\newif\ifbxwy at upTeX@ok
\bxwy at next\forcecjktoken{\bxwy at upTeX@oktrue}
\newif\ifbxwy at epTeXinputencoding@ok
@@ -53,6 +60,7 @@
\else\ifbxwy at upTeX@ok \bxwy at customdate@oktrue
\fi\fi
\or % jTeX
+\or % fallback
\else \bxwy at customdate@oktrue
\fi
@@ -64,7 +72,7 @@
\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.
+ % pTeX/JTeX/Omega/fallback
\def\bxwy at oncex#1{#1}
\def\bxwy at twicex#1{#1}
\fi
@@ -88,6 +96,8 @@
\fi
%--------------------------------------- options
+% Note: This package will never have ordinary options.
+% If it has options, they will be used only in special workflow.
%% 'download'
\DeclareOption{download2019}{}% now no-op
@@ -111,6 +121,10 @@
\let\bxwy at normal@S\relax
%% \bxwy at C : Japanese character printer for JTeX
\let\bxwy at C\relax
+%% \bxwy at U : Japanese character printer for fallback mode
+\let\bxwy at U\relax
+%% \bxwy at normal@U : the normal definition of \bxwy at U
+\def\bxwy at normal@U#1{?}
%% \bxwy at freeze@fragile : make fragile cs unexpandable
\let\bxwy at freeze@fragile\relax
@@ -162,21 +176,38 @@
\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
+\or %fallback
\def\bxwy at add@jchar at dec#1:#2:#3:#4:#5\bxwy at end{%
+ \bxwy at next{\bxwy at U{#2}}}
+ \def\bxwy at C#1#2#3{%
+ \mbox{\csname j#1\endcsname\char"#2#3}}
+ \def\bxwy at S{~}
+ \let\bxwy at org@tie\relax
+ \def\bxwy at freeze@fragile{%
+ \let\bxwy at org@U\bxwy at U \let\bxwy at U\relax
+ \let\bxwy at org@tie=~\let~=\relax}
+ \def\bxwy at restore@fragile{%
+ \let~=\bxwy at org@tie \let\bxwy at U\bxwy at org@U}
+\else %Omega/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.
+%--------------------------------------- Inter-ascii-kanji spaces
+
+%%<*> \WarekiUseNormalInterGlue
+% Uses the normal definition of inter-ascii-kanji space.
\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.
+%%<*> \WarekiUseNoInterGlue
+% Disables inter-ascii-kanji skip.
+\newcommand*\WarekiUseNoInterGlue{%
+ \let\bxwy at S\@empty
+ \bxwy at render@all}
+\ifbxwy at eTeX@ok %<*eTeX>
+%%<*> \WarekiUseCustomInterGlue{<text>}
+% Uses the custom definition of inter-ascii-kanji space.
\@ifdefinable\WarekiUseCustomInterGlue{%
\def\WarekiUseCustomInterGlue#{%
\afterassignment\bxwy at render@all
@@ -183,6 +214,23 @@
\protected\def\bxwy at S}}
\fi %</eTeX>
+% default is \WarekiUseNormalInterGlue
+\let\bxwy at normal@S\bxwy at S
+
+%--------------------------------------- Fallback handler
+
+%%<+> \WarekiResetUHandler
+% Sets \bxwy at U to \bxwy at normal@U.
+\newcommand*\WarekiResetUHandler{%
+ \let\bxwy at U\bxwy at normal@U}
+%%<+> \WarekiSetUHandler{<text>}
+% Redefines \bxwy at U. In <text> #1 means the codepoint in hex.
+\@ifdefinable\WarekiSetUHandler{%
+ \def\WarekiSetUHandler#{%
+ \def\bxwy at U##1}}
+% set default
+\WarekiResetUHandler
+
%--------------------------------------- Japanese words
%% \bxwy@@meiji : kanji string 'Meiji'
@@ -242,11 +290,13 @@
\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>}
+%%<*> \WarekiKansuji{<counter>}
%% \bxwy at kansuji{<number>}
% The kansuji representation of the number.
\newcommand*\WarekiKansuji[1]{%
- \expandafter\bxwy at kansuji\csname c@#1\endcsname}
+ \expandafter\@WarekiKansuji\csname c@#1\endcsname}
+\newcommand*\@WarekiKansuji{%
+ \bxwy at counter@fun\bxwy at kansuji}
\def\bxwy at kansuji#1{%
\ifnum#1<\z@\else
\expandafter\bxwy at kansuji@a\number#1\bxwy at mk
@@ -257,9 +307,14 @@
\expandafter\bxwy at kansuji@a
\fi}
+%%<*> \WarekiJKansuji{<counter>}
%% \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.
+\newcommand*\WarekiJKansuji[1]{%
+ \expandafter\@WarekiJKansuji\csname c@#1\endcsname}
+\newcommand*\@WarekiJKansuji{%
+ \bxwy at counter@fun\bxwy at jkansuji}
\def\bxwy at jkansuji#1{%
\expandafter\bxwy at jkansuji@a\number#1\bxwy at mk}
\chardef\bxwy at jk@x=10
@@ -283,6 +338,18 @@
\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}
+%% \bxwy at counter@fun
+\let\bxwy at tmpa=f
+\ifcase\bxwy at engine \or
+\or \let\bxwy at tmpa=t %jTeX
+\or \let\bxwy at tmpa=t %fallback
+\fi
+\ifx t\bxwy at tmpa
+ \def\bxwy at counter@fun#1#2{%
+ \expandafter\protect\expandafter#1\expandafter{\number#2}}
+\else \let\bxwy at counter@fun\@empty
+\fi
+
%--------------------------------------- calculate wareki year
%% errors
@@ -434,6 +501,17 @@
\let\bxwy at today@year\relax
\let\bxwy at today@yearstr\relax
+%%<*> \WarekiIfAvailable{<true>}{<false>}
+\ifnum\bxwy at engine=3
+ \newcommand*\WarekiIfAvailable{%
+ \ifx\bxwy at U\bxwy at normal@U \expandafter\@secondoftwo
+ \else \expandafter\@firstoftwo
+ \fi}
+\else
+ \newcommand*\WarekiIfAvailable{%
+ \@firstoftwo}
+\fi
+
%%<*> counter 'warekiyear' : number of wareki year
\bxwy at newcounter{warekiyear}
%%<*> \warekigengo : kanji string of the current gengo
Deleted: trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki2019.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki2019.def 2023-07-09 19:49:24 UTC (rev 67593)
+++ trunk/Master/texmf-dist/tex/latex/bxwareki/bxwareki2019.def 2023-07-09 19:49:38 UTC (rev 67594)
@@ -1,3 +0,0 @@
-E4BBA4:4EE4:4E61:l44
-E5928C:548C:4F42:l83
-R
More information about the tex-live-commits
mailing list.