summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/xelatex/tetragonos
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-16 22:28:52 +0000
committerKarl Berry <karl@freefriends.org>2019-01-16 22:28:52 +0000
commitbf5f2cf038af70ebe507b22f919440bc51669b19 (patch)
treebe0cc781e3f63de7574d4af47736e1951368238e /Master/texmf-dist/doc/xelatex/tetragonos
parent2d7231ed7a2a27a8998d33d34e6c35c83b821d30 (diff)
tetragonos (16jan19)
git-svn-id: svn://tug.org/texlive/trunk@49732 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/xelatex/tetragonos')
-rw-r--r--Master/texmf-dist/doc/xelatex/tetragonos/README.md46
-rw-r--r--Master/texmf-dist/doc/xelatex/tetragonos/tetragonos-example.tex77
-rw-r--r--Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.pdfbin0 -> 105483 bytes
-rw-r--r--Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.tex163
4 files changed, 286 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/xelatex/tetragonos/README.md b/Master/texmf-dist/doc/xelatex/tetragonos/README.md
new file mode 100644
index 00000000000..24d2283a927
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/tetragonos/README.md
@@ -0,0 +1,46 @@
+tetragonos
+=======
+
+`tetragonos` is a XeLaTeX package for mapping Chinese characters to their codes in
+the Four-Corner Method. Four-Corner Method is an encoding system for Chinese
+characters, which attaches Chinese characters with four of five digits according
+to their shape, so they can be sorted and indexed.
+A macro for this purpose is provided in the package.
+This package can only run with `xeCJK` package and XeLaTeX.
+
+The package manual in Chinese provides more details and explanations to the
+implementation.
+
+Contributing
+------------
+
+This package is developed and maintained by Yuchang Yang <yang.yc.allium@gmail.com>.
+
+Discussions and questions are welcome.
+
+Copyright and Licence
+---------------------
+
+ Copyright (C) 2019 by Yuchang Yang < yang.yc.allium@gmail.com >
+ ----------------------------------------------------------------------
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any later
+ version. This version of this license is in
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+ and the latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3 or later is part of all distributions of
+ LaTeX version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Yuchang Yang.
+
+ This work consists of the files tetragonos.sty,
+ tetragonos-database.def,
+ tetragonos-example.tex,
+ tetragonos.tex,
+ tetragonos.pdf, and
+ README.md.
diff --git a/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos-example.tex b/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos-example.tex
new file mode 100644
index 00000000000..ba2c1560be5
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos-example.tex
@@ -0,0 +1,77 @@
+% arara: clean: {files: [tetragonos-example.glsdefs, tetragonos-example.TG-*]}
+% arara: xelatex
+% arara: makeglossaries
+% arara: xelatex
+% arara: xelatex
+
+%% tetragonos-example.sty
+%% Copyright 2019 Yuchang Yang < yang.yc.allium@gmail.com >
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Yuchang Yang.
+%
+% This work consists of the files tetragonos.sty and tetragonos-database.def
+% and the associated example file tetragonos-example.tex
+
+\documentclass[a5paper]{ctexart}
+\usepackage[margin=25mm]{geometry}
+\usepackage{multicol}
+\usepackage{tetragonos}
+\usepackage[nopostdot,nomain]{glossaries}
+\newglossary*{TG}{Tegragonos}
+\makeglossaries
+\def\syntaxTG#1#2#3#4#5{\textbf{#1#2#3#4\textsubscript{#5}}}
+\newcommand{\addTG}[1]{%
+ \newglossaryentry{#1}{
+ type=TG,
+ name={\syntaxTG#1},
+ description={\nopostdesc}
+ }%
+}
+\newcommand{\anchorTG}[1]{%
+ \edef\theTG{\getTG{#1}}%
+ \expandafter\addTG\expandafter{\theTG\expandafter}%
+ \newglossaryentry{#1}{
+ type=TG,
+ name={\textmd{#1}},
+ parent={\theTG},
+ sort={\theTG},
+ description={\hfill}
+ }%
+ \glsadd{#1}%
+}
+\newcommand{\cc}[1]{#1\anchorTG{#1}}
+
+\title{廣東新語·木語·諸山果\footnote{\texttt{https://ctext.org/library.pl?if=en\&file=24116\&page=115}}}
+\author{屈大均}
+\date{康熙二十六年}
+
+\begin{document}
+
+\maketitle
+
+廣中山果,曰\cc{穀子}者,大如\cc{橄欖}而長,初亦苦澀,後甘,嫩者蜜漬之可食。曰\cc{餘甘子},樹高丈餘,葉如\cc{槐},子如\cc{川楝},白色,有文理,核作六稜,亦初苦澀後甘,行者以之生津,一名\cc{菴摩勒}。曰\cc{鬼目子},大如\cc{梅}、\cc{李},皮黃肉紅,味甚酸,人以爲蔬,以皮上有目,名\cc{鬼目},一曰\cc{麂木},麂者,鬼之譌也。曰\cc{山棗子},葉似\cc{梅},子如\cc{荔支},九月熟。曰\cc{卍果},果作卍字形,畫甚方正,蔕在字中不可見,生食香甘,一名\cc{蓬鬆子}。曰\cc{桾櫏子},樹似\cc{甘蕉},子如\cc{馬乳}而小,俗稱\cc{牛奶柹},亦曰\cc{牛乳子},廣人言乳曰奶,中有美漿若牛乳,故曰\cc{牛奶子},一名\cc{㮕棗}。曰\cc{五子},其狀如\cc{梨},有五核。曰\cc{千歲子},蔓生,子在根下,有綠鬚交加如織,一苞恒二百餘子,皮青黃,乾者殼肉相離,撼之有聲,似\cc{肉荳蔻}。曰\cc{秋風子},色褐,如梨而小,味酸澀,熟乃可食。曰\cc{金紐子},色紅黃,味甘,大如\cc{秋風子},俗歌云:「一雙\cc{金紐子},無計上羅衫。」曰\cc{青竹子},如\cc{桃}而圓,味酸,色黃。曰\cc{羊齒子},一曰\cc{羊矢},如\cc{石蓮}而小,色青味甘。曰\cc{不納子},實如圓\cc{棗},十月黃熟,味甜酸,蓋\cc{蘋果}之小者,粵中少\cc{蘋果}、\cc{花紅}二種,以\cc{不納子}代之。曰\cc{山葡萄},一名\cc{蘡薁},其莖細裊,花紫白,實比\cc{葡萄}而小,色赤,味酢,可爲酒,八九月熟。曰\cc{山韶子},類\cc{荔支}而鮮麗過之,微有小毫,一名\cc{毛荔支},亦曰\cc{毛珧子},肉薄而酸澀,著核不離,蓋\cc{荔支}之變者。曰\cc{臙脂子},子赤如臙脂,味甜酸,諺曰:「不采\cc{紅蓼}花,但采\cc{臙脂子};持以作朱顏,其餘入玉齒。」曰\cc{都捻子},樸樕叢生,花如\cc{芍藥}而小,春時開,有紅白二種,子如\cc{軟柿},外紫內赤,亦小,有四葉承之,每食必倒捻其蔕,故一名\cc{倒捻子},子汁可染若臙脂,花可爲酒,葉可麯,皮漬之得膠以代\cc{柿},蘇子瞻名曰\cc{海漆},非\cc{漆}而名爲\cc{漆},以其得乙木之液,凝而爲血,而可補人之血,與\cc{漆}同功,功逾\cc{青黏},故名,取子研濾爲膏,餌之又止腸滑,以其爲用甚眾,食治皆需,故又名\cc{都捻},產羅浮者高丈許,子尤美。曰\cc{黃皮果},狀如金彈,六月熟,其漿酸甘似\cc{葡萄},可消食順氣除暑熱,與\cc{荔支}並進,\cc{荔支}饜飫,以\cc{黃皮}解之,諺曰:「饑食\cc{荔支},飽食\cc{黃皮}。」有曰\cc{白蠟子}者,與相似,其味尤勝,諺曰:「\cc{黃皮}\cc{白蠟},甜酸相雜。」曰\cc{蘋婆果},一名\cc{林檎},樹極高,葉大而光潤,莢如\cc{皂角}而大,長二三寸,子生莢兩旁,或四或六,子老則莢迸開,內深紅,包子皮黑,肉黃,熟食味甘,蓋\cc{耎栗}也,相傳三藏法師從西域攜至,與\cc{訶梨勒}、\cc{菩提}雜植虞飜苑中,今遍粵中有之,梵語曰\cc{蘋婆},以其葉盛成叢,又曰\cc{叢林}。一種\cc{水樃子},與相似,多生水間,或謂\cc{林檎}爲雄,\cc{水樃}爲雌,粵歌云:「\cc{水樃}\cc{林檎}大小同,盤中不辩是雌雄。」
+
+\section*{植物名稱四角號碼檢索表}
+
+\setlength{\columnsep}{16pt}
+\setlength{\columnseprule}{0.4pt}
+\begin{multicols}{4}
+ \renewcommand{\glossarysection}[2][]{}
+ \renewcommand*{\glsgroupskip}{}
+ \setlength{\glstreeindent}{7pt}
+ \printglossary[type=TG,style=tree,title=]
+\end{multicols}
+
+\end{document}
+
+%% End of file `tetrogonos-example.sty'
diff --git a/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.pdf b/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.pdf
new file mode 100644
index 00000000000..cb216af72a0
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.tex b/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.tex
new file mode 100644
index 00000000000..2c565bcdbba
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/tetragonos/tetragonos.tex
@@ -0,0 +1,163 @@
+\documentclass[a4paper]{ctexart}
+% 20190115
+% Author: Yuchang Yang < yang.yc.allium@gmail.com >
+\usepackage{metalogo}
+\usepackage{fancyvrb}
+\usepackage{changepage}
+\usepackage{color}
+\definecolor{darkmiku}{RGB}{19, 149, 139}
+\CTEXsetup[format={\Large\bfseries}]{section}
+
+\title{tetragonos宏包\footnote{Github 地址:\texttt{https://github.com/Mikumikunisiteageru/tetragonos}}}
+\author{杨宇昌\footnote{电子邮箱:\texttt{yang.yc.allium@gmail.com}}}
+\date{2019年1月16日\qquad v1}
+
+\begin{document}
+
+\maketitle
+
+\begingroup
+ \CJKfontspec{IPAPMincho}
+ \large
+ \centerline{四角い地球を丸くしてる!}
+ \hfill --- 初音ミク、\kern1ex TOKOTOKO(西沢さん\mbox{P})\hbox{}\par
+ \vskip1em
+\endgroup
+
+\section{简介}
+tetragonos 是一个用于查询汉字四角号码的\XeLaTeX{}宏包。\par
+宏包名称取自希腊语,tetra者四也,gon者角也。\par
+
+\section{用法}
+tetragonos 宏包定义了宏 \verb|\getTG|。\texttt{\textbackslash getTG\{\textit{<string>}\}} 可展开成汉字字符串 \texttt{\textit{<string>}} 中第一个汉字的带附号的新版四角号码。举个简单的例子,\verb|\getTG{汉}| 与 \verb|\getTG{汉字}| 都会展开成“汉”字的四角号码,即 37140。\par
+
+\section{四角索引范例}
+四角号码常用来为汉字字词编写索引。文件 tetragonos-example.tex 中即示范了 tetragonos 宏包与 glossaries 宏包的联合应用。该文件从《广东新语》中摘录了一段文字,并为其中出现的所有植物名称建立了首字四角号码索引。该文件中的关键内容如下:
+
+\begingroup
+ \begin{adjustwidth}{3em}{3em}
+ \footnotesize
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=1,formatcom=\color{darkmiku}]
+ % arara: clean: {files: [tetragonos-example.glsdefs, tetragonos-example.TG-*]}
+ % arara: xelatex
+ % arara: makeglossaries
+ % arara: xelatex
+ % arara: xelatex
+ \end{Verbatim}
+ 指示 arara 运行时先清空历史索引条目,之后依次执行 \XeLaTeX{}、makeglossaries 等各程序。编译时直接输入 \verb|arara tetragonos-example| 即可。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=28,formatcom=\color{darkmiku}]
+ \usepackage{tetragonos}
+ \usepackage[nopostdot,nomain]{glossaries}
+ \newglossary*{TG}{Tegragonos}
+ \makeglossaries
+ \end{Verbatim}
+ 引入 tetragonos 与 glossaries 宏包后,新建好索引,准备登记四角号码与汉字条目。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=32,formatcom=\color{darkmiku}]
+ \def\syntaxTG#1#2#3#4#5{\textbf{#1#2#3#4\textsubscript{#5}}}
+ \end{Verbatim}
+ 定义四角号码的格式,使其整体加粗,并令附号(即附角号码)作下标。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=33,tabsize=4,formatcom=\color{darkmiku}]
+ \newcommand{\addTG}[1]{%
+ \newglossaryentry{#1}{
+ type=TG,
+ name={\syntaxTG#1},
+ description={\nopostdesc}
+ }%
+ }
+ \end{Verbatim}
+ 定义宏 \verb|\addTG|,建立四角号码条目,在索引中位于第一级。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=40,tabsize=4,formatcom=\color{darkmiku}]
+ \newcommand{\anchorTG}[1]{%
+ \edef\theTG{\getTG{#1}}%
+ \expandafter\addTG\expandafter{\theTG\expandafter}%
+ \newglossaryentry{#1}{
+ type=TG,
+ name={\textmd{#1}},
+ parent={\theTG},
+ sort={\theTG},
+ description={\hfill}
+ }%
+ \glsadd{#1}%
+ }
+ \end{Verbatim}
+ 定义宏 \verb|\anchorTG|,建立汉字(词)条目,居于第二级,是其首字四角号码对应的条目的子条目。\verb|\anchorTG| 只插入锚点,登记汉字(词)条目与当前页码,不在正文中产生可视效应。这是照顾一些在正文与索引中有不同字(词)形的条目的需要,毕竟在 \TeX{} 里合总比分容易。glossaries 宏包中的 \verb|\newglossaryentry| 命令会自动忽略登记过的条目,因此不必特意对条目判重。\verb|\expandafter| 强迫 \verb|\theTG| 在送入 \verb|\addTG| 前完全展平成四角号码。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=52,formatcom=\color{darkmiku}]
+ \newcommand{\cc}[1]{#1\anchorTG{#1}}
+ \end{Verbatim}
+ \verb|\cc| 则定义为显示完汉字(词)后马上把它原样加入索引的命令。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=68,tabsize=4,formatcom=\color{darkmiku}]
+ \begin{multicols}{4}
+ \renewcommand{\glossarysection}[2][]{}
+ \renewcommand*{\glsgroupskip}{}
+ \setlength{\glstreeindent}{7pt}
+ \printglossary[type=TG,style=tree,title=]
+ \end{multicols}
+ \end{Verbatim}
+ 四角号码索引分成多个纵栏,采用 tree 样式,第一级的四角号码均无缩进,第二级的汉字(词)排于各自所属的四角号码之后,统一缩进值可根据需要自由调整。
+ \end{adjustwidth}
+\endgroup
+
+\section{代码实现}
+
+宏包主文件 tetragonos.sty 的全部内容如下:
+
+\begingroup
+ \begin{adjustwidth}{3em}{3em}
+ \footnotesize
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,formatcom=\color{darkmiku}]
+ %% tetragonos.sty
+ %% Copyright 2019 Yuchang Yang < yang.yc.allium@gmail.com >
+ %
+ % This work may be distributed and/or modified under the
+ % conditions of the LaTeX Project Public License, either version 1.3
+ % of this license or (at your option) any later version.
+ % The latest version of this license is in
+ % http://www.latex-project.org/lppl.txt
+ % and version 1.3 or later is part of all distributions of LaTeX
+ % version 2005/12/01 or later.
+ %
+ % This work has the LPPL maintenance status `maintained'.
+ %
+ % The Current Maintainer of this work is Yuchang Yang.
+ %
+ % This work consists of the files tetragonos.sty and tetragonos-database.def
+ % and the associated example file tetragonos-example.tex.
+ %%
+ \NeedsTeXFormat{LaTeX2e}
+ \ProvidesPackage{tetragonos}[2019/01/15 v1 package tetragonos]
+ \newcommand{\saveTG}[2]{\expandafter\gdef\csname TG-#1\endcsname{#2}}
+ \newcommand{\loadTG}[1]{\csname TG-#1\endcsname}
+ \end{Verbatim}
+ 宏 \verb|\saveTG| 与 \verb|\loadTG| 实际上实现了一个索引为汉字字符的数组的写入与读出。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=last,formatcom=\color{darkmiku}]
+ \makeatletter
+ \newcommand{\get@first@char}[1]{\loadTG{#1}\iffalse}
+ \newcommand{\getTG}[1]{\get@first@char#1\fi}
+ \makeatother
+ \end{Verbatim}
+ 宏 \verb|\getTG| 利用 \TeX{} 的宏机制配合 \verb|\get@first@char|,实现了抓取参数中的第一个字符并查询其四角号码的功能。
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,firstnumber=last,formatcom=\color{darkmiku}]
+ \input{tetragonos-database.tex}
+ %%
+ %% End of file `tetrogonos.sty'
+ \end{Verbatim}
+ \end{adjustwidth}
+\endgroup
+
+汉字到四角号码的映射储存在另外的文件 tetragonos-example.def 中。其正文开头数行如下:
+
+\begingroup
+ \begin{adjustwidth}{3em}{3em}
+ \footnotesize
+ \begin{Verbatim}[numbers=left,numbersep=1ex,gobble=2,formatcom=\color{darkmiku},firstnumber=22]
+ \ProvidesFile{tetragonos-database.def}[2019/01/14 v1 tetragonos database]
+ \saveTG{亠}{00000}
+ \saveTG{弯}{00027}
+ \saveTG{亪}{00037}
+ \saveTG{疒}{00100}
+ \saveTG{韲}{00101}
+ \end{Verbatim}
+ \end{adjustwidth}
+\endgroup
+
+\end{document}