summaryrefslogtreecommitdiff
path: root/language/japanese/BX
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-23 03:00:32 +0000
committerNorbert Preining <norbert@preining.info>2019-09-23 03:00:32 +0000
commitda6f3bd15942a19bc893c478d3afe97b6d13b954 (patch)
treec5d23eee839edfb983cdeadc16a7d72073a6e0e3 /language/japanese/BX
parent77cef1d14e947b4899f54ca0311ca5ce9d253164 (diff)
CTAN sync 201909230300
Diffstat (limited to 'language/japanese/BX')
-rw-r--r--language/japanese/BX/bxghost/LICENSE21
-rw-r--r--language/japanese/BX/bxghost/README.md37
-rw-r--r--language/japanese/BX/bxghost/bxghost.sty100
3 files changed, 158 insertions, 0 deletions
diff --git a/language/japanese/BX/bxghost/LICENSE b/language/japanese/BX/bxghost/LICENSE
new file mode 100644
index 0000000000..d20a0d418f
--- /dev/null
+++ b/language/japanese/BX/bxghost/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright 2019 Takuto ASAKURA (wtsnjp)
+
+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/bxghost/README.md b/language/japanese/BX/bxghost/README.md
new file mode 100644
index 0000000000..f9096387cc
--- /dev/null
+++ b/language/japanese/BX/bxghost/README.md
@@ -0,0 +1,37 @@
+# The BXghost Package
+
+LaTeX: ghost insertion for proper xkanjiskip
+
+## System requirements
+
+* TeX format: LaTeX
+* TeX engine: LuaTeX, XeTeX, pTeX, upTeX, and ApTeX (pTeX-ng)
+
+Since this package is intended to create documents in Japanese, it assumes appropriate classes and/or packages are loaded in some engines (e.g., LuaTeX-ja for LuaTeX and bxjscls for XeTeX). BXghost does not load any external packages automatically.
+
+## Usage
+
+This package provides following commands:
+
+* `\eghostguarded{<text>}` inserts *Europian ghost* (invisible and zero-width alphabets) before and after the `<text>`. In math mode, it outputs only `<text>` without the ghosts.
+* `\jghostguarded{<text>}` inserts *Japanese ghost* (invisible and zero-width Kanji) before and after the `<text>`. In math mode, it outputs only `<text>` without the ghosts.
+
+## 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)).
+
+## License
+
+This package is distributed under [the MIT license](./LICENSE).
+
+## Revision History
+
+* Version 0.2.0 ‹2019/09/17›
+ * Add supports for XeTeX and ApTeX (pTeX-ng)
+* Version 0.1.0 ‹2019/09/16›
+ * The first public version
+ * Add supports for LuaTeX to the original [PXghost](https://gist.github.com/zr-tex8r/4461060) package
+
+---
+
+Takuto ASAKURA ([wtsnjp](https://twitter.com/wtsnjp))
diff --git a/language/japanese/BX/bxghost/bxghost.sty b/language/japanese/BX/bxghost/bxghost.sty
new file mode 100644
index 0000000000..552d28ad9c
--- /dev/null
+++ b/language/japanese/BX/bxghost/bxghost.sty
@@ -0,0 +1,100 @@
+%%
+%% This is file 'bxghost.sty'.
+%%
+%% Copyright 2019 Takuto ASAKURA (wtsnjp)
+%% GitHub: https://github.com/wtsnjp
+%% Twitter: @wtsnjp
+%%
+%% This package is distributed under the MIT License.
+%%
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bxghost}[2019/09/17 v0.2.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 }% (u)pTeX (or ApTeX)
+\bxqgg@next\luatexversion{\chardef\bxqgg@engine=2 }% LuaTeX
+\bxqgg@next\XeTeXversion {\chardef\bxqgg@engine=3 }% XeTeX
+
+%--------------------------------------- not supported engine
+
+\ifnum\bxqgg@engine=\z@
+ \bxqgg@warn{This engine is not supported, sorry}
+ \expandafter\endinput
+\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 % 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@TI\bxqgg@cwm}%
+ #1%
+ {\bxqgg@TI\bxqgg@cwm}%
+}
+
+%--------------------------------------- jghostguarded
+
+%% \bxqgg@fwsp: a zenkaku space (U+3000)
+\begingroup
+ \ifnum\bxqgg@engine=\@ne % pTeX
+ \kansujichar\@ne=\jis"2121\relax
+ \xdef\bxqgg@fwsp{\kansuji\@ne}
+ \else % others
+ \lccode`\Z="3000\relax
+ \lowercase{\xdef\bxqgg@fwsp{Z}}
+ \fi
+\endgroup
+
+%% \bxqgg@kern@m@ne@zw: a negative zenkaku width kern
+\ifnum\bxqgg@engine=\@ne
+ % 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{%
+ \bxqgg@fwsp\bxqgg@kern@m@ne@zw
+ #1%
+ \bxqgg@kern@m@ne@zw\bxqgg@fwsp
+}
+
+%--------------------------------------- all done
+\endinput
+%% EOF