summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-09-29 03:02:14 +0000
committerNorbert Preining <norbert@preining.info>2021-09-29 03:02:14 +0000
commit0396814223158484c2f424d382bcd670de158d82 (patch)
treea29575da4ec01f8ac3611b6c2e632c45de465dcf /macros
parenta2b2d914413ee324c82473e97eab978f2dff8a5f (diff)
CTAN sync 202109290302
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx7
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin577947 -> 577949 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.tex4
-rw-r--r--macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdfbin40812 -> 40813 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdfbin197491 -> 201045 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/1-criticalnotes.pdfbin195653 -> 199196 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/1-sidenotes.pdfbin291188 -> 295847 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/1-tabular.pdfbin281031 -> 284803 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdfbin197564 -> 200373 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/1-verses.pdfbin197396 -> 200204 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-antilabe.pdfbin205373 -> 209856 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-cross_referencing.pdfbin196391 -> 199197 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdfbin199862 -> 202702 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-glossaries.pdfbin280691 -> 284462 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-indexing.pdfbin279825 -> 283598 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdfbin273987 -> 277764 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdfbin289480 -> 293260 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-linespacing.pdfbin284653 -> 288423 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdfbin285314 -> 290106 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-notes-width.pdfbin203109 -> 205925 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdfbin208756 -> 211562 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-performances.pdfbin281669 -> 286175 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdfbin31448 -> 31498 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdfbin304788 -> 309311 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdfbin283765 -> 287548 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdfbin196243 -> 199051 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdfbin23426 -> 23428 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdfbin172606 -> 174535 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdfbin32047 -> 32047 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdfbin284905 -> 288679 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdfbin190129 -> 199948 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdfbin189364 -> 199183 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdfbin168145 -> 177026 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdfbin189772 -> 199590 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdfbin188698 -> 198522 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdfbin188752 -> 198573 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdfbin188888 -> 198707 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdfbin210267 -> 213256 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.tex1
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdfbin209050 -> 211867 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdfbin201331 -> 204143 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdfbin293347 -> 297127 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdfbin200437 -> 203251 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdfbin221703 -> 224508 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdfbin246378 -> 249192 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdfbin201164 -> 203970 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdfbin197012 -> 199821 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdfbin297750 -> 301523 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdfbin203497 -> 206311 bytes
-rw-r--r--macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdfbin192572 -> 195383 bytes
-rw-r--r--macros/latex/contrib/reledmac/migration.pdfbin358155 -> 368877 bytes
-rw-r--r--macros/latex/contrib/reledmac/reledmac.dtx7
-rw-r--r--macros/latex/contrib/reledmac/reledmac.pdfbin2041560 -> 2063704 bytes
-rw-r--r--macros/latex/contrib/reledmac/reledpar.dtx8
-rw-r--r--macros/latex/contrib/reledmac/reledpar.pdfbin987754 -> 1006705 bytes
-rw-r--r--macros/latex/contrib/willowtreebook/README6
-rw-r--r--macros/latex/contrib/willowtreebook/willowtreebook.pdfbin13991774 -> 13992183 bytes
-rw-r--r--macros/latex/contrib/willowtreebook/willowtreebook.tex20
-rw-r--r--macros/unicodetex/latex/uwa-letterhead/README3
-rw-r--r--macros/unicodetex/latex/uwa-letterhead/uwa-letterhead-example.tex (renamed from macros/unicodetex/latex/uwa-letterhead/example.tex)4
-rw-r--r--macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.dtx54
-rw-r--r--macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.ins6
-rw-r--r--macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.pdfbin58265 -> 58508 bytes
-rw-r--r--macros/unicodetex/latex/uwa-pcf/README24
-rw-r--r--macros/unicodetex/latex/uwa-pcf/uwa-pcf-example.tex47
-rw-r--r--macros/unicodetex/latex/uwa-pcf/uwa-pcf.dtx735
-rw-r--r--macros/unicodetex/latex/uwa-pcf/uwa-pcf.ins58
-rw-r--r--macros/unicodetex/latex/uwa-pcf/uwa-pcf.pdfbin0 -> 53157 bytes
-rw-r--r--macros/unicodetex/latex/uwa-pif/README24
-rw-r--r--macros/unicodetex/latex/uwa-pif/uwa-pif-example.tex92
-rw-r--r--macros/unicodetex/latex/uwa-pif/uwa-pif.dtx646
-rw-r--r--macros/unicodetex/latex/uwa-pif/uwa-pif.ins58
-rw-r--r--macros/unicodetex/latex/uwa-pif/uwa-pif.pdfbin0 -> 50323 bytes
-rw-r--r--macros/xetex/latex/hanzibox/README.md45
-rw-r--r--macros/xetex/latex/hanzibox/hanzibox.dtx2176
-rw-r--r--macros/xetex/latex/hanzibox/hanzibox.pdfbin292228 -> 459483 bytes
76 files changed, 3391 insertions, 634 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 2081f55551..2a841ac896 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/09/12}{1.3d}
+\ProvidesExplClass{easybook}{2021/09/28}{1.3e}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -297,7 +297,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/09/12}{1.3d}
+\ProvidesExplPackage{easybase}{2021/09/28}{1.3e}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -1771,6 +1771,7 @@
\tl_gset:Nn \dbltopfraction { 0.9 }
\tl_gset:Nn \dblfloatpagefraction { 0.9 }
}
+\dim_zero:N \mathindent
\skip_set:Nn \parskip { 0pt plus 2pt minus 1pt }
\skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt }
\skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt }
@@ -2389,7 +2390,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/09/12}{1.3d}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/09/28}{1.3e}
{Customization of tcolorbox for easybook}
\tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip }
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index 2549d682b3..9a4997299c 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex
index a979be5a54..0c202a3674 100644
--- a/macros/latex/contrib/easybook/easybook.tex
+++ b/macros/latex/contrib/easybook/easybook.tex
@@ -12,8 +12,8 @@
name = easybook,
color-scheme = blue,
title = EASYBOOK 使用手册,
- version = v1.3d,
- date = 2021/09/12,
+ version = v1.3e,
+ date = 2021/09/28,
authors = 瞿毅,
info = 排版简体中文学位论文和书籍,
email = quee123@foxmail.com,
diff --git a/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf b/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf
index 4e6cef7423..b92b60e47b 100644
--- a/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf
+++ b/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf b/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf
index 4a4492ba6d..4766e38d38 100644
--- a/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf
+++ b/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf b/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf
index edcc2bf125..f669ce30c9 100644
--- a/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf
+++ b/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf b/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf
index 87fcfccdb0..fe9826bcf5 100644
--- a/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf
+++ b/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/1-tabular.pdf b/macros/latex/contrib/reledmac/examples/1-tabular.pdf
index 3b5e5715b7..abb3976b59 100644
--- a/macros/latex/contrib/reledmac/examples/1-tabular.pdf
+++ b/macros/latex/contrib/reledmac/examples/1-tabular.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf b/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf
index c833b9f6ae..ac76fd9f8b 100644
--- a/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf
+++ b/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/1-verses.pdf b/macros/latex/contrib/reledmac/examples/1-verses.pdf
index 382ba54302..8a975fac9f 100644
--- a/macros/latex/contrib/reledmac/examples/1-verses.pdf
+++ b/macros/latex/contrib/reledmac/examples/1-verses.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-antilabe.pdf b/macros/latex/contrib/reledmac/examples/2-antilabe.pdf
index 319e83f2ea..e295f0204d 100644
--- a/macros/latex/contrib/reledmac/examples/2-antilabe.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-antilabe.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf b/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf
index a407c54f18..55fb7476ee 100644
--- a/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf b/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf
index d66bb8eda8..81a3764006 100644
--- a/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-glossaries.pdf b/macros/latex/contrib/reledmac/examples/2-glossaries.pdf
index c75e366e1a..4f21057ba8 100644
--- a/macros/latex/contrib/reledmac/examples/2-glossaries.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-glossaries.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-indexing.pdf b/macros/latex/contrib/reledmac/examples/2-indexing.pdf
index 471a7a233d..99ce6fe10b 100644
--- a/macros/latex/contrib/reledmac/examples/2-indexing.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-indexing.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf b/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf
index 0561b50d0d..2a1b3ebdf4 100644
--- a/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf b/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf
index 4cdceb5b2e..56789481bf 100644
--- a/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-linespacing.pdf b/macros/latex/contrib/reledmac/examples/2-linespacing.pdf
index 5fd637fe57..bf49a6826b 100644
--- a/macros/latex/contrib/reledmac/examples/2-linespacing.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-linespacing.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf b/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf
index 494cc2fa3c..274f719ce6 100644
--- a/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-notes-width.pdf b/macros/latex/contrib/reledmac/examples/2-notes-width.pdf
index 3237be4be1..028329e06b 100644
--- a/macros/latex/contrib/reledmac/examples/2-notes-width.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-notes-width.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf b/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf
index e7c505a201..d4ac5f3c64 100644
--- a/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-performances.pdf b/macros/latex/contrib/reledmac/examples/2-performances.pdf
index 65d17ca2e9..482b1ed01b 100644
--- a/macros/latex/contrib/reledmac/examples/2-performances.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-performances.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf b/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf
index 62a3ac3b45..5ae176bc27 100644
--- a/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf b/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf
index 60abd860ab..3d7988bcde 100644
--- a/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf b/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf
index 113a237956..0fa1eda97d 100644
--- a/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf b/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf
index ff5d2b97c7..784b4f5e91 100644
--- a/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf
+++ b/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf
index a7fd40a1ea..5a2396d8fa 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf
index a963695d7c..a5ac937d4b 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf
index c47c522bb4..297ddc4672 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf
index 33b19d76f6..222c139845 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf
index 4b48dcc44c..04a751bd9e 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf
index 4883912f88..957720ca6f 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf
index 6dab47543e..3338e9124c 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf
index 08c01a94bf..67756d6ad9 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf
index 7d1d97c5c1..d292d76db0 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf
index 4f5cf3ccf6..b378e9dec8 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf
index 40df495e5a..497ecc61f5 100644
--- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf
+++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf
index 3bd111bac9..bb47c504a1 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.tex b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.tex
index 8ca3aa3aed..9c542dda87 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.tex
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.tex
@@ -22,6 +22,7 @@
\begin{english}
\date{}
\title{Mixing multiple columns with a single column, using continuous numbering}
+\maketitle
\begin{abstract}
In this example, we use the \verb+widthliketwocolumns+ and \\ \verb+continuousnumberingwithcolumns+ and \verb+\pausenumbering+ to alternate parallel typesetting in columns and typesetting in a single column, getting continuous line numbering between them.
\end{abstract}
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf
index 7c5e7413e5..70aa4ce555 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf
index 5b42775a42..612f63e28b 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf
index c8b8d81cf9..a901f4b4d6 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf
index 5f21322ee8..4e610657b4 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf
index 4ac56fd5c9..9195e3c8a4 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf
index f328cc61d3..3232142908 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf
index 842a706a28..8d323b82b5 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf
index 2b2f02ecbb..7b169a2f9c 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf
index 353ab235fa..95ee47081d 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf
index 23415e60b4..b8eb7dabec 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf
index 32008aee75..205c3bc2f9 100644
--- a/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf
+++ b/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/migration.pdf b/macros/latex/contrib/reledmac/migration.pdf
index 6800d46fac..6363914c61 100644
--- a/macros/latex/contrib/reledmac/migration.pdf
+++ b/macros/latex/contrib/reledmac/migration.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/reledmac.dtx b/macros/latex/contrib/reledmac/reledmac.dtx
index dd6a6f39c0..996dc98008 100644
--- a/macros/latex/contrib/reledmac/reledmac.dtx
+++ b/macros/latex/contrib/reledmac/reledmac.dtx
@@ -586,6 +586,7 @@
% \changes{v2.38.0}{2021/05/30}{Add hyperlinks between footnote and lemma when using abbreviated line range.}
% \changes{v2.38.0}{2021/05/30}{Add \protect\cs{Xnopagenumberifcurrent} hook.}
% \changes{v2.38.0}{2021/05/30}{Add \protect\cs{Xbeforepagenumber} hook.}
+% \changes{v2.38.1}{2021/09/27}{Fix incompatibility between \protect\parpackage's option \protect\option{continuousnumberingwithcolumns} and lineation by page.}
% Typeset scholarly editions with \LaTeX\thanks{This file (\dtxfilename)
% has version number \fileversion, last revised \filedate.}}
%
@@ -4475,7 +4476,7 @@
% \begin{macrocode}
%<*code>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledmac}[2021/05/30 v2.38.0 typesetting critical editions]%
+\ProvidesPackage{reledmac}[2021/09/27 v2.38.1 typesetting critical editions]%
% \end{macrocode}
%
% \subsection{Package options}
@@ -6808,7 +6809,7 @@
\ifbypage@R
\ifx\l@dchset@num\relax%Not resetting if preceded by a \setlinenum
\ifboolexpr{%
- bool{resumenumberingR@start}%
+ (bool{continuousnumberingwithcolumns} or bool{resumenumberingR@start})%
and test {\ifnumequal{\last@page@numR}{-10000}}%
}%
{}%
@@ -6821,7 +6822,7 @@
\fi
\page@numR=#1%
\global\this@section@page@numR=#1%
- \last@page@numR=#1%
+ \global\last@page@numR=#1%
\global\this@section@last@page@numR=#1%
\def\next@page@numR{#1}%
\gdef\this@section@next@page@numR{#1}%
diff --git a/macros/latex/contrib/reledmac/reledmac.pdf b/macros/latex/contrib/reledmac/reledmac.pdf
index 0e3ba600ed..a0bae5136c 100644
--- a/macros/latex/contrib/reledmac/reledmac.pdf
+++ b/macros/latex/contrib/reledmac/reledmac.pdf
Binary files differ
diff --git a/macros/latex/contrib/reledmac/reledpar.dtx b/macros/latex/contrib/reledmac/reledpar.dtx
index 4fe935f799..55d7ea094b 100644
--- a/macros/latex/contrib/reledmac/reledpar.dtx
+++ b/macros/latex/contrib/reledmac/reledpar.dtx
@@ -349,6 +349,7 @@
% \changes{v2.24.3}{2020/11/08}{Fix bug with hanging verse in parallel typesetting.}
% \changes{v2.25.0}{2020/11/29}{Add compatibility with \protect\cs{linenumannotationothersidetrue} of \protect\macpackage.}.
% \changes{v2.25.1}{2021/01/21}{\protect\cs{ifsublines@R} migrated to \protect\macpackage}
+% \changes{v2.25.2}{2021/09/27}{Fix incompatibility with \protect\package{babel} v.3.61}
% ^^A PW added following as the definitions are at some unknown elsewhere
%
% \newcommand{\egstart}{%
@@ -1405,7 +1406,7 @@
% \begin{macrocode}
%<*code>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{reledpar}[2021/03/08 v2.25.1a reledmac extension for parallel texts]%
+\ProvidesPackage{reledpar}[2021/09/27 v2.25.2 reledmac extension for parallel texts]%
% \end{macrocode}
% \subsection{Package's requirement}
@@ -5617,7 +5618,10 @@
% that \protect\cs{theledlanguageL} and \protect\cs{theledlanguageR} are unaltered.
% \begin{macrocode}
\renewcommand*{\l@duselanguage}[1]{%
- \expandafter\l@doldselectlanguage\expandafter{#1}}
+ \let\bbl@savelastskip\relax% Babel 3.61, which provokes spurious vertical space
+ \let\bbl@restorelastskip\relax%% Babel 3.61, which provokes spurious vertical space
+ \expandafter\l@doldselectlanguage\expandafter{#1}%
+ }%
% \end{macrocode}
% Lastly, initialise the left and right languages to the current \protect\package{babel}
% one.
diff --git a/macros/latex/contrib/reledmac/reledpar.pdf b/macros/latex/contrib/reledmac/reledpar.pdf
index ed94a2657e..01117f6c19 100644
--- a/macros/latex/contrib/reledmac/reledpar.pdf
+++ b/macros/latex/contrib/reledmac/reledpar.pdf
Binary files differ
diff --git a/macros/latex/contrib/willowtreebook/README b/macros/latex/contrib/willowtreebook/README
index df5fb11cab..fb1eb87949 100644
--- a/macros/latex/contrib/willowtreebook/README
+++ b/macros/latex/contrib/willowtreebook/README
@@ -1,6 +1,6 @@
Willow Tree Book Class
-v1.02
-22 September 2021
+v1.03
+28 September 2021
Authors:
Ben McKay
@@ -18,4 +18,4 @@ See http://www.latex-project.org/lppl.txt
The willowtreebook class is a simple book class, which I use for lecture notes.
It actually just selects options for the more sophisticated memoir class.
-Changes: added hint and bibliography preambles, to load before the hints or bibliography.
+Changes: fixed typo in user manual.
diff --git a/macros/latex/contrib/willowtreebook/willowtreebook.pdf b/macros/latex/contrib/willowtreebook/willowtreebook.pdf
index 0c3d8b6578..6df38e5391 100644
--- a/macros/latex/contrib/willowtreebook/willowtreebook.pdf
+++ b/macros/latex/contrib/willowtreebook/willowtreebook.pdf
Binary files differ
diff --git a/macros/latex/contrib/willowtreebook/willowtreebook.tex b/macros/latex/contrib/willowtreebook/willowtreebook.tex
index 2418ae455e..331432e52e 100644
--- a/macros/latex/contrib/willowtreebook/willowtreebook.tex
+++ b/macros/latex/contrib/willowtreebook/willowtreebook.tex
@@ -1,5 +1,5 @@
\documentclass{willowtreebook}
-\Title{The Willow Tree Book Class 1.02}
+\Title{The Willow Tree Book Class 1.03}
\Author{Benjamin \scotsMc{}Kay}
\Colophon{Released under the \LaTeX{} Public Project License 1.3c}
\BibliographyFile{willowtreebook}
@@ -129,12 +129,26 @@ is evaluated by substituting \(u=x^2\), so
\section{Preambles}
We can put some \LaTeX{} code before the hints:
\begin{Verbatim}[frame=leftline]
-\RenewDocumentCommand\hintsPreamble{}{\par\noindent{}\textit{When you are describing, \\ A shape, or sound, or tint; \\ Don't state the matter plainly, \\ But put it in a hint; \\\ And learn to look at all things, \\ With a sort of mental squint.}\par\noindent{}---\ {Lewis Carroll}}
+\RenewDocumentCommand\hintsPreamble{}{
+\par\noindent{}
+\textit{When you are describing, \\
+A shape, or sound, or tint; \\
+Don't state the matter plainly, \\
+But put it in a hint; \\
+And learn to look at all things, \\
+With a sort of mental squint.}
+\par\noindent{}---\ {Lewis Carroll}}
\end{Verbatim}
\RenewDocumentCommand\hintsPreamble{}{\par\noindent{}\textit{When you are describing, \\ A shape, or sound, or tint; \\ Don't state the matter plainly, \\ But put it in a hint; \\\ And learn to look at all things, \\ With a sort of mental squint.}\par\noindent{}---\ {Lewis Carroll}}
or before the bibliography:
\begin{Verbatim}[frame=leftline]
-\RenewDocumentCommand\bibliographyPreamble{}{\par\noindent\textit{If those books are in agreement with the Quran, we have no need of them; and if these are opposed to the Quran, destroy them.}\par\noindent{}---\ {Omar}}
+\RenewDocumentCommand\bibliographyPreamble{}{
+\par\noindent
+\textit{If those books are in agreement with the Quran,
+we have no need of them;
+and if these are opposed to the Quran,
+destroy them.}
+\par\noindent{}---\ {Omar}}
\end{Verbatim}
\RenewDocumentCommand\bibliographyPreamble{}{\par\noindent\textit{If those books are in agreement with the Quran, we have no need of them; and if these are opposed to the Quran, destroy them.}\par\noindent{}---\ {Omar}}
\end{document}
diff --git a/macros/unicodetex/latex/uwa-letterhead/README b/macros/unicodetex/latex/uwa-letterhead/README
index 5aa003f531..15b9f212d2 100644
--- a/macros/unicodetex/latex/uwa-letterhead/README
+++ b/macros/unicodetex/latex/uwa-letterhead/README
@@ -20,4 +20,5 @@ This work has the LPPL maintenance status `maintained'.
The Current Maintainer of this work is Anthony Di Pietro.
This work consists of the files uwa-letterhead.dtx, uwa-letterhead.ins, and
-example.tex and the derived files uwa-letterhead.sty and uwa-letterhead.pdf.
+uwa-letterhead-example.tex and the derived files uwa-letterhead.sty and
+uwa-letterhead.pdf.
diff --git a/macros/unicodetex/latex/uwa-letterhead/example.tex b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead-example.tex
index 9168e2d7d1..3a467e0eeb 100644
--- a/macros/unicodetex/latex/uwa-letterhead/example.tex
+++ b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead-example.tex
@@ -13,7 +13,8 @@
% The Current Maintainer of this work is Anthony Di Pietro.
%
% This work consists of the files uwa-letterhead.dtx, uwa-letterhead.ins, and
-% example.tex and the derived files uwa-letterhead.sty and uwa-letterhead.pdf.
+% uwa-letterhead-example.tex and the derived files uwa-letterhead.sty and
+% uwa-letterhead.pdf.
\documentclass[a4paper,11pt]{article}
\usepackage{uwa-letterhead}
@@ -22,7 +23,6 @@
\school{School of Psychological Science}
\mbdp{000}
\phone{+61 8 6488 0000}
-\mobile{+61 000 000 000}
\email{john.smith@uwa.edu.au}
\begin{document}
diff --git a/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.dtx b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.dtx
index 87f044cc85..7f3a1e4073 100644
--- a/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.dtx
+++ b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.dtx
@@ -14,7 +14,8 @@
% The Current Maintainer of this work is Anthony Di Pietro.
%
% This work consists of the files uwa-letterhead.dtx, uwa-letterhead.ins, and
-% example.tex and the derived files uwa-letterhead.sty and uwa-letterhead.pdf.
+% uwa-letterhead-example.tex and the derived files uwa-letterhead.sty and
+% uwa-letterhead.pdf.
% \fi
%
% \iffalse
@@ -24,7 +25,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{uwa-letterhead}
%<*package>
- [2019/08/31 1.0.0 UWA Letterhead]
+ [2021/09/13 1.0.1 UWA Letterhead]
%</package>
%
%<*driver>
@@ -38,7 +39,7 @@
regular,
nouwafont,
noarial
-]{uwa-letterhead}[2019/08/31]
+]{uwa-letterhead}[2021/09/13]
\GetFileInfo{uwa-letterhead.dtx}
\setcounter{secnumdepth}{3}
\geometry{
@@ -59,7 +60,7 @@
\DisableCrossrefs
\CodelineIndex
\RecordChanges
-\CheckSum{545}
+\CheckSum{561}
\begin{document}
\DocInput{uwa-letterhead.dtx}
\end{document}
@@ -83,6 +84,7 @@
% Right brace \} Tilde \~}
%
% \changes{1.0.0}{2019/08/31}{Initial version}
+% \changes{1.0.1}{2021/09/13}{Make first-page footer optional}
%
% \maketitle
%
@@ -104,7 +106,7 @@
% typeface for the first-page footer and the
% \href{https://www.brand.uwa.edu.au/}{UWA Slab} typeface for headings.
% The fonts must be installed on the system for this to work. Arial is
-% available as part of Microsoft's TypeType core fonts for the web
+% available as part of Microsoft's TrueType core fonts for the web
% (\url{https://sourceforge.net/projects/mscorefonts2/}), and UWA Slab is
% available from the UWA website
% (\url{https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/fonts/uwa/}).
@@ -132,6 +134,13 @@
% \item |nouwafont|: Use the body text typeface for headings.
% \end{itemize}
%
+% You can pass the following options to specify whether to include the
+% first-page footer:
+% \begin{itemize}
+% \item |footer|: Include the first-page footer.
+% \item |nofooter|: Do not include the first-page footer (default).
+% \end{itemize}
+%
% You can pass the following options to specify whether to use Arial
% for the first-page footer:
% \begin{itemize}
@@ -241,14 +250,17 @@
%
% \begin{minipage}{\textwidth}
% \begin{macro}{\uwalh@uwafont}
+% \begin{macro}{\uwalh@footer}
% \begin{macro}{\uwalh@arialfont}
% Define conditionals for the package options.
% \begin{macrocode}
\newif\ifuwalh@uwafont
+\newif\ifuwalh@footer
\newif\ifuwalh@arialfont
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
% \end{minipage}
%
% The |uwafont| and |nouwafont| options respectively enable and disable
@@ -262,6 +274,17 @@
}
% \end{macrocode}
%
+% The |footer| and |nofooter| options respectively enable and disable
+% the first-page footer.
+% \begin{macrocode}
+\DeclareOption{footer}{
+ \uwalh@footertrue
+}
+\DeclareOption{nofooter}{
+ \uwalh@footerfalse
+}
+% \end{macrocode}
+%
% The |arial| and |noarial| options respectively enable and disable
% using Arial for the first-page footer.
% \begin{macrocode}
@@ -301,14 +324,17 @@
}{sourcecodepro}
}
% \end{macrocode}
-% Use the |uwafont|, |arial|, and |light| options by default.
+%
+% Use the |uwafont|, |nofooter|, |arial|, and |light| options by default.
% \begin{macrocode}
\ExecuteOptions{
uwafont,
+ nofooter,
arial,
light
}
% \end{macrocode}
+%
% Complete option processing.
% \begin{macrocode}
\ProcessOptions\relax
@@ -355,8 +381,12 @@
%
% Set font for first-page footer.
% \begin{macrocode}
-\ifuwalh@arialfont
- \newfontfamily{\uwalh@arial}{Arial}
+\ifuwalh@footer
+ \ifuwalh@arialfont
+ \newfontfamily{\uwalh@arial}{Arial}
+ \else
+ \newcommand*{\uwalh@arial}{\sffamily}
+ \fi
\else
\newcommand*{\uwalh@arial}{\sffamily}
\fi
@@ -385,6 +415,7 @@
\titlespacing*{\section}{0em}{2\baselineskip}{0em}
\titlespacing*{\subsection}{0em}{\baselineskip}{0em}
% \end{macrocode}
+%
% Disable section numbering.
% \begin{macrocode}
\setcounter{secnumdepth}{0}
@@ -424,11 +455,13 @@
% \begin{macrocode}
\RequirePackage{stringstrings}
% \end{macrocode}
+%
% Use |textpos| in |absolute| mode to place letterhead elements
% at arbitrary positions on the page.
% \begin{macrocode}
\RequirePackage[absolute]{textpos}
% \end{macrocode}
+%
% Use |graphicx| to add the university logo.
% \begin{macrocode}
\RequirePackage{graphicx}
@@ -590,6 +623,7 @@
% \begin{macro}{\address}
% \begin{macro}{\phone}
% \begin{macro}{\mobile}
+% \changes{1.0.1}{2021/09/13}{Make mobile optional without first-page footer}
% \begin{macro}{\email}
% \begin{macro}{\website}
% \begin{macro}{\footeraddress}
@@ -858,7 +892,7 @@
\uwalh@checkfield{\uwalh@school}{\noexpand\school}
\uwalh@checkfield{\uwalh@mbdp}{\noexpand\mbdp}
\uwalh@checkfield{\uwalh@phone}{\noexpand\phone}
- \uwalh@checkfield{\uwalh@mobile}{\noexpand\mobile}
+ \ifuwalh@footer\uwalh@checkfield{\uwalh@mobile}{\noexpand\mobile}\fi
\uwalh@checkfield{\uwalh@email}{\noexpand\email}
}
% \end{macrocode}
@@ -874,7 +908,7 @@
\uwalh@bar{}%
\uwalh@logo{}%
\uwalh@addressblock{}%
- \uwalh@firstpagefooter{}%
+ \ifuwalh@footer\uwalh@firstpagefooter{}\fi%
\vspace*{\uwalh@vspaceatstart}%
}
% \end{macrocode}
diff --git a/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.ins b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.ins
index fbf81d2c00..914719e130 100644
--- a/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.ins
+++ b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.ins
@@ -13,7 +13,8 @@
%% The Current Maintainer of this work is Anthony Di Pietro.
%%
%% This work consists of the files uwa-letterhead.dtx, uwa-letterhead.ins, and
-%% example.tex and the derived files uwa-letterhead.sty and uwa-letterhead.pdf.
+%% uwa-letterhead-example.tex and the derived files uwa-letterhead.sty and
+%% uwa-letterhead.pdf.
\input docstrip.tex
\keepsilent
@@ -37,7 +38,8 @@ This work has the LPPL maintenance status `maintained'.
The Current Maintainer of this work is Anthony Di Pietro.
This work consists of the files uwa-letterhead.dtx, uwa-letterhead.ins, and
-example.tex and the derived files uwa-letterhead.sty and uwa-letterhead.pdf.
+uwa-letterhead-example.tex and the derived files uwa-letterhead.sty and
+uwa-letterhead.pdf.
\endpreamble
diff --git a/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.pdf b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.pdf
index 1325f7aa0d..cdc994b8cd 100644
--- a/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.pdf
+++ b/macros/unicodetex/latex/uwa-letterhead/uwa-letterhead.pdf
Binary files differ
diff --git a/macros/unicodetex/latex/uwa-pcf/README b/macros/unicodetex/latex/uwa-pcf/README
new file mode 100644
index 0000000000..4af4f788fe
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pcf/README
@@ -0,0 +1,24 @@
+This package generates a Participant Consent Form (PCF) for a
+human research protocol at the University of Western Australia.
+
+It requires the UWA logo in PDF format, which is available in SVG format at
+https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/,
+and uses the Arial (https://docs.microsoft.com/en-us/typography/font-list/arial)
+and UWA Slab (https://www.brand.uwa.edu.au/) fonts by default.
+
+Copyright 2019, 2021 Anthony Di Pietro
+
+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 Anthony Di Pietro.
+
+This work consists of the files uwa-pcf.dtx, uwa-pcf.ins, and
+uwa-pcf-example.tex and the derived files uwa-pcf.cls and uwa-pcf.pdf.
diff --git a/macros/unicodetex/latex/uwa-pcf/uwa-pcf-example.tex b/macros/unicodetex/latex/uwa-pcf/uwa-pcf-example.tex
new file mode 100644
index 0000000000..a39fa7100c
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pcf/uwa-pcf-example.tex
@@ -0,0 +1,47 @@
+% Copyright 2019, 2021 Anthony Di Pietro
+%
+% 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 Anthony Di Pietro.
+%
+% This work consists of the files uwa-pcf.dtx, uwa-pcf.ins, and
+% uwa-pcf-example.tex and the derived files uwa-pcf.cls and uwa-pcf.pdf.
+
+\documentclass{uwa-pcf}
+
+\author{John Smith}
+\school{School of Psychological Science}
+\mbdp{000}
+\phone{+61 8 6488 0000}
+\email{john.smith@uwa.edu.au}
+\project{My Research Project}
+
+\begin{document}
+
+I, \theparticipant, have read the information provided and any
+questions I have asked have been answered to my satisfaction. I agree
+to participate in this research project but withdrawal is not possible
+once data are submitted.
+
+I understand that all identifiable (attributable) information that I
+provide is treated as strictly confidential and will not be released
+by the investigator in any form that may identify me. The only
+exception to this principle of confidentiality is if documents are
+required by law.
+
+I have been advised as to what data is being collected, the purpose
+for collecting the data, and what will be done with the data upon
+completion of the research.
+
+I agree that research data gathered for the study may be published
+provided my name or other identifying information is not used.
+
+\end{document}
diff --git a/macros/unicodetex/latex/uwa-pcf/uwa-pcf.dtx b/macros/unicodetex/latex/uwa-pcf/uwa-pcf.dtx
new file mode 100644
index 0000000000..d8c52a147b
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pcf/uwa-pcf.dtx
@@ -0,0 +1,735 @@
+% \iffalse meta-comment
+% Copyright 2019, 2021 Anthony Di Pietro
+%
+% 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 Anthony Di Pietro.
+%
+% This work consists of the files uwa-pcf.dtx, uwa-pcf.ins, and
+% uwa-pcf-example.tex and the derived files uwa-pcf.cls and uwa-pcf.pdf.
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{uwa-pcf.dtx}
+%</driver>
+%<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+%<class>\ProvidesClass{uwa-pcf}
+%<*class>
+ [2021/09/28 1.0.1 UWA Participant Consent Form]
+%</class>
+%
+%<*driver>
+\documentclass[
+ a4paper,
+ 10pt
+]{ltxdoc}
+\usepackage{hypdoc}
+\PassOptionsToPackage{scale=0.9}{sourcecodepro}
+\usepackage[regular]{uwa-letterhead}[2021/09/13]
+\GetFileInfo{uwa-pcf.dtx}
+\setcounter{secnumdepth}{3}
+\geometry{
+ left=5cm,
+ right=2cm
+}
+\hypersetup{colorlinks=true}
+\date{}
+\makeatletter
+\title{%
+ {The UWA Participant Consent Form Class} \\
+ {\Large uwa-pcf \fileversion{} (\filedate{})}%
+}
+\c@IndexColumns = 2
+\renewcommand*{\uwalh@uwa}{\sffamily}
+\renewcommand{\uwalh@makeletterhead}{}
+\makeatother
+\DoNotIndex{\newcommand, \newenvironment}
+\DisableCrossrefs
+\CodelineIndex
+\RecordChanges
+\CheckSum{328}
+\begin{document}
+ \DocInput{uwa-pcf.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \changes{1.0.0}{2019/08/31}{Initial version}
+% \changes{1.0.1}{2021/09/28}{Make HREO statement and signature lines optional}
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+% This class generates a Participant Consent Form (PCF) for a
+% human research protocol at the University of Western Australia.
+%
+% \section{Usage}
+%
+% \subsection{External Dependencies}
+%
+% You must supply the university logo (as |uwacrest-blue.pdf| by default).
+% It is available in SVG format at
+% \href{https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}
+% {https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}.
+%
+% In accordance with the official PCF template, this class uses the
+% \href{https://docs.microsoft.com/en-us/typography/font-list/arial}{Arial}
+% typeface by default. The fonts must be installed on the system for this to
+% work. Arial is available as part of Microsoft's TrueType core fonts for the
+% web (\url{https://sourceforge.net/projects/mscorefonts2/}). Alternatively,
+% you can use the |noarial| package option to substitute it with
+% \href{https://adobe-fonts.github.io/source-sans/}{Source Sans Pro}, the usual
+% typeface used for university correspondence.
+%
+% \subsection{Class Options}
+%
+% \DescribeMacro{\documentclass}
+% To select the class, add this to your preamble:
+% \begin{quote}
+% |\documentclass{uwa-pcf}|
+% \end{quote}
+%
+% This class supports the |draft|, |final|, |leqno|, and |fleqn| options
+% from the |article| base class and the |footer|, |nofooter|, |arial|, and
+% |noarial| options from the |uwa-letterhead| package.
+%
+% You can pass the following options to specify whether to include the
+% mandatory Human Ethics Research Office (HREO) statement:
+% \begin{itemize}
+% \item |hreo|: Include HREO statement (default).
+% \item |nohreo|: Do not include HREO statement.
+% \end{itemize}
+%
+% You can pass the following options to specify whether to include the
+% signature and date lines:
+% \begin{itemize}
+% \item |signature|: Include signature and date lines (default).
+% \item |nosignature|: Do not include signature and date lines.
+% \end{itemize}
+%
+% \subsection{Letterhead Fields}
+%
+% Use the following commands in the preamble to set the letterhead fields:
+%
+% \DescribeMacro{\author}
+% \begin{minipage}[t]{\textwidth}
+% |\author|\marg{author} \\
+% The author of the document. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\school}
+% \begin{minipage}[t]{\textwidth}
+% |\school|\marg{school} \\
+% The author's school within the university. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\mbdp}
+% \begin{minipage}[t]{\textwidth}
+% |\mbdp|\marg{mbdp} \\
+% The author's \href{http://www.staff.uwa.edu.au/facilities/mail/mbdp}
+% {mailbag delivery point (MBDP)}. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\university}
+% \begin{minipage}[t]{\textwidth}
+% |\university|\marg{university} \\
+% The name of the university. \\
+% Default: \textit{The University of Western Australia}
+% \end{minipage}
+%
+% \DescribeMacro{\address}
+% \begin{minipage}[t]{\textwidth}
+% |\address|\marg{address} \\
+% The university's address. \\
+% Default: \textit{35 Stirling Highway, Crawley WA 6009}
+% \end{minipage}
+%
+% \DescribeMacro{\phone}
+% \begin{minipage}[t]{\textwidth}
+% |\phone|\marg{phone} \\
+% The author's phone number. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\mobile}
+% \begin{minipage}[t]{\textwidth}
+% |\mobile|\marg{mobile} \\
+% The author's mobile number. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\email}
+% \begin{minipage}[t]{\textwidth}
+% |\email|\marg{email} \\
+% The author's email address. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\website}
+% \begin{minipage}[t]{\textwidth}
+% |\website|\marg{website} \\
+% The author's website, or their school's website. \\
+% Omit the scheme (|https://|) and path (|/|). \\
+% Default: \textit{www.uwa.edu.au}
+% \end{minipage}
+%
+% \DescribeMacro{\footeraddress}
+% \begin{minipage}[t]{\textwidth}
+% |\footeraddress|\marg{footeraddress} \\
+% The university's address, shortened for the first-page footer. \\
+% Default: \textit{Perth WA 6009 Australia}
+% \end{minipage}
+%
+% \DescribeMacro{\cricos}
+% \begin{minipage}[t]{\textwidth}
+% |\cricos|\marg{cricos} \\
+% The university's \href{http://cricos.education.gov.au/}{CRICOS} provider code. \\
+% Default: \textit{00126G}
+% \end{minipage}
+%
+% \DescribeMacro{\uwacrest}
+% \begin{minipage}[t]{\textwidth}
+% |\uwacrest|\marg{uwacrest} \\
+% The filename of the UWA crest in PDF format (available in SVG format at
+% \href{https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}
+% {https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}). \\
+% Default: \textit{uwacrest-blue.pdf}
+% \end{minipage}
+%
+% \subsection{Project Fields}
+%
+% Use the following commands in the preamble to set the project fields:
+%
+% \DescribeMacro{\project}
+% \begin{minipage}[t]{\textwidth}
+% |\project|\marg{project} \\
+% The project's title. \\
+% Required
+% \end{minipage}
+%
+% \subsection{Participant Name}
+%
+% \DescribeMacro{\theparticipant}
+% Use |\theparticipant| to generate the line for the participant's name.
+% For example:
+%
+% \begin{quote}
+% \begin{verbatim}
+% I, \theparticipant, have read the information provided and
+% any questions I have asked have been answered to my satisfaction.
+% I agree to participate in this research project but withdrawal
+% is not possible once data are submitted.
+% \end{verbatim}
+% \end{quote}
+%
+% \StopEventually{\PrintChanges\PrintIndex}
+%
+% \section{Implementation}
+%
+% \subsection{Class Options}
+%
+% \begin{minipage}{\textwidth}
+% \begin{macro}{\uwapcf@hreo}
+% \begin{macro}{\uwapcf@signature}
+% Define conditionals for the class options.
+% \begin{macrocode}
+\newif\ifuwapcf@hreo
+\newif\ifuwapcf@signature
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{minipage}
+%
+% The |hreo| and |nohreo| options respectively enable and disable
+% the HREO statement.
+% \begin{macrocode}
+\DeclareOption{hreo}{
+ \uwapcf@hreotrue
+}
+\DeclareOption{nohreo}{
+ \uwapcf@hreofalse
+}
+% \end{macrocode}
+%
+% The |signature| and |nosignature| options respectively enable and disable
+% the signature and date lines.
+% \begin{macrocode}
+\DeclareOption{signature}{
+ \uwapcf@signaturetrue
+}
+\DeclareOption{nosignature}{
+ \uwapcf@signaturefalse
+}
+% \end{macrocode}
+%
+% Pass the |draft|, |final|, |leqno|, and |fleqn| options through to the
+% |article| base class, and pass the |footer|, |nofooter|, |arial|, and
+% |noarial| options through to the |uwa-letterhead| package.
+% \begin{macrocode}
+\DeclareOption{draft}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{final}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{leqno}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{fleqn}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{footer}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+\DeclareOption{nofooter}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+\DeclareOption{arial}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+\DeclareOption{noarial}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+% \end{macrocode}
+%
+% Show a warning for unknown options.
+% \begin{macrocode}
+\DeclareOption*{
+ \ClassWarning{uwa-pcf}{Unknown option '\CurrentOption'}
+}
+% \end{macrocode}
+%
+% Use the |hreo| and |signature| options by default.
+% \begin{macrocode}
+\ExecuteOptions{
+ hreo,
+ signature
+}
+% \end{macrocode}
+%
+% Complete option processing.
+% \begin{macrocode}
+\ProcessOptions\relax
+% \end{macrocode}
+%
+% Load the |article| base class with the |a4paper| and |11pt| options.
+% \begin{macrocode}
+\PassOptionsToClass{
+ a4paper,
+ 11pt
+}{article}
+\LoadClass{article}
+% \end{macrocode}
+%
+% \subsection{Page Configuration}
+%
+% Use |uwa-letterhead| to configure the page.
+% \begin{macrocode}
+\RequirePackage[regular]{uwa-letterhead}
+% \end{macrocode}
+%
+% Adjust paragraph spacing.
+% \begin{macrocode}
+\setlength{\parskip}{0.83\baselineskip}
+% \end{macrocode}
+%
+% \subsection{Font Configuration}
+%
+% Use |fontspec| for access to OpenType and TrueType fonts.
+% \begin{macrocode}
+\RequirePackage[no-math]{fontspec}
+% \end{macrocode}
+%
+% Set default fonts.
+% \begin{macrocode}
+\uwalh@arial
+\ifuwalh@arialfont
+ \setmainfont{Arial}
+ \setsansfont{Arial}
+\fi
+\renewcommand{\familydefault}{\sfdefault}
+% \end{macrocode}
+%
+% Use |anyfontsize| to support the irregular font sizes required.
+% \begin{macrocode}
+\RequirePackage{anyfontsize}
+% \end{macrocode}
+%
+% \subsection{Letterhead}
+%
+% Adjust the address block of the letterhead to match the PCF template.
+% \begin{macro}{\uwalh@addresstop}
+% \begin{macro}{\uwalh@addressblock}
+% \begin{macrocode}
+\setlength{\uwalh@addresstop}{2.07cm}
+\renewcommand{\uwalh@addressblock}{%
+ \begin{textblock*}%
+ {\uwalh@addresswidth}(\uwalh@addressleft, \uwalh@addresstop)
+ \begin{minipage}[t]{\uwalh@addresswidth}
+ \color{UWAPCFBody}%
+ \sffamily\fontsize{9}{10.4}\selectfont%
+ \@author{} \\
+ \uwalh@school{}, M\uwalh@mbdp{} \\
+ \uwalh@university{} \\
+ \uwalh@address{} \\
+ \noblanks[q]{\uwalh@phone}%
+ Tel: \href{tel:\thestring}{\uwalh@phone} \\
+ Email: \href{mailto:\uwalh@email}{\uwalh@email} \\
+ \href{https://\uwalh@website/}{\uwalh@website}
+ \end{minipage}
+ \end{textblock*}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Heading Configuration}
+%
+% Use |titlesec| to configure headings.
+% \begin{macrocode}
+\RequirePackage[sf]{titlesec}
+\titleformat{\section}{\color{black}\bfseries}{\thesection}{1em}{}
+\titleformat{\subsection}{\color{black}\bfseries\small}{\thesubsection}{1em}{}
+\titlespacing*{\section}{0pt}{-0.07em}{-0.07em}
+\titlespacing*{\subsection}{0pt}{-0.07em}{-0.07em}
+% \end{macrocode}
+% Disable section numbering.
+% \begin{macrocode}
+\setcounter{secnumdepth}{0}
+% \end{macrocode}
+%
+% \subsection{Colour Configuration}
+%
+% Use |xcolor| for colour support, and enable |hyperref| compatibility.
+% \begin{macrocode}
+\RequirePackage[hyperref]{xcolor}
+% \end{macrocode}
+% Define body text colour.
+% \begin{macrocode}
+\definecolor{UWAPCFBody}{RGB}{77, 77, 79}
+% \end{macrocode}
+%
+% \subsection{Template Fields}
+%
+% Set default values for the letterhead template fields.
+% \begin{macrocode}
+\renewcommand*{\uwalh@footermbdp}{459}
+\renewcommand*{\uwalh@footerphone}{+61 8 6488 3703}
+\renewcommand*{\uwalh@mobile}{+61 000 000 000}
+\renewcommand*{\uwalh@footeremail}{humanethics@uwa.edu.au}
+% \end{macrocode}
+%
+% Redefine macros to set the letterhead template fields
+% without affecting the first-page footer.
+% \begin{macrocode}
+\renewcommand*{\mbdp}[1]{\renewcommand*{\uwalh@mbdp}{#1}}
+\renewcommand*{\university}[1]{\renewcommand*{\uwalh@university}{#1}}
+\renewcommand*{\phone}[1]{\renewcommand*{\uwalh@phone}{#1}}
+\renewcommand*{\mobile}[1]{}
+\renewcommand*{\email}[1]{\renewcommand*{\uwalh@email}{#1}}
+% \end{macrocode}
+%
+% \begin{minipage}{\textwidth}
+% \begin{macro}{\uwapcf@project}
+% Set default values for the template fields.
+% \begin{macrocode}
+\newcommand*{\uwapcf@project}{}
+% \end{macrocode}
+% \end{macro}
+% \end{minipage}
+%
+% \begin{minipage}{\textwidth}
+% \begin{macro}{\project}
+% Define macros to set the template fields.
+% \begin{macrocode}
+\newcommand*{\project}[1]{\renewcommand*{\uwapcf@project}{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{minipage}
+%
+% \subsection{Field Validation}
+%
+% \begin{macro}{\uwapcf@checkfields}
+% Check that the required template fields are set.
+% \begin{macrocode}
+\newcommand{\uwapcf@checkfields}{%
+ \uwalh@checkfield{\uwapcf@project}{\noexpand\project}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Document Title}
+%
+% \begin{macro}{\uwapcf@maketitle}
+% Generate the title of the Participant Consent Form, including the
+% fields for the project title and researchers.
+% \begin{macrocode}
+\newcommand{\uwapcf@maketitle}{%
+ \uwapcf@checkfields{}%
+ \vspace{-1\parskip}\vspace{-0.310cm}%
+ \begin{center}%
+ \uwalh@arial%
+ \fontsize{16}{16.96}\selectfont%
+ \textbf{Participant Consent Form}%
+ \normalsize%
+ \end{center}%
+ \vspace{-1\parskip}\vspace{-0.120cm}%
+ \begin{center}%
+ \uwalh@arial%
+ \fontsize{12}{12.72}\selectfont%
+ \uwapcf@project{}%
+ \normalsize%
+ \end{center}%
+ \uwalh@arial%
+ \fontsize{10}{11.6}\selectfont%
+ \vspace{-1\parskip}\vspace{0.860cm}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Signature Lines}
+%
+% \begin{macro}{\uwapcf@sig@vspace}
+% The vertical space before the signature lines.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@vspace}
+\setlength{\uwapcf@sig@vspace}{1.3cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@sig@rulewidth}
+% The width of the signature lines.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@rulewidth}
+\setlength{\uwapcf@sig@rulewidth}{0.0227cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@sig@offset}
+% The horizontal offset of the leftmost signature line.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@offset}
+\setlength{\uwapcf@sig@offset}{0.095cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@sig@labeloffset}
+% The horizontal offset of the signature line labels.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@labeloffset}
+\setlength{\uwapcf@sig@labeloffset}{0.008cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@siglabelvspace}
+% The vertical space added before the signature line labels.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@labelvspace}
+\setlength{\uwapcf@sig@labelvspace}{-0.0675cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@sig@gutter}
+% The horizontal space between the signature lines.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@gutter}
+\setlength{\uwapcf@sig@gutter}{3cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@sig@siglinelength}
+% The length of the line for the signature.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@siglinelength}
+\setlength{\uwapcf@sig@siglinelength}{4.905cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@sig@datelinelength}
+% The length of the line for the date.
+% \begin{macrocode}
+\newlength{\uwapcf@sig@datelinelength}
+\setlength{\uwapcf@sig@datelinelength}{2.946cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@makesignature}
+% Generate the signature lines.
+% \begin{macrocode}
+\newcommand{\uwapcf@makesignature}{%
+ \vspace{\uwapcf@sig@vspace}%
+ \hspace{\uwapcf@sig@offset}%
+ \begin{minipage}[t]{\uwapcf@sig@siglinelength}
+ \rule{\textwidth}{\uwapcf@sig@rulewidth} \\
+ \vspace{-1\baselineskip}\vspace{\uwapcf@sig@labelvspace} \\
+ \hspace*{\uwapcf@sig@labeloffset}%
+ Participant signature
+ \end{minipage}%
+ \hspace{\uwapcf@sig@gutter}%
+ \begin{minipage}[t]{\uwapcf@sig@datelinelength}
+ \rule{\textwidth}{\uwapcf@sig@rulewidth} \\
+ \vspace{-1\baselineskip}\vspace{\uwapcf@sig@labelvspace} \\
+ \hspace*{\uwapcf@sig@labeloffset}%
+ Date
+ \end{minipage}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{HREO Statement}
+%
+% \begin{macro}{\uwapcf@hreo@vspace}
+% The vertical space before the HREO statement.
+% \begin{macrocode}
+\newlength{\uwapcf@hreo@vspace}
+\setlength{\uwapcf@hreo@vspace}{1.843cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@hreo@font}
+% The font for the HREO statement.
+% \begin{macrocode}
+\newcommand*{\uwapcf@hreo@font}{%
+ \uwalh@arial%
+ \fontsize{9}{10.4}\selectfont%
+ \color{black}%
+ \bfseries\itshape%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@hreo@parvspace}
+% The vertical space between paragraphs for the HREO statement.
+% \begin{macrocode}
+\newlength{\uwapcf@hreo@parvspace}
+\setlength{\uwapcf@hreo@parvspace}{0.5\baselineskip}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@hreo@statement}
+% The statement required by the Human Research Ethics Office (HREO).
+% \begin{macrocode}
+\newcommand{\uwapcf@hreo@statement}{%
+ \begin{minipage}{\textwidth}
+ Approval to conduct this research has been provided by the
+ University of Western Australia, in accordance with its ethics
+ review and approval procedures. Any person considering
+ participation in this research project, or agreeing to
+ participate, may raise any questions or issues with the
+ researchers at any time.
+ \end{minipage}
+
+ \vspace*{\uwapcf@hreo@parvspace}
+
+ \begin{minipage}{\textwidth}
+ In addition, any person not satisfied with the response of
+ researchers may raise ethics issues or concerns, and may make
+ any complaints about this research project by contacting the
+ Human Ethics office at UWA on
+ \href{tel:+61-8-6488-4703}{(08)~6488~4703} or by emailing to
+ \href{mailto:humanethics@uwa.edu.au}{humanethics@uwa.edu.au}.
+ \end{minipage}
+
+ \vspace*{\uwapcf@hreo@parvspace}
+
+ \begin{minipage}{\textwidth}
+ All research participants are entitled to retain a copy of any
+ Participant Information Form and/or Participant Consent Form
+ relating to this research project.
+ \end{minipage}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapcf@makehreostatement}
+% Generate the HREO statement.
+% \begin{macrocode}
+\newcommand{\uwapcf@makehreostatement}{%
+ \vspace{\uwapcf@hreo@vspace} \\
+ \begin{minipage}{\textwidth}
+ {%
+ \uwapcf@hreo@font{}%
+ \uwapcf@hreo@statement{}%
+ }%
+ \end{minipage}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Body Text Font}
+%
+% \begin{macro}{\uwapcf@bodyfont}
+% Set the body text font and colour.
+% \begin{macrocode}
+\newcommand*{\uwapcf@bodyfont}{%
+ \sffamily%
+ \fontsize{11}{15.5}\selectfont%
+ \color{UWAPCFBody}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Form Generation}
+%
+% Automatically generate the title and set the body text font at
+% the beginning of the document.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \uwapcf@bodyfont{}%
+ \uwapcf@maketitle{}%
+}
+% \end{macrocode}
+%
+% Automatically add the signature lines and HREO statement at the end
+% of the document.
+% \begin{macrocode}
+\AtEndDocument{%
+ \ifuwapcf@signature\uwapcf@makesignature{}\fi%
+ \ifuwapcf@hreo\uwapcf@makehreostatement{}\fi%
+}
+% \end{macrocode}
+%
+% \subsection{Participant Name}
+%
+% \begin{macro}{\theparticipant}
+% Generate the line for the participant's name.
+% \begin{macrocode}
+\newcommand{\theparticipant}{%
+ \begin{minipage}[t]{9.415cm}
+ \vspace*{0.048cm}%
+ \rule{\textwidth}{0.0227cm}%
+ \end{minipage}%
+}
+% \end{macrocode}
+% \end{macro}
+% \Finale
+\endinput
diff --git a/macros/unicodetex/latex/uwa-pcf/uwa-pcf.ins b/macros/unicodetex/latex/uwa-pcf/uwa-pcf.ins
new file mode 100644
index 0000000000..501f6ce4a1
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pcf/uwa-pcf.ins
@@ -0,0 +1,58 @@
+%% Copyright 2019 Anthony Di Pietro
+%%
+%% 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 Anthony Di Pietro.
+%%
+%% This work consists of the files uwa-pcf.dtx, uwa-pcf.ins, and
+%% uwa-pcf-example.tex and the derived files uwa-pcf.cls and uwa-pcf.pdf.
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/uwa-pcf}
+
+\preamble
+
+Copyright 2019 Anthony Di Pietro
+
+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 Anthony Di Pietro.
+
+This work consists of the files uwa-pcf.dtx, uwa-pcf.ins, and
+uwa-pcf-example.tex and the derived files uwa-pcf.cls and uwa-pcf.pdf.
+
+\endpreamble
+
+\askforoverwritefalse
+\generate{\file{uwa-pcf.cls}{\from{uwa-pcf.dtx}{class}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To complete the installation, move uwa-pcf.cls *}
+\Msg{* into a directory searched by LaTeX. *}
+\Msg{* *}
+\Msg{* To produce the documentation, run uwa-pcf.dtx *}
+\Msg{* through pdfLaTeX. *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/macros/unicodetex/latex/uwa-pcf/uwa-pcf.pdf b/macros/unicodetex/latex/uwa-pcf/uwa-pcf.pdf
new file mode 100644
index 0000000000..978fa44120
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pcf/uwa-pcf.pdf
Binary files differ
diff --git a/macros/unicodetex/latex/uwa-pif/README b/macros/unicodetex/latex/uwa-pif/README
new file mode 100644
index 0000000000..6b84099d33
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pif/README
@@ -0,0 +1,24 @@
+This package generates a Participant Information Form (PIF) for a
+human research protocol at the University of Western Australia.
+
+It requires the UWA logo in PDF format, which is available in SVG format at
+https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/,
+and uses the Calibri (https://docs.microsoft.com/en-us/typography/font-list/calibri)
+fonts by default.
+
+Copyright 2019, 2021 Anthony Di Pietro
+
+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 Anthony Di Pietro.
+
+This work consists of the files uwa-pif.dtx, uwa-pif.ins, and
+uwa-pif-example.tex and the derived files uwa-pif.cls and uwa-pif.pdf.
diff --git a/macros/unicodetex/latex/uwa-pif/uwa-pif-example.tex b/macros/unicodetex/latex/uwa-pif/uwa-pif-example.tex
new file mode 100644
index 0000000000..137c3eb108
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pif/uwa-pif-example.tex
@@ -0,0 +1,92 @@
+% Copyright 2019, 2021 Anthony Di Pietro
+%
+% 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 Anthony Di Pietro.
+%
+% This work consists of the files uwa-pif.dtx, uwa-pif.ins, and
+% uwa-pif-example.tex and the derived files uwa-pif.cls and uwa-pif.pdf.
+
+\documentclass{uwa-pif}
+
+\author{John Smith}
+\school{School of Psychological Science}
+\mbdp{000}
+\phone{+61 8 6488 0000}
+\email{john.smith@uwa.edu.au}
+\project{My Research Project}
+\researchers{Joe Bloggs (PhD Student) \\ John Smith (Supervisor)}
+
+\begin{document}
+
+\section{Invitation:}
+
+You are invited to participate in a research project. You are asked
+to take part in this project because you are registered as a research
+participant in our database.
+
+\section{Aim of the Study (What is the project about?)}
+
+This project examines how people think and behave.
+
+\section{What does participation involve?}
+
+You will be asked to complete a task. You may also be asked to complete
+surveys that provide demographic information about yourself. This information
+will be anonymised, and so will not be linked to your identity.
+
+We estimate that participating in this study will take 15~minutes.
+
+\section{Voluntary Participation and Withdrawal from the Study}
+
+Participation in this study is entirely voluntary, and does not
+prejudice any right to compensation, which you may be entitled to
+under statute or common law. Should you wish to withdraw from the study
+before completing it, your responses will be discarded. Your data will
+be stored in a deidentified fashion, meaning that no identifying information
+will be associated with the data we collect from you in the experiment.
+Accordingly, you will not be able to withdraw your consent for us to
+use your data once the study has been completed.
+
+\section{Your privacy}
+
+On publication of this work, your responses (without any personally
+identifying information) will be made publicly available by banking
+the data from the entire study on data sharing websites.
+
+\section{Possible Benefits}
+
+The data from this project may allow researchers (including us) to better
+understand how people think and behave.
+
+\section{Possible Risks and Risk Management Plan}
+
+There are no foreseeable risks associated with this study.
+
+\section{Reimbursement}
+
+You will receive a payment of £2 as reimbursement for your participation.
+
+\section{Contacts}
+
+If you would like to participate or discuss any aspect of this study,
+please feel free to contact Mr Joe Bloggs (PhD Student,
+\href{mailto:joe.bloggs@research.uwa.edu.au}{joe.bloggs@research.uwa.edu.au},
+\href{tel:+61-000-000-000}{+61 000 000 000}) or Dr John Smith (Supervisor,
+\href{mailto:john.smith@uwa.edu.au}{john.smith@uwa.edu.au},
+\href{tel:+61-8-6488-000}{+61 8 6488 000}).
+
+\section{About This Document}
+
+You are entitled to retain a copy of this document. If you would prefer
+a PDF copy, email the above contacts to obtain one.
+
+\end{document}
diff --git a/macros/unicodetex/latex/uwa-pif/uwa-pif.dtx b/macros/unicodetex/latex/uwa-pif/uwa-pif.dtx
new file mode 100644
index 0000000000..7bd0944453
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pif/uwa-pif.dtx
@@ -0,0 +1,646 @@
+% \iffalse meta-comment
+% Copyright 2019, 2021 Anthony Di Pietro
+%
+% 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 Anthony Di Pietro.
+%
+% This work consists of the files uwa-pif.dtx, uwa-pif.ins, and
+% uwa-pif-example.tex and the derived files uwa-pif.cls and uwa-pif.pdf.
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{uwa-pif.dtx}
+%</driver>
+%<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+%<class>\ProvidesClass{uwa-pif}
+%<*class>
+ [2021/09/28 1.0.1 UWA Participant Information Form]
+%</class>
+%
+%<*driver>
+\documentclass[
+ a4paper,
+ 10pt
+]{ltxdoc}
+\usepackage{hypdoc}
+\PassOptionsToPackage{scale=0.9}{sourcecodepro}
+\usepackage[regular]{uwa-letterhead}[2021/09/13]
+\GetFileInfo{uwa-pif.dtx}
+\setcounter{secnumdepth}{3}
+\geometry{
+ left=5cm,
+ right=2cm
+}
+\hypersetup{colorlinks=true}
+\date{}
+\makeatletter
+\title{%
+ {The UWA Participant Information Form Class} \\
+ {\Large uwa-pif \fileversion{} (\filedate{})}%
+}
+\c@IndexColumns = 2
+\renewcommand*{\uwalh@uwa}{\sffamily}
+\renewcommand{\uwalh@makeletterhead}{}
+\makeatother
+\DoNotIndex{\newcommand, \newenvironment}
+\DisableCrossrefs
+\CodelineIndex
+\RecordChanges
+\CheckSum{220}
+\begin{document}
+ \DocInput{uwa-pif.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \changes{1.0.0}{2019/08/31}{Initial version}
+% \changes{1.0.1}{2021/09/28}{
+% Make HREO statement, closing, and Calibri optional
+% }
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+% This class generates a Participant Information Form (PIF) for a
+% human research protocol at the University of Western Australia.
+%
+% \section{Usage}
+%
+% \subsection{External Dependencies}
+%
+% You must supply the university logo (as |uwacrest-blue.pdf| by default).
+% It is available in SVG format at
+% \href{https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}
+% {https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}.
+%
+% In accordance with the official PIF template, this class uses the
+% \href{https://docs.microsoft.com/en-us/typography/font-list/calibri}{Calibri}
+% typeface by default. The fonts must be installed on the system for this to
+% work. Calibri is available as part of Microsoft's TrueType core fonts for the
+% web (\url{https://sourceforge.net/projects/mscorefonts2/}). Alternatively,
+% you can use the |nocalibri| class option to substitute it with
+% \href{https://adobe-fonts.github.io/source-sans/}{Source Sans Pro}, the usual
+% typeface used for university correspondence.
+%
+% With the |footer| option, this class uses the
+% \href{https://docs.microsoft.com/en-us/typography/font-list/arial}{Arial}
+% typeface by default. The fonts must be installed on the system for this to
+% work. Arial is also available as part of Microsoft's TrueType core fonts
+% for the web, and you can use the |noarial| class option to substitute it
+% with Source Sans Pro.
+%
+% \subsection{Class Options}
+%
+% \DescribeMacro{\documentclass}
+% To select the class, add this to your preamble:
+% \begin{quote}
+% |\documentclass{uwa-pif}|
+% \end{quote}
+%
+% This class supports the |draft|, |final|, |leqno|, and |fleqn| options
+% from the |article| base class and the |footer|, |nofooter|, |arial|, and
+% |noarial| options from the |uwa-letterhead| package.
+%
+% You can pass the following options to specify whether to include the
+% mandatory Human Ethics Research Office (HREO) statement:
+% \begin{itemize}
+% \item |hreo|: Include HREO statement (default).
+% \item |nohreo|: Do not include HREO statement.
+% \end{itemize}
+%
+% You can pass the following options to specify whether to include the
+% closing:
+% \begin{itemize}
+% \item |closing|: Include closing (default).
+% \item |noclosing|: Do not include closing.
+% \end{itemize}
+%
+% You can pass the following options to specify whether to use the
+% Calibri typeface:
+% \begin{itemize}
+% \item |calibri|: Use Calibri (default).
+% \item |nocalibri|: Do not use Calibri.
+% \end{itemize}
+%
+% \subsection{Letterhead Fields}
+%
+% Use the following commands in the preamble to set the letterhead fields:
+%
+% \DescribeMacro{\author}
+% \begin{minipage}[t]{\textwidth}
+% |\author|\marg{author} \\
+% The author of the document. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\school}
+% \begin{minipage}[t]{\textwidth}
+% |\school|\marg{school} \\
+% The author's school within the university. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\mbdp}
+% \begin{minipage}[t]{\textwidth}
+% |\mbdp|\marg{mbdp} \\
+% The author's \href{http://www.staff.uwa.edu.au/facilities/mail/mbdp}
+% {mailbag delivery point (MBDP)}. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\university}
+% \begin{minipage}[t]{\textwidth}
+% |\university|\marg{university} \\
+% The name of the university. \\
+% Default: \textit{The University of Western Australia}
+% \end{minipage}
+%
+% \DescribeMacro{\address}
+% \begin{minipage}[t]{\textwidth}
+% |\address|\marg{address} \\
+% The university's address. \\
+% Default: \textit{35 Stirling Highway, Crawley WA 6009}
+% \end{minipage}
+%
+% \DescribeMacro{\phone}
+% \begin{minipage}[t]{\textwidth}
+% |\phone|\marg{phone} \\
+% The author's phone number. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\mobile}
+% \begin{minipage}[t]{\textwidth}
+% |\mobile|\marg{mobile} \\
+% The author's mobile number. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\email}
+% \begin{minipage}[t]{\textwidth}
+% |\email|\marg{email} \\
+% The author's email address. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\website}
+% \begin{minipage}[t]{\textwidth}
+% |\website|\marg{website} \\
+% The author's website, or their school's website. \\
+% Omit the scheme (|https://|) and path (|/|). \\
+% Default: \textit{www.uwa.edu.au}
+% \end{minipage}
+%
+% \DescribeMacro{\footeraddress}
+% \begin{minipage}[t]{\textwidth}
+% |\footeraddress|\marg{footeraddress} \\
+% The university's address, shortened for the first-page footer. \\
+% Default: \textit{Perth WA 6009 Australia}
+% \end{minipage}
+%
+% \DescribeMacro{\cricos}
+% \begin{minipage}[t]{\textwidth}
+% |\cricos|\marg{cricos} \\
+% The university's \href{http://cricos.education.gov.au/}{CRICOS} provider code. \\
+% Default: \textit{00126G}
+% \end{minipage}
+%
+% \DescribeMacro{\uwacrest}
+% \begin{minipage}[t]{\textwidth}
+% |\uwacrest|\marg{uwacrest} \\
+% The filename of the UWA crest in PDF format (available in SVG format at
+% \href{https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}
+% {https://static-listing.weboffice.uwa.edu.au/visualid/core-rebrand/img/uwacrest/}). \\
+% Default: \textit{uwacrest-blue.pdf}
+% \end{minipage}
+%
+% \subsection{Project Fields}
+%
+% Use the following commands in the preamble to set the project fields:
+%
+% \DescribeMacro{\project}
+% \begin{minipage}[t]{\textwidth}
+% |\project|\marg{project} \\
+% The project's title. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\researchers}
+% \begin{minipage}[t]{\textwidth}
+% |\researchers|\marg{researchers} \\
+% The project's researchers. Use |\researcher| for each researcher. \\
+% Required
+% \end{minipage}
+%
+% \DescribeMacro{\researcher}
+% \begin{minipage}[t]{\textwidth}
+% |\researcher|\marg{name}\marg{role} \\
+% Define a researcher by name and role.
+% \end{minipage}
+%
+% For example, a student project might define its researchers as follows:
+% \begin{quote}
+% \begin{verbatim}
+% \researchers{
+% \researcher{John Doe}{PhD Student}
+% \researcher{Jane Doe}{Supervisor}
+% }
+% \end{verbatim}
+% \end{quote}
+%
+% \StopEventually{\PrintChanges\PrintIndex}
+%
+% \section{Implementation}
+%
+% \subsection{Class Options}
+%
+% \begin{minipage}{\textwidth}
+% \begin{macro}{\uwapif@hreo}
+% \begin{macro}{\uwapif@closing}
+% \begin{macro}{\uwapif@calibrifont}
+% Define conditionals for the class options.
+% \begin{macrocode}
+\newif\ifuwapif@hreo
+\newif\ifuwapif@closing
+\newif\ifuwapif@calibrifont
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{minipage}
+%
+% The |hreo| and |nohreo| options respectively enable and disable
+% the HREO statement.
+% \begin{macrocode}
+\DeclareOption{hreo}{
+ \uwapif@hreotrue
+}
+\DeclareOption{nohreo}{
+ \uwapif@hreofalse
+}
+% \end{macrocode}
+%
+% The |closing| and |noclosing| options respectively enable and disable
+% the closing.
+% \begin{macrocode}
+\DeclareOption{closing}{
+ \uwapif@closingtrue
+}
+\DeclareOption{noclosing}{
+ \uwapif@closingfalse
+}
+% \end{macrocode}
+%
+% The |calibri| and |nocalibri| options respectively enable and disable
+% the Calibri typeface.
+% \begin{macrocode}
+\DeclareOption{calibri}{
+ \uwapif@calibrifonttrue
+}
+\DeclareOption{nocalibri}{
+ \uwapif@calibrifontfalse
+}
+% \end{macrocode}
+%
+% Pass the |draft|, |final|, |leqno|, and |fleqn| options through to the
+% |article| base class, and pass the |footer|, |nofooter|, |arial|, and
+% |noarial| options through to the |uwa-letterhead| package.
+% \begin{macrocode}
+\DeclareOption{draft}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{final}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{leqno}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{fleqn}{
+ \PassOptionsToClass{\CurrentOption}{article}
+}
+\DeclareOption{footer}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+\DeclareOption{nofooter}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+\DeclareOption{arial}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+\DeclareOption{noarial}{
+ \PassOptionsToPackage{\CurrentOption}{uwa-letterhead}
+}
+% \end{macrocode}
+%
+% Show a warning for unknown options.
+% \begin{macrocode}
+\DeclareOption*{
+ \ClassWarning{uwa-pif}{Unknown option '\CurrentOption'}
+}
+% \end{macrocode}
+%
+% Use the |hreo|, |closing|, and |calibri| options by default.
+% \begin{macrocode}
+\ExecuteOptions{
+ hreo,
+ closing,
+ calibri
+}
+% \end{macrocode}
+%
+% Complete option processing.
+% \begin{macrocode}
+\ProcessOptions\relax
+% \end{macrocode}
+%
+% Load the |article| base class with the |a4paper| and |11pt| options.
+% \begin{macrocode}
+\PassOptionsToClass{
+ a4paper,
+ 11pt
+}{article}
+\LoadClass{article}
+% \end{macrocode}
+%
+% \subsection{Page Configuration}
+%
+% Use |uwa-letterhead| to configure the page.
+% \begin{macrocode}
+\RequirePackage{uwa-letterhead}
+% \end{macrocode}
+%
+% \subsection{Font Configuration}
+%
+% Use |fontspec| for access to OpenType and TrueType fonts.
+% \begin{macrocode}
+\RequirePackage[no-math]{fontspec}
+% \end{macrocode}
+%
+% Set default fonts.
+% \begin{macrocode}
+\sffamily
+\ifuwapif@calibrifont
+ \setmainfont{Calibri}
+ \setsansfont{Calibri}
+\fi
+\renewcommand{\familydefault}{\sfdefault}
+% \end{macrocode}
+%
+% Use |anyfontsize| to support the irregular font sizes required.
+% \begin{macrocode}
+\RequirePackage{anyfontsize}
+% \end{macrocode}
+%
+% Use |setspace| to adjust line spacing of HREO statement.
+% \begin{macrocode}
+\RequirePackage{setspace}
+% \end{macrocode}
+%
+% \subsection{Heading Configuration}
+%
+% Use |titlesec| to configure headings.
+% \begin{macrocode}
+\RequirePackage[sf]{titlesec}
+\titleformat{\section}{\color{black}\bfseries}{\thesection}{1em}{}
+\titleformat{\subsection}{\color{black}\bfseries\small}{\thesubsection}{1em}{}
+\titlespacing*{\section}{0pt}{-0.07em}{-0.07em}
+\titlespacing*{\subsection}{0pt}{-0.07em}{-0.07em}
+% \end{macrocode}
+% Disable section numbering.
+% \begin{macrocode}
+\setcounter{secnumdepth}{0}
+% \end{macrocode}
+%
+% \subsection{Colour Configuration}
+%
+% Use |xcolor| for colour support, and enable |hyperref| compatibility.
+% \begin{macrocode}
+\RequirePackage[hyperref]{xcolor}
+% \end{macrocode}
+% Define body text colour.
+% \begin{macrocode}
+\definecolor{UWAPIFBody}{RGB}{31, 73, 125}
+% \end{macrocode}
+%
+% \subsection{Template Fields}
+%
+% Set default values for the letterhead template fields.
+% \begin{macrocode}
+\renewcommand*{\uwalh@footermbdp}{459}
+\renewcommand*{\uwalh@footerphone}{+61 8 6488 3703}
+\renewcommand*{\uwalh@mobile}{+61 000 000 000}
+\renewcommand*{\uwalh@footeremail}{humanethics@uwa.edu.au}
+% \end{macrocode}
+%
+% Redefine macros to set the letterhead template fields
+% without affecting the first-page footer.
+% \begin{macrocode}
+\renewcommand*{\mbdp}[1]{\renewcommand*{\uwalh@mbdp}{#1}}
+\renewcommand*{\university}[1]{\renewcommand*{\uwalh@university}{#1}}
+\renewcommand*{\phone}[1]{\renewcommand*{\uwalh@phone}{#1}}
+\renewcommand*{\mobile}[1]{}
+\renewcommand*{\email}[1]{\renewcommand*{\uwalh@email}{#1}}
+% \end{macrocode}
+%
+% \begin{minipage}{\textwidth}
+% \begin{macro}{\uwapif@project}
+% \begin{macro}{\uwapif@researchers}
+% Set default values for the template fields.
+% \begin{macrocode}
+\newcommand*{\uwapif@project}{}
+\newcommand*{\uwapif@researchers}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{minipage}
+%
+% \begin{minipage}{\textwidth}
+% \begin{macro}{\project}
+% \begin{macro}{\researcher}
+% \begin{macro}{\researchers}
+% Define macros to set the template fields.
+% \begin{macrocode}
+\newcommand*{\project}[1]{\renewcommand*{\uwapif@project}{#1}}
+\newcommand{\researcher}[2]{#1 & (#2) \\}
+\newcommand{\researchers}[1]{\renewcommand{\uwapif@researchers}{%
+ \begin{tabular}{@{}ll@{}}
+ #1
+ \end{tabular}%
+}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{minipage}
+%
+% \subsection{Field Validation}
+%
+% \begin{macro}{\uwapif@checkfields}
+% Check that the required template fields are set.
+% \begin{macrocode}
+\newcommand{\uwapif@checkfields}{%
+ \uwalh@checkfield{\uwapif@project}{\noexpand\project}
+ \uwalh@checkfield{\uwapif@researchers}{\noexpand\researchers}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Document Title}
+%
+% \begin{macro}{\uwapif@maketitle}
+% Generate the title of the Participant Information Form, including the
+% fields for the project title and researchers.
+% \begin{macrocode}
+\newcommand{\uwapif@maketitle}{%
+ \uwapif@checkfields{}%
+ \vspace{-1\baselineskip}\vspace{0.450cm}%
+ \begin{center}%
+ \fontsize{16}{16.96}\selectfont%
+ \textcolor{black}{\textbf{Participant Information Form}}%
+ \normalsize%
+ \end{center}%
+ \vspace{-1\baselineskip}\vspace{0.935cm}
+ \textcolor{black}{\textbf{Project title:}} \uwapif@project{} \\
+ \vspace{-2\baselineskip}\vspace{0.477cm} \\
+ \textcolor{black}{\textbf{Name of Researchers:}} \\
+ \vspace{-2\baselineskip}\vspace{1.025cm} \\
+ \uwapif@researchers{}
+ \vspace{-0.045cm}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Closing}
+%
+% \begin{macro}{\uwapif@closingvspace}
+% The vertical space before the closing.
+% \begin{macrocode}
+\newlength{\uwapif@closingvspace}
+\setlength{\uwapif@closingvspace}{2.6cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapif@makeclosing}
+% Generate the closing.
+% \begin{macrocode}
+\newcommand{\uwapif@makeclosing}{%
+ \vspace{\uwapif@closingvspace}%
+ {%
+ \color{black}%
+ Sincerely,
+
+ \@author
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{HREO Statement}
+%
+% \begin{macro}{\uwapif@hreovspace}
+% The vertical space before the HREO statement.
+% \begin{macrocode}
+\newlength{\uwapif@hreovspace}
+\setlength{\uwapif@hreovspace}{2.55cm}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapif@hreostatement}
+% The statement required by the Human Research Ethics Office (HREO).
+% \begin{macrocode}
+\newcommand{\uwapif@hreostatement}{%
+ Approval to conduct this research has been provided by the University
+ of Western Australia, in accordance with its ethics review and
+ approval procedures. Any person considering participation in this
+ research project, or agreeing to participate, may raise any questions
+ or issues with the researchers at any time. In addition, any person
+ not satisfied with the response of researchers may raise ethics issues
+ or concerns, and may make any complaints about this research project
+ by contacting the Human Ethics office at UWA on
+ \href{tel:+61-8-6488-4703}{(08)~6488~4703} or by emailing to
+ \href{mailto:humanethics@uwa.edu.au}{humanethics@uwa.edu.au}. All
+ research participants are entitled to retain a copy of any Participant
+ Information Form and/or Participant Consent Form relating to this
+ research project.
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\uwapif@makehreostatement}
+% Generate the HREO statement.
+% \begin{macrocode}
+\newcommand{\uwapif@makehreostatement}{%
+ \vspace{\uwapif@hreovspace}%
+ \hrule%
+ \begin{minipage}{\textwidth}
+ {%
+ \begin{spacing}{1.17}
+ \fontsize{9}{10.8}\selectfont\color{black}%
+ \uwapif@hreostatement{}%
+ \end{spacing}
+ }%
+ \end{minipage}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Body Text Font}
+%
+% \begin{macro}{\uwapif@bodyfont}
+% Set the body text font and colour.
+% \begin{macrocode}
+\newcommand*{\uwapif@bodyfont}{%
+ \sffamily\fontsize{11}{15.5}\selectfont\color{UWAPIFBody}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Form Generation}
+%
+% Automatically generate the title and set the body text font at
+% the beginning of the document.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \uwapif@bodyfont{}%
+ \uwapif@maketitle{}%
+}
+% \end{macrocode}
+%
+% Automatically add the closing and HREO statement at the end
+% of the document.
+% \begin{macrocode}
+\AtEndDocument{%
+ \ifuwapif@closing\uwapif@makeclosing{}\fi%
+ \ifuwapif@hreo\uwapif@makehreostatement{}\fi%
+}
+% \end{macrocode}
+%
+% \Finale
+\endinput
diff --git a/macros/unicodetex/latex/uwa-pif/uwa-pif.ins b/macros/unicodetex/latex/uwa-pif/uwa-pif.ins
new file mode 100644
index 0000000000..b0ff82713e
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pif/uwa-pif.ins
@@ -0,0 +1,58 @@
+%% Copyright 2019 Anthony Di Pietro
+%%
+%% 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 Anthony Di Pietro.
+%%
+%% This work consists of the files uwa-pif.dtx, uwa-pif.ins, and
+%% uwa-pif-example.tex and the derived files uwa-pif.cls and uwa-pif.pdf.
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/uwa-pif}
+
+\preamble
+
+Copyright 2019 Anthony Di Pietro
+
+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 Anthony Di Pietro.
+
+This work consists of the files uwa-pif.dtx, uwa-pif.ins, and
+uwa-pif-example.tex and the derived files uwa-pif.cls and uwa-pif.pdf.
+
+\endpreamble
+
+\askforoverwritefalse
+\generate{\file{uwa-pif.cls}{\from{uwa-pif.dtx}{class}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To complete the installation, move uwa-pif.cls *}
+\Msg{* into a directory searched by LaTeX. *}
+\Msg{* *}
+\Msg{* To produce the documentation, run uwa-pif.dtx *}
+\Msg{* through pdfLaTeX. *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/macros/unicodetex/latex/uwa-pif/uwa-pif.pdf b/macros/unicodetex/latex/uwa-pif/uwa-pif.pdf
new file mode 100644
index 0000000000..82e051f648
--- /dev/null
+++ b/macros/unicodetex/latex/uwa-pif/uwa-pif.pdf
Binary files differ
diff --git a/macros/xetex/latex/hanzibox/README.md b/macros/xetex/latex/hanzibox/README.md
index 68fd73ec82..07e27823da 100644
--- a/macros/xetex/latex/hanzibox/README.md
+++ b/macros/xetex/latex/hanzibox/README.md
@@ -1,28 +1,49 @@
hanzibox
-LaTeX3 Chinese Character package, v1.1.0
+LaTeX3-based Chinese Character package, v2.0.0
=======
-`hanzibox` is a LaTeX package written to simplify the input of Chinese
-with Hanyu Pinyin and translation. Hanyu Pinyin was placed above Chinese with
-xpinyin package and the translation was placed below the Chinese.
+`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.
-`hanzibox` is a utility for creating practise sheets, dialogs, character explanations and more.
-There are PDFs included which may be useful to regular users.
+And you can display the Hanyu Pinyin above the Chinese character and the translation below them as needed.
-It was inspired by hanzibox.sty from https://github.com/janvorisek/chinese-latex-utilities.
+The `\hanzibox` macro can automatically invoke the `\xpinyin*` command of the `xpinyin` package to achieve Hanyu Pinyin according to the Chinese characters. And the `\hanzibox` command provides an asterisk version of `\hanzibox*`, whose function is achieved by automatically invoking the `xpinyin` package's `\pinyin` macro to achieve this. The `\hanzidialog` macro is implemented by manually inserting the `\pinyin` macro of the `xpinyin` package in it's pinyin option.
-In this new package, the commands were kept, but redesign its options and mandatories.
+`hanzibox` is a utility for learning to write and pronounce Chinese characters, and can be used for Chinese character learning plans, presentations, exercise booklets and other documentation work.
-At present, hanzibox.sty only supports XeTeX engines and only allows UTF-8 encoding tex source file.
+The development of this package was inspired by [Jan Vorisek's hanzibox package](https://github.com/janvorisek/chinese-latex-utilities).
-You can read the package manual (in Chinese) for more detailed explanations.
+However, the new package redesigned the `\hanzibox` and `\hanzidialog` macros and the background grid is redesigned with the `l3draw` package with reference to [zitie package](https://www.ctan.org/pkg/zitie). Also, the new macro package provides more options and arguments in order to get better typesetting results.
+
+Due to the limitations of the `xpinyin` package, the `hanzibox.sty` package currently only supports the XeTeX engine and only supports UTF-8 encoded LaTeX source files.
+
+You can read the manual (in Chinese) for more details and examples.
Contributing
------------
-Gitee repository: https://gitee.com/nwafu_nan/hanzibox-l3.
+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的汉字练习宏包, v2.0.0
+=======
+
+`hanzibox`是一个用LaTeX3开发的LaTeX宏包,它提供了`\hanzibox`和`\hanzidialog` 两个命令。这两个命令用于排版汉字学习中带有或不带田字格、米字格等背景格子的汉字,并可以根据需要在汉字正上方显示拼音,在正下方显示译文。其中,`\hanzibox`命令能够根据汉字自动调用`xpinyin`宏包的`\xpinyin*`命令实现汉字注音。并且`\hanzibox`命令提供了`\hanzibox*`星号版本,其注音功能是通过自动调用`xpinyin`宏包的`\pinyin`命令实现的。`\hanzidialog`命令的注音功能通过在拼音选项中手动插入`xpinyin`宏包的`\pinyin`命令实现。
-Issues and pull requests are welcome.
+`hanzibox` 是一个用于学习汉字书写与发音的工具,可以用于汉字学习教案、演示文稿、习题册等文档工作。
+
+开发该宏的灵感来自于[Jan Vorisek的hanzibox宏包](https://github.com/janvorisek/chinese-latex-utilities)。但该宏包对`\hanzibox`和`\hanzidialog`命令进行了重新设计,并参考[zitie字贴宏包](https://www.ctan.org/pkg/zitie)重新用`l3draw`宏包设计了背景格子。同时,新的宏包也提供了更多命令选项和参数,以期更好地控制排版结果。
+
+受`xpinyin`基础宏包所限,目前`hanzibox.sty`宏包仅支持XeTeX编译引擎,并且只支持UTF-8编码的LaTeX源文件。
+
+可以通过阅读宏包手册(中文)以也解该宏包更多的使用细节和使用样例。
+
+### 参与贡献
+---------------------
+1. 本项目由西北农林科技大学信息工程学院耿楠创建和维护
+2. 如果您愿意一同参与工作(不计报酬,免费自由),请及时与作者联系
+3. 项目的gitee仓库地址:[hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
+4. 如果您有任何改进意见或者功能需求,欢迎提交 [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) 或 [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls)。
Copyright and Licence
---------------------
diff --git a/macros/xetex/latex/hanzibox/hanzibox.dtx b/macros/xetex/latex/hanzibox/hanzibox.dtx
index ae34ed29bb..b84c920ac4 100644
--- a/macros/xetex/latex/hanzibox/hanzibox.dtx
+++ b/macros/xetex/latex/hanzibox/hanzibox.dtx
@@ -5,30 +5,51 @@
%</internal>
%<*readme>
hanzibox
-LaTeX3 Chinese Character package, v1.1.0
+LaTeX3-based Chinese Character package, v2.0.0
=======
-`hanzibox` is a LaTeX package written to simplify the input of Chinese
-with Hanyu Pinyin and translation. Hanyu Pinyin was placed above Chinese with
-xpinyin package and the translation was placed below the Chinese.
+`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.
-`hanzibox` is a utility for creating practise sheets, dialogs, character explanations and more.
-There are PDFs included which may be useful to regular users.
+And you can display the Hanyu Pinyin above the Chinese character and the translation below them as needed.
-It was inspired by hanzibox.sty from https://github.com/janvorisek/chinese-latex-utilities.
+The `\hanzibox` macro can automatically invoke the `\xpinyin*` command of the `xpinyin` package to achieve Hanyu Pinyin according to the Chinese characters. And the `\hanzibox` command provides an asterisk version of `\hanzibox*`, whose function is achieved by automatically invoking the `xpinyin` package's `\pinyin` macro to achieve this. The `\hanzidialog` macro is implemented by manually inserting the `\pinyin` macro of the `xpinyin` package in it's pinyin option.
-In this new package, the commands were kept, but redesign its options and mandatories.
+`hanzibox` is a utility for learning to write and pronounce Chinese characters, and can be used for Chinese character learning plans, presentations, exercise booklets and other documentation work.
-At present, hanzibox.sty only supports XeTeX engines and only allows UTF-8 encoding tex source file.
+The development of this package was inspired by [Jan Vorisek's hanzibox package](https://github.com/janvorisek/chinese-latex-utilities).
-You can read the package manual (in Chinese) for more detailed explanations.
+However, the new package redesigned the `\hanzibox` and `\hanzidialog` macros and the background grid is redesigned with the `l3draw` package with reference to [zitie package](https://www.ctan.org/pkg/zitie). Also, the new macro package provides more options and arguments in order to get better typesetting results.
+
+Due to the limitations of the `xpinyin` package, the `hanzibox.sty` package currently only supports the XeTeX engine and only supports UTF-8 encoded LaTeX source files.
+
+You can read the manual (in Chinese) for more details and examples.
Contributing
------------
-Gitee repository: https://gitee.com/nwafu_nan/hanzibox-l3.
+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的汉字练习宏包, v2.0.0
+=======
+
+`hanzibox`是一个用LaTeX3开发的LaTeX宏包,它提供了`\hanzibox`和`\hanzidialog` 两个命令。这两个命令用于排版汉字学习中带有或不带田字格、米字格等背景格子的汉字,并可以根据需要在汉字正上方显示拼音,在正下方显示译文。其中,`\hanzibox`命令能够根据汉字自动调用`xpinyin`宏包的`\xpinyin*`命令实现汉字注音。并且`\hanzibox`命令提供了`\hanzibox*`星号版本,其注音功能是通过自动调用`xpinyin`宏包的`\pinyin`命令实现的。`\hanzidialog`命令的注音功能通过在拼音选项中手动插入`xpinyin`宏包的`\pinyin`命令实现。
+
+`hanzibox` 是一个用于学习汉字书写与发音的工具,可以用于汉字学习教案、演示文稿、习题册等文档工作。
+
+开发该宏的灵感来自于[Jan Vorisek的hanzibox宏包](https://github.com/janvorisek/chinese-latex-utilities)。但该宏包对`\hanzibox`和`\hanzidialog`命令进行了重新设计,并参考[zitie字贴宏包](https://www.ctan.org/pkg/zitie)重新用`l3draw`宏包设计了背景格子。同时,新的宏包也提供了更多命令选项和参数,以期更好地控制排版结果。
+
+受`xpinyin`基础宏包所限,目前`hanzibox.sty`宏包仅支持XeTeX编译引擎,并且只支持UTF-8编码的LaTeX源文件。
-Issues and pull requests are welcome.
+可以通过阅读宏包手册(中文)以也解该宏包更多的使用细节和使用样例。
+
+### 参与贡献
+---------------------
+1. 本项目由西北农林科技大学信息工程学院耿楠创建和维护
+2. 如果您愿意一同参与工作(不计报酬,免费自由),请及时与作者联系
+3. 项目的gitee仓库地址:[hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
+4. 如果您有任何改进意见或者功能需求,欢迎提交 [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) 或 [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls)。
Copyright and Licence
---------------------
@@ -132,7 +153,7 @@ Copyright and Licence
%</internal>
%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
%<package>\RequirePackage{expl3}
-%<+package>\GetIdInfo$Id: hanzibox.dtx 1.1.0 2021-09-23 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
+%<+package>\GetIdInfo$Id: hanzibox.dtx 2.0.0 2021-09-28 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
%<package> {Boxed Chinese characters with Pinyin above and translation below.}
%<package>\ProvidesExplPackage{\ExplFileName}
%<package> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -145,11 +166,14 @@ Copyright and Licence
\renewcommand*\marg[1]{\{\meta{#1}\}}
\renewcommand*\oarg[1]{[\meta{#1}]}
\renewcommand*\parg[1]{(\meta{#1})}
+\NewDocumentCommand{\init}{+v}{\hspace{\fill}初始值~=~\textcolor{blue}{\bfseries#1}}
\DeclareDocumentCommand\opt{m}{\texttt{#1}}
\DeclareDocumentCommand\kvopt{mm}
{\texttt{#1\breakablethinspace=\breakablethinspace#2}}
\def\breakablethinspace{\hskip 0.16667em\relax}
\begin{document}
+ \DisableImplementation
+ \EnableImplementation
\DocInput{\jobname.dtx}
\IndexLayout
\PrintChanges
@@ -158,9 +182,11 @@ Copyright and Licence
%</driver>
% \fi
%
-% \changes{v1.0.0}{2021/09/18}{开始编写模板。}
+% \changes{v1.0.0}{2021/09/18}{开始编写模板}
+% \changes{v2.0.0}{2021/09/25}{基于l3draw重新设计}
+% \changes{v2.0.0}{2021/09/28}{重新编写README.md内容}
%
-% \CheckSum{420}
+% \CheckSum{829}
% \GetFileId{hanzibox.sty}
%
% \CharacterTable
@@ -185,234 +211,436 @@ Copyright and Licence
% \date{\filedate\qquad\fileversion\thanks{\url{https://gitee.com/nwafu_nan/hanzibox-l3}.}}
% \maketitle
%
+% \changes{v2.0.0}{2021/09/28}{修订说明文档}
+%
% \begin{documentation}
%
% \begin{abstract}
%
-% \pkg{hanzibox} 是一个用\LaTeX3开发的 \LaTeX 宏包,它提供了\tn{hanzidialog}和\tn{hanzibox}
-% 两个命令。这两个命令用于输出汉字学习中的田字格或米字格,并可以根据需要在汉字正上方显示拼音,
-% 在正下方显示需要的译文。其中,\tn{hanzidialog}命令的注音功能通过手动插入\pkg{xpinyin}宏包的
-% \tn{pinyin}命令实现。\tn{hanzibox}命令的注音功能自动调用\pkg{xpinyin}宏包的\tn{pinyin}命令实现,
-% 并且\tn{hanzibox}命令提供了\tn{hanzibox*}星号版本,该星号版本能够根据汉字自动调用
-% \pkg{xpinyin}宏包的\tn{xpinyin*}命令实现汉字注音。
+% \pkg{hanzibox} 是一个用\LaTeX3开发的 \LaTeX 宏包,它提供了\tn{hanzibox}和\tn{hanzidialog}
+% 两个命令。这两个命令用于输出汉字学习中带有或不带田字格、米字格等背景格子的汉字,
+% 并可以根据需要在汉字正上方显示拼音,在正下方显示译文。
+% 其中,\tn{hanzibox}命令能够根据汉字自动调用\pkg{xpinyin}宏包的\tn{xpinyin*}命令实现汉字注音。
+% 同时,\tn{hanzibox}命令还提供了\tn{hanzibox*}星号版本,其注音功能是通过自动调用\pkg{xpinyin}宏包
+% 的\tn{pinyin}命令实现的。\tn{hanzidialog}命令的注音功能则是通过在其拼音选项中手动插入
+% \pkg{xpinyin}宏包的\tn{pinyin}命令实现。
%
% \end{abstract}
%
% \section{简要说明}
%
-% \pkg{hanzibox} 是一个用于输出汉字学习中的田字格或米字格,并在汉字正上方显示拼音,
-% 在正下方显示需要的译文。同时,也可以根据需要隐藏拼音、汉字或译文。
+% \pkg{hanzibox} 是一个用于输出汉字学习中的田字格、米字格等背景,并在汉字正上方显示拼音,
+% 在正下方显示译文。当然,也可以根据需要隐藏拼音、汉字或译文。
%
% 使用\pkg{hanzibox}宏包的\LaTeX 源文件需采用 \texttt{UTF-8}编码,并且需使用\XeLaTeX 进行编译。
%
-% \pkg{hanzibox} 依赖 \package{l3kernel} 和 \package{l3packages}。
+% \pkg{hanzibox} 依赖 \package{l3kernel} 、\package{l3packages}、\package{l3draw}和\package{xpinyin}宏包。
%
% \section{用户接口}
%
-% \begin{function}[added=2021-09-18,updated=2021-09-19]{\hanzidialog}
-% \begin{syntax}
-% \tn{hanzidialog} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
-% \end{syntax}
-% 排版汉字,并根据选项内容在顶部排版拼音,在底部排版译文。\\
-% 其中,\oarg{拼音选项}可以是任意文本,如果是汉语拼音则需要使用\pkg{xpinyin}宏包的
-% \tn{pinyin}命令进行处理;\oarg{译文选项}可以是任意文本。
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.3\linewidth,gobble=5]
-% \hanzidialog{王老师}[Wang \pinyin{lao3shi1}][teacher wang]
-% \hanzidialog{王老师}[Wang \pinyin{lao3shi1}][王先生]
-% \end{SideBySideExample}
-% \end{function}
-%
-% \begin{function}[added=2021-09-18,updated=2021-09-20]{\hanzibox,\hanzibox*}
+% \begin{function}[added=2021-09-18,updated=2021-09-28]{\hanzibox,\hanzibox*}
% \begin{syntax}
-% \tn{hanzibox} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
+% \tn{hanzibox} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
% \tn{hanzibox*} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
% \end{syntax}
% 排版汉字,并根据选项内容在顶部排版拼音,在底部排版译文。\\
-% 其中,\oarg{外观选项}用于设置盒子外观;\oarg{拼音选项}用于设置拼音,
-% 要求其拼音格式符合\pkg{xpinyin}宏包的规定;\oarg{译文选项}可以是任意文本。
+% 其中,\Arg{汉字}可以留空,\oarg{外观选项}用于设置盒子外观;
+% \tn{hanzibox}命令中的\oarg{拼音选项}无效,可以省略,也可以留空;\\
+% \oarg{译文选项}可以是任意文本,需要注意的是,当需要\oarg{译文选项}时,
+% \oarg{拼音选项}可以留空,但不能省略。
+% 注音由\pkg{xpinyin}宏包自动根据汉字获得,此时,可能会存在多音字等问题,
+% 其调整详情请参阅其\pkg{xpinyin}宏包说明。
+%
+% 排版样式可能通过\tn{hanziboxset}命令或\tn{hanzidialog}\oarg{外观选项}的key-value进行设置。
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5]
-% \hanzibox[inner=none,border=false]{我}[wo3][me]
-% \hanzibox[inner=cross,border=true]{我}[wo3][吾]
-% \hanzibox[inner=star]{我}[wo3][俺]
-% \hanzibox[borderwidth=1.5pt]{我}[wo3][爷]
-% \hanzibox[bordercolor=red]{我}[wo3][山人]
+% \hanziboxset{fillcolor=yellow!30, charcolor=red,
+% framecolor=red}
+% \hanzibox[frametype=none]{我}
+% \hanzibox[frametype=none]{我}[][me]
+% \hanzibox[frametype=口 ]{我}[][吾]
+% \hanzibox[frametype=十 ]{我}[wo3][俺]
+% \hanzibox[frametype=× ]{我}[wo2][爷]
+% \hanzibox[frametype=田 ]{我}[wo1][愚]
+% \hanzibox[frametype=米 ]{我}[ni3][奴]
+% \hanzibox[frametype=咪 ]{我}[ta1][山人]
% \end{SideBySideExample}
-% 星号命令用于根据汉字自动在顶部排版拼音,在底部排版译文。\\
-% 此时,\oarg{拼音选项}中的拼音无效,可以留空,但若有译文则该选项不可省略;
-% \oarg{译文选项}可以是任意文本。\\
-% 注意:此时的注音由\pkg{xpinyin}宏包实现,如需要设置多音字的拼音,请参阅其宏包说明。
+% 星号命令\tn{hanzibox*}用于手动排版拼音。\\
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5]
-% \hanzibox*[inner=none,border=false]{我}[][me]
-% \hanzibox*[inner=cross,border=true]{我}[][吾]
-% \hanzibox*[inner=star]{我}[wo3][不才]
-% \hanzibox*[borderwidth=1.5pt]{我}[wo2][本人]
-% \hanzibox*[bordercolor=red]{我}[ni3][孤家]
+% \hanziboxset{xscale=1.5,yscale=1.5,resize=real}
+% \hanzibox*[frametype=none]{我}[wo3][me]
+% \hanzibox*[frametype=口 ]{我}[wo3][吾]
+% \hanzibox*[frametype=十 ]{我}[wo3][俺]
+% \hanzibox*[frametype=× ]{我}[wo3][爷]
+% \hanzibox*[frametype=田 ]{我}[wo2][愚]
+% \hanzibox*[frametype=米 ]{我}[ni3][奴]
+% \hanzibox*[frametype=咪 ]{我}[ta5][山人]
% \end{SideBySideExample}
% \end{function}
%
-% \section{选项说明}
-%
-% \begin{function}[added=2021-09-20]{\hanziboxset}
+% \begin{function}[added=2021-09-18,updated=2021-09-28]{\hanzidialog}
% \begin{syntax}
-% \tn{hanziboxset} \marg{键值列表}
+% \tn{hanzidialog} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
% \end{syntax}
-% 本宏包提供了一系列选项,以实现汉字盒子外观样式设置。
-% 载入\pkg{hanzibox}宏包后,以下选项均可通过统一的\tn{hanziboxset}命令进行设置。
-% 同时,这些选项也可以通过\tn{hanzibox}命令的外观选项进行设置。
-% \end{function}
+% 排版汉字,并根据选项内容在顶部排版拼音,在底部排版译文。\\
+% 其中,\Arg{汉字}可以留空,\oarg{拼音选项}可以是任意文本;\oarg{译文选项}可以是任意文本。
+% \oarg{拼音选项}和\oarg{译文选项}都可以留空,也可以省略,
+% 但当需要\oarg{译文选项}时,\oarg{拼音选项}可以留空,不能省略。
+% 如果是汉语拼音则需要手动使用\pkg{xpinyin}宏包的\tn{pinyin}命令,
+% 排版样式可能通过\tn{hanziboxset}命令或\tn{hanzidialog}\oarg{外观选项}的key-value进行设置。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5]
+% \hanzidialog{王老师}[teacher wang][Wang \pinyin{lao3shi1}]
+%
+% \hanzidialog[frametype=田]{王老师}[Wang \pinyin{lao3shi1}]
+% [王先生]
%
-% \tn{hanziboxset} 的参数是一组由(英文)逗号隔开的选项列表,
-% 列表中的选项通常是 \kvopt{\meta{key}}{\meta{value}} 形式。
-% 部分选项的\meta{value} 可以省略。对于同一项,后续设置会覆盖以前的设置。
-% 在下文的说明中,将用\textbf{粗体}表示默认值。
+% \hanzidialog[height=1cm,frametype=咪,framecolor=red,resize=real]
+% {王老师}[Wang \pinyin{lao3shi1}][王先生]
%
-% \tn{hanziboxset} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种
-% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意,
-% 参数列表中\textbf{不可以出现空行}。
+% \end{SideBySideExample}
+% \end{function}
%
-% 布尔型的参数 \kvopt{\meta{选项}}{true} 中的“|= true|”可以省略。
+% \begin{function}[added=2021-09-20,updated=2021-09-24]{\hanziboxset}
+% \begin{syntax}
+% \tn{hanziboxset} \marg{键值列表}
+% \end{syntax}
%
-% \changes{v1.1.0}{2021/09/22}{添加外观选项设置命令示例代码。}
+% \tn{hanziboxset} 的参数是一组由(英文)逗号隔开的选项列表,
+% 列表中的选项通常是 \kvopt{\meta{key}}{\meta{value}} 形式。
+% 部分选项的\meta{value} 可以省略。对于同一项,后续设置会覆盖以前的设置。
+% 在下文的说明中,将用\textbf{粗体}表示默认值。
%
-% \begin{frameverb}
-% \hanziboxset{
-% scale = 0.8, % 整体缩放比例
-% inner = star, % 盒子内部图案
-% border = true, % 是否有边框
-% borderwidth = 1.5 pt, % 边框宽度
-% bordercolor = red, % 边框颜色
-% fgcolor = red, % 盒子前景色(文字颜色)
-% bgcolor = yellow!50, % 盒子背景色
-% withpinyin = false, % 是否显示拼音
-% withhanzi = true, % 是否显示汉字
-% withtran = true % 是否显示译文
-% }
-% \end{frameverb}
+% \tn{hanziboxset} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种
+% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意,
+% 参数列表中\textbf{不可以出现空行}。
%
-% 注:各选项也可以以相同的键值列表在汉字盒子命令的外观选项中进行设置。
+% 布尔型的参数 \kvopt{\meta{选项}}{true} 中的“|= true|”可以省略。
+% \end{function}
%
-% \subsection{缩放比例}
+% \section{选项说明}
%
-% \changes{v1.1.0}{2021/09/22}{将缩放比例键ratio改为scale。}
+% 本宏包提供了一系列选项,以实现汉字盒子外观样式设置。
+% 载入\pkg{hanzibox}宏包后,以下选项均可通过统一的\tn{hanziboxset}命令进行设置。
+% 同时,这些选项也可以通过\tn{hanzibox}命令的外观选项进行设置。
%
-% \begin{function}[added=2021-09-20,updated=2021-09-22]{scale}
+% \begin{function}[added=2021-09-24,updated=2021-09-24]{basechar,zihao}
% \begin{syntax}
-% scale = \Arg{number}
+% basechar = \meta{CJK char} \init{好}
+% zihao = \meta{字号} \init{4}
% \end{syntax}
-% 设置\tn{hanzibox}命令绘制汉字盒子及其拼音和译文的整体缩放比例,默认值为\textbf{1.0}。
+% \opt{basechar} 设置基字符,用于计算缩放比例,
+% 基字符不同时,即使给定相同的缩放比例,其实际缩放比例也可能不同。
+%
+% \opt{zihao} 设置计算缩放比例时的字号大小。
% \end{function}
%
-% \subsection{汉字边框}
-%
-% \begin{function}[added=2021-09-20]{border}
+% \begin{function}[added=2021-09-27,updated=2021-09-28]{pinyinf,charf,tranf}
% \begin{syntax}
-% border = <\TTF>
+% pinyinf = \meta{格式命令} \init{\normalsize}
+% charf = \meta{格式命令} \init{\tiny}
+% tranf = \meta{格式命令} \init{\tiny}
% \end{syntax}
-% 为\tn{hanzibox}命令选择是否绘制汉字的边框,默认值为\textbf{true}。该选项对\tn{hanzidialog}命令无效。
+% 分别用于设置拼音、汉字、译文的排版格式。
% \end{function}
%
-% \begin{function}[added=2021-09-20]{borderwidth}
+% \begin{function}[added=2021-09-24,updated=2021-09-24]{frametype,resize}
+% \begin{syntax}
+% frametype = <none|口|十|田|米|咪> \init{none}
+% resize = <none|real|base> \init{none}
+% \end{syntax}
+% \opt{frametype} 设置汉字盒子样式。可用值的效果与选项值文字形状类似:\verb|口|--仅方框,
+% \verb|十|--仅中间的横线和竖线,\verb|田|--常见的田字格,\verb|米|--十字格再加上斜的两条线,
+% \verb|咪|--常见的米字格。
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5]
+% \hanzibox[frametype=none]{无}
+% \hanzibox[frametype=口 ]{口}
+% \hanzibox[frametype=十 ]{十}
+% \hanzibox[frametype=田 ]{田}
+% \hanzibox[frametype=米 ]{米}
+% \hanzibox[frametype=咪 ]{咪}
+% \end{SideBySideExample}
+%
+% \opt{resize} 设置缩放方式,\opt{real}--使用字符实际宽高缩放,
+% \opt{base}--使用 \opt{basechar} 设置的字符的宽高缩放,
+%
+% 以下为宽度设置为 1cm 时的缩放情况。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=5]
+% \hanziboxset{width=1cm,frametype=咪,
+% framecolor=black}
+% \hanzibox[resize=none ]{无}
+% \hanzibox[resize=real ]{实}
+% \hanzibox[resize=base ]{基}
+% \end{SideBySideExample}
+% \end{function}
+%
+% \begin{function}[added=2021-09-24,updated=2021-09-24]{
+% xscale,yscale,scale,
+% width,height}
% \begin{syntax}
-% borderwidth = \Arg{dimen}
+% xscale = \meta{scale ratio} \init{1}
+% yscale = \meta{scale ratio} \init{1}
+% scale = \meta{scale ratio}
+% width = \meta{dim}
+% height = \meta{dim}
% \end{syntax}
-% 为\tn{hanzibox}命令设置汉字的边框宽度,默认值为\textbf{0.4pt}。该选项对\tn{hanzidialog}命令无效。
+% 设置缩放比例和盒子宽高。
+%
+% 宽高具有更高的优先级,即若比例和宽高都设置了,则使用宽高来计算。
+% 宽高为二者都为0cm视为未设置,二者有一大于0cm,视为设置了宽高。
+%
+% 此处的宽高和最终的宽高可能略有差异,最终的宽高保存在
+% \tn{hanziboxwidth} 和 \tn{hanziboxheight} dim寄存器中。
% \end{function}
%
-% \begin{function}[added=2021-09-20]{bordercolor}
+% \begin{function}[added=2021-09-24,updated=2021-09-24]{
+% linewidth,
+% dashpattern,
+% framearc,
+% framearc*
+% }
% \begin{syntax}
-% bordercolor = \Arg{color}
+% linewidth = \meta{dim} \init{0.4pt}
+% dashpattern = \meta{ dim1, dim2, ... }
+% framearc = \meta{dim}
+% framearc* = \{ \marg{dim1} \marg{dim2} \}
% \end{syntax}
-% 为\tn{hanzibox}命令设置汉字的边框颜色,默认值为\textbf{black}。该选项对\tn{hanzidialog}命令无效。
+% 设置边框线宽、线型、转角样式。
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.30\linewidth,gobble=5]
+% \hanziboxset{width=1.0cm,resize=real,framecolor=red}
+% \hanzibox[linewidth=1pt,frametype=口]{好}
+% \hanzibox[dashpattern={1.5mm,1mm,2mm,1.5mm},frametype=田]{好}
+% \hanzibox[framearc=1mm,frametype=口]{好} \\
+% \hanzibox[framearc=1mm,frametype=咪]{好}
+% \hanzibox[framearc*={1mm}{2mm},frametype=口]{好}
+% \hanzibox[framearc*={2mm}{1mm},frametype=咪]{好}
+% \end{SideBySideExample}
% \end{function}
%
-% \changes{v1.1.0}{2021/09/21}{添加前景颜色设置选项。}
-%
-% \begin{function}[added=2021-09-21]{fgcolor}
+% \begin{function}[added=2021-09-24,updated=2021-09-24]{
+% framecolor,
+% framecolor*,
+% charcolor,
+% charcolor*,
+% fillcolor,
+% fillcolor*
+% }
% \begin{syntax}
-% fgcolor = \Arg{color}
+% framecolor = \meta{color expr} \init{black}
+% framecolor* = \meta{model(s)} \meta{value(s)}
+% charcolor = \meta{color expr} \init{black}
+% charcolor* = \meta{model(s)} \meta{value(s)}
+% fillcolor = \meta{color expr}
+% fillcolor* = \meta{model(s)} \meta{value(s)}
% \end{syntax}
-% 为\tn{hanzibox}命令设置汉字盒子前景颜色(文字颜色),
-% 默认值为\textbf{black}。该选项对\tn{hanzidialog}命令无效。
-% \end{function}
+% 命名的颜色仅支持 \LaTeX3 定义的 black, white, red, green, blue, cyan, magenta 和 yellow。
+% 颜色模型和表达式也应使用 \LaTeX3 支持的模型和表达式,详见 \pkg{interface3.pdf} 文档。
%
-% \changes{v1.1.0}{2021/09/21}{添加背景颜色设置选项。}
+% 若要去掉 \opt{fillcolor},应将其设置为空,即 \verb|fillcolor={}|,而不是将其设置为白色。
+% \end{function}
%
-% \begin{function}[added=2021-09-21]{bgcolor}
+% \begin{function}[added=2021-09-24,updated=2021-09-24]{initial,vowel,tone}
% \begin{syntax}
-% bgcolor = \Arg{color}
+% initial = <\TTF> \init{true}
+% vowel = <\TTF> \init{true}
+% tone = <\TTF> \init{true}
% \end{syntax}
-% 为\tn{hanzibox}命令设置汉字盒子背景颜色(填充颜色),
-% 默认值为\textbf{white}。该选项对\tn{hanzidialog}命令无效。
+% 分别用于设置是否输出拼音的声母、韵母和声调,默认值为\textbf{true}。
+% 该选项仅对\tn{hanzibox}命令有效。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.33\linewidth,gobble=5]
+% \hanziboxset{frametype=咪,framecolor=red,
+% fillcolor=yellow!40,resize=real}
+% \hanzibox{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[initial=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[vowel=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[tone=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[initial=false,vowel=false]{明有几时有}
+% [][How long will the full moon appear?]
+% \end{SideBySideExample}
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.28\linewidth,gobble=5]
+% \hanziboxset{frametype=咪,framecolor=red,fillcolor=yellow!40,
+% charf=\Huge,resize=real}
+% \hanzibox*[initial=false]{我}[wo3][吾]
+% \hanzibox*[initial=true,vowel=false]{我}[wo3][吾]
+% \hanzibox*[initial=true,vowel=true,tone=false]{我}[wo3][不才]
+% \end{SideBySideExample}
% \end{function}
%
-% \subsection{格子样式}
-%
-% \begin{function}[added=2021-09-20]{inner}
+% \begin{function}[added=2021-09-21,updated=2021-09-26]{pinyin,hanzi,tran}
% \begin{syntax}
-% inner = <(none)|star|cross>
+% pinyin = <\TTF> \init{true}
+% hanzi = <\TTF> \init{true}
+% tran = <\TTF> \init{true}
% \end{syntax}
-% 为\tn{hanzibox}命令设置汉字盒子内部装饰为无(none)、米字格(star)或田字格(cross),
-% 默认值为\textbf{none}。该选项对\tn{hanzidialog}命令无效。
+% 分别用于设置是否输出拼音、汉字和译文,默认值为\textbf{true}。
+% 该选项对\tn{hanzidialog}命令无效。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.33\linewidth,gobble=5]
+% \centering
+% \hanziboxset{frametype=咪,framecolor=red,charf=\large,
+% fillcolor=yellow!40}
+% \hanzibox[hanzi=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[pinyin=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[tran=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \end{SideBySideExample}
% \end{function}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏拼音选项。}
+% \changes{v2.0.0}{2021/09/28}{在说明文档中添加应用实例}
%
-% \subsection{内容隐藏}
+% \section{应用实例}
%
-% \begin{function}[added=2021-09-21]{withpinyin}
-% \begin{syntax}
-% withpinyin = <\TTF>
-% \end{syntax}
-% 为\tn{hanzibox}命令选择是否输出拼音,默认值为\textbf{true}。该选项对\tn{hanzidialog}命令无效。
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
-% \hanzibox[inner=cross]{我}[wo3][吾]
-% \hanzibox[withpinyin=false,inner=star]{我}[wo3][不才]
-% \hanzibox[bordercolor=red]{我们}[wo3men5][吾辈]
+% \pkg{hanzibox}宏包可以广泛用于汉字学习的练习中。
+%
+% \subsection{拼一拼---写一写练习}
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=5]
+% \hanziboxset{frametype=田,framecolor=blue}
+% \hanzibox{门}\hanzibox[hanzi=false]{口}\hfill
+% \hanzibox{生}\hanzibox[hanzi=false]{日}\hfill
+% \hanzibox{题}\hanzibox[hanzi=false]{目}\hfill
+% \hanzibox[hanzi=false]{田}\hanzibox{野}
% \end{SideBySideExample}
+%
+% \subsection{标注声母练习}
+%
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
-% \hanzibox*[inner=cross]{我}[][吾]
-% \hanzibox*[withpinyin=false,inner=star]{我}[wo3][不才]
-% \hanzibox*[bordercolor=red]{我们}[wo3][吾辈]
+% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
+% charf=\Huge,pinyinf=\small,initial=false}
+% \hanzibox{门口}\hfill
+% \hanzibox{生日}\\
+% \hanzibox{题目}\hfill
+% \hanzibox{田野}
% \end{SideBySideExample}
-% \end{function}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏汉字选项。}
+% \subsection{标注韵母练习}
%
-% \begin{function}[added=2021-09-21]{withhanzi}
-% \begin{syntax}
-% withhanzi = <\TTF>
-% \end{syntax}
-% 为\tn{hanzibox}命令选择是否输出汉字,默认值为\textbf{true}。该选项对\tn{hanzidialog}命令无效。
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
-% \hanzibox[inner=cross]{我}[wo3][吾]
-% \hanzibox[withhanzi=false,inner=star]{我}[wo3][不才]
-% \hanzibox[bordercolor=red]{我们}[wo3men5][吾辈]
+% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
+% charf=\Huge,pinyinf=\small,vowel=false}
+% \hanzibox{门口}\hfill
+% \hanzibox{生日}\\
+% \hanzibox{题目}\hfill
+% \hanzibox{田野}
% \end{SideBySideExample}
+%
+% \subsection{标注声调练习}
+%
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
-% \hanzibox*[inner=cross]{我}[][吾]
-% \hanzibox*[withhanzi=false,inner=star]{我}[wo3][不才]
-% \hanzibox*[bordercolor=red]{我们}[wo3][吾辈]
+% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
+% charf=\Huge,pinyinf=\small,tone=false}
+% \hanzibox{门口}\hfill
+% \hanzibox{生日}\\
+% \hanzibox{题目}\hfill
+% \hanzibox{田野}
% \end{SideBySideExample}
-% \end{function}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏译文选项。}
+% \subsection{随机生成生词练习}
+%
+% 假设提前准备了生词表的\verb!\clist_set:Nn \l__words_clist!,则可以使用
+% \LaTeX3的随机处理随机生成生词练习题(每次编译可以成不同的结果)。
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.30\linewidth,gobble=5]
+% \ExplSyntaxOn
+% \clist_set:Nn \l__words_clist
+% {
+% {铅笔} , {橡皮} , {报纸} ,
+% {头发} , {耳朵} , {眼睛} ,
+% {大象} , {蚂蚁} , {松鼠} ,
+% {男孩} , {同学} , {兄弟} ,
+% {学生} , {医生} , {护士} ,
+% {老师} , {警察} , {羊肉} ,
+% {窗户} , {镜子} , {沙发}
+% }
+% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
+% charf=\huge,pinyinf=\footnotesize,hanzi=false}
+% \centering
+% \int_step_inline:nn {6}
+% {
+% \hanzibox{\clist_rand_item:N \l__words_clist}\\
+% }
+% \ExplSyntaxOff
+% \end{SideBySideExample}
%
-% \begin{function}[added=2021-09-21]{withtran}
-% \begin{syntax}
-% withtran = <\TTF>
-% \end{syntax}
-% 为\tn{hanzibox}命令选择是否输出译文,默认值为\textbf{true}。该选项对\tn{hanzidialog}命令无效。
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
-% \hanzibox[inner=cross]{我}[wo3][吾]
-% \hanzibox[withtran=false,inner=star]{我}[wo3][不才]
-% \hanzibox[bordercolor=red]{我们}[wo3men5][吾辈]
+% \subsection{随机生成拼音练习}
+%
+% 假设提前准备了生词表的声母和韵母表,则可以使用
+% \LaTeX3的随机处理随机生成拼音练习题(每次编译可以成不同的结果)。
+% 此时,可能生成的拼音不正确,可让学生填写“无”。
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5]
+% \ExplSyntaxOn
+% \int_new:N \l__tone_int
+% \clist_set:Nn \l__initials_clist
+% {
+% {zh} , {ch} , {sh} , {b} , {p} , {m} , {f} ,
+% {d} , {t} , {n} , {l} , {g} , {k} , {h} ,
+% {j} , {q} , {x} , {r} , {z} , {c} , {s} ,
+% {y} , {w}
+% }
+% \clist_set:Nn \l__vowel_clist
+% {
+% {iang} , {iong} , {uang} , {ueng} , {ang} , {eng} , {ing} ,
+% {ong} , {uai} , {uan} , {uai} , {uei} , {iao} , {iou} ,
+% {ian} , {van} , {uen} , {ai} , {ei} , {ua} , {uo} ,
+% {ui} , {ao} , {ou} , {iu} , {ie} , {ve} , {er} ,
+% {an} , {en} , {in} , {un} , {vn} , {a} , {e} ,
+% {i} , {o} , {u} , {v}
+% }
+% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
+% charf=\huge,pinyinf=\footnotesize,hanzi=false}
+% \centering
+% \int_step_inline:nn {10}
+% {
+% \int_zero:N \l__tone_int
+% \int_set:Nn \l__tone_int {\int_rand:n {5}}
+% \hanzibox*{好}[
+% \clist_rand_item:N \l__initials_clist
+% \clist_rand_item:N \l__vowel_clist
+% \int_use:N \l__tone_int
+% ]\\
+% }
+% \ExplSyntaxOff
% \end{SideBySideExample}
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
-% \hanzibox*[inner=cross]{我}[][吾]
-% \hanzibox*[withtran=false,inner=star]{我}[wo3][不才]
-% \hanzibox*[bordercolor=red]{我们}[wo3][吾辈]
+%
+% \subsection{生成格式纸}
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5]
+% \hanziboxset{frametype=咪,framecolor=red,
+% charcolor=red,charf=\huge}
+% \centering
+% \ExplSyntaxOn
+% \int_step_inline:nn {8}
+% {
+% \int_step_inline:nn {6}
+% {
+% \hanzibox{}
+% \hspace*{-0.4pt}
+% }
+% \par\nointerlineskip\vspace*{-6.0pt}
+% }
+% \ExplSyntaxOff
+% \end{SideBySideExample}
+%
+% \subsection{生成诗词注音}
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5]
+% \setpinyin{长}{chang2}
+% \setpinyin{尽}{jin4}
+% \hanziboxset{frametype=咪,framecolor=red,
+% charf=\huge,pinyinf=\footnotesize,
+% charcolor=green!40!black}
+% \centering
+% \hanzibox{故人西辞黄鹤楼}
+% \hanzibox{烟花三月下扬州}
+% \hanzibox{孤帆远影碧空尽}
+% \hanzibox{唯见长江天际流}
% \end{SideBySideExample}
-% \end{function}
%
% \end{documentation}
%
@@ -423,9 +651,9 @@ Copyright and Licence
% \section{代码实现}
%
% 本宏包使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境,
-% 并需调用 \pkg{l3packages} 中的相关宏包。
+% 并需调用 \pkg{l3packages} 中的\pkg{l3draw}等相关宏包。
%
-% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符完全被忽略,
+% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符会完全被忽略,
% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。
% 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”,
% 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。
@@ -450,7 +678,7 @@ Copyright and Licence
%
% \begin{macrocode}
-\RequirePackage { xtemplate, l3keys2e, xparse }
+\RequirePackage { xtemplate, l3keys2e, l3draw, xparse }
% \end{macrocode}
%
@@ -482,78 +710,26 @@ Copyright and Licence
}
\msg_new:nnn { hanzibox } { unsupported-engine }
{
- The~ hanzibox~ packages~ requires~ either~ XeTeX. \\\\
+ The~ hanzibox~ packages~ requires~ XeTeX. \\\\
"#1"~ is~ not~ supported~ at~ present.~ You~ must~ change \\
your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex".
}
% \end{macrocode}
%
-% 载入TikZ, xpinyin宏包
-%
-% \begin{macrocode}
-\RequirePackage { tikz, xpinyin }
-
-% \end{macrocode}
-%
-% 在Expl3中使用TikZ库的补丁
-%
-% \begin{macrocode}
-\RequirePackage{etoolbox}
-\ExplSyntaxOff
-\patchcmd
- {\pgfutil@InputIfFileExists}
- {\input #1}
- {%
- \@pushfilename
- \xdef\@currname{#1}%
- \input #1 %
- \@popfilename
- }
- {}{}
-\ExplSyntaxOn
-\usetikzlibrary{decorations}
-\usetikzlibrary{shapes.geometric}
-\usetikzlibrary{positioning}
-
-% \end{macrocode}
-%
-% TikZ样式设置
+% 载入xpinyin宏包
%
% \begin{macrocode}
-\tikzset{%
- stretch~dash/.code~args={on~#1~off~#2}{%
- \tikz@addoption{%
- \pgfgetpath\currentpath%
- \pgfprocessround{\currentpath}{\currentpath}%
- \pgf@decorate@parsesoftpath{\currentpath}{\currentpath}%
- \pgfmathparse{max(round((\pgf@decorate@totalpathlength-#1)/(#1+#2)),0)}%
- \let\npattern=\pgfmathresult%
- \pgfmathparse{\pgf@decorate@totalpathlength/(\npattern*(#1+#2)+#1)}%
- \let\spattern=\pgfmathresult%
- \pgfsetdash{{\spattern*#1}{\spattern*#2}}{0pt}%
- }%
- }%
-}
+\RequirePackage { xpinyin }
% \end{macrocode}
%
% \subsection{用户接口}
%
-% \changes{v1.1.0}{2021/09/22}{为用户命令添加组限制。}
-%
-% \begin{macro}{\hanzidialog}
-% 手动汉字盒子命令。
-% \begin{macrocode}
-\NewDocumentCommand{\hanzidialog}{ m O{} O{} }
- {
- \group_begin:
- \@@_dialog:nnnn { #1 } { #2 } { #3 }
- \group_end:
- }
-
-% \end{macrocode}
-% \end{macro}
+% \changes{v1.1.0}{2021/09/22}{为用户命令添加组限制}
+% \changes{v2.0.0}{2021/09/26}{调整星号命令为手动拼音注音}
+% 汉字背景盒子改为l3draw实现,
+% 其设计思路和部分源码来自\LaTeX 字帖宏包(\url{https://www.ctan.org/pkg/zitie})。
%
% \begin{macro}{\hanzibox}
% 自动拼音汉字盒子命令。
@@ -562,14 +738,27 @@ Copyright and Licence
{
\IfBooleanTF{#1}
{
- \group_begin:
- \@@_asterisk_draw:nnnn { #2 } { #3 } { #4 } { #5 }
- \group_end:
+ \bool_set_false:N \l_@@_autopinyin_bool
}{
- \group_begin:
- \@@_draw:nnnn { #2 } { #3 } { #4 } { #5 }
- \group_end:
+ \bool_set_true:N \l_@@_autopinyin_bool
}
+ \group_begin:
+ \@@_handle:nnnn { #2 } { #3 } { #4 } { #5 }
+ \group_end:
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hanzidialog}
+% 手动汉字盒子命令。
+% \begin{macrocode}
+\NewDocumentCommand{\hanzidialog}{O{} m O{} O{} }
+ {
+ \group_begin:
+ \bool_set_false:N \l_@@_autopinyin_bool
+ \@@_dialog:nnnn { #1 } { #2 } { #3 } { #4 }
+ \group_end:
}
% \end{macrocode}
@@ -578,566 +767,1371 @@ Copyright and Licence
% \subsection{内部变量声明}
%
% \changes{v1.1.0}{2021/09/21}{添加缩放比例,前景/背景色,隐藏控制变量。}
-%
-% \begin{variable}{\fp_new:N \l_@@_scale_fp,
-% \l_@@_inner_int,
-% \l_@@_border_bool,
-% \l_@@_borderwidth_dim,
-% \l_@@_bordercolor_tl,
-% \l_@@_fgcolor_tl,
-% \l_@@_bgcolor_tl,
-% \l_@@_pinyin_bool,
-% \l_@@_hanzi_bool,
-% \l_@@_tran_bool,
+% \changes{v2.0.0}{2021/09/24}{根据l3draw的需要重新设计各个变量。}
+%
+% \begin{variable}{\l_@@_autopinyin_bool,
+% \l_@@_withinitials_bool,
+% \l_@@_withvowel_bool,
+% \l_@@_withtone_bool,
+% \l_@@_withpinyin_bool,
+% \l_@@_withhanzi_bool,
+% \l_@@_withtran_bool,
+% \l_@@_basebox_box,
+% \l_@@_frame_type_tl,
+% \g_@@_frame_list_clist,
+% \l_@@_resize_method_tl,
+% \g_@@_resize_method_clist,
+% \l_@@_frame_size_dim,
+% \l_@@_char_width_dim,
+% \l_@@_char_height_dim,
+% \l_@@_box_width_dim,
+% \l_@@_box_height_dim,
+% \l_@@_linewidth_dim,
+% \l_@@_box_coffin,
+% \l_@@_tmpa_coffin,
+% \l_@@_tmpb_coffin,
+% \hanziboxwidth,
+% \hanziboxheight,
+% \hanziboxboxwd,
+% \hanziboxboxht,
+% \hanziboxboxdp,
+% \hanziboxxscaleratio,
+% \hanziboxyscaleratio,
% \l_@@_pinyin_tl,
% \l_@@_character_tl,
% \l_@@_translation_tl,
+% \l_@@_pinyin_format_tl,
+% \l_@@_character_format_tl,
+% \l_@@_translation_format_tl,
% \l_@@_pinyin_int,
% \l_@@_character_int,
-% \l_@@_translation_int
+% \l_@@_translation_int,
+% \l_@@_tone_int,
+% \l_@@_pinyin_str,
+% \l_@@_initial_tl,
+% \l_@@_vowel_tl
% }
-% 临时变量。
-%
-% \begin{macrocode}
-\fp_new:N \l_@@_scale_fp
-\int_new:N \l_@@_inner_int
-\bool_new:N \l_@@_border_bool
-\dim_new:N \l_@@_borderwidth_dim
-\tl_new:N \l_@@_bordercolor_tl
-\tl_new:N \l_@@_fgcolor_tl
-\tl_new:N \l_@@_bgcolor_tl
-\bool_new:N \l_@@_pinyin_bool
-\bool_new:N \l_@@_hanzi_bool
-\bool_new:N \l_@@_tran_bool
-\tl_new:N \l_@@_pinyin_tl
-\tl_new:N \l_@@_character_tl
-\tl_new:N \l_@@_translation_tl
-\int_new:N \l_@@_pinyin_int
-\int_new:N \l_@@_character_int
-\int_new:N \l_@@_translation_int
+% 定义变量。
+%
+% \begin{macrocode}
+\bool_new:N \l_@@_autopinyin_bool
+\bool_new:N \l_@@_withinitials_bool
+\bool_new:N \l_@@_withvowel_bool
+\bool_new:N \l_@@_withtone_bool
+\bool_new:N \l_@@_withpinyin_bool
+\bool_new:N \l_@@_withhanzi_bool
+\bool_new:N \l_@@_withtran_bool
+
+\box_new:N \l_@@_basebox_box
+\tl_new:N \l_@@_frame_type_tl
+\clist_new:N \g_@@_frame_list_clist
+\tl_new:N \l_@@_resize_method_tl
+\clist_new:N \g_@@_resize_method_clist
+\dim_new:N \l_@@_frame_size_dim
+\dim_new:N \l_@@_char_width_dim
+\dim_new:N \l_@@_char_height_dim
+\dim_new:N \l_@@_box_width_dim
+\dim_new:N \l_@@_box_height_dim
+\dim_new:N \l_@@_linewidth_dim
+
+\coffin_new:N \l_@@_str_box_coffin
+\coffin_new:N \l_@@_box_coffin
+\coffin_new:N \l_@@_pinyin_box_coffin
+\coffin_new:N \l_@@_tran_box_coffin
+\coffin_new:N \l_@@_tmpa_coffin
+\coffin_new:N \l_@@_tmpb_coffin
+
+\dim_new:N \hanziboxwidth
+\dim_new:N \hanziboxheight
+\dim_new:N \hanziboxboxwd
+\dim_new:N \hanziboxboxht
+\dim_new:N \hanziboxboxdp
+\tl_new:N \hanziboxxscaleratio
+\tl_new:N \hanziboxyscaleratio
+
+\tl_new:N \l_@@_pinyin_tl
+\tl_new:N \l_@@_character_tl
+\tl_new:N \l_@@_translation_tl
+\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_@@_pinyin_int
+\int_new:N \l_@@_character_int
+\int_new:N \l_@@_translation_int
+
+\int_new:N \l_@@_tone_int
+\str_new:N \l_@@_pinyin_str
+\tl_new:N \l_@@_initial_tl
+\tl_new:N \l_@@_vowel_tl
% \end{macrocode}
% \end{variable}
%
+% \subsection{辅助函数}
%
-% \subsection{选项处理}
+% \subsubsection{设置填充色}
%
-% 定义 |hanzibox| 键值类。
+% \begin{macro}{\@@_aux_color_fill:}
+% 设置填充色
% \begin{macrocode}
-\keys_define:nn { hanzibox }
+\cs_new_nopar:Nn \@@_aux_color_fill:
+ { }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{计算盒子尺寸}
+%
+% \begin{macro}{\@@_calc_basechar_w_h:}
+% 计算基字符盒子宽和高
+% \begin{macrocode}
+\cs_new:Npn \@@_calc_basechar_w_h:
+ {
+ \dim_set:Nn \l_@@_char_width_dim
+ {
+ \box_wd:N \l_@@_basebox_box
+ }
+ \dim_set:Nn \l_@@_char_height_dim
+ {
+ \box_ht_plus_dp:N \l_@@_basebox_box
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_coffin_ht_plus_dp:N}
+% 获取coffin盒子总高度
+% \begin{macrocode}
+\cs_new_nopar:Npn \@@_coffin_ht_plus_dp:N #1
{
+ \coffin_ht:N #1 + \coffin_dp:N #1
+ }
% \end{macrocode}
+% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加缩放比例键。}
+% \changes{v2.0.0}{2021/09/28}{添加根据基字符格式计算外观盒子尺寸的函数}
%
-% \begin{macro}{scale}
-% 设置汉字及其拼音和译文的整体缩放比例。
+% \begin{macro}{\@@_calc_frame_size:}
+% 计算外框长度(正方形,由基字符按charf选项设定的格式盒子确定)
% \begin{macrocode}
- scale .fp_set:N = \l_@@_scale_fp,
- scale .initial:n = 1.0,
+\cs_new:Npn \@@_calc_frame_size:
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \tl_use:N \l_@@_character_format_tl
+ \tl_use:N \c_@@_basechar_tl
+ }
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \box_wd:N \l_tmpa_box
+ }
+ \dim_set:Nn \l_tmpb_dim
+ {
+ \box_ht_plus_dp:N \l_tmpa_box
+ }
+
+ \dim_compare:nNnTF \l_tmpa_dim > \l_tmpb_dim
+ {
+ \dim_gset_eq:NN \l_@@_frame_size_dim \l_tmpa_dim
+ }
+ {
+ \dim_gset_eq:NN \l_@@_frame_size_dim \l_tmpb_dim
+ }
+
+ \dim_gadd:Nn \l_@@_frame_size_dim { 2pt }
+
+ \dim_gset_eq:NN \hanziboxwidth \l_@@_frame_size_dim
+ \dim_gset_eq:NN \hanziboxheight \l_@@_frame_size_dim
+
+ }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{inner}
-% 设置汉字格子内部样式,有空白、米字和十字3种样式,默认为空白样式。
+% \subsubsection{定义边框样式}
+%
+% \begin{macro}{\@@_frame_type:n,\@@_frame_type_c:n}
+% 生成边框样式函数名称
% \begin{macrocode}
- inner .choice:,
- inner .value_required:n = true,
- inner .choices:nn =
- { none,star,cross }
- { \int_set_eq:NN \l_@@_inner_int \l_keys_choice_int },
- inner .initial:n = none,
-
+\cs_new_nopar:Npn \@@_frame_type:n #1
+ {
+ @@_frame_construct_type_ #1 :nnnnnn
+ }
+\cs_new_nopar:Npn \@@_frame_type_c:n #1
+ {
+ \use:c
+ {
+ @@_frame_construct_type_ #1 :nnnnnn
+ }
+ }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{border}
-% 是否绘制汉字盒子边框,默认为空true。
+% \begin{macro}{\@@_new_frame_construct:nn}
+% 边框样式函数的定义函数。
% \begin{macrocode}
- border .bool_set:N = \l_@@_border_bool,
- border .default:n = true,
- border .initial:n = true,
-
+\cs_new:Npn \@@_new_frame_construct:nn #1
+ {
+ \clist_put_right:Nn \g_@@_frame_list_clist {#1}
+ \cs_new:cn { \@@_frame_type:n {#1} }
+ }
+\@@_new_frame_construct:nn { none } { }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{borderwidth}
-% 汉字盒子边框宽度,默认为空3 pt。
% \begin{macrocode}
- borderwidth .dim_set:N = \l_@@_borderwidth_dim,
- borderwidth .initial:n = 0.4 pt,
+\@@_new_frame_construct:nn { 口 }
+ {
+ \color_stroke:n { hanziboxframecolor }
+ \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
+
+ \cs_if_eq:NNTF \@@_aux_color_fill: \c_empty_tl
+ {
+ \draw_path_use_clear:n { stroke }
+ }
+ {
+ \draw_path_use_clear:n { stroke , fill }
+ }
+ }
+
+\@@_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 }
+ \draw_path_moveto:n { (#3)/2, #2 }
+ \draw_path_lineto:n { #3/2, #4 }
+ \draw_path_moveto:n { #1, (#4)/2 }
+ \draw_path_lineto:n { #3, (#4)/2 }
+ \draw_path_use_clear:n { stroke }
+ }
+
+\@@_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 }
+ \draw_path_moveto:n { #1, #2 }
+ \draw_path_lineto:n { #3, #4 }
+ \draw_path_moveto:n { #1, #4 }
+ \draw_path_lineto:n { #3, #2 }
+ \draw_path_use_clear:n { stroke }
+ }
+
+\@@_new_frame_construct:nn { 田 }
+ {
+ \@@_frame_type_c:n { 口 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+
+\@@_new_frame_construct:nn { 米 }
+ {
+ \@@_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+\@@_new_frame_construct:nn { 咪 }
+ {
+ \@@_frame_type_c:n { 口 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+% \end{macrocode}
+%
+% \subsubsection{定义缩放方式}
+%
+% \begin{macro}{\@@_resize:n,\@@_resize_c:n}
+% 缩放方式命名函数
+% \begin{macrocode}
+\cs_new_nopar:Npn \@@_resize:n #1
+ {
+ @@_processor_resize_ #1 :w
+ }
+\cs_new_nopar:Npn \@@_resize_c:n #1
+ {
+ \use:c
+ {
+ @@_processor_resize_ #1 :w
+ }
+ }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{bordercolor}
-% 汉字盒子边框颜色,默认为black。
+% \begin{macro}{\@@_dim_gezero_dispatch:NNnnn,\@@_dim_gezero_dispatch:NNnnn,
+% \@@_force_size_dispatch:nnn,\@@_force_size_dispatch:nnnn}
+% 定义缩放方式函数需要的辅助函数。
% \begin{macrocode}
- bordercolor .tl_set:N = \l_@@_bordercolor_tl,
- bordercolor .initial:n = black,
-
+\cs_new:Npn \@@_dim_gezero_dispatch:NNnnn #1#2 #3#4#5
+ {
+ \dim_compare:nNnTF #1 > \c_zero_dim
+ { #3 }
+ {
+ \dim_compare:nNnTF #2 > \c_zero_dim
+ { #4 } { #5 }
+ }
+ }
+\cs_new:Npn \@@_dim_gezero_dispatch:NNnnnn #1#2 #3#4#5#6
+ {
+ \dim_compare:nNnTF #1 > \c_zero_dim
+ {
+ \dim_compare:nNnTF #2 > \c_zero_dim
+ { #3 } { #4 }
+ }
+ {
+ \dim_compare:nNnTF #2 > \c_zero_dim
+ { #5 } { #6 }
+ }
+ }
+\cs_new:Npn \@@_force_size_dispatch:nnn % height, width, none
+ {
+ \@@_dim_gezero_dispatch:NNnnn \l_@@_height_dim \l_@@_width_dim
+ }
+\cs_new:Npn \@@_force_size_dispatch:nnnn % both, height, width, none
+ {
+ \@@_dim_gezero_dispatch:NNnnnn \l_@@_box_height_dim \l_@@_box_width_dim
+ }
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加前景颜色键。}
+% \begin{macro}{\@@_new_resize_method:nn}
+% 缩放方式函数的定义函数。
+% \begin{macrocode}
+\cs_new:Npn \@@_new_resize_method:nn #1
+ {
+ \clist_put_right:Nn \g_@@_resize_method_clist {#1}
+ \cs_new:cpn { \@@_resize:n {#1} }
+ }
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{fgcolor}
-% 汉字盒子前景颜色(文字颜色),默认为black。
+% 定义缩放方式函数。
% \begin{macrocode}
- fgcolor .tl_set:N = \l_@@_fgcolor_tl,
- fgcolor .initial:n = black,
+\@@_new_resize_method:nn { none } { }
+
+\@@_new_resize_method:nn { real }
+ {
+ \@@_force_size_dispatch:nnnn
+ {
+ \coffin_resize:Nnn \l_@@_box_coffin
+ \l_@@_box_width_dim
+ \l_@@_box_height_dim
+ }
+ {
+ \coffin_scale:Nnn \l_@@_box_coffin
+ {
+ \dim_ratio:nn { \l_@@_box_height_dim }
+ { \@@_coffin_ht_plus_dp:N \l_@@_box_coffin }
+ }
+ {
+ \dim_ratio:nn { \l_@@_box_height_dim }
+ { \@@_coffin_ht_plus_dp:N \l_@@_box_coffin }
+ }
+ }
+ {
+ \coffin_scale:Nnn \l_@@_box_coffin
+ {
+ \dim_ratio:nn { \l_@@_box_width_dim }
+ { \coffin_wd:N \l_@@_box_coffin }
+ }
+ {
+ \dim_ratio:nn { \l_@@_box_width_dim }
+ { \coffin_wd:N \l_@@_box_coffin }
+ }
+ }
+ {
+ \coffin_scale:Nnn \l_@@_box_coffin
+ { \l_@@_x_scale_tl }
+ { \l_@@_y_scale_tl }
+ }
+ }
+
+\@@_new_resize_method:nn { base }
+ {
+ \@@_force_size_dispatch:nnnn
+ {
+ \coffin_resize:Nnn \l_@@_box_coffin
+ \l_@@_box_width_dim
+ \l_@@_box_height_dim
+ }
+ {
+ \coffin_resize:Nnn \l_@@_box_coffin
+ {
+ \l_@@_char_width_dim * \dim_ratio:nn { \l_@@_box_height_dim }
+ { \@@_coffin_ht_plus_dp:N \l_@@_box_coffin }
+ }
+ {
+ \l_@@_box_height_dim
+ }
+ }
+ {
+ \coffin_resize:Nnn \l_@@_box_coffin
+ {
+ \l_@@_box_width_dim
+ }
+ {
+ \l_@@_char_height_dim * \dim_ratio:nn { \l_@@_box_width_dim }
+ { \coffin_wd:N \l_@@_box_coffin }
+ }
+ }
+ {
+ \coffin_resize:Nnn \l_@@_box_coffin
+ {
+ \l_@@_x_scale_tl \l_@@_char_width_dim
+ }
+ {
+ \l_@@_y_scale_tl \l_@@_char_height_dim
+ }
+ }
+ }
+\msg_new:nnn { hanzibox } { frame-type } { using~ `#1'~ frame. }
% \end{macrocode}
-% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加背景颜色键。}
+% \changes{v2.0.0}{2021/09/28}{删除square缩放样式}
+%
+% \subsubsection{设置字号}
%
-% \begin{macro}{bgcolor}
-% 汉字盒子背景颜色,默认为black。
+% \begin{macro}{\@@_zihao:n}
+% 设置字号
% \begin{macrocode}
- bgcolor .tl_set:N = \l_@@_bgcolor_tl,
- bgcolor .initial:n = white,
-
+\cs_new_nopar:Npn \@@_zihao:n #1 { \zihao {#1} }
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏拼音键。}
+% \subsubsection{定义边框类型错误提示信息}
%
-% \begin{macro}{withpinyin}
-% 是否显示汉语拼音,默认为true。
% \begin{macrocode}
- withpinyin .bool_set:N = \l_@@_pinyin_bool,
- withpinyin .default:n = true,
- withpinyin .initial:n = true,
-
+\msg_new:nnn { hanzibox } { frame-exists } { The~ frame~ type~ `#1~ not~ exists. }
+% \end{macrocode}
+%
+% \subsubsection{命名颜色}
+%
+% \begin{macro}{\@@_color_select:nn,\@@_color_select:nnn}
+% 颜色命名函数,注意使用的是l3语法
+% \begin{macrocode}
+\cs_set_nopar:Npn \@@_color_select:nn #1#2
+ {
+ \color_set:nn {#1} {#2}
+ }
+\cs_set_nopar:Npn \@@_color_select:nnn #1#2#3
+ {
+ \color_set:nnn {#1} {#2} {#3}
+ }
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏汉字键。}
+% \subsubsection{设置Debug状态}
%
-% \begin{macro}{withhanzi}
-% 是否显示汉语拼音,默认为true。
+% \begin{macro}{\@@_debug:n}
+% 设置debug状态
% \begin{macrocode}
- withhanzi .bool_set:N = \l_@@_hanzi_bool,
- withhanzi .default:n = true,
- withhanzi .initial:n = true,
-
+\cs_new:Npn \@@_debug:n
+ {
+ \bool_if:NTF \l_@@_debug_bool
+ { \use:n } { \use_none:n }
+ }
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏译文键。}
+% \subsection{选项处理}
%
-% \begin{macro}{withtran}
-% 是否显示汉语拼音,默认为true。
+% \changes{v2.0.0}{2021/09/25}{参考zitie宏包,重新设计选项,
+% 仅保留1.1.0版本中的拼音、汉字、译文显示控制选项。}
+%
+% 定义 |hanzibox| 键值类。
% \begin{macrocode}
- withtran .bool_set:N = \l_@@_tran_bool,
- withtran .default:n = true,
- withtran .initial:n = true,
-
+\keys_define:nn { hanzibox }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{basechar}
+% 设置基字符。
+% \begin{macrocode}
+ basechar .code:n = { \tl_gset:Nx \c_@@_basechar_tl {#1}
+ \@@_calc_basechar_w_h:
+ },
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{zihao}
+% 设置字号。
+% \begin{macrocode}
+ zihao .code:n = { \hbox_gset:Nn \l_@@_basebox_box
+ {
+ \@@_zihao:n {#1} \c_@@_basechar_tl
+ }
+ \@@_calc_basechar_w_h:
+ },
+% \end{macrocode}
+% \end{macro}
%
-% 处理未知选项。
+% \begin{macro}{pinyinf}
+% 拼音的格式
% \begin{macrocode}
- unknown .code:n = { \@@_error:n { unknown-option } }
- }
-\msg_new:nnn { hanzibox } { unknown-option }
- { package~ option~ "\l_keys_key_tl"~ is~ unknown. }
-
+ pinyinf .tl_set:N = \l_@@_pinyin_format_tl ,
+ pinyinf .initial:n = \tiny ,
% \end{macrocode}
+% \end{macro}
%
-% \subsection{选项用户接口}
+% \begin{macro}{charf}
+% 汉字的格式
+% \begin{macrocode}
+ charf .code:n = { \tl_gset:Nn \l_@@_character_format_tl {#1}
+ \@@_calc_frame_size:
+ },
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\hanziboxset}
-% 选项设置用户接口。
+% \begin{macro}{tranf}
+% 译文的格式
% \begin{macrocode}
-\NewDocumentCommand \hanziboxset { m }
- { \keys_set:nn { hanzibox } {#1} }
+ tranf .tl_set:N = \l_@@_translation_format_tl ,
+ tranf .initial:n = \tiny ,
% \end{macrocode}
% \end{macro}
%
-% \subsection{内部函数}
+% \begin{macro}{frametype}
+% 设置边框类型,其取值可以是:none-无方框,口–仅方框, 十–仅中间的横线和竖线,
+% 田–常见的田字格, 米–十字格再加上斜的两条线, 咪–常见的米字格。
+% \begin{macrocode}
+ frametype .code:n = { \exp_args:NNx \clist_if_in:NnTF \g_@@_frame_list_clist {#1}
+ { \tl_set:Nx \l_@@_frame_type_tl {#1} }
+ { \msg_error:nnx { hanzibox } { frame-exists } {#1} }
+ },
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\@@_dialog:nnnn}
-% 手动汉字盒子排版内部命令,根据选项用TikZ实现绘制。
+% \begin{macro}{resize}
+% resize 设置缩放方式,其取值可以是:
+% none,不使用缩放
+% real,使用字符实际宽高缩放,
+% base,使用 basechar 设置的字符的宽高缩放,
+% square,使得字符的宽高相等再进行缩放。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_dialog:nnnn #1#2#3
- {
- \tl_set:Nx \l_@@_character_tl {#1}
- \tl_set:Nx \l_@@_pinyin_tl {#2}
- \tl_set:Nx \l_@@_translation_tl {#3}
- \scalebox{\fp_use:N \l_@@_scale_fp}{
- \tikz[scale=0.5, every~node/.style={inner~sep=0,outer~sep=0}]{%
- {\node[] at (1,1){\huge{\l_@@_character_tl}}};
- {\node[label={\strut\small\textbf{\l_@@_pinyin_tl}},
- text~height=1cm] (charr) at (1,1){};}%
- {\node[align=center] at (1,-0.5)
- {\strut\small\textit{\l_@@_translation_tl}};}%
- }%
- }%
- }
-
+ resize .code:n = { \exp_args:NNx \clist_if_in:NnTF \g_@@_resize_method_clist {#1}
+ { \tl_set:Nx \l_@@_resize_method_tl {#1} }
+ { \msg_error:nnx { hanzibox } { resize-method } {#1} }
+ },
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{xscale}
+% x方向缩放比例
+% \begin{macrocode}
+ xscale .tl_set:N = \l_@@_x_scale_tl ,
+ xscale .initial:n = 1 ,
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\@@_pinyinaux:n}
-% \begin{macro}{\@@_pinyinaux:x}
-% \pkg{xpyinyin}宏包\tn{pinyin} 命令的\LaTeX3{}版本函数及其函数变体。
+% \begin{macro}{yscale}
+% y方向缩放比例
% \begin{macrocode}
-\cs_set_eq:NN \@@_pinyinaux:n \pinyin
-\cs_generate_variant:Nn \@@_pinyinaux:n { x }
+ yscale .tl_set:N = \l_@@_y_scale_tl ,
+ yscale .initial:n = 1 ,
% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{scale}
+% x,y方向缩放比例
+% \begin{macrocode}
+ scale .meta:n = { xscale = #1 , yscale = #1 } ,
+% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加整体缩放代码。}
-% \changes{v1.1.0}{2021/09/21}{添加按需要隐藏拼音、汉字或译文代码。}
-% \changes{v1.1.0}{2021/09/21}{将隐藏功能修正为用前景/背景色实现。}
-% \changes{v1.1.0}{2021/09/22}{将各部分绘制分解为函数实现。}
+% \begin{macro}{width}
+% 盒子宽度
+% \begin{macrocode}
+ width .dim_set:N = \l_@@_box_width_dim ,
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\@@_draw:nnnn}
-% 自动汉字盒子排版内部命令,根据选项用TikZ实现绘制。
+% \begin{macro}{height}
+% 盒子高度
% \begin{macrocode}
-\cs_new_protected:Npn \@@_draw:nnnn #1#2#3#4
- {
+ height .dim_set:N = \l_@@_box_height_dim ,
% \end{macrocode}
+% \end{macro}
%
-% 设置盒子外观选项
+% \begin{macro}{linewidth}
+% 线条宽度
+% \begin{macrocode}
+ linewidth .dim_set:N = \l_@@_linewidth_dim ,
+ linewidth .initial:n = 0.4pt ,
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{framecolor}
+% 边框颜色
% \begin{macrocode}
- \keys_set:nn { hanzibox } { #1 }
+ framecolor .code:n = { \@@_color_select:nn { hanziboxframecolor } {#1} } ,
+ framecolor .initial:n = black ,
+ framecolor* .code:n = { \@@_color_select:nnn { hanziboxframecolor } #1 } ,
% \end{macrocode}
+% \end{macro}
%
-% 将各参数存入token list变量,注意使用x递归展开
+% \begin{macro}{charcolor}
+% 字符颜色
+% \begin{macrocode}
+ charcolor .code:n = { \@@_color_select:nn { hanziboxcharcolor } {#1} } ,
+ charcolor .initial:n = black ,
+ charcolor* .code:n = { \@@_color_select:nnn { hanziboxframecolor } {#1} } ,
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{color}
+% 同时设置边框和字符颜色
% \begin{macrocode}
- \tl_set:Nx \l_@@_character_tl {#2}
- \tl_set:Nx \l_@@_pinyin_tl {#3}
- \tl_set:Nx \l_@@_translation_tl {#4}
+ color .meta:n = { framecolor = #1, charcolor = #1 } ,
+ color* .meta:n = { framecolor* = #1, charcolor* = #1 } ,
% \end{macrocode}
+% \end{macro}
%
-% 计算token list中的内容长度(个数)
+% \begin{macro}{fillcolor}
+% 填充色
+% \begin{macrocode}
+ fillcolor .code:n = { \exp_args:Nx \tl_if_empty:nTF {#1}
+ { \@@_color_select:nn { hanziboxfillcolor } { white }
+ \cs_set_nopar:Npn \@@_aux_color_fill: { }
+ }{ \@@_color_select:nn { hanziboxfillcolor } {#1}
+ \cs_set_nopar:Npn \@@_aux_color_fill: { \color_fill:n {#1} }
+ }
+ } ,
+ fillcolor* .code:n = { \@@_color_select:nnn { hanziboxfillcolor } #1
+ \cs_set_nopar:Npn \@@_aux_color_fill: { \color_fill:nn #1 }
+ } ,
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{dashpattern}
+% 虚线样式
% \begin{macrocode}
- \int_set:Nn \l_@@_character_int
- {
- \tl_count:V \l_@@_character_tl
- }
- \int_set:Nn \l_@@_pinyin_int
- {
- \tl_count:V \l_@@_pinyin_tl
- }
- \int_set:Nn \l_@@_translation_int
- {
- \tl_count:V \l_@@_translation_tl
- }
-
- \scalebox{\fp_use:N \l_@@_scale_fp}{
- \tikz[scale=0.5, every~node/.style={inner~sep=0,outer~sep=0}]{%
+ dashpattern .tl_set:N = \l_@@_dash_pattern_tl ,
+ dashpattern .initial:n = { } ,
% \end{macrocode}
+% \end{macro}
%
-% 根据汉字长度绘制汉字盒子背景,必须提前绘制
+% \begin{macro}{framearc}
+% 转角半径
+% \begin{macrocode}
+ framearc .code:n = { \tl_set:Nn \l_@@_frame_arc_tl { {#1}{#1} } } ,
+ framearc* .tl_set:N = \l_@@_frame_arc_tl ,
+ framearc* .initial:n = { { 0cm }{ 0cm } } ,
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{debug}
+% Debug状态
% \begin{macrocode}
- \@@_border_draw:n {0.0cm}
+ debug .bool_set:N = \l_@@_debug_bool ,
+ debug .initial:n = false ,
+ debug .default:n = true ,
% \end{macrocode}
+% \end{macro}
%
-% 如果显示汉字,则内部格线应该提前绘制
+% \begin{macro}{autopinyin}
+% 是否使用\tn{xpyinyin*}命令通过汉字自动获取汉语拼音,默认为true。
+% \begin{macrocode}
+ autopinyin .bool_set:N = \l_@@_autopinyin_bool,
+ autopinyin .default:n = true,
+ autopinyin .initial:n = true,
+
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{initial}
+% 是否输出声母,默认为true。
% \begin{macrocode}
- \bool_if:NT \l_@@_hanzi_bool
- {
- \@@_frame_background:n {0.0cm}
- }
- \int_compare:nNnTF { \l_@@_character_int } = {0}
- {
- \bool_if:NTF \l_@@_hanzi_bool
- {
- \node[\l_@@_fgcolor_tl] at (1,1){\huge{\l_@@_character_tl}};
- }{
- \node[\l_@@_bgcolor_tl] at (1,1){\huge{\l_@@_character_tl}};
- }
- \bool_if:NTF \l_@@_pinyin_bool
- {
- \node[label={[font=\small,text=\l_@@_fgcolor_tl]
- \strut\@@_pinyinaux:x {\l_@@_pinyin_tl}},
- text~height=1cm] (charr) at (1,1){};
- }{
- \node[label={[font=\small,text=\l_@@_bgcolor_tl]
- \strut\@@_pinyinaux:x {\l_@@_pinyin_tl}},
- text~height=1cm] (charr) at (1,1){};
- }
- \@@_tran_draw:nn {1}{-0.5}
- }
- {
- \bool_if:NTF \l_@@_hanzi_bool
- {
- \node[\l_@@_fgcolor_tl] at (1*\l_@@_character_int,1)
- {\huge\tl_use:N \l_@@_character_tl};
- }{
- \node[\l_@@_bgcolor_tl] at (1*\l_@@_character_int,1)
- {\huge\tl_use:N \l_@@_character_tl};
- }
+ initial .bool_set:N = \l_@@_withinitials_bool,
+ initial .default:n = true,
+ initial .initial:n = true,
- \bool_if:NTF \l_@@_pinyin_bool
- {
- \node[label={[font=\small,text=\l_@@_fgcolor_tl]
- \strut\@@_pinyinaux:x {\l_@@_pinyin_tl}},
- text~height=1cm] (charr) at (1*\l_@@_character_int,1){};
- }{
- \node[label={[font=\small,text=\l_@@_bgcolor_tl]
- \strut\@@_pinyinaux:x {\l_@@_pinyin_tl}},
- text~height=1cm] (charr) at (1*\l_@@_character_int,1){};
- }
- \@@_tran_draw:nn {\l_@@_character_int}{-0.5}
- }
% \end{macrocode}
+% \end{macro}
%
-% 如果不显示汉字,则内部格线应该最后绘制
+% \begin{macro}{vowel}
+% 是否输出韵母,默认为true。
+% \begin{macrocode}
+ vowel .bool_set:N = \l_@@_withvowel_bool,
+ vowel .default:n = true,
+ vowel .initial:n = true,
+
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{tone}
+% 是否输出声调,默认为true。
% \begin{macrocode}
- \bool_if:NF \l_@@_hanzi_bool
- {
- \@@_frame_background:n {0.0cm}
- }
- }%
- }%
- }
+ tone .bool_set:N = \l_@@_withtone_bool,
+ tone .default:n = true,
+ tone .initial:n = true,
+
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加\tn{hanzibox*}星号命令的内部实现代码。}
-% \changes{v1.1.0}{2021/09/21}{添加按需要隐藏拼音、汉字或译文代码。}
-% \changes{v1.1.0}{2021/09/21}{将隐藏功能修正为用前景/背景色实现。}
-% \changes{v1.1.0}{2021/09/22}{将各部分绘制分解为函数实现。}
+% \changes{v1.1.0}{2021/09/21}{添加隐藏拼音键。}
%
-% \begin{macro}{\@@_asterisk_draw:nnnn}
-% 自动汉字拼音盒子排版内部命令,根据选项用TikZ实现绘制。
+% \begin{macro}{pinyin}
+% 是否显示汉语拼音,默认为true。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_asterisk_draw:nnnn #1#2#3#4
- {
+ pinyin .bool_set:N = \l_@@_withpinyin_bool,
+ pinyin .default:n = true,
+ pinyin .initial:n = true,
+
% \end{macrocode}
+% \end{macro}
%
-% 设置盒子外观选项
+% \changes{v1.1.0}{2021/09/21}{添加隐藏汉字键。}
%
+% \begin{macro}{hanzi}
+% 是否显示汉语拼音,默认为true。
% \begin{macrocode}
- \keys_set:nn { hanzibox } { #1 }
+ hanzi .bool_set:N = \l_@@_withhanzi_bool,
+ hanzi .default:n = true,
+ hanzi .initial:n = true,
+
% \end{macrocode}
+% \end{macro}
%
-% 将各参数存入token list变量,注意使用x递归展开
+% \changes{v1.1.0}{2021/09/21}{添加隐藏译文键。}
%
+% \begin{macro}{tran}
+% 是否显示汉语拼音,默认为true。
% \begin{macrocode}
- \tl_set:Nx \l_@@_character_tl {#2}
- \tl_set:Nx \l_@@_pinyin_tl {#3}
- \tl_set:Nx \l_@@_translation_tl {#4}
+ tran .bool_set:N = \l_@@_withtran_bool,
+ tran .default:n = true,
+ tran .initial:n = true,
+
% \end{macrocode}
+% \end{macro}
%
-% 计算token list中的内容长度(个数)
%
+% 处理未知选项。
% \begin{macrocode}
- \int_set:Nn \l_@@_character_int
- {
- \tl_count:V \l_@@_character_tl
- }
- \int_set:Nn \l_@@_pinyin_int
- {
- \tl_count:V \l_@@_pinyin_tl
- }
- \int_set:Nn \l_@@_translation_int
- {
- \tl_count:V \l_@@_translation_tl
- }
+ unknown .code:n = { \@@_error:n { unknown-option } }
+ }
+\msg_new:nnn { hanzibox } { unknown-option }
+ { package~ option~ "\l_keys_key_tl"~ is~ unknown. }
+
+% \end{macrocode}
+%
+% 参数默认值
+% \begin{macrocode}
+\keys_set:nn { hanzibox }
+ {
+ basechar = 好 ,
+ zihao = 4 ,
+ pinyinf = \tiny ,
+ charf = \normalsize ,
+ tranf = \tiny ,
+ frametype = none ,
+ resize = none ,
+ }
- \scalebox{\fp_use:N \l_@@_scale_fp}{
- \tikz[scale=0.5, every~node/.style={inner~sep=0,outer~sep=0}]{%
% \end{macrocode}
%
-% 根据汉字长度绘制汉字盒子背景,必须提前绘制
+% \subsection{选项用户接口}
%
+% \begin{macro}{\hanziboxset}
+% 选项设置用户接口。
% \begin{macrocode}
- \@@_border_draw:n {-0.5cm}
+\NewDocumentCommand \hanziboxset { m }
+ { \keys_set:nn { hanzibox } {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{内部函数}
+%
+% \begin{macro}{\@@_pinyinaux:n}
+% \begin{macro}{\@@_pinyinaux:x}
+% \pkg{xpyinyin}宏包\tn{pinyin} 命令的\LaTeX3{}版本函数及其函数变体。
+% \begin{macrocode}
+ % \xpinyinsetup{pysep={\hspace*{1em}}}
+\cs_set_eq:NN \@@_pinyinaux:n \pinyin
+\cs_generate_variant:Nn \@@_pinyinaux:n { x }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_dialog:nnnn}
+% 手动汉字盒子排版内部命令。
+% \begin{macrocode}
+\cs_new:Npn \@@_dialog:nnnn #1#2#3#4
+ {
+ \group_begin:
+ \keys_set:nn { hanzibox } { #1 }
+
+ \tl_set:Nx \l_@@_character_tl {#2}
+ \tl_set:Nx \l_@@_pinyin_tl {#3}
+ \tl_set:Nx \l_@@_translation_tl {#4}
+
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \tl_use:N \l_@@_pinyin_format_tl
+ \tl_use:N \l_@@_pinyin_tl
+ }
+ \hcoffin_set:Nn \l_@@_str_box_coffin
+ {
+ \tl_map_inline:Nn \l_@@_character_tl
+ {
+ \@@_single_handle:N ##1 \allowbreak
+ }
+ }
+ \hcoffin_set:Nn \l_@@_tran_box_coffin
+ {
+ \tl_use:N \l_@@_translation_format_tl
+ \tl_use:N \l_@@_translation_tl
+ }
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin
+ { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin
+ { hc } { b } \l_@@_tran_box_coffin { hc } { t } { 0pt } { -2pt }
+
+ \coffin_set_eq:NN \l_@@_box_coffin \l_@@_str_box_coffin
+
+ \@@_resize_c:n { \l_@@_resize_method_tl }
+
+ \coffin_typeset:Nnnnn \l_@@_box_coffin
+ { l } { b } { 0pt } { 0pt }
+ \group_end:
+ }
% \end{macrocode}
+% \end{macro}
%
-% 如果显示汉字,则内部格线应该提前绘制
+% \changes{v2.0.0}{2021/09/28}{将拼音处理调整为在handle函数中直接实现}
+% \changes{v2.0.0}{2021/09/28}{区分了单个汉字和0个汉字的处理}
%
+% \begin{macro}{\@@_handle:nnnn}
+% 构造汉字盒子入口
% \begin{macrocode}
- \bool_if:NT \l_@@_hanzi_bool
+\cs_new:Npn \@@_handle:nnnn #1#2#3#4
+ {
+ \group_begin:
+ \keys_set:nn { hanzibox } { #1 }
+
+ \tl_set:Nx \l_@@_character_tl {#2}
+ \tl_set:Nx \l_@@_pinyin_tl {#3}
+ \tl_set:Nx \l_@@_translation_tl {#4}
+
+ \int_set:Nn \l_@@_character_int
+ {
+ \tl_count:V \l_@@_character_tl
+ }
+ \int_set:Nn \l_@@_translation_int
{
- \@@_frame_background:n {-0.5cm}
+ \tl_count:V \l_@@_translation_tl
}
- \int_compare:nNnTF { \l_@@_character_int } = {0}
+ \int_set:Nn \l_@@_pinyin_int
{
- \bool_if:NTF \l_@@_pinyin_bool
+ \tl_count:V \l_@@_pinyin_tl
+ }
+
+ \bool_if:NTF \l_@@_autopinyin_bool
+ {
+ \int_compare:nNnTF { \l_@@_character_int } > { 0 }
{
- \bool_if:NTF \l_@@_hanzi_bool
+ \hcoffin_set:Nn \l_@@_str_box_coffin
{
- \node[\l_@@_fgcolor_tl] at (1,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_fgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
- }{
- \node[\l_@@_bgcolor_tl] at (1,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_fgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
+ \tl_map_inline:Nn \l_@@_character_tl
+ {
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \@@_single_handle:N ##1
+ }
+
+ \bool_if:NT \l_@@_withpinyin_bool
+ {
+ \tl_gset_eq:Nc \l_@@_pinyin_tl
+ {
+ c__xpinyin_ \int_to_arabic:n { `##1 } _tl
+ }
+ \@@_single_pinyin:V \l_@@_pinyin_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_if:NTF \l_@@_hanzi_bool
+ }
+ {
+ \hcoffin_set:Nn \l_@@_str_box_coffin
{
- \node[\l_@@_fgcolor_tl] at (1,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_bgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
- }{
- \node[\l_@@_fgcolor_tl] at (1,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_bgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
+ \bool_set_false:N \l_@@_withhanzi_bool
+ \tl_set:Nn \l_@@_character_tl {好}
+
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \@@_single_handle:N \l_@@_character_tl
+ }
+
+ \bool_if:NT \l_@@_withpinyin_bool
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+ \@@_pinyinaux:x {\l@@_pinyin_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
}
}
- \@@_tran_draw:nn {1}{-1.0}
}
{
- \bool_if:NTF \l_@@_pinyin_bool
+ \int_compare:nNnTF { \l_@@_character_int } > { 1 }
+ {
+ \hcoffin_set:Nn \l_@@_str_box_coffin
+ {
+ \tl_map_inline:Nn \l_@@_character_tl
+ {
+ \@@_single_handle:N ##1 \allowbreak
+ }
+ }
+ \bool_if:NT \l_@@_withpinyin_bool
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \@@_pinyinaux:x {\l_@@_pinyin_tl}
+ }
+ }
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin
+ { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 7pt }
+ }
{
- \bool_if:NTF \l_@@_hanzi_bool
+ \int_compare:nNnTF { \l_@@_character_int } = { 1 }
{
- \node[\l_@@_fgcolor_tl] at (1*\l_@@_character_int,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_fgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
- }{
- \node[\l_@@_bgcolor_tl] at (1*\l_@@_character_int,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_fgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
+ \hcoffin_set:Nn \l_@@_str_box_coffin
+ {
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \@@_single_handle:N \l_@@_character_tl
+ }
+
+ \bool_if:NT \l_@@_withpinyin_bool
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+ \@@_pinyinaux:x {\l@@_pinyin_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_if:NTF \l_@@_hanzi_bool
{
- \node[\l_@@_fgcolor_tl] at (1*\l_@@_character_int,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_bgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
- }{
- \node[\l_@@_fgcolor_tl] at (1*\l_@@_character_int,1)
- {\huge{\xpinyin*[format={\small\color{\l_@@_bgcolor_tl}},
- vsep=0.90 cm]{\l_@@_character_tl}}};
+ \hcoffin_set:Nn \l_@@_str_box_coffin
+ {
+ \bool_set_false:N \l_@@_withhanzi_bool
+ \tl_set:Nn \l_@@_character_tl {好}
+
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \@@_single_handle:N \l_@@_character_tl
+ }
+
+ \bool_if:NT \l_@@_withpinyin_bool
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+ \@@_pinyinaux:x {\l@@_pinyin_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
+ }
}
}
- \@@_tran_draw:nn {\l_@@_character_int}{-1.0}
}
+ \bool_if:NT \l_@@_withtran_bool
+ {
+ \hcoffin_set:Nn \l_@@_tran_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_translation_format_tl
+ \tl_use:N \l_@@_translation_tl
+ }
+ }
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin
+ { hc } { b } \l_@@_tran_box_coffin { hc } { t } { 0pt } { -3pt }
+
+ \coffin_set_eq:NN \l_@@_box_coffin \l_@@_str_box_coffin
+
+ \@@_resize_c:n { \l_@@_resize_method_tl }
+
+ \coffin_typeset:Nnnnn \l_@@_box_coffin
+ { l } { b } { 0pt } { 0pt }
+ \group_end:
+ }
% \end{macrocode}
+% \end{macro}
%
-% 如果不显示汉字,则内部格线应该最后绘制
+% \changes{v2.0.0}{2021/09/27}{对于无需分解声韵母的情况,
+% 直接使用xpinyin宏包的结果排版拼音。}
%
+% \begin{macro}{\@@_single_pinyin:n}
+% 构造单个汉字的拼音盒子
% \begin{macrocode}
- \bool_if:NF \l_@@_hanzi_bool
+\cs_new:Npn \@@_single_pinyin:n #1
+ {
+ \bool_if:NTF \l_@@_withtone_bool
+ {
+ \bool_if:nTF { !(\l_@@_withinitials_bool) || !(\l_@@_withvowel_bool) }
+ {
+ \@@_split_pinyin_withtone:n { #1 }
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+
+ \bool_if:NTF \l_@@_withinitials_bool
+ {
+ \bool_if:NTF \l_@@_withvowel_bool
+ {
+ \tl_use:N \l_@@_initial_tl
+ \tl_use:N \l_@@_vowel_tl
+ }
+ {
+ \tl_use:N \l_@@_initial_tl
+ \phantom{ \tl_use:N \l_@@_vowel_tl }
+ }
+ }
+ {
+ \bool_if:NTF \l_@@_withvowel_bool
+ {
+ \phantom{ \tl_use:N \l_@@_initial_tl }
+ \tl_use:N \l_@@_vowel_tl
+ }
+ {
+ \phantom{ \tl_use:N \l_@@_initial_tl }
+ \phantom{ \tl_use:N \l_@@_vowel_tl }
+ }
+ }
+ }
+ }
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+ #1
+ }
+ }
+ }
+ {
+ \@@_split_pinyin_withouttone:n { #1 }
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
{
- \@@_frame_background:n {-0.5cm}
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+
+ \tl_use:N \l_@@_pinyin_tl
}
- }%
- }%
+ }
}
+\cs_generate_variant:Nn \@@_single_pinyin:n { V }
+\cs_generate_variant:Nn \@@_single_pinyin:n { x }
+\cs_set:Npn \@@_single_pinyin_o:n
+ { \exp_after:wN \@@_single_pinyin:n }
+\cs_set:Npn \@@_single_pinyin_f:n
+ { \exp_args:Nf \@@_single_pinyin:n }
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/22}{添加方格背景绘制内部函数。}
+% \begin{macro}{\@@_single_handle:nN,\@@_single_handle:N}
+% 构造单个汉字盒子入口
+% \begin{macrocode}
+\cs_new:Npn \@@_single_handle:nN #1#2
+ {
+ \group_begin:
+ \tl_if_empty:nF {#1} { \keys_set:nn { hanzibox } {#1} }
+
+ \tl_set:Nf \l_@@_curr_char_tl {#2}
+
+ \@@_single_construct_o:N \l_@@_curr_char_tl
+ \group_end:
+ }
+\cs_new:Npn \@@_single_handle:N #1
+ {
+ \group_begin:
+ \tl_set:Nf \l_@@_curr_char_tl {#1}
+ \@@_single_construct_o:N \l_@@_curr_char_tl
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.0.0}{2021/09/27}{删除单个汉字构造中添加拼音的功能}
%
-% \begin{macro}{\@@_frame_background:n}
-% TikZ米字格绘制代码。
+% \begin{macro}{\@@_single_construct:N}
+% 构造单个汉字盒子
% \begin{macrocode}
-\cs_new_protected:Npn \@@_frame_background:n #1
+\cs_new:Npn \@@_single_construct:N #1
{
- \int_compare:nNnT { \l_@@_character_int } < {2}
+ \bool_if:NTF \l_@@_withhanzi_bool
{
- \int_case:nn {\l_@@_inner_int}
+ \hcoffin_set:Nn \l_@@_box_coffin
{
- {1}{
- }
- {2}{
- \@@_star_background:n {#1}
- }
- {3}{
- \@@_cross_background:n {#1}
- }
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_character_format_tl
+ #1
+ }
+ }
+ {
+ \hcoffin_set:Nn \l_@@_box_coffin
+ {
+ \color_select:n { hanziboxcharcolor }
+ \tl_use:N \l_@@_character_format_tl
+ \phantom{#1}
}
}
+
+ \@@_single_frame_construct:
}
+\cs_set:Npn \@@_single_construct_o:N
+ { \exp_after:wN \@@_single_construct:N }
+\cs_set:Npn \@@_single_construct_f:N
+ { \exp_args:Nf \@@_single_construct:N }
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/22}{添加米字格内部函数。}
+% \changes{v2.0.0}{2021/09/28}{为边框添加偏移,以使汉字尽量居中}
%
-% \begin{macro}{\@@_star_background:n}
-% TikZ米字格绘制代码。
+% \begin{macro}{\@@_single_frame_construct:}
+% 构造单个汉字盒子边框
% \begin{macrocode}
-\cs_new_protected:Npn \@@_star_background:n #1
+\cs_new:Npn \@@_single_frame_construct:
{
- \draw[stretch~dash=on~2pt~off~2pt,thin, yshift=#1,
- \l_@@_bordercolor_tl!50](0,0)--(2,2);%
- \draw[stretch~dash=on~2pt~off~2pt,thin, yshift=#1,
- \l_@@_bordercolor_tl!50](0,2)--(2,0);%
-
- \draw[stretch~dash=on~2pt~off~2pt,thin, yshift=#1,
- \l_@@_bordercolor_tl!50](0,1)--(2,1);%
- \draw[stretch~dash=on~2pt~off~2pt,thin, yshift=#1,
- \l_@@_bordercolor_tl!50](1,0)--(1,2);%
+ \draw_begin:
+ \draw_linewidth:n { \l_@@_linewidth_dim }
+ \@@_aux_color_fill:
+ \color_stroke:n { hanziboxframecolor }
+
+ \exp_after:wN \draw_path_corner_arc:nn \l_@@_frame_arc_tl
+
+ \draw_path_scope_begin:
+ \draw_transform_shift:n { -1.00pt, -1.50pt }
+ \@@_frame_type_c:n { \l_@@_frame_type_tl }
+ { 0 } { 0 } { \hanziboxwidth } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_path_scope_end:
+ \draw_coffin_use:Nnn \l_@@_box_coffin { l } { b }
+ \draw_end:
}
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/22}{添加田字格背景内部函数。}
+% \subsection{\pkg{xpinyin}宏包拼音后处理函数}
+%
+% \changes{v2.0.0}{2021/09/24}{添加从xpinyin宏包中提取拼音函数。}
+% 代码摘录自LaTeX工作室:基于xpinyin宏包获取汉字的声母,韵母,声调
+% (\url{https://www.latexstudio.net/index/details/index/mid/1994.html})
+%
+% 从需要的声母、韵母、读音表。
%
-% \begin{macro}{\@@_cross_background:n}
-% TikZ田字格绘制代码。
+% 声母表
% \begin{macrocode}
-\cs_new_protected:Npn \@@_cross_background:n #1
+\clist_set:Nn \l_@@_initials_clist
{
- \draw[stretch~dash=on~2pt~off~2pt,thin, yshift=#1,
- \l_@@_bordercolor_tl!50](0,1)--(2,1);%
- \draw[stretch~dash=on~2pt~off~2pt,thin, yshift=#1,
- \l_@@_bordercolor_tl!50](1,0)--(1,2);%
+ {zh} , {ch} , {sh} , {b} , {p} , {m} , {f} ,
+ {d} , {t} , {l} , {k} , {h} , {j} , {q} ,
+ {x} , {r} , {z} , {c} , {s} , {y} , {w} ,
+ {g} , {n}
}
% \end{macrocode}
-% \end{macro}
%
-% \changes{v1.1.0}{2021/09/22}{添加背景方格内部函数。}
+% \changes{v2.0.0}{2021/09/27}{修订部分错误带音调韵母表}
%
-% \begin{macro}{\@@_border_draw:n}
-% 绘制边框代码。
+% 带声音调韵母表
% \begin{macrocode}
-\cs_new_protected:Npn \@@_border_draw:n #1
+\clist_set:Nn \l_@@_vowel_tone_clist
{
- \int_compare:nNnTF { \l_@@_character_int } = {0}
- {
- \draw[fill=\l_@@_bgcolor_tl,line~width=\l_@@_borderwidth_dim,
- yshift=#1, draw=\l_@@_bordercolor_tl] (0,0) rectangle(2,2);
- }
- {
- \bool_if:NTF \l_@@_border_bool
- {
- \draw[fill=\l_@@_bgcolor_tl,line~width=\l_@@_borderwidth_dim,
- yshift=#1, draw=\l_@@_bordercolor_tl] (0,0)
- rectangle(2*\l_@@_character_int,2);
- }{}
- }
+ {iāng} , {iáng} , {iǎng} , {iàng} , {iang} ,
+ {iōng} , {ióng} , {iǒng} , {iòng} , {iong} ,
+ {uāng} , {uáng} , {uǎng} , {uàng} , {uang} ,
+ {uēng} , {uéng} , {uěng} , {uèng} , {ueng} ,
+ {āng} , {áng} , {ǎng} , {àng} , {ang} ,
+ {ēng} , {éng} , {ěng} , {èng} , {eng} ,
+ {īng} , {íng} , {ǐng} , {ìng} , {ing} ,
+ {ōng} , {óng} , {ǒng} , {òng} , {ong} ,
+ {uāi} , {uái} , {uǎi} , {uài} , {uai} ,
+ {uān} , {uán} , {uǎn} , {uàn} , {uan} ,
+ {uēi} , {uéi} , {uěi} , {uèi} , {uei} ,
+ {uāo} , {uáo} , {uǎo} , {uào} , {uao} ,
+ {iōu} , {ióu} , {iǒu} , {iòu} , {iou} ,
+ {iān} , {ián} , {iǎn} , {iàn} , {ian} ,
+ {üān} , {üán} , {üǎn} , {üàn} , {üan} ,
+ {uēn} , {uén} , {uěn} , {uèn} , {uen} ,
+ {āi} , {ái} , {ǎi} , {ài} , {ai} ,
+ {ēi} , {éi} , {ěi} , {èi} , {ei} ,
+ {uā} , {uá} , {uǎ} , {uà} , {ua} ,
+ {uō} , {uó} , {uǒ} , {uò} , {uo} ,
+ {uī} , {uí} , {uǐ} , {uì} , {ui} ,
+ {āo} , {áo} , {ǎo} , {ào} , {ao} ,
+ {ōu} , {óu} , {ǒu} , {òu} , {ou} ,
+ {iū} , {iú} , {iǔ} , {iù} , {iu} ,
+ {iā} , {iá} , {iǎ} , {ià} , {ia} ,
+ {iē} , {ié} , {iě} , {iè} , {ie} ,
+ {uē} , {ué} , {uě} , {uè} , {ue} ,
+ {üē} , {üé} , {üě} , {üè} , {üe} ,
+ {ēr} , {ér} , {ěr} , {èr} , {er} ,
+ {ān} , {án} , {ǎn} , {àn} , {an} ,
+ {ēn} , {én} , {ěn} , {èn} , {en} ,
+ {īn} , {ín} , {ǐn} , {ìn} , {in} ,
+ {ūn} , {ún} , {ǔn} , {ùn} , {un} ,
+ {ǖn} , {ǘn} , {ǚn} , {ǜn} , {ün} ,
+ {ā} , {á} , {ǎ} , {à} , {a} ,
+ {ē} , {é} , {ě} , {è} , {e} ,
+ {ī} , {í} , {ǐ} , {ì} , {i} ,
+ {ō} , {ó} , {ǒ} , {ò} , {o} ,
+ {ū} , {ú} , {ǔ} , {ù} , {u} ,
+ {ǖ} , {ǘ} , {ǚ} , {ǜ} , {ü}
+ }
+% \end{macrocode}
+%
+% 韵母表
+% \begin{macrocode}
+\clist_set:Nn \l_@@_vowel_clist
+ {
+ {iang} , {iong} , {uang} , {ueng} , {ang} , {eng} , {ing} ,
+ {ong} , {uai} , {uan} , {uai} , {uei} , {iao} , {iou} ,
+ {ian} , {üan} , {uen} , {ai} , {ei} , {ua} , {uo} ,
+ {ui} , {ao} , {ou} , {iu} , {ie} , {üe} , {er} ,
+ {an} , {en} , {in} , {un} , {ün} , {a} , {e} ,
+ {i} , {o} , {ü} , {u}
+ }
+% \end{macrocode}
+%
+% 声调表
+% \begin{macrocode}
+\clist_set:Nn \l_@@_tone_num_clist
+ {
+ {ā} {a1} , {á} {a2} , {ǎ} {a3} , {à} {a4} ,
+ {ō} {o1} , {ó} {o2} , {ǒ} {o3} , {ò} {o4} ,
+ {ē} {e1} , {é} {e2} , {ě} {e3} , {è} {e4} ,
+ {ū} {u1} , {ú} {u2} , {ǔ} {u3} , {ù} {u4} ,
+ {ḿ} {m2} ,
+ {ń} {n2} , {ň} {n3} , {ǹ} {n4} ,
+ {ī} {i1} , {í} {i2} , {ǐ} {i3} , {ì} {i4} ,
+ {ǖ} {v1} , {ǘ} {v2} , {ǚ} {v3} , {ǜ} {v4}
}
% \end{macrocode}
-% \end{macro}
%
-% \changes{v1.1.0}{2021/09/22}{添加译文文本绘制内部函数。}
+% 去声调表
+% \begin{macrocode}
+\clist_set:Nn \l_@@_nonetone_clist
+ {
+ {ā} {a} , {á} {a} , {ǎ} {a} , {à} {a} ,
+ {ō} {o} , {ó} {o} , {ǒ} {o} , {ò} {o} ,
+ {ē} {e} , {é} {e} , {ě} {e} , {è} {e} ,
+ {ū} {u} , {ú} {u} , {ǔ} {u} , {ù} {u} ,
+ {ḿ} {m} ,
+ {ń} {n} , {ň} {n} , {ǹ} {n} ,
+ {ī} {i} , {í} {i} , {ǐ} {i} , {ì} {i} ,
+ {ǖ} {ü} , {ǘ} {ü} , {ǚ} {ü} , {ǜ} {ü}
+ }
+% \end{macrocode}
%
-% \begin{macro}{\@@_tran_draw:nn}
-% 绘制译文文本。
+% \begin{macro}{\@@_split_pinyin_withtone:n}
+% 分离拼音中的声母和带声调的韵母。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_tran_draw:nn #1#2
+\cs_new_protected:Npn \@@_split_pinyin_withtone:n #1
{
- \bool_if:NTF \l_@@_tran_bool
+ \int_zero:N \l_@@_tone_int
+ \str_clear:N \l_@@_pinyin_str
+ \tl_clear:N \l_@@_pinyin_tl
+ \tl_clear:N \l_@@_initial_tl
+ \tl_clear:N \l_@@_vowel_tl
+
+ \tl_set:Nn \l_@@_pinyin_tl {#1}
+
+ \tl_map_inline:Nn \l_@@_pinyin_tl
{
- \node[align=center,\l_@@_fgcolor_tl] at (1*#1,#2)
- {\strut\small\textit{\l_@@_translation_tl}};
- }{
- \node[align=center,\l_@@_bgcolor_tl] at (1*#1,#2)
- {\strut\small\textit{\l_@@_translation_tl}};
+ \str_put_right:Nn \l_@@_pinyin_str {##1}
+ }
+
+ \clist_map_inline:Nn \l_@@_initials_clist
+ {
+ \str_if_in:NnT { \l_@@_pinyin_str } {##1}
+ {
+ \tl_set:Nn \l_@@_initial_tl {##1}
+ \clist_map_break:
+ }
+ }
+
+ \clist_map_inline:Nn \l_@@_vowel_tone_clist
+ {
+ \str_if_in:NnT { \l_@@_pinyin_str } { ##1 }
+ {
+ \tl_set:Nn \l_@@_vowel_tl {##1}
+ \clist_map_break:
+ }
+ }
+ }
+\cs_generate_variant:Nn \@@_split_pinyin:n { V }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_split_pinyin_withouttone:n}
+% 分离拼音中的声母和不带声调的韵母。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_split_pinyin_withouttone:n #1
+ {
+ \int_zero:N \l_@@_tone_int
+ \str_clear:N \l_@@_pinyin_str
+ \tl_clear:N \l_@@_pinyin_tl
+ \tl_clear:N \l_@@_initial_tl
+ \tl_clear:N \l_@@_vowel_tl
+
+ \tl_set:Nn \l_@@_pinyin_tl {#1}
+
+ \clist_map_inline:Nn \l_@@_nonetone_clist
+ {
+ \tl_replace_all:Nnn \l_@@_pinyin_tl ##1
+ }
+
+ \tl_map_inline:Nn \l_@@_pinyin_tl
+ {
+ \str_put_right:Nn \l_@@_pinyin_str {##1}
+ }
+
+ \clist_map_inline:Nn \l_@@_initials_clist
+ {
+ \str_if_in:NnT {\l_@@_pinyin_str} {##1}
+ {
+ \tl_set:Nn \l_@@_initial_tl {##1}
+ \clist_map_break:
+ }
+ }
+
+ \clist_map_inline:Nn \l_@@_vowel_clist
+ {
+ \str_if_in:NnT { \l_@@_pinyin_str } { ##1 }
+ {
+ \tl_set:Nn \l_@@_vowel_tl {##1}
+ \clist_map_break:
+ }
}
}
+\cs_generate_variant:Nn \@@_split_pinyin:n { V }
% \end{macrocode}
% \end{macro}
%
diff --git a/macros/xetex/latex/hanzibox/hanzibox.pdf b/macros/xetex/latex/hanzibox/hanzibox.pdf
index 57f81b9296..0d4335cc6e 100644
--- a/macros/xetex/latex/hanzibox/hanzibox.pdf
+++ b/macros/xetex/latex/hanzibox/hanzibox.pdf
Binary files differ