summaryrefslogtreecommitdiff
path: root/language
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-09 03:01:12 +0000
committerNorbert Preining <norbert@preining.info>2023-07-09 03:01:12 +0000
commitfb9a8ffb415de6aca48954ade22852bc93eb7f89 (patch)
tree6d86c3d72967d96a5f31c34d0caab679fbc6f696 /language
parenteeed32591ed8e985fd458c43d976027ad679d682 (diff)
CTAN sync 202307090301
Diffstat (limited to 'language')
-rw-r--r--language/japanese/BX/bxwareki/LICENSE2
-rw-r--r--language/japanese/BX/bxwareki/README.md4
-rw-r--r--language/japanese/BX/bxwareki/bxwareki-cd.def8
-rw-r--r--language/japanese/BX/bxwareki/bxwareki.pdfbin182364 -> 229958 bytes
-rw-r--r--language/japanese/BX/bxwareki/bxwareki.sty110
-rw-r--r--language/japanese/BX/bxwareki/bxwareki.tex106
-rw-r--r--language/japanese/BX/bxwareki/bxwareki2019.def3
7 files changed, 174 insertions, 59 deletions
diff --git a/language/japanese/BX/bxwareki/LICENSE b/language/japanese/BX/bxwareki/LICENSE
index c4443b644c..78f96f7c9e 100644
--- a/language/japanese/BX/bxwareki/LICENSE
+++ b/language/japanese/BX/bxwareki/LICENSE
@@ -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
diff --git a/language/japanese/BX/bxwareki/README.md b/language/japanese/BX/bxwareki/README.md
index b02a5bc205..1486939c10 100644
--- a/language/japanese/BX/bxwareki/README.md
+++ b/language/japanese/BX/bxwareki/README.md
@@ -36,6 +36,10 @@ See the manual `bxwareki.pdf` for detail.
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›
diff --git a/language/japanese/BX/bxwareki/bxwareki-cd.def b/language/japanese/BX/bxwareki/bxwareki-cd.def
index 695a4c2460..8098d669f3 100644
--- a/language/japanese/BX/bxwareki/bxwareki-cd.def
+++ b/language/japanese/BX/bxwareki/bxwareki-cd.def
@@ -1,23 +1,25 @@
%%
%% 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
%%
%% 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@epTeXinputencoding@ok
\epTeXinputencoding utf8
\fi
+%Note: The code in this file does NOT assume e-TeX extension.
+
%--------------------------------------- helpers
%% \bxwy@burst-`>...
diff --git a/language/japanese/BX/bxwareki/bxwareki.pdf b/language/japanese/BX/bxwareki/bxwareki.pdf
index 5bfcc6272d..18b52130bc 100644
--- a/language/japanese/BX/bxwareki/bxwareki.pdf
+++ 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
index d3dab98aca..f21d77a4ab 100644
--- a/language/japanese/BX/bxwareki/bxwareki.sty
+++ b/language/japanese/BX/bxwareki/bxwareki.sty
@@ -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@pkgname{bxwareki}
@@ -34,11 +34,18 @@
\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
+\bxwy@next\Omegaversion {\chardef\bxwy@engine=4 }% Omega
+\bxwy@next\XeTeXversion {\chardef\bxwy@engine=5 }% XeTeX
+\bxwy@next\luatexversion {\chardef\bxwy@engine=6 }% LuaTeX
\newif\ifbxwy@eTeX@ok
\bxwy@next\eTeXversion{\bxwy@eTeX@oktrue}
+% if non-e-TeX and non-kanji-aware then fallback
+\ifbxwy@eTeX@ok\else \ifnum\bxwy@engine=0
+ \chardef\bxwy@engine=3 % fallback
+\fi\fi
+\ifx\WarekiForceFallback\@undefined\else
+ \chardef\bxwy@engine=3
+\fi
\newif\ifbxwy@upTeX@ok
\bxwy@next\forcecjktoken{\bxwy@upTeX@oktrue}
\newif\ifbxwy@epTeXinputencoding@ok
@@ -53,6 +60,7 @@
\else\ifbxwy@upTeX@ok \bxwy@customdate@oktrue
\fi\fi
\or % jTeX
+\or % fallback
\else \bxwy@customdate@oktrue
\fi
@@ -64,7 +72,7 @@
\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.
+ % pTeX/JTeX/Omega/fallback
\def\bxwy@oncex#1{#1}
\def\bxwy@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@normal@S\relax
%% \bxwy@C : Japanese character printer for JTeX
\let\bxwy@C\relax
+%% \bxwy@U : Japanese character printer for fallback mode
+\let\bxwy@U\relax
+%% \bxwy@normal@U : the normal definition of \bxwy@U
+\def\bxwy@normal@U#1{?}
%% \bxwy@freeze@fragile : make fragile cs unexpandable
\let\bxwy@freeze@fragile\relax
@@ -162,27 +176,61 @@
\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
+\or %fallback
+ \def\bxwy@add@jchar@dec#1:#2:#3:#4:#5\bxwy@end{%
+ \bxwy@next{\bxwy@U{#2}}}
+ \def\bxwy@C#1#2#3{%
+ \mbox{\csname j#1\endcsname\char"#2#3}}
+ \def\bxwy@S{~}
+ \let\bxwy@org@tie\relax
+ \def\bxwy@freeze@fragile{%
+ \let\bxwy@org@U\bxwy@U \let\bxwy@U\relax
+ \let\bxwy@org@tie=~\let~=\relax}
+ \def\bxwy@restore@fragile{%
+ \let~=\bxwy@org@tie \let\bxwy@U\bxwy@org@U}
+\else %Omega/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.
+%--------------------------------------- Inter-ascii-kanji spaces
+
+%%<*> \WarekiUseNormalInterGlue
+% Uses the normal definition of inter-ascii-kanji space.
\newcommand*\WarekiUseNormalInterGlue{%
\let\bxwy@S\bxwy@normal@S
\bxwy@render@all}
-%%<+> \WarekiUseCustomInterGlue{<text>}
-% Uses the custom definition of inter-ascii-kanji skip.
+%%<*> \WarekiUseNoInterGlue
+% Disables inter-ascii-kanji skip.
+\newcommand*\WarekiUseNoInterGlue{%
+ \let\bxwy@S\@empty
+ \bxwy@render@all}
+\ifbxwy@eTeX@ok %<*eTeX>
+%%<*> \WarekiUseCustomInterGlue{<text>}
+% Uses the custom definition of inter-ascii-kanji space.
\@ifdefinable\WarekiUseCustomInterGlue{%
\def\WarekiUseCustomInterGlue#{%
\afterassignment\bxwy@render@all
\protected\def\bxwy@S}}
\fi %</eTeX>
+% default is \WarekiUseNormalInterGlue
+\let\bxwy@normal@S\bxwy@S
+
+%--------------------------------------- Fallback handler
+
+%%<+> \WarekiResetUHandler
+% Sets \bxwy@U to \bxwy@normal@U.
+\newcommand*\WarekiResetUHandler{%
+ \let\bxwy@U\bxwy@normal@U}
+%%<+> \WarekiSetUHandler{<text>}
+% Redefines \bxwy@U. In <text> #1 means the codepoint in hex.
+\@ifdefinable\WarekiSetUHandler{%
+ \def\WarekiSetUHandler#{%
+ \def\bxwy@U##1}}
+% set default
+\WarekiResetUHandler
+
%--------------------------------------- Japanese words
%% \bxwy@@meiji : kanji string 'Meiji'
@@ -242,11 +290,13 @@
\bxwy@set@jchar@digit{X}{E58D81:5341:3D3D:eE2}% ten
\bxwy@set@jchar@digit{C}{E799BE:767E:4934:j41}% hundred
-%%<+> \WarekiKansuji{<counter>}
+%%<*> \WarekiKansuji{<counter>}
%% \bxwy@kansuji{<number>}
% The kansuji representation of the number.
\newcommand*\WarekiKansuji[1]{%
- \expandafter\bxwy@kansuji\csname c@#1\endcsname}
+ \expandafter\@WarekiKansuji\csname c@#1\endcsname}
+\newcommand*\@WarekiKansuji{%
+ \bxwy@counter@fun\bxwy@kansuji}
\def\bxwy@kansuji#1{%
\ifnum#1<\z@\else
\expandafter\bxwy@kansuji@a\number#1\bxwy@mk
@@ -257,9 +307,14 @@
\expandafter\bxwy@kansuji@a
\fi}
+%%<*> \WarekiJKansuji{<counter>}
%% \bxwy@jkansuji{<number>}
% The kansuji-by-reading representation of the number.
% NB. Only valid in range 0..999; otherwise fallback to \bxwy@kansuji.
+\newcommand*\WarekiJKansuji[1]{%
+ \expandafter\@WarekiJKansuji\csname c@#1\endcsname}
+\newcommand*\@WarekiJKansuji{%
+ \bxwy@counter@fun\bxwy@jkansuji}
\def\bxwy@jkansuji#1{%
\expandafter\bxwy@jkansuji@a\number#1\bxwy@mk}
\chardef\bxwy@jk@x=10
@@ -283,6 +338,18 @@
\ifnum#2>\z@ \bxwy@twicex{\csname bxwy@jcd/X\endcsname}\fi
\ifnum#3>\z@ \bxwy@twicex{\csname bxwy@jcd/#3\endcsname}\fi}
+%% \bxwy@counter@fun
+\let\bxwy@tmpa=f
+\ifcase\bxwy@engine \or
+\or \let\bxwy@tmpa=t %jTeX
+\or \let\bxwy@tmpa=t %fallback
+\fi
+\ifx t\bxwy@tmpa
+ \def\bxwy@counter@fun#1#2{%
+ \expandafter\protect\expandafter#1\expandafter{\number#2}}
+\else \let\bxwy@counter@fun\@empty
+\fi
+
%--------------------------------------- calculate wareki year
%% errors
@@ -434,6 +501,17 @@
\let\bxwy@today@year\relax
\let\bxwy@today@yearstr\relax
+%%<*> \WarekiIfAvailable{<true>}{<false>}
+\ifnum\bxwy@engine=3
+ \newcommand*\WarekiIfAvailable{%
+ \ifx\bxwy@U\bxwy@normal@U \expandafter\@secondoftwo
+ \else \expandafter\@firstoftwo
+ \fi}
+\else
+ \newcommand*\WarekiIfAvailable{%
+ \@firstoftwo}
+\fi
+
%%<*> counter 'warekiyear' : number of wareki year
\bxwy@newcounter{warekiyear}
%%<*> \warekigengo : kanji string of the current gengo
diff --git a/language/japanese/BX/bxwareki/bxwareki.tex b/language/japanese/BX/bxwareki/bxwareki.tex
index ac00bc9be7..bd7b3e5f94 100644
--- a/language/japanese/BX/bxwareki/bxwareki.tex
+++ b/language/japanese/BX/bxwareki/bxwareki.tex
@@ -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 @@ with the different notation of years.
{\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 @@ No options are available.
\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,47 +102,47 @@ No options are available.
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}.
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.
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 @@ No options are available.
%-------------------
\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 @@ and are not affected by |\warekisetdate| (or |\warekisettoday|).
\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 @@ for the engine in use.
(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 @@ the command for shibuaki can be changed with the following commands:
(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}
diff --git a/language/japanese/BX/bxwareki/bxwareki2019.def b/language/japanese/BX/bxwareki/bxwareki2019.def
deleted file mode 100644
index 438a5bdba1..0000000000
--- a/language/japanese/BX/bxwareki/bxwareki2019.def
+++ /dev/null
@@ -1,3 +0,0 @@
-E4BBA4:4EE4:4E61:l44
-E5928C:548C:4F42:l83
-R