OSDN Git Service

Include Chinese testing files (test-zh-maqiyuan.*) by MaQiYuan.
[luatex-ja/luatexja.git] / test / zh / test-zh-maqiyuan.tex
1 %% Created by MaQiYuan(1113706230@qq.com, ClerkMa@gmail.com)\r
2 % This a test file which using LuaTeX-ja to typeset Chinese.\r
3 % 本文是使用 LuaTeX-ja 来排版中文。\r
4 % As peoples knows that the Japanese is similar to Chinese. And the typography of both languages is highly similar too.\r
5 % 如人所周知,日文和中文极为相似。此两者的排版也是高度相似的。\r
6 % In this test file, part of codes can patching to your '.tex' file to typeset Chinese very well.\r
7 % 本文档中的部分代码可以添加到你的“.tex”文档中来排印中文。\r
8 % This file do not using 'luatexja-fontspec'. And in the futrue, when have fixed the bug in 'xunicode.sty', the 'luatexja-fontspec' is the simplest and recommended way to typeset Chinese.% 本文未使用“luatexja-fontspec”。在将来,“xunicode.sty”中的 bug 修复之后,使用“luatexja-fontspec”是最简单而且最有效的方法。\r
9 \documentclass{article}\r
10 \usepackage{luatexja}\r
11 % We need set a new encoding in NFSS for Chinese: ZH (stand for "zhongwen hengban"). \r
12 % 我们需要重新定义一个 NFSS 中的编码来代表中文,ZH,是“中文横板”的缩写。\r
13 \DeclareYokoKanjiEncoding{ZH}{}{}\r
14 \DeclareKanjiEncodingDefaults{}{}\r
15 \DeclareErrorKanjiFont{ZH}{song}{m}{n}{10}\r
16 \DeclareKanjiSubstitution{ZH}{song}{m}{n}\r
17 %\r
18 \newcommand\songdefault{song}\r
19 \newcommand\heidefault{hei}\r
20 \renewcommand\kanjiencodingdefault{ZH}\r
21 \renewcommand\kanjifamilydefault{\songdefault}\r
22 \renewcommand\kanjiseriesdefault{\mddefault}\r
23 \renewcommand\kanjishapedefault{\updefault}\r
24 % There are two fonts usually using in Chinese typograph: 'song' style and 'hei' style. You can adding some font like 'kai' style, 'fangsong' style etc.\r
25 % 此处设定了中文排版中的两种常用字体:宋体和黑体。你可以填入其他的字体,比如楷体和仿宋体。\r
26 % The pTeX have using 9.62216pt's Japanese font to acompany with 10pt's Latin font. And so is in LuaTeX-ja. But this is not a must when using Chinese font.\r
27 % pTeX 中使用 9.62216pt 大小的中文字体来配合西文字体使用。LuaTeX-ja 中也是如此。但是使用中文字体时,此项非必需。\r
28 % There are two Adobe's font: 'AdobeSongStd-Light' and 'AdobeHeitiStd-Regular'. You also can using the 'SimSun' and 'SimHei' if your platform is Windows.\r
29 % 此处使用两款 Adobe 字体:“AdobeSongStd-Light”和“AdobeHeitiStd-Regular”。如果你的平台是 Windows,你也可使用“中易宋体”和“中易黑体”。\r
30 \DeclareKanjiFamily{ZH}{song}{}\r
31 \DeclareFontShape{ZH}{song}{m}{n}{<->name:AdobeSongStd-Light:jfm=jis}{}\r
32 \DeclareFontShape{ZH}{song}{bx}{n}{<->ssub*hei/m/n}{}\r
33 \DeclareKanjiFamily{ZH}{hei}{}\r
34 \DeclareFontShape{ZH}{hei}{m}{n}{<->name:AdobeHeitiStd-Regular:jfm=jis}{}\r
35 %\r
36 \fontencoding{ZH}\selectfont\r
37 \DeclareTextFontCommand{\textsong}{\songfamily}\r
38 \DeclareTextFontCommand{\texthei}{\heifamily}\r
39 \DeclareOldFontCommand{\song}{\normalfont\songfamily}{}\r
40 \DeclareOldFontCommand{\hei}{\normalfont\heifamily}{}\r
41 % There is the setting of math typestting.\r
42 %此处为数学排版设定。\r
43 \DeclareSymbolFont{songti}{ZH}{song}{m}{n}\r
44 \jfam\symsongti\r
45 \SetSymbolFont{songti}{bold}{ZH}{hei}{m}{n}\r
46 \DeclareSymbolFontAlphabet{\mathsong}{songti}\r
47 \DeclareMathAlphabet{\mathhei}{ZH}{hei}{m}{n}\r
48 % Redefine the fontfamily.\r
49 % 重新定义字体族。\r
50 \makeatletter\r
51 \DeclareRobustCommand\songfamily{\not@math@alphabet\songfamily\mathsong\kanjifamily\songdefault\selectfont}\r
52 \DeclareRobustCommand\heifamily{\not@math@alphabet\heifamily\mathhei\kanjifamily\heidefault\selectfont}\r
53 \DeclareRobustCommand\rmfamily{\not@math@alphabet\rmfamily\mathrm\romanfamily\rmdefault\kanjifamily\songdefault\selectfont}\r
54 \DeclareRobustCommand\sffamily{\not@math@alphabet\sffamily\mathsf\romanfamily\sfdefault\kanjifamily\heidefault\selectfont}\r
55 \makeatother\r
56 \begin{document}\r
57 \section{字体变换}\r
58 \r
59 \verb!{\song 你好!}! → 你好!\hskip 4\zw\verb!{\hei 你好!}! → {\hei 你好!}\r
60 \section{一个简单的积分公式}\r
61 $$      \int\frac{\mathrm{d}x}{x (ax + b)} = - \frac{1}{bx} + \frac{a}{b^2}\ln\biggl|\frac{ax + b}{x}\biggr| + C        $$\r
62 \section{一首诗}\r
63 \begin{center}\r
64 \sf 將進酒\r
65 \end{center}\r
66 君不見,黃河之水天上來,奔流到海不復回!君不見,高堂明鏡悲白髮,朝如青絲暮成雪!人生得意須盡歡,莫使金樽空對月。天生我材必有用,千金散盡還復來。烹羊宰牛且為樂,會須一飲三百杯。\r
67 岑夫子,丹丘生。進酒君莫停。與君歌一曲,請君為我傾耳聽。鐘鼓饌玉不足貴,但願長醉不用醒。古來聖賢皆寂寞,惟有飲者留其名。陳王昔時宴平樂,斗酒十千恣歡謔。主人何為言少錢?\r
68 徑須沽酒對君酌。五花馬,千金裘。呼兒將出換美酒,與爾同銷萬古愁。\r
69 \section{关于汉字数字}\r
70 \verb!\kansuji 1995年! → \kansuji 1995年\r
71 \section{苏州码子}\r
72 \def\suzhoumazi#1{%\r
73 \begingroup%\r
74 \ltjsetparameter{kansujichar={0,`〇}}%\r
75 \ltjsetparameter{kansujichar={1,`〡}}%\r
76 \ltjsetparameter{kansujichar={2,`〢}}%\r
77 \ltjsetparameter{kansujichar={3,`〣}}%\r
78 \ltjsetparameter{kansujichar={4,`〤}}%\r
79 \ltjsetparameter{kansujichar={5,`〥}}%\r
80 \ltjsetparameter{kansujichar={6,`〦}}%\r
81 \ltjsetparameter{kansujichar={7,`〧}}%\r
82 \ltjsetparameter{kansujichar={8,`〨}}%\r
83 \ltjsetparameter{kansujichar={9,`〩}}%\r
84 \kansuji #1%\r
85 \endgroup}\r
86 \fbox{\vbox{\hbox{\suzhoumazi{402}二}\hbox{拾元}}}\r
87 \end{document}