From d811ebd312fa93d2ceef5345a32ee9ccf270aa99 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 8 Oct 2021 03:01:38 +0000 Subject: CTAN sync 202110080301 --- macros/xetex/latex/hanzibox/README.md | 3 +- macros/xetex/latex/hanzibox/hanzibox.dtx | 158 ++++++++++++++++++++++++------- macros/xetex/latex/hanzibox/hanzibox.pdf | Bin 494235 -> 505041 bytes 3 files changed, 125 insertions(+), 36 deletions(-) (limited to 'macros/xetex') diff --git a/macros/xetex/latex/hanzibox/README.md b/macros/xetex/latex/hanzibox/README.md index 5f7e8d4ee0..0daf1efe0e 100644 --- a/macros/xetex/latex/hanzibox/README.md +++ b/macros/xetex/latex/hanzibox/README.md @@ -1,5 +1,5 @@ hanzibox -LaTeX3-based Chinese Character package +Boxed Chinese characters with Pinyin above and translation below based LaTeX3 ======= `hanzibox` is a LaTeX package developed in LaTeX3, which provides `\hanzibox` and `\hanzidialog` macros. These two macros are used for typesetting Chinese character with or without a background grid such as a cross grid or star grid for Chinese character writting learning. @@ -24,6 +24,7 @@ Contributing 1. Gitee repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3) 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls). +======= hanzibox 基于LaTeX3的汉字练习宏包 ======= diff --git a/macros/xetex/latex/hanzibox/hanzibox.dtx b/macros/xetex/latex/hanzibox/hanzibox.dtx index e3099aba20..c499c05c8d 100644 --- a/macros/xetex/latex/hanzibox/hanzibox.dtx +++ b/macros/xetex/latex/hanzibox/hanzibox.dtx @@ -5,7 +5,7 @@ % %<*readme> hanzibox -LaTeX3-based Chinese Character package +Boxed Chinese characters with Pinyin above and translation below based LaTeX3 ======= `hanzibox` is a LaTeX package developed in LaTeX3, which provides `\hanzibox` and `\hanzidialog` macros. These two macros are used for typesetting Chinese character with or without a background grid such as a cross grid or star grid for Chinese character writting learning. @@ -30,6 +30,7 @@ Contributing 1. Gitee repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3) 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls). +======= hanzibox 基于LaTeX3的汉字练习宏包 ======= @@ -153,7 +154,7 @@ Copyright and Licence % %\NeedsTeXFormat{LaTeX2e}[2020/10/01] %\RequirePackage{expl3} -%<+package>\GetIdInfo$Id: hanzibox.dtx 2.1.0 2021-09-30 08:00:00 +0800 Nan Geng $ +%<+package>\GetIdInfo$Id: hanzibox.dtx 2.1.1 2021-10-07 08:00:00 +0800 Nan Geng $ % {Boxed Chinese characters with Pinyin above and translation below.} %\ProvidesExplPackage{\ExplFileName} % {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -186,7 +187,7 @@ Copyright and Licence % \changes{v2.0.0}{2021/09/25}{基于l3draw重新设计} % \changes{v2.0.0}{2021/09/28}{重新编写README.md内容} % -% \CheckSum{1043} +% \CheckSum{1085} % \GetFileId{hanzibox.sty} % % \CharacterTable @@ -445,6 +446,23 @@ Copyright and Licence % 若要去掉 \opt{fillcolor},应将其置为空(\verb|fillcolor={}|),而不是将其设置为white(白色)。 % \end{function} % +% \begin{function}[added=2021-10-07,updated=2021-10-07]{crosscolorratio} +% \begin{syntax} +% crosscolorratio = \meta{integer} \init{20} +% \end{syntax} +% 格子内部十字线或米字线颜色占边框颜色的比例。 +% +% \textcolor[HTML]{AD1457}{注:\textsf{crosscolorratio}选项须在使用\textsf{framecolor}后起效}。 +% +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5] +% \centering +% \hanzibox[frametype=咪,framecolor=red]{十} +% \hanzibox[frametype=咪,crosscolorratio=30,framecolor=red]{田} +% \hanzibox[frametype=咪,crosscolorratio=50,framecolor=red]{米} +% \hanzibox[frametype=咪,crosscolorratio=80,framecolor=red]{咪} +% \end{SideBySideExample} +% \end{function} +% % \begin{function}[added=2021-09-24,updated=2021-09-24]{initial,vowel,tone} % \begin{syntax} % initial = <\TTF> \init{true} @@ -620,6 +638,8 @@ Copyright and Licence % \ExplSyntaxOff % \end{SideBySideExample} % +% \changes{v2.1.1}{2021/10/07}{在格子纸示例中用coffin实现每行格子以提升编译速度} +% % \subsection{生成汉字书写练习格子纸} % % 可以通过将\tn{hanzibox}命令的\Arg{汉字}参数留空, @@ -628,36 +648,46 @@ Copyright and Licence % 再根据需要通过循环的方式生成指定行数和列数的 % 汉字书写练习用格子纸。 % -% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5] +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5] % \hanziboxset{frametype=咪,framecolor=red, -% charcolor=red,charf=\huge} +% charcolor=red,charf=\huge} % \centering % \ExplSyntaxOn -% \int_step_inline:nn {8} +% \hcoffin_set:Nn \l_tmpa_coffin % { % \int_step_inline:nn {6} % { % \hanzibox{} -% \hspace*{-0.4pt} +% \hspace*{-0.35pt} % } -% \par\nointerlineskip\vspace*{-6.0pt} +% } +% \int_step_inline:nn {8} +% { +% \coffin_typeset:Nnnnn +% \l_tmpa_coffin { l } { b } { 0pt } { 0pt } +% \par\nointerlineskip\vspace*{-3.3pt} % } % \ExplSyntaxOff % \end{SideBySideExample} % -% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5] +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5] % \hanziboxset{frametype=咪,framecolor=red, % charcolor=red,charf=\huge,hanzi=false} % \centering % \ExplSyntaxOn -% \int_step_inline:nn {8} +% \hcoffin_set:Nn \l_tmpa_coffin % { % \int_step_inline:nn {6} % { % \hanzibox*{国} -% \hspace*{-0.4pt} +% \hspace*{-0.35pt} % } -% \par\nointerlineskip\vspace*{-6.0pt} +% } +% \int_step_inline:nn {8} +% { +% \coffin_typeset:Nnnnn +% \l_tmpa_coffin { l } { b } { 0pt } { 0pt } +% \par\nointerlineskip\vspace*{-6.30pt} % } % \ExplSyntaxOff % \end{SideBySideExample} @@ -694,7 +724,7 @@ Copyright and Licence % \hanzibox*{故人西辞黄鹤楼}[gu4ren2xi1ci2huang2he2lou2] % \hanzibox*{烟花三月下扬州}[yan1hua1san1yue4] % \hanzibox*{孤帆远影 }[gu1fan1yuan3ying3bi4kong1jin4] -% \hanzibox*{唯见长江天际流}[wei2jian4] +% \hanzibox*{}[wei2jian4chang2jiang1tian1ji4liu2] % \end{SideBySideExample} % % \end{documentation} @@ -755,6 +785,20 @@ Copyright and Licence % % \end{macrocode} % +% \changes{v2.1.1}{2021/10/03}{修订盒子高度计算函数的expl3版本兼容问题} +% +% 判断\tn{box_ht_plus_dp:N}函数是否存在,若不存在,则定义该函数。 +% 为了解决expl3的旧版本兼容问题。 +% 摘录于\url{https://ask.latexstudio.net/ask/question/3773.html}。 +% +% \begin{macrocode} +\cs_if_free:NT \box_ht_plus_dp:N + { + \cs_new_protected:Npn \box_ht_plus_dp:N #1 + { \tex_dimexpr:D \box_ht:N #1 + \box_dp:N #1 \scan_stop: } + } +% \end{macrocode} +% % 检查编译引擎 % % \begin{macrocode} @@ -855,6 +899,7 @@ Copyright and Licence % \l_@@_pinyin_format_tl, % \l_@@_character_format_tl, % \l_@@_translation_format_tl, +% \l_@@_cross_color_ratio_int, % \l_@@_pinyin_int, % \l_@@_character_int, % \l_@@_translation_int, @@ -904,6 +949,7 @@ Copyright and Licence \tl_new:N \l_@@_pinyin_format_tl \tl_new:N \l_@@_character_format_tl \tl_new:N \l_@@_translation_format_tl +\int_new:N \l_@@_cross_color_ratio_int \int_new:N \l_@@_pinyin_int \int_new:N \l_@@_character_int \int_new:N \l_@@_translation_int @@ -1041,14 +1087,18 @@ Copyright and Licence \draw_path_use_clear:n { stroke , fill } } } - +% \end{macrocode} +% +% \changes{v2.1.1}{2021/10/07}{用hanziboxcrosscolor设置内格子线颜色} +% +% \begin{macrocode} \@@_new_frame_construct:nn { 十 } { \tl_if_empty:NF \l_@@_dash_pattern_tl { \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt } } - \color_stroke:n { hanziboxframecolor!30 } + \color_stroke:n { hanziboxcrosscolor } \draw_path_moveto:n { (#3)/2, #2 } \draw_path_lineto:n { #3/2, #4 } \draw_path_moveto:n { #1, (#4)/2 } @@ -1062,7 +1112,7 @@ Copyright and Licence { \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt } } - \color_stroke:n { hanziboxframecolor!30 } + \color_stroke:n { hanziboxcrosscolor } \draw_path_moveto:n { #1, #2 } \draw_path_lineto:n { #3, #4 } \draw_path_moveto:n { #1, #4 } @@ -1265,10 +1315,12 @@ Copyright and Licence { \color_set:nn {#1} {#2} } +\cs_generate_variant:Nn \@@_color_select:nn {nx} \cs_set_nopar:Npn \@@_color_select:nnn #1#2#3 { \color_set:nnn {#1} {#2} {#3} } +\cs_generate_variant:Nn \@@_color_select:nnn {nnx} % \end{macrocode} % \end{macro} % @@ -1411,12 +1463,28 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v2.1.1}{2021/10/07}{添加格子内部十字和米字线颜色与边框颜色比例选项corsscolorratio} +% +% \begin{macro}{crosscolorratio} +% 边框颜色 +% \begin{macrocode} + crosscolorratio .int_set:N = \l_@@_cross_color_ratio_int, + crosscolorratio .initial:n = 20, +% \end{macrocode} +% \end{macro} +% +% \changes{v2.1.1}{2021/10/07}{为格子内部十字和米字线定义hanziboxcrosscolor颜色} +% % \begin{macro}{framecolor} % 边框颜色 % \begin{macrocode} - framecolor .code:n = { \@@_color_select:nn { hanziboxframecolor } {#1} } , + framecolor .code:n = { \tl_set:Nx \l_tmpa_tl { #1 ! \int_use:N \l_@@_cross_color_ratio_int } + \@@_color_select:nn { hanziboxframecolor } {#1} + \@@_color_select:nx{ hanziboxcrosscolor } { \l_tmpa_tl } } , framecolor .initial:n = black , - framecolor* .code:n = { \@@_color_select:nnn { hanziboxframecolor } #1 } , + framecolor* .code:n = { \tl_set:Nx \l_tmpa_tl { #1 ! \int_use:N \l_@@_cross_color_ratio_int } + \@@_color_select:nnn { hanziboxframecolor } #1 + \@@_color_select:nnx { hanziboxcrosscolor } \l_tmpa_tl } , % \end{macrocode} % \end{macro} % @@ -1576,6 +1644,8 @@ Copyright and Licence tranf = \tiny , frametype = none , resize = none , + crosscolorratio = 20, + framecolor = black, } % \end{macrocode} @@ -1856,39 +1926,57 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v2.1.1}{2021/10/02}{修复无汉字手动拼音无法正确处理的问题} +% % \begin{macro}{\@@_null_str_coffin_construct:} % 构造空白汉字(0个汉字)带拼音字符串盒子。 % \begin{macrocode} \cs_new:Npn \@@_null_str_coffin_construct: { - \hcoffin_set:Nn \l_@@_str_box_coffin + \bool_if:NTF \l_@@_autopinyin_bool { - \bool_set_false:N \l_@@_withhanzi_bool - - \hcoffin_set:Nn \l_tmpa_coffin + \hcoffin_set:Nn \l_@@_str_box_coffin { + \bool_set_false:N \l_@@_withhanzi_bool \@@_single_handle:N \c_@@_basechar_tl + \allowbreak } - - \bool_if:NT \l_@@_withpinyin_bool + } + { + \hcoffin_set:Nn \l_@@_str_box_coffin { - \hcoffin_set:Nn \l_@@_pinyin_box_coffin + \bool_if:NTF \l_@@_withpinyin_bool { - \color_select:n { hanziboxcharcolor } - \tl_use:N \l_@@_pinyin_format_tl \@@_get_tone_pinyin:V \l_@@_pinyin_tl \clist_clear:N \l_@@_tone_pinyin_clist \clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl - \clist_use:Nn \l_@@_tone_pinyin_clist {} - % \@@_get_tone_pinyin:V \l_@@_pinyin_tl - % \l_@@_tone_pinyin_tl + \int_set:Nn \l_tmpa_int {\clist_count:N \l_@@_tone_pinyin_clist} + + \int_step_inline:nn { \l_tmpa_int } + { + \bool_set_false:N \l_@@_withhanzi_bool + + \hcoffin_set:Nn \l_tmpa_coffin + { + \@@_single_handle:N \c_@@_basechar_tl + } + + \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl + \@@_single_pinyin:V \l_tmpb_tl + + \coffin_join:NnnNnnnn \l_tmpa_coffin + { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt } + \coffin_typeset:Nnnnn \l_tmpa_coffin + { l } { b } { 0pt } { 0pt } + \allowbreak + } + } + { + \bool_set_false:N \l_@@_withhanzi_bool + \@@_single_handle:N \c_@@_basechar_tl + \allowbreak } - \coffin_join:NnnNnnnn \l_tmpa_coffin - { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt } } - \coffin_typeset:Nnnnn \l_tmpa_coffin - { l } { b } { 0pt } { 0pt } - \allowbreak } } % \end{macrocode} diff --git a/macros/xetex/latex/hanzibox/hanzibox.pdf b/macros/xetex/latex/hanzibox/hanzibox.pdf index ce083be4f2..de80686c06 100644 Binary files a/macros/xetex/latex/hanzibox/hanzibox.pdf and b/macros/xetex/latex/hanzibox/hanzibox.pdf differ -- cgit v1.2.3