summaryrefslogtreecommitdiff
path: root/language/japanese
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-05-22 03:00:52 +0000
committerNorbert Preining <norbert@preining.info>2022-05-22 03:00:52 +0000
commitfcedb80554137a681150f48c9a1ca20dbfb2e83a (patch)
tree58a8e560b04be42fbe1ec8e4bf4a817a82fd3da1 /language/japanese
parentfbe3cb5feb55dc6417d9bb95e3c7954a1b0b9ee8 (diff)
CTAN sync 202205220300
Diffstat (limited to 'language/japanese')
-rw-r--r--language/japanese/BX/bxghost/README.md14
-rw-r--r--language/japanese/BX/bxghost/bxghost-lib.sty143
-rw-r--r--language/japanese/BX/bxghost/bxghost.sty129
3 files changed, 159 insertions, 127 deletions
diff --git a/language/japanese/BX/bxghost/README.md b/language/japanese/BX/bxghost/README.md
index 23419832ba..4080b42c37 100644
--- a/language/japanese/BX/bxghost/README.md
+++ b/language/japanese/BX/bxghost/README.md
@@ -2,7 +2,7 @@
LaTeX: ghost insertion for proper xkanjiskip
-## System requirements
+## Requirements
* TeX format: LaTeX
* TeX engine: LuaTeX, XeTeX, pTeX, upTeX, and ApTeX (pTeX-ng)
@@ -22,6 +22,16 @@ In addition, the following package options are available:
* `verb` patches the `\verb` command of LaTeX to be guarded by European ghost.
* `noverb` disables the `verb` feature. (default)
+### For package authors
+
+To use the function of this package in your package, a library version is available:
+
+```tex
+\RequirePackage{bxghost-lib}
+```
+
+This provides all the commands defined in the package but does not have any package option to prevent the problem of option clashes.
+
## Acknowledgements
The logic and style of the code in this package is greatly inspired by [Package PXghost](https://gist.github.com/zr-tex8r/4461060) and various packages in [the BX series](http://zrbabbler.sp.land.to/package.html#ssec-bx). I would like to thank the author of the packages, Dr. Takayuki YATO (aka. [ZR](https://github.com/zr-tex8r)).
@@ -32,6 +42,8 @@ This package is distributed under [the MIT license](./LICENSE).
## Revision History
+* Version 0.5.0 ‹2022/05/20›
+ * Provide `bxghost-lib` for internal use from other packages
* Version 0.4.0 ‹2022/02/12›
* More general implementation for `\jghostguarded`
* Add the `noverb` option
diff --git a/language/japanese/BX/bxghost/bxghost-lib.sty b/language/japanese/BX/bxghost/bxghost-lib.sty
new file mode 100644
index 0000000000..00a148deed
--- /dev/null
+++ b/language/japanese/BX/bxghost/bxghost-lib.sty
@@ -0,0 +1,143 @@
+%%
+%% This is file 'bxghost-lib.sty'.
+%%
+%% Copyright 2019-2022 Takuto ASAKURA (wtsnjp)
+%% GitHub: https://github.com/wtsnjp
+%% Twitter: @wtsnjp
+%%
+%% This package is distributed under the MIT License.
+%%
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bxghost-lib}[2022/05/20 v0.5.0]
+
+%% preparations
+\def\bxqgg@pkgname{bxghost}
+\def\bxqgg@warn{\PackageWarningNoLine\bxqgg@pkgname}
+
+%--------------------------------------- general
+
+%% \bxqgg@engine : engine type
+\def\bxqgg@next#1#2{%
+ \edef\bxqgg@tmpa{\string#1}\edef\bxqgg@tmpb{\meaning#1}%
+ \ifx\bxqgg@tmpa\bxqgg@tmpb #2\fi}
+\chardef\bxqgg@engine=0 % other TeX
+\bxqgg@next\kanjiskip {\chardef\bxqgg@engine=1 }% pTeX
+\bxqgg@next\enablecjktoken{\chardef\bxqgg@engine=2 }% upTeX
+\bxqgg@next\luatexversion {\chardef\bxqgg@engine=3 }% LuaTeX
+\bxqgg@next\XeTeXversion {\chardef\bxqgg@engine=4 }% XeTeX
+
+%--------------------------------------- not supported engine
+
+\ifnum\bxqgg@engine=\z@
+ \bxqgg@warn{This engine is not supported, sorry}
+ \expandafter\endinput
+\fi
+
+%--------------------------------------- load LuaTeX-ja
+
+\ifnum\bxqgg@engine=\thr@@
+ \RequirePackage{luatexja}
+ \@ifpackageloaded{luatexja-adjust}{}{%
+ \RequirePackage{luatexja-adjust}\ltjdisableadjust}
+\fi
+
+%--------------------------------------- eghostguarded
+
+% use an arbitrary font available in T1 encoding
+\font\bxqgg@TI=ec-lmr10 at 1.23456pt
+\chardef\bxqgg@cwm=23 % compwordmark (in T1)
+
+% allow xkanjiskip around
+% Note: for XeTeX, xeCJK will handle nicely. We have nothing to do :)
+\ifcase\bxqgg@engine
+\or % pTeX
+ \xspcode\bxqgg@cwm=3\relax
+\or % upTeX
+ \xspcode\bxqgg@cwm=3\relax
+\or % LuaTeX
+ \ltjsetparameter{alxspmode={\bxqgg@cwm,3}}
+\fi
+
+%%<*> \eghostguarded{<text>}
+\newcommand*\eghostguarded{%
+ \ifmmode \expandafter\@firstofone
+ \else \expandafter\bxqgg@eghostguarded@a
+ \fi
+}
+\def\bxqgg@eghostguarded@a#1{%
+ \bxqgg@eghost #1\bxqgg@eghost}
+\def\bxqgg@eghost{\bgroup
+ \bxqgg@TI\bxqgg@cwm\egroup}
+
+%--------------------------------------- jghostguarded
+
+%% \bxqgg@fwsp: a zenkaku space (U+3000)
+\begingroup
+ \ifnum\bxqgg@engine<\thr@@ % (u)pTeX
+ \kansujichar\@ne=\jis"2121\relax
+ \xdef\bxqgg@fwsp{\kansuji\@ne}
+ \else % others
+ \lccode`\Z="3000\relax
+ \lowercase{\xdef\bxqgg@fwsp{Z}}
+ \fi
+\endgroup
+
+% make sure to use a font whose zenkaku space is class zero
+\let\bxqgg@jafont\relax
+
+\ifcase\bxqgg@engine
+\or % pTeX
+ \DeclareFontFamily{JY1}{bxqgg}{}
+ \DeclareFontFamily{JT1}{bxqgg}{}
+ \DeclareFontShape{JY1}{bxqgg}{m}{n}{<->s*[0.961]jis}{}
+ \DeclareFontShape{JT1}{bxqgg}{m}{n}{<->s*[0.961]tmin10}{}
+ \def\bxqgg@jafont{\usekanji{\k@encoding}{bxqgg}{m}{n}}
+\or % upTeX
+ \DeclareFontFamily{JY2}{bxqgg}{}
+ \DeclareFontFamily{JT2}{bxqgg}{}
+ \DeclareFontShape{JY2}{bxqgg}{m}{n}{<->s*[0.92469]upjisr-h}{}
+ \DeclareFontShape{JT2}{bxqgg}{m}{n}{<->s*[0.92469]upjisr-v}{}
+ \def\bxqgg@jafont{\usekanji{\k@encoding}{bxqgg}{m}{n}}
+\fi
+
+%% \bxqgg@kern@m@ne@zw: a negative zenkaku width kern
+\ifnum\bxqgg@engine<\thr@@
+ % (u)pTeX knows the unit `zw'
+ \def\bxqgg@kern@m@ne@zw{\kern-1zw\relax}
+\else
+ % for other engines, we use \zw instead
+ \def\bxqgg@kern@m@ne@zw{\kern-1\zw\relax}
+\fi
+
+%%<*> \jghostguarded{<text>}
+\newcommand*\jghostguarded{%
+ \ifmmode \expandafter\@firstofone
+ \else \expandafter\bxqgg@jghostguarded@a
+ \fi
+}
+\edef\bxqgg@jghostguarded@a#1{%
+ \bgroup
+ \noexpand\bxqgg@jafont
+ \bxqgg@fwsp\bxqgg@kern@m@ne@zw
+ \egroup
+ #1%
+ \bgroup
+ \noexpand\bxqgg@jafont
+ \bxqgg@kern@m@ne@zw\bxqgg@fwsp
+ \egroup
+}
+
+% better definition for LuaTeX-ja (20220211.0 or later)
+\ifnum\bxqgg@engine=\thr@@ % LuaTeX
+ \ifx\ltjghostbeforejachar\@undefined\else
+ \def\bxqgg@jghostguarded@a#1{%
+ \ltjghostbeforejachar #1\ltjghostafterjachar
+ }
+ \fi
+\fi
+
+%--------------------------------------- all done
+\endinput
+%% EOF
diff --git a/language/japanese/BX/bxghost/bxghost.sty b/language/japanese/BX/bxghost/bxghost.sty
index 33b965ef3a..8291e3a090 100644
--- a/language/japanese/BX/bxghost/bxghost.sty
+++ b/language/japanese/BX/bxghost/bxghost.sty
@@ -10,38 +10,10 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bxghost}[2022/02/12 v0.4.0]
+\ProvidesPackage{bxghost}[2022/05/20 v0.5.0]
-%% preparations
-\def\bxqgg@pkgname{bxghost}
-\def\bxqgg@warn{\PackageWarningNoLine\bxqgg@pkgname}
-
-%--------------------------------------- general
-
-%% \bxqgg@engine : engine type
-\def\bxqgg@next#1#2{%
- \edef\bxqgg@tmpa{\string#1}\edef\bxqgg@tmpb{\meaning#1}%
- \ifx\bxqgg@tmpa\bxqgg@tmpb #2\fi}
-\chardef\bxqgg@engine=0 % other TeX
-\bxqgg@next\kanjiskip {\chardef\bxqgg@engine=1 }% pTeX
-\bxqgg@next\enablecjktoken{\chardef\bxqgg@engine=2 }% upTeX
-\bxqgg@next\luatexversion {\chardef\bxqgg@engine=3 }% LuaTeX
-\bxqgg@next\XeTeXversion {\chardef\bxqgg@engine=4 }% XeTeX
-
-%--------------------------------------- not supported engine
-
-\ifnum\bxqgg@engine=\z@
- \bxqgg@warn{This engine is not supported, sorry}
- \expandafter\endinput
-\fi
-
-%--------------------------------------- load LuaTeX-ja
-
-\ifnum\bxqgg@engine=\thr@@
- \RequirePackage{luatexja}
- \@ifpackageloaded{luatexja-adjust}{}{%
- \RequirePackage{luatexja-adjust}\ltjdisableadjust}
-\fi
+%% load the library
+\RequirePackage{bxghost-lib}
%--------------------------------------- the verb option
@@ -50,34 +22,6 @@
\DeclareOption{noverb}{\bxqgg@verbfalse}
\ProcessOptions\relax
-%--------------------------------------- eghostguarded
-
-% use an arbitrary font available in T1 encoding
-\font\bxqgg@TI=ec-lmr10 at 1.23456pt
-\chardef\bxqgg@cwm=23 % compwordmark (in T1)
-
-% allow xkanjiskip around
-% Note: for XeTeX, xeCJK will handle nicely. We have nothing to do :)
-\ifcase\bxqgg@engine
-\or % pTeX
- \xspcode\bxqgg@cwm=3\relax
-\or % upTeX
- \xspcode\bxqgg@cwm=3\relax
-\or % LuaTeX
- \ltjsetparameter{alxspmode={\bxqgg@cwm,3}}
-\fi
-
-%%<*> \eghostguarded{<text>}
-\newcommand*\eghostguarded{%
- \ifmmode \expandafter\@firstofone
- \else \expandafter\bxqgg@eghostguarded@a
- \fi
-}
-\def\bxqgg@eghostguarded@a#1{%
- \bxqgg@eghost #1\bxqgg@eghost}
-\def\bxqgg@eghost{\bgroup
- \bxqgg@TI\bxqgg@cwm\egroup}
-
% patch \verb
\ifbxqgg@verb
\edef\verb{\noexpand\bxqgg@eghost\unexpanded\expandafter{\verb}}
@@ -85,73 +29,6 @@
\unexpanded\expandafter{\verb@egroup}\noexpand\bxqgg@eghost}
\fi
-%--------------------------------------- jghostguarded
-
-%% \bxqgg@fwsp: a zenkaku space (U+3000)
-\begingroup
- \ifnum\bxqgg@engine<\thr@@ % (u)pTeX
- \kansujichar\@ne=\jis"2121\relax
- \xdef\bxqgg@fwsp{\kansuji\@ne}
- \else % others
- \lccode`\Z="3000\relax
- \lowercase{\xdef\bxqgg@fwsp{Z}}
- \fi
-\endgroup
-
-% make sure to use a font whose zenkaku space is class zero
-\let\bxqgg@jafont\relax
-
-\ifcase\bxqgg@engine
-\or % pTeX
- \DeclareFontFamily{JY1}{bxqgg}{}
- \DeclareFontFamily{JT1}{bxqgg}{}
- \DeclareFontShape{JY1}{bxqgg}{m}{n}{<->s*[0.961]jis}{}
- \DeclareFontShape{JT1}{bxqgg}{m}{n}{<->s*[0.961]tmin10}{}
- \def\bxqgg@jafont{\usekanji{\k@encoding}{bxqgg}{m}{n}}
-\or % upTeX
- \DeclareFontFamily{JY2}{bxqgg}{}
- \DeclareFontFamily{JT2}{bxqgg}{}
- \DeclareFontShape{JY2}{bxqgg}{m}{n}{<->s*[0.92469]upjisr-h}{}
- \DeclareFontShape{JT2}{bxqgg}{m}{n}{<->s*[0.92469]upjisr-v}{}
- \def\bxqgg@jafont{\usekanji{\k@encoding}{bxqgg}{m}{n}}
-\fi
-
-%% \bxqgg@kern@m@ne@zw: a negative zenkaku width kern
-\ifnum\bxqgg@engine<\thr@@
- % (u)pTeX knows the unit `zw'
- \def\bxqgg@kern@m@ne@zw{\kern-1zw\relax}
-\else
- % for other engines, we use \zw instead
- \def\bxqgg@kern@m@ne@zw{\kern-1\zw\relax}
-\fi
-
-%%<*> \jghostguarded{<text>}
-\newcommand*\jghostguarded{%
- \ifmmode \expandafter\@firstofone
- \else \expandafter\bxqgg@jghostguarded@a
- \fi
-}
-\edef\bxqgg@jghostguarded@a#1{%
- \bgroup
- \noexpand\bxqgg@jafont
- \bxqgg@fwsp\bxqgg@kern@m@ne@zw
- \egroup
- #1%
- \bgroup
- \noexpand\bxqgg@jafont
- \bxqgg@kern@m@ne@zw\bxqgg@fwsp
- \egroup
-}
-
-% better definition for LuaTeX-ja (20220211.0 or later)
-\ifnum\bxqgg@engine=\thr@@ % LuaTeX
- \ifx\ltjghostbeforejachar\@undefined\else
- \def\bxqgg@jghostguarded@a#1{%
- \ltjghostbeforejachar #1\ltjghostafterjachar
- }
- \fi
-\fi
-
%--------------------------------------- all done
\endinput
%% EOF