From 81a7ccd5ab5c04e2749fb3f4c99f816b4c1acae6 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 24 Dec 2024 03:02:52 +0000 Subject: CTAN sync 202412240302 --- macros/latex/contrib/colorblind/ChangeLog | 13 +- macros/latex/contrib/colorblind/README.md | 2 +- macros/latex/contrib/colorblind/colorblind.sty | 811 +++++++++++---------- macros/latex/contrib/colorblind/colorblind_doc.pdf | Bin 0 -> 129981 bytes macros/latex/contrib/colorblind/colorblind_doc.tex | 422 +++++++++++ macros/latex/contrib/colorblind/documentation.pdf | Bin 105258 -> 0 bytes macros/latex/contrib/colorblind/documentation.tex | 365 ---------- macros/latex/contrib/easybook/README.md | 2 +- macros/latex/contrib/easybook/easybook.dtx | 8 +- macros/latex/contrib/easybook/easybook.pdf | Bin 651938 -> 651935 bytes macros/latex/contrib/easybook/easybook.tex | 4 +- macros/latex/contrib/exesheet/exesheet.dtx | 171 ++--- macros/latex/contrib/exesheet/exesheet.pdf | Bin 342355 -> 348338 bytes macros/latex/contrib/pageslts/README | 10 +- macros/latex/contrib/pageslts/pageslts-example.pdf | Bin 316387 -> 316385 bytes macros/latex/contrib/pageslts/pageslts.dtx | 61 +- macros/latex/contrib/pageslts/pageslts.pdf | Bin 616268 -> 616599 bytes macros/xetex/latex/hduthesis/README.md | 21 +- macros/xetex/latex/hduthesis/doc/cha/abstract.tex | 12 + macros/xetex/latex/hduthesis/doc/cha/contents.tex | 345 +++++++++ macros/xetex/latex/hduthesis/doc/cha/source.tex | 18 + macros/xetex/latex/hduthesis/doc/cha/source/a1.tex | 224 ++++++ macros/xetex/latex/hduthesis/doc/cha/source/a2.tex | 88 +++ macros/xetex/latex/hduthesis/doc/cha/source/a3.tex | 231 ++++++ macros/xetex/latex/hduthesis/doc/cha/source/a4.tex | 4 + macros/xetex/latex/hduthesis/doc/cha/source/a5.tex | 4 + macros/xetex/latex/hduthesis/doc/cha/source/a6.tex | 28 + macros/xetex/latex/hduthesis/doc/cha/source/a7.tex | 35 + macros/xetex/latex/hduthesis/doc/hduthesis.pdf | Bin 857818 -> 960114 bytes macros/xetex/latex/hduthesis/doc/hduthesis.tex | 250 +------ .../xetex/latex/hduthesis/example/cha/abstract.tex | 25 + macros/xetex/latex/hduthesis/example/cha/cha1.tex | 9 + macros/xetex/latex/hduthesis/example/cha/cha2.tex | 60 ++ macros/xetex/latex/hduthesis/example/cha/cha3.tex | 108 +++ macros/xetex/latex/hduthesis/example/cha/cha4.tex | 301 ++++++++ macros/xetex/latex/hduthesis/example/cha/cha5.tex | 135 ++++ macros/xetex/latex/hduthesis/example/cha/cha6.tex | 40 + macros/xetex/latex/hduthesis/example/cha/cha7.tex | 11 + .../xetex/latex/hduthesis/example/cha/thanks.tex | 14 + .../latex/hduthesis/example/figures/image-0145.png | Bin 0 -> 18951 bytes .../latex/hduthesis/example/figures/image-0162.png | Bin 0 -> 14808 bytes .../latex/hduthesis/example/figures/image-0163.png | Bin 0 -> 6806 bytes .../latex/hduthesis/example/figures/image-0236.png | Bin 0 -> 4712 bytes .../latex/hduthesis/example/figures/image-0284.png | Bin 0 -> 6290 bytes .../latex/hduthesis/example/figures/image-0285.png | Bin 0 -> 11282 bytes .../latex/hduthesis/example/figures/image-0289.png | Bin 0 -> 17271 bytes .../latex/hduthesis/example/figures/image-0419.png | Bin 0 -> 13508 bytes .../latex/hduthesis/example/figures/image-0439.png | Bin 0 -> 9503 bytes .../latex/hduthesis/example/figures/image-0440.png | Bin 0 -> 13350 bytes .../xetex/latex/hduthesis/example/hduthesis-bc.pdf | Bin 0 -> 489599 bytes .../xetex/latex/hduthesis/example/hduthesis-bc.tex | 45 ++ .../xetex/latex/hduthesis/example/hduthesis-pg.pdf | Bin 0 -> 182025 bytes .../xetex/latex/hduthesis/example/hduthesis-pg.tex | 76 ++ .../hduthesis/example/hduthesis-stationery.pdf | Bin 0 -> 175923 bytes .../hduthesis/example/hduthesis-stationery.tex | 34 + macros/xetex/latex/hduthesis/example/reference.bib | 103 +++ .../latex/hduthesis/examples/cha/abstract.tex | 25 - macros/xetex/latex/hduthesis/examples/cha/cha1.tex | 9 - macros/xetex/latex/hduthesis/examples/cha/cha2.tex | 60 -- macros/xetex/latex/hduthesis/examples/cha/cha3.tex | 108 --- macros/xetex/latex/hduthesis/examples/cha/cha4.tex | 301 -------- macros/xetex/latex/hduthesis/examples/cha/cha5.tex | 135 ---- macros/xetex/latex/hduthesis/examples/cha/cha6.tex | 40 - macros/xetex/latex/hduthesis/examples/cha/cha7.tex | 11 - .../xetex/latex/hduthesis/examples/cha/thanks.tex | 14 - .../hduthesis/examples/figures/image-0145.png | Bin 18951 -> 0 bytes .../hduthesis/examples/figures/image-0162.png | Bin 14808 -> 0 bytes .../hduthesis/examples/figures/image-0163.png | Bin 6806 -> 0 bytes .../hduthesis/examples/figures/image-0236.png | Bin 4712 -> 0 bytes .../hduthesis/examples/figures/image-0284.png | Bin 6290 -> 0 bytes .../hduthesis/examples/figures/image-0285.png | Bin 11282 -> 0 bytes .../hduthesis/examples/figures/image-0289.png | Bin 17271 -> 0 bytes .../hduthesis/examples/figures/image-0419.png | Bin 13508 -> 0 bytes .../hduthesis/examples/figures/image-0439.png | Bin 9503 -> 0 bytes .../hduthesis/examples/figures/image-0440.png | Bin 13350 -> 0 bytes .../latex/hduthesis/examples/hduthesis-bc.pdf | Bin 478706 -> 0 bytes .../latex/hduthesis/examples/hduthesis-bc.tex | 44 -- .../latex/hduthesis/examples/hduthesis-pg.pdf | Bin 153643 -> 0 bytes .../latex/hduthesis/examples/hduthesis-pg.tex | 71 -- .../hduthesis/examples/hduthesis-stationery.pdf | Bin 179443 -> 0 bytes .../hduthesis/examples/hduthesis-stationery.tex | 31 - .../xetex/latex/hduthesis/examples/reference.bib | 103 --- .../tex/hduthesis-bc.config-module.code.tex | 58 +- .../tex/hduthesis-hdu.l3doc-module.code.tex | 63 +- .../tex/hduthesis-hdu.stationery-module.code.tex | 115 +-- .../hduthesis/tex/hduthesis-layout-module.code.tex | 53 +- .../tex/hduthesis-pg.config-module.code.tex | 99 ++- .../tex/hduthesis-typeset-module.code.tex | 14 +- macros/xetex/latex/hduthesis/tex/hduthesis.cls | 30 +- 89 files changed, 3248 insertions(+), 2226 deletions(-) create mode 100644 macros/latex/contrib/colorblind/colorblind_doc.pdf create mode 100644 macros/latex/contrib/colorblind/colorblind_doc.tex delete mode 100644 macros/latex/contrib/colorblind/documentation.pdf delete mode 100644 macros/latex/contrib/colorblind/documentation.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/abstract.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/contents.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a1.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a2.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a3.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a4.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a5.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a6.tex create mode 100644 macros/xetex/latex/hduthesis/doc/cha/source/a7.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/abstract.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha1.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha2.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha3.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha4.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha5.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha6.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/cha7.tex create mode 100644 macros/xetex/latex/hduthesis/example/cha/thanks.tex create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0145.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0162.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0163.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0236.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0284.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0285.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0289.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0419.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0439.png create mode 100644 macros/xetex/latex/hduthesis/example/figures/image-0440.png create mode 100644 macros/xetex/latex/hduthesis/example/hduthesis-bc.pdf create mode 100644 macros/xetex/latex/hduthesis/example/hduthesis-bc.tex create mode 100644 macros/xetex/latex/hduthesis/example/hduthesis-pg.pdf create mode 100644 macros/xetex/latex/hduthesis/example/hduthesis-pg.tex create mode 100644 macros/xetex/latex/hduthesis/example/hduthesis-stationery.pdf create mode 100644 macros/xetex/latex/hduthesis/example/hduthesis-stationery.tex create mode 100644 macros/xetex/latex/hduthesis/example/reference.bib delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/abstract.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha1.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha2.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha3.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha4.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha5.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha6.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/cha7.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/cha/thanks.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0145.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0162.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0163.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0236.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0284.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0285.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0289.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0419.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0439.png delete mode 100644 macros/xetex/latex/hduthesis/examples/figures/image-0440.png delete mode 100644 macros/xetex/latex/hduthesis/examples/hduthesis-bc.pdf delete mode 100644 macros/xetex/latex/hduthesis/examples/hduthesis-bc.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/hduthesis-pg.pdf delete mode 100644 macros/xetex/latex/hduthesis/examples/hduthesis-pg.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf delete mode 100644 macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex delete mode 100644 macros/xetex/latex/hduthesis/examples/reference.bib (limited to 'macros') diff --git a/macros/latex/contrib/colorblind/ChangeLog b/macros/latex/contrib/colorblind/ChangeLog index a864cd215e..bdef33e32f 100644 --- a/macros/latex/contrib/colorblind/ChangeLog +++ b/macros/latex/contrib/colorblind/ChangeLog @@ -1,7 +1,16 @@ Package `colorblind` by Simon Pfahler -https://github.com/simon-pfahler/colorblind +https://github.com/simon-pfahler/colorblind/issues History ======= +2024/12/23 v1.1 +* Redefine default colors unless the option `keep-defaults` is specified +* Refactor documentation +* Minor bug fixes + +2024/05/16 v1.0.1 +* Add package options `pgf` and `no-tikz` to give more control over which +packages are loaded + 2024/05/12 v1.0 -* First published release. +* Initial published release diff --git a/macros/latex/contrib/colorblind/README.md b/macros/latex/contrib/colorblind/README.md index 0fd83d42f8..b8ba60d9fb 100644 --- a/macros/latex/contrib/colorblind/README.md +++ b/macros/latex/contrib/colorblind/README.md @@ -1,6 +1,6 @@ ## Package `colorblind` by Simon Pfahler -Version 2024-05-12 v1.0 +Version 2024-12-24 v1.1 In colorblind-safe documents, the contents are presented in a way that the same information is conveyed to readers regardless of a potential color vision deficiency. This package provides the tools necessary for colorblind-safe typesetting in LaTeX. diff --git a/macros/latex/contrib/colorblind/colorblind.sty b/macros/latex/contrib/colorblind/colorblind.sty index a549ea06f9..0f3401a115 100644 --- a/macros/latex/contrib/colorblind/colorblind.sty +++ b/macros/latex/contrib/colorblind/colorblind.sty @@ -4,395 +4,458 @@ %% ---------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{colorblind}[2024/05/12 Easy colorblind-safe typesetting] +\ProvidesPackage{colorblind}[2024/12/23 Easy colorblind-safe typesetting] \RequirePackage{xcolor} \RequirePackage{ifthen} -\RequirePackage{tikz} -\usetikzlibrary{math} -\RequirePackage{pgfplots} -\pgfplotsset{compat=1.18} -\DeclareOption{Tol}{ -%>>> Color schemes by Paul Tol, source: https://personal.sron.nl/~pault -% -%>>> Qualitative color schemes -% -% Bright Qualitative color scheme -\providecolorset{RGB}{T-Q-B}{}{% - 1,68,119,170;% - 2,102,204,238;% - 3,34,136,51;% - 4,204,187,68;% - 5,238,102,119;% - 6,170,51,119;% - 0,187,187,187% -} -% -% High-contrast qualitative color scheme -\providecolorset{RGB}{T-Q-HC}{}{% - 1,255,255,255;% - 2,221,170,51;% - 3,187,85,102;% - 4,0,68,136;% - 0,0,0,0% -} -% -% Vibrant qualitative color scheme -\providecolorset{RGB}{T-Q-V}{}{% - 1,0,119,187;% - 2,51,187,238;% - 3,0,153,136;% - 4,238,119,51;% - 5,204,51,17;% - 6,238,51,119;% - 0,187,187,187% -} -% -% Muted qualitative color scheme -\providecolorset{RGB}{T-Q-M}{}{% - 1,51,34,136;% - 2,136,204,238;% - 3,68,170,153;% - 4,153,153,51;% - 5,221,204,119;% - 6,204,102,119;% - 7,136,34,85;% - 8,170,68,153;% - 0,221,221,221% -} -% -% Medium-contrast qualitative color scheme -\providecolorset{RGB}{T-Q-MC}{}{% - 1,255,255,255;% - 2,238,204,102;% - 3,238,153,170;% - 4,102,153,204;% - 5,153,119,0;% - 6,153,68,85;% - 7,0,68,136;% - 0,0,0,0% -} -% -% Pale qualitative color scheme, for highlighting -\providecolorset{RGB}{T-Q-PH}{}{% - 1,187,204,238;% - 2,204,238,255;% - 3,204,221,170;% - 4,238,238,187;% - 5,255,204,204;% - 0,221,221,221% -} -% -% Dark qualitative color scheme, for text colors -\providecolorset{RGB}{T-Q-DT}{}{% - 1,34,34,85;% - 2,34,85,85;% - 3,34,85,34;% - 4,102,102,51;% - 5,102,51,51;% - 0,85,85,85% -} -% -% Light qualitative color scheme -\providecolorset{RGB}{T-Q-L}{}{% - 1,119,170,221;% - 2,153,221,255;% - 3,68,187,153;% - 4,187,204,51;% - 5,170,170,0;% - 6,238,221,136;% - 7,238,136,102;% - 8,255,170,187;% - 0,221,221,221% -} -% -%<<< Qualitative color schemes -% -%>>> Diverging color schemes -% -% Sunset diverging color scheme -\providecolorset{RGB}{T-D-S}{}{% - 1,54,75,154;% - 2,74,123,183;% - 3,110,166,205;% - 4,152,202,225;% - 5,194,228,239;% - 6,234,236,204;% - 7,254,218,139;% - 8,253,179,102;% - 9,246,126,75;% - 10,221,61,45;% - 11,165,0,38;% - 0,255,255,255% -} -\pgfplotsset{ - colormap={T-D-S}{color(0)=(T-D-S1) color(1)=(T-D-S2) color(2)=(T-D-S3) color(3)=(T-D-S4) color(4)=(T-D-S5) color(5)=(T-D-S6) color(6)=(T-D-S7) color(7)=(T-D-S8) color(8)=(T-D-S9) color(9)=(T-D-S10) color(10)=(T-D-S11)} -} -% -% Nightfall diverging color scheme -\providecolorset{RGB}{T-D-N}{}{% - 1,18,90,86;% - 2,0,118,123;% - 3,35,143,157;% - 4,66,167,198;% - 5,96,188,233;% - 6,157,204,239;% - 7,198,219,237;% - 8,222,230,231;% - 9,236,234,218;% - 10,240,230,178;% - 11,249,213,118;% - 12,255,185,84;% - 13,253,154,68;% - 14,245,118,52;% - 15,233,76,31;% - 16,209,24,7;% - 17,160,24,19;% - 0,255,255,255% -} -\pgfplotsset{ - colormap={T-D-N}{color(0)=(T-D-N1) color(1)=(T-D-N2) color(2)=(T-D-N3) color(3)=(T-D-N4) color(4)=(T-D-N5) color(5)=(T-D-N6) color(6)=(T-D-N7) color(7)=(T-D-N8) color(8)=(T-D-N9) color(9)=(T-D-N10) color(10)=(T-D-N11) color(11)=(T-D-N12) color(12)=(T-D-N13) color(13)=(T-D-N14) color(14)=(T-D-N15) color(15)=(T-D-N16) color(16)=(T-D-N17)} -} -% -% BuRd diverging color scheme -\providecolorset{RGB}{T-D-BR}{}{% - 1,32,102,172;% - 2,67,147,195;% - 3,146,197,222;% - 4,209,229,240;% - 5,247,247,247;% - 6,253,219,199;% - 7,244,165,130;% - 8,214,96,77;% - 9,178,24,43;% - 0,255,238,153% -} -\pgfplotsset{ - colormap={T-D-BR}{color(0)=(T-D-BR1) color(1)=(T-D-BR2) color(2)=(T-D-BR3) color(3)=(T-D-BR4) color(4)=(T-D-BR5) color(5)=(T-D-BR6) color(6)=(T-D-BR7) color(7)=(T-D-BR8) color(8)=(T-D-BR9)} -} -% -% PRGn diverging color scheme -\providecolorset{RGB}{T-D-PG}{}{% - 1,118,42,131;% - 2,153,112,171;% - 3,194,165,207;% - 4,231,212,232;% - 5,247,247,247;% - 6,217,240,211;% - 7,172,211,158;% - 8,90,174,97;% - 9,27,120,55;% - 0,255,238,153% -} -\pgfplotsset{ - colormap={T-D-PG}{color(0)=(T-D-PG1) color(1)=(T-D-PG2) color(2)=(T-D-PG3) color(3)=(T-D-PG4) color(4)=(T-D-PG5) color(5)=(T-D-PG6) color(6)=(T-D-PG7) color(7)=(T-D-PG8) color(8)=(T-D-PG9)} +\newif\iftikz +\tikztrue +\DeclareOption{no-tikz}{ + \tikzfalse } -% -%<<< Diverging color schemes -% -%>>> Sequential color schemes -% -% YlOrBr sequential color scheme -\providecolorset{RGB}{T-S-YOB}{}{% - 1,255,255,229;% - 2,255,247,188;% - 3,254,227,145;% - 4,254,196,79;% - 5,251,154,41;% - 6,236,112,20;% - 7,204,76,2;% - 8,153,52,4;% - 9,102,37,6;% - 0,136,136,136% -} -\pgfplotsset{ - colormap={T-S-YOB}{color(0)=(T-S-YOB1) color(1)=(T-S-YOB2) color(2)=(T-S-YOB3) color(3)=(T-S-YOB4) color(4)=(T-S-YOB5) color(5)=(T-S-YOB6) color(6)=(T-S-YOB7) color(7)=(T-S-YOB8) color(8)=(T-S-YOB9)} -} -% -% Iridescent sequential color scheme -\providecolorset{RGB}{T-S-IR}{}{% - 1,254,251,233;% - 2,252,247,213;% - 3,245,243,193;% - 4,234,240,181;% - 5,221,236,191;% - 6,208,231,202;% - 7,194,227,210;% - 8,181,221,216;% - 9,168,216,220;% - 10,155,210,225;% - 11,141,203,228;% - 12,129,196,231;% - 13,123,188,231;% - 14,126,178,228;% - 15,136,165,221;% - 16,147,152,210;% - 17,155,138,196;% - 18,157,125,178;% - 19,154,112,158;% - 20,144,99,136;% - 21,128,87,112;% - 22,104,73,87;% - 23,70,53,58;% - 0,153,153,153% -} -\pgfplotsset{ - colormap={T-S-IR}{color(0)=(T-S-IR1) color(1)=(T-S-IR2) color(2)=(T-S-IR3) color(3)=(T-S-IR4) color(4)=(T-S-IR5) color(5)=(T-S-IR6) color(6)=(T-S-IR7) color(7)=(T-S-IR8) color(8)=(T-S-IR9) color(9)=(T-S-IR10) color(10)=(T-S-IR11) color(11)=(T-S-IR12) color(12)=(T-S-IR13) color(13)=(T-S-IR14) color(14)=(T-S-IR15) color(15)=(T-S-IR16) color(16)=(T-S-IR17) color(17)=(T-S-IR18) color(18)=(T-S-IR19) color(19)=(T-S-IR20) color(20)=(T-S-IR21) color(21)=(T-S-IR22) color(22)=(T-S-IR23)} -} -% -% Incandescent sequential color scheme -\providecolorset{RGB}{T-S-IN}{}{% - 1,206,255,255;% - 2,198,247,214;% - 3,162,244,155;% - 4,187,228,83;% - 5,213,206,4;% - 6,231,181,3;% - 7,241,153,3;% - 8,246,121,11;% - 9,249,73,2;% - 10,228,5,21;% - 11,168,0,3;% - 0,136,136,136% -} -\pgfplotsset{ - colormap={T-S-IN}{color(0)=(T-S-IN1) color(1)=(T-S-IN2) color(2)=(T-S-IN3) color(3)=(T-S-IN4) color(4)=(T-S-IN5) color(5)=(T-S-IN6) color(6)=(T-S-IN7) color(7)=(T-S-IN8) color(8)=(T-S-IN9) color(9)=(T-S-IN10) color(10)=(T-S-IN11)} -} -% -% Discrete rainbow color scheme -\providecolorset{RGB}{T-S-DR}{}{% - 1,209,187,215;% - 2,174,118,163;% - 3,136,46,114;% - 4,25,101,176;% - 5,82,137,199;% - 6,123,175,222;% - 7,78,178,101;% - 8,144,201,135;% - 9,202,224,171;% - 10,247,240,86;% - 11,246,193,65;% - 12,241,147,45;% - 13,232,96,28;% - 14,220,5,12;% - 0,119,119,119% -} -% -\providecolorset{RGB}{T-S-SR}{}{% - 1,232,236,251;% - 2,221,216,239;% - 3,209,193,225;% - 4,195,168,209;% - 5,181,143,194;% - 6,167,120,180;% - 7,155,98,167;% - 8,140,78,153;% - 9,111,76,155;% - 10,96,89,169;% - 11,85,104,184;% - 12,78,121,197;% - 13,77,138,198;% - 14,78,150,188;% - 15,84,158,179;% - 16,89,165,169;% - 17,96,171,158;% - 18,105,177,144;% - 19,119,183,125;% - 20,140,188,104;% - 21,166,190,84;% - 22,190,188,72;% - 23,209,181,65;% - 24,221,170,60;% - 25,228,156,57;% - 26,231,140,53;% - 27,230,121,50;% - 28,228,99,45;% - 29,223,72,40;% - 30,218,34,34;% - 31,184,34,30;% - 32,149,33,27;% - 33,114,30,23;% - 34,82,26,19;% - 0,102,102,102% + +\newif\ifpgf +\pgffalse +\DeclareOption{pgf}{ + \pgftrue } -\pgfplotsset{ - colormap={T-S-SR}{color(0)=(T-S-SR1) color(1)=(T-S-SR2) color(2)=(T-S-SR3) color(3)=(T-S-SR4) color(4)=(T-S-SR5) color(5)=(T-S-SR6) color(6)=(T-S-SR7) color(7)=(T-S-SR8) color(8)=(T-S-SR9) color(9)=(T-S-SR10) color(10)=(T-S-SR11) color(11)=(T-S-SR12) color(12)=(T-S-SR13) color(13)=(T-S-SR14) color(14)=(T-S-SR15) color(15)=(T-S-SR16) color(16)=(T-S-SR17) color(17)=(T-S-SR18) color(18)=(T-S-SR19) color(19)=(T-S-SR20) color(20)=(T-S-SR21) color(21)=(T-S-SR22) color(22)=(T-S-SR23) color(23)=(T-S-SR24) color(24)=(T-S-SR25) color(25)=(T-S-SR26) color(26)=(T-S-SR27) color(27)=(T-S-SR28) color(28)=(T-S-SR29) color(29)=(T-S-SR30) color(30)=(T-S-SR31) color(31)=(T-S-SR32) color(32)=(T-S-SR33) color(33)=(T-S-SR34)} + +\newif\ifredefinedefaults +\redefinedefaultstrue +\DeclareOption{keep-defaults}{ + \redefinedefaultsfalse } -% -%<<< Sequential color schemes -% -%<<< Color schemes by Paul Tol, source: https://personal.sron.nl/~pault + +\newif\ifTolColors +\TolColorsfalse +\DeclareOption{Tol}{ + \TolColorstrue + %>>> Color schemes by Paul Tol, source: https://personal.sron.nl/~pault + % + %>>> Qualitative color schemes + % + % Bright Qualitative color scheme + \providecolorset{RGB}{T-Q-B}{}{% + 1,68,119,170;% + 2,102,204,238;% + 3,34,136,51;% + 4,204,187,68;% + 5,238,102,119;% + 6,170,51,119;% + 0,187,187,187% + } + % + % High-contrast qualitative color scheme + \providecolorset{RGB}{T-Q-HC}{}{% + 1,255,255,255;% + 2,221,170,51;% + 3,187,85,102;% + 4,0,68,136;% + 0,0,0,0% + } + % + % Vibrant qualitative color scheme + \providecolorset{RGB}{T-Q-V}{}{% + 1,0,119,187;% + 2,51,187,238;% + 3,0,153,136;% + 4,238,119,51;% + 5,204,51,17;% + 6,238,51,119;% + 0,187,187,187% + } + % + % Muted qualitative color scheme + \providecolorset{RGB}{T-Q-M}{}{% + 1,51,34,136;% + 2,136,204,238;% + 3,68,170,153;% + 4,17,119,51;% + 5,153,153,51;% + 6,221,204,119;% + 7,204,102,119;% + 8,136,34,85;% + 9,170,68,153;% + 0,221,221,221% + } + % + % Medium-contrast qualitative color scheme + \providecolorset{RGB}{T-Q-MC}{}{% + 1,255,255,255;% + 2,238,204,102;% + 3,238,153,170;% + 4,102,153,204;% + 5,153,119,0;% + 6,153,68,85;% + 7,0,68,136;% + 0,0,0,0% + } + % + % Pale qualitative color scheme, for highlighting + \providecolorset{RGB}{T-Q-PH}{}{% + 1,187,204,238;% + 2,204,238,255;% + 3,204,221,170;% + 4,238,238,187;% + 5,255,204,204;% + 0,221,221,221% + } + % + % Dark qualitative color scheme, for text colors + \providecolorset{RGB}{T-Q-DT}{}{% + 1,34,34,85;% + 2,34,85,85;% + 3,34,85,34;% + 4,102,102,51;% + 5,102,51,51;% + 0,85,85,85% + } + % + % Light qualitative color scheme + \providecolorset{RGB}{T-Q-L}{}{% + 1,119,170,221;% + 2,153,221,255;% + 3,68,187,153;% + 4,187,204,51;% + 5,170,170,0;% + 6,238,221,136;% + 7,238,136,102;% + 8,255,170,187;% + 0,221,221,221% + } + % + %<<< Qualitative color schemes + % + %>>> Diverging color schemes + % + % Sunset diverging color scheme + \providecolorset{RGB}{T-D-S}{}{% + 1,54,75,154;% + 2,74,123,183;% + 3,110,166,205;% + 4,152,202,225;% + 5,194,228,239;% + 6,234,236,204;% + 7,254,218,139;% + 8,253,179,102;% + 9,246,126,75;% + 10,221,61,45;% + 11,165,0,38;% + 0,255,255,255% + } + % + % Nightfall diverging color scheme + \providecolorset{RGB}{T-D-N}{}{% + 1,18,90,86;% + 2,0,118,123;% + 3,35,143,157;% + 4,66,167,198;% + 5,96,188,233;% + 6,157,204,239;% + 7,198,219,237;% + 8,222,230,231;% + 9,236,234,218;% + 10,240,230,178;% + 11,249,213,118;% + 12,255,185,84;% + 13,253,154,68;% + 14,245,118,52;% + 15,233,76,31;% + 16,209,24,7;% + 17,160,24,19;% + 0,255,255,255% + } + % + % BuRd diverging color scheme + \providecolorset{RGB}{T-D-BR}{}{% + 1,32,102,172;% + 2,67,147,195;% + 3,146,197,222;% + 4,209,229,240;% + 5,247,247,247;% + 6,253,219,199;% + 7,244,165,130;% + 8,214,96,77;% + 9,178,24,43;% + 0,255,238,153% + } + % + % PRGn diverging color scheme + \providecolorset{RGB}{T-D-PG}{}{% + 1,118,42,131;% + 2,153,112,171;% + 3,194,165,207;% + 4,231,212,232;% + 5,247,247,247;% + 6,217,240,211;% + 7,172,211,158;% + 8,90,174,97;% + 9,27,120,55;% + 0,255,238,153% + } + % + %<<< Diverging color schemes + % + %>>> Sequential color schemes + % + % YlOrBr sequential color scheme + \providecolorset{RGB}{T-S-YOB}{}{% + 1,255,255,229;% + 2,255,247,188;% + 3,254,227,145;% + 4,254,196,79;% + 5,251,154,41;% + 6,236,112,20;% + 7,204,76,2;% + 8,153,52,4;% + 9,102,37,6;% + 0,136,136,136% + } + % + % Iridescent sequential color scheme + \providecolorset{RGB}{T-S-IR}{}{% + 1,254,251,233;% + 2,252,247,213;% + 3,245,243,193;% + 4,234,240,181;% + 5,221,236,191;% + 6,208,231,202;% + 7,194,227,210;% + 8,181,221,216;% + 9,168,216,220;% + 10,155,210,225;% + 11,141,203,228;% + 12,129,196,231;% + 13,123,188,231;% + 14,126,178,228;% + 15,136,165,221;% + 16,147,152,210;% + 17,155,138,196;% + 18,157,125,178;% + 19,154,112,158;% + 20,144,99,136;% + 21,128,87,112;% + 22,104,73,87;% + 23,70,53,58;% + 0,153,153,153% + } + % + % Incandescent sequential color scheme + \providecolorset{RGB}{T-S-IN}{}{% + 1,206,255,255;% + 2,198,247,214;% + 3,162,244,155;% + 4,187,228,83;% + 5,213,206,4;% + 6,231,181,3;% + 7,241,153,3;% + 8,246,121,11;% + 9,249,73,2;% + 10,228,5,21;% + 11,168,0,3;% + 0,136,136,136% + } + % + % Discrete rainbow color scheme + \providecolorset{RGB}{T-S-DR}{}{% + 1,209,187,215;% + 2,174,118,163;% + 3,136,46,114;% + 4,25,101,176;% + 5,82,137,199;% + 6,123,175,222;% + 7,78,178,101;% + 8,144,201,135;% + 9,202,224,171;% + 10,247,240,86;% + 11,246,193,65;% + 12,241,147,45;% + 13,232,96,28;% + 14,220,5,12;% + 0,119,119,119% + } + % + % Smooth rainbow color scheme + \providecolorset{RGB}{T-S-SR}{}{% + 1,232,236,251;% + 2,221,216,239;% + 3,209,193,225;% + 4,195,168,209;% + 5,181,143,194;% + 6,167,120,180;% + 7,155,98,167;% + 8,140,78,153;% + 9,111,76,155;% + 10,96,89,169;% + 11,85,104,184;% + 12,78,121,197;% + 13,77,138,198;% + 14,78,150,188;% + 15,84,158,179;% + 16,89,165,169;% + 17,96,171,158;% + 18,105,177,144;% + 19,119,183,125;% + 20,140,188,104;% + 21,166,190,84;% + 22,190,188,72;% + 23,209,181,65;% + 24,221,170,60;% + 25,228,156,57;% + 26,231,140,53;% + 27,230,121,50;% + 28,228,99,45;% + 29,223,72,40;% + 30,218,34,34;% + 31,184,34,30;% + 32,149,33,27;% + 33,114,30,23;% + 34,82,26,19;% + 0,102,102,102% + } + % + %<<< Sequential color schemes + % + %<<< Color schemes by Paul Tol, source: https://personal.sron.nl/~pault } \DeclareOption{OkabeIto}{ -%>>> Qualitative color scheme by Okabe and Ito -\providecolorset{RGB}{OI}{}{% - 1,230,159,0;% - 2,86,180,233;% - 3,0,158,115;% - 4,240,228,66;% - 5,0,114,178;% - 6,213,94,0;% - 7,204,121,167;% - 0,0,0,0% -} -%<<< Qualitative color scheme by Okabe and Ito + %>>> Qualitative color scheme by Okabe and Ito + \providecolorset{RGB}{OI}{}{% + 1,230,159,0;% + 2,86,180,233;% + 3,0,158,115;% + 4,240,228,66;% + 5,0,114,178;% + 6,213,94,0;% + 7,204,121,167;% + 0,0,0,0% + } + %<<< Qualitative color scheme by Okabe and Ito } \DeclareOption*{\PackageWarning{colorblind}{Unknown '\CurrentOption'}} \ProcessOptions\relax -%>>> Function to print a discrete color scheme -\newcommand\@drawSchemeRadius{0.7cm} -\newcommand\@drawSchemeOffset{1cm} -\newcounter{ColorNum} -\newcommand\drawScheme[1]{% - \tikz{% - \node[inner sep=1, fill=red] at (-1.2*\@drawSchemeRadius,2.3*\@drawSchemeRadius) {R}; - \node[inner sep=1, fill=green] at (-1.2*\@drawSchemeRadius, 1.8*\@drawSchemeRadius) {G}; - \node[inner sep=1, fill=blue] at (-1.2*\@drawSchemeRadius,1.3*\@drawSchemeRadius) {B}; - \setcounter{ColorNum}{1}% - \whiledo{% - \@ifundefined{\string\color@#1\theColorNum}{\boolean{false}}{\boolean{true}}% - }{% - \extractcolorspecs{#1\the\value{ColorNum}}{\modelspec}{\colorspec}% - \tikzmath{ - int \r, \g, \b; - \r = round(255*array({\colorspec},0)); - \g = round(255*array({\colorspec},1)); - \b = round(255*array({\colorspec},2)); - }% - \node at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,2.3*\@drawSchemeRadius) {\r}; - \node at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,1.8*\@drawSchemeRadius) {\g}; - \node at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,1.3*\@drawSchemeRadius) {\b}; - \draw[fill=#1\the\value{ColorNum}] (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,0) circle (\@drawSchemeRadius);% - \node[rotate=25, anchor=north east] at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,-1*\@drawSchemeRadius) {#1\theColorNum};% - \stepcounter{ColorNum}% - }% - \extractcolorspecs{#10}{\modelspec}{\colorspec}% - \tikzmath{ - int \r, \g, \b; - \r = round(255*array({\colorspec},0)); - \g = round(255*array({\colorspec},1)); - \b = round(255*array({\colorspec},2)); - }% - \node at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,2.3*\@drawSchemeRadius) {\r}; - \node at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,1.8*\@drawSchemeRadius) {\g}; - \node at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,1.3*\@drawSchemeRadius) {\b}; - \draw[fill=#10] (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,0) circle(\@drawSchemeRadius);% - \node[rotate=25, anchor=north east] at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset, -1*\@drawSchemeRadius) {#10};% - }% -} -%<<< Function to print a discrete color scheme +\ifredefinedefaults + % This redefines the default colors by removing most of them and setting + % the remaining to colors from the qualitative Vibrant color scheme by Tol. + \xdefinecolor{blue}{RGB}{68,119,170} + \xdefinecolor{cyan}{RGB}{102,204,238} + \xdefinecolor{green}{RGB}{34,136,51} + \xdefinecolor{yellow}{RGB}{204,187,68} + \xdefinecolor{red}{RGB}{238,102,119} + \xdefinecolor{violet}{RGB}{170,51,119} + \xdefinecolor{gray}{RGB}{187,187,187} + \xdefinecolor{orange}{RGB}{0,0,0} + \xdefinecolor{brown}{RGB}{0,0,0} + \xdefinecolor{darkgray}{RGB}{0,0,0} + \xdefinecolor{lightgray}{RGB}{0,0,0} + \xdefinecolor{lime}{RGB}{0,0,0} + \xdefinecolor{magenta}{RGB}{0,0,0} + \xdefinecolor{olive}{RGB}{0,0,0} + \xdefinecolor{pink}{RGB}{0,0,0} + \xdefinecolor{purple}{RGB}{0,0,0} + \xdefinecolor{teal}{RGB}{0,0,0} +\fi -%>>> Function to print a continuous color scheme -\newcommand\drawSchemeC[2][0.5\textwidth]{% - \tikz{% - \pgfplotscolorbardrawstandalone[colormap name=#2, colorbar horizontal, colorbar style={width=#1, ticks=none}]% - \draw[fill=#20] (#1+0.5*\@drawSchemeOffset,-0.55cm) circle(0.5*\@drawSchemeRadius);% - }% -} -%<<< Function to print a continuous color scheme +% define continuous colormaps and command to plot them if `pgf` option is given +\ifpgf + % do nothing if option `Tol` was not provided, since then no applicable color schemes exist + \ifTolColors + \RequirePackage{pgfplots} + \pgfplotsset{compat=1.18} + % Sunset diverging colormap + \pgfplotsset{ + colormap={T-D-S}{color(0)=(T-D-S1) color(1)=(T-D-S2) color(2)=(T-D-S3) color(3)=(T-D-S4) color(4)=(T-D-S5) color(5)=(T-D-S6) color(6)=(T-D-S7) color(7)=(T-D-S8) color(8)=(T-D-S9) color(9)=(T-D-S10) color(10)=(T-D-S11)} + } + % Nightfall diverging colormap + \pgfplotsset{ + colormap={T-D-N}{color(0)=(T-D-N1) color(1)=(T-D-N2) color(2)=(T-D-N3) color(3)=(T-D-N4) color(4)=(T-D-N5) color(5)=(T-D-N6) color(6)=(T-D-N7) color(7)=(T-D-N8) color(8)=(T-D-N9) color(9)=(T-D-N10) color(10)=(T-D-N11) color(11)=(T-D-N12) color(12)=(T-D-N13) color(13)=(T-D-N14) color(14)=(T-D-N15) color(15)=(T-D-N16) color(16)=(T-D-N17)} + } + % BuRd diverging colormap + \pgfplotsset{ + colormap={T-D-BR}{color(0)=(T-D-BR1) color(1)=(T-D-BR2) color(2)=(T-D-BR3) color(3)=(T-D-BR4) color(4)=(T-D-BR5) color(5)=(T-D-BR6) color(6)=(T-D-BR7) color(7)=(T-D-BR8) color(8)=(T-D-BR9)} + } + % PRGn diverging colormap + \pgfplotsset{ + colormap={T-D-PG}{color(0)=(T-D-PG1) color(1)=(T-D-PG2) color(2)=(T-D-PG3) color(3)=(T-D-PG4) color(4)=(T-D-PG5) color(5)=(T-D-PG6) color(6)=(T-D-PG7) color(7)=(T-D-PG8) color(8)=(T-D-PG9)} + } + % YlOrBr sequential colormap + \pgfplotsset{ + colormap={T-S-YOB}{color(0)=(T-S-YOB1) color(1)=(T-S-YOB2) color(2)=(T-S-YOB3) color(3)=(T-S-YOB4) color(4)=(T-S-YOB5) color(5)=(T-S-YOB6) color(6)=(T-S-YOB7) color(7)=(T-S-YOB8) color(8)=(T-S-YOB9)} + } + % Iridescent sequential colormap + \pgfplotsset{ + colormap={T-S-IR}{color(0)=(T-S-IR1) color(1)=(T-S-IR2) color(2)=(T-S-IR3) color(3)=(T-S-IR4) color(4)=(T-S-IR5) color(5)=(T-S-IR6) color(6)=(T-S-IR7) color(7)=(T-S-IR8) color(8)=(T-S-IR9) color(9)=(T-S-IR10) color(10)=(T-S-IR11) color(11)=(T-S-IR12) color(12)=(T-S-IR13) color(13)=(T-S-IR14) color(14)=(T-S-IR15) color(15)=(T-S-IR16) color(16)=(T-S-IR17) color(17)=(T-S-IR18) color(18)=(T-S-IR19) color(19)=(T-S-IR20) color(20)=(T-S-IR21) color(21)=(T-S-IR22) color(22)=(T-S-IR23)} + } + % Incandescent sequential colormap + \pgfplotsset{ + colormap={T-S-IN}{color(0)=(T-S-IN1) color(1)=(T-S-IN2) color(2)=(T-S-IN3) color(3)=(T-S-IN4) color(4)=(T-S-IN5) color(5)=(T-S-IN6) color(6)=(T-S-IN7) color(7)=(T-S-IN8) color(8)=(T-S-IN9) color(9)=(T-S-IN10) color(10)=(T-S-IN11)} + } + % Smooth Rainbow sequential colormap + \pgfplotsset{ + colormap={T-S-SR}{color(0)=(T-S-SR1) color(1)=(T-S-SR2) color(2)=(T-S-SR3) color(3)=(T-S-SR4) color(4)=(T-S-SR5) color(5)=(T-S-SR6) color(6)=(T-S-SR7) color(7)=(T-S-SR8) color(8)=(T-S-SR9) color(9)=(T-S-SR10) color(10)=(T-S-SR11) color(11)=(T-S-SR12) color(12)=(T-S-SR13) color(13)=(T-S-SR14) color(14)=(T-S-SR15) color(15)=(T-S-SR16) color(16)=(T-S-SR17) color(17)=(T-S-SR18) color(18)=(T-S-SR19) color(19)=(T-S-SR20) color(20)=(T-S-SR21) color(21)=(T-S-SR22) color(22)=(T-S-SR23) color(23)=(T-S-SR24) color(24)=(T-S-SR25) color(25)=(T-S-SR26) color(26)=(T-S-SR27) color(27)=(T-S-SR28) color(28)=(T-S-SR29) color(29)=(T-S-SR30) color(30)=(T-S-SR31) color(31)=(T-S-SR32) color(32)=(T-S-SR33) color(33)=(T-S-SR34)} + } + % + %>>> Function to print a continuous color scheme + \newcommand\drawSchemeC[2][0.5\textwidth]{% + \tikz{% + \pgfplotscolorbardrawstandalone[colormap name=#2, colorbar horizontal, colorbar style={width=#1, ticks=none}]% + \draw[fill=#20] (#1+0.5*\@drawSchemeOffset,-0.55cm) circle(0.5*\@drawSchemeRadius);% + }% + } + %<<< Function to print a continuous color scheme + \fi +\fi + +% define command to draw discrete color schemes when tikz is enabled +\iftikz + \RequirePackage{tikz} + \usetikzlibrary{math} + %>>> Function to print a discrete color scheme + \newcommand\@drawSchemeRadius{0.7cm} + \newcommand\@drawSchemeOffset{1cm} + \newcounter{ColorNum} + \newcommand\drawScheme[1]{% + \tikz{% + \node[inner sep=1, fill=red] at (-1.2*\@drawSchemeRadius,2.3*\@drawSchemeRadius) {R}; + \node[inner sep=1, fill=green] at (-1.2*\@drawSchemeRadius, 1.8*\@drawSchemeRadius) {G}; + \node[inner sep=1, fill=blue] at (-1.2*\@drawSchemeRadius,1.3*\@drawSchemeRadius) {B}; + \setcounter{ColorNum}{1}% + \whiledo{% + \@ifundefined{\string\color@#1\theColorNum}{\boolean{false}}{\boolean{true}}% + }{% + \extractcolorspecs{#1\the\value{ColorNum}}{\modelspec}{\colorspec}% + \tikzmath{ + int \r, \g, \b; + \r = round(255*array({\colorspec},0)); + \g = round(255*array({\colorspec},1)); + \b = round(255*array({\colorspec},2)); + }% + \node at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,2.3*\@drawSchemeRadius) {\r}; + \node at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,1.8*\@drawSchemeRadius) {\g}; + \node at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,1.3*\@drawSchemeRadius) {\b}; + \draw[fill=#1\the\value{ColorNum}] (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,0) circle (\@drawSchemeRadius);% + \node[rotate=25, anchor=north east] at (\value{ColorNum}*\@drawSchemeOffset-\@drawSchemeOffset,-1*\@drawSchemeRadius) {#1\theColorNum};% + \stepcounter{ColorNum}% + }% + \extractcolorspecs{#10}{\modelspec}{\colorspec}% + \tikzmath{ + int \r, \g, \b; + \r = round(255*array({\colorspec},0)); + \g = round(255*array({\colorspec},1)); + \b = round(255*array({\colorspec},2)); + }% + \node at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,2.3*\@drawSchemeRadius) {\r}; + \node at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,1.8*\@drawSchemeRadius) {\g}; + \node at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,1.3*\@drawSchemeRadius) {\b}; + \draw[fill=#10] (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset,0) circle(\@drawSchemeRadius);% + \node[rotate=25, anchor=north east] at (\value{ColorNum}*\@drawSchemeOffset-0.5*\@drawSchemeOffset, -1*\@drawSchemeRadius) {#10};% + }% + } + %<<< Function to print a discrete color scheme +\fi \endinput diff --git a/macros/latex/contrib/colorblind/colorblind_doc.pdf b/macros/latex/contrib/colorblind/colorblind_doc.pdf new file mode 100644 index 0000000000..0ecc058ae8 Binary files /dev/null and b/macros/latex/contrib/colorblind/colorblind_doc.pdf differ diff --git a/macros/latex/contrib/colorblind/colorblind_doc.tex b/macros/latex/contrib/colorblind/colorblind_doc.tex new file mode 100644 index 0000000000..311de4ad34 --- /dev/null +++ b/macros/latex/contrib/colorblind/colorblind_doc.tex @@ -0,0 +1,422 @@ +%% +%% ---------------------------------------------------------------- +%% Copyright (C) 2023-2024 by Simon Pfahler +%% ---------------------------------------------------------------- +%% +%! TeX program = lualatex +\DocumentMetadata{lang = en-us} +\documentclass{scrartcl} +\usepackage[left=4.5cm,right=3cm,top=3cm,bottom=3cm, marginpar=4cm]{geometry} +\setlength{\parindent}{0pt} +\setlength{\parskip}{1ex} + +\usepackage{xcolor} +\usepackage{soul} + +\usepackage{tikz} +\usetikzlibrary{positioning, shapes, fit, arrows.meta, decorations.pathmorphing, math} +\pgfdeclarelayer{bg} +\pgfsetlayers{bg,main} + +\usepackage{pgfplots, pgfplotstable} +\pgfplotsset{compat=1.18} + +%%%% from https://tex.stackexchange.com/questions/355713/pgfplots-show-error-marker-in-legend +\pgfplotsset{error bar legend/.style={% + /pgfplots/legend image code/.prefix code={% + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \draw[% + /pgfplots/every error bar, + mark=\pgfplotserrorbarsmark, + /pgfplots/error bars/error mark options, + sharp plot, + ##1 + ] plot coordinates {(0.3cm, -0.15cm) (0.3cm, 0.15cm)};% + } + } +} +%%%% + +\pgfplotsset{custom area legend/.style={% + /pgfplots/legend image code/.prefix code={% + \fill[##1, draw=white] plot coordinates {(0cm, -0.1cm) (0.6cm,-0.1cm) (0.6cm, 0.1cm) (0cm, 0.1cm)};% + } + } +} + +\def\w{420pt} + +\usepackage{hyperref} +\hypersetup{ + pdftitle={Easy colorblind-safe typesetting: the colorblind package}, + pdfauthor={Simon Pfahler}, +} +\usepackage{cleveref} + +\usepackage{csquotes} +\usepackage[backend=biber, style=numeric-comp, seconds=true, sorting=none, subentry=true, doi=false, alldates=iso]{biblatex} +\renewcommand*{\entrysetpunct}{\\[5pt]} +\addbibresource{bib.bib} + +\usepackage[keep-defaults, Tol, OkabeIto, pgf]{colorblind} + +\newcommand\colorblind{\textbf{colorblind} } +\newcommand\hlc[2][T-Q-PH4]{{% + \colorlet{foo}{#1}% + \sethlcolor{foo}\hl{#2}}% +} + +\reversemarginpar +\newcommand\marg[1]{\leavevmode\marginpar{\raggedleft #1}} +\newcommand\tbs{\textbackslash} +\newcommand\cs[1]{\texttt{\tbs#1}} + +\title{Easy colorblind-safe typesetting:\\ the \colorblind package} +\author{Simon Pfahler} +\date{\today\\Version 1.1} + + +\begin{document} + +\maketitle + +\begin{abstract} + In colorblind-safe documents, the contents are presented in a way that the same information is conveyed to readers regardless of a potential color vision deficiency. + This package provides some useful tools for colorblind-safe typesetting in \LaTeX. + It provides color schemes for a wide range of applications. + The most commonly used schemes are qualitative schemes, providing easily distinguishable colors for use in graphics, but also for text coloring or highlighting. + Additionally, diverging and sequential schemes are provided, which can be used for encoding quantitative information using colors. + This package incorporates colorblind-safeness into the writing process, making it both less cumbersome and less error-prone. +\end{abstract} + +\tableofcontents +\clearpage + +\section{Introduction} +\subsection{For the impatient} +Writing good colorblind-safe documents can be a tricky task. +It is a good starting point to realize that the default \LaTeX\ colors like \hlc[red]{red} or \hlc[blue]{blue} should be avoided. +This is why for the impatient, simply loading this package without specifying any options (i.e.\ \cs{usepackage\{colorblind\}}) redefines the default colors to more sensible alternatives. +\footnote{Where no suitable redefinition was possible for a builtin named color, the definition is changed to black.} + +\begin{figure}[ht] + \centering + \begin{tikzpicture} + \node[inner sep=1, fill=red] at (-1.2*0.7cm,2.3*0.7cm) {R}; + \node[inner sep=1, fill=green] at (-1.2*0.7cm, 1.8*0.7cm) {G}; + \node[inner sep=1, fill=blue] at (-1.2*0.7cm,1.3*0.7cm) {B}; + + \node at (1*1cm-1cm,2.3*0.7cm) {68}; + \node at (1*1cm-1cm,1.8*0.7cm) {119}; + \node at (1*1cm-1cm,1.3*0.7cm) {170}; + \draw[fill=T-Q-B1] (1*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (1*1cm-1cm,-1*0.7cm) {\vphantom{bp}blue}; + + \node at (2*1cm-1cm,2.3*0.7cm) {102}; + \node at (2*1cm-1cm,1.8*0.7cm) {204}; + \node at (2*1cm-1cm,1.3*0.7cm) {238}; + \draw[fill=T-Q-B2] (2*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (2*1cm-1cm,-1*0.7cm) {\vphantom{bp}cyan}; + + \node at (3*1cm-1cm,2.3*0.7cm) {34}; + \node at (3*1cm-1cm,1.8*0.7cm) {136}; + \node at (3*1cm-1cm,1.3*0.7cm) {51}; + \draw[fill=T-Q-B3] (3*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (3*1cm-1cm,-1*0.7cm) {\vphantom{bp}green}; + + \node at (4*1cm-1cm,2.3*0.7cm) {204}; + \node at (4*1cm-1cm,1.8*0.7cm) {187}; + \node at (4*1cm-1cm,1.3*0.7cm) {68}; + \draw[fill=T-Q-B4] (4*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (4*1cm-1cm,-1*0.7cm) {\vphantom{bp}yellow}; + + \node at (5*1cm-1cm,2.3*0.7cm) {238}; + \node at (5*1cm-1cm,1.8*0.7cm) {102}; + \node at (5*1cm-1cm,1.3*0.7cm) {119}; + \draw[fill=T-Q-B5] (5*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (5*1cm-1cm,-1*0.7cm) {\vphantom{bp}red}; + + \node at (6*1cm-1cm,2.3*0.7cm) {170}; + \node at (6*1cm-1cm,1.8*0.7cm) {51}; + \node at (6*1cm-1cm,1.3*0.7cm) {119}; + \draw[fill=T-Q-B6] (6*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (6*1cm-1cm,-1*0.7cm) {\vphantom{bp}violet}; + + \node at (7*1cm-1cm,2.3*0.7cm) {187}; + \node at (7*1cm-1cm,1.8*0.7cm) {187}; + \node at (7*1cm-1cm,1.3*0.7cm) {187}; + \draw[fill=T-Q-B0] (7*1cm-1cm,0) circle (0.7cm); + \node[rotate=25, anchor=north east] at (7*1cm-1cm,-1*0.7cm) {\vphantom{bp}gray}; + + \end{tikzpicture} + \caption{Redefinitions of the default \LaTeX\ colors.} +\end{figure} + +It should be noted that this is a very brute-force way of trying to achieve colorblind-safeness. +If you care about this topic (which you should), the rest of this document provides details on how colorblind-safeness is best achieved in different scenarios. + +\subsection{Package options} +\marg{\texttt{Tol}\\\texttt{OkabeIto}}% +The \colorblind package provides the color schemes by Paul Tol~\cite{Tol} and the Okabe Ito color palette~\cite{Ichihara_2008}. +By default, no schemes are loaded. +Providing one of the options \texttt{Tol} or \texttt{OkabeIto} loads all corresponding schemes. + +\marg{\texttt{pgf}}% +If the option \texttt{pgf} is provided, continuous colormaps are defined for use with \texttt{pgfplots} (or \texttt{TikZ}). +Also, the command \cs{drawSchemeC} for drawing continuous color schemes is only defined when the option is provided and continuous color schemes are available (through providing the \texttt{Tol} option). +Continuous versions of color schemes are only available when the colors are allowed to be interpolated, see below for details. + +\marg{\texttt{no-tikz}}% +The package uses \texttt{TikZ} to draw the discrete versions of color schemes. +Providing the option \texttt{no-tikz} disables this, the command \cs{drawScheme} is not defined in this case. + +\marg{\texttt{keep-defaults}}% +The package redefines the default colors like \hlc[T-Q-PH5]{red} or \hlc[T-Q-PH1]{blue} to be colorblind-safe. By specifying this option, the defaults are not changed. + +\subsection{Overview} +As an example for how to use the colors, we look at the \emph{bright qualitative} color scheme by Tol. +\cref{fig:T-Q-Bexample} shows the colors in the scheme. + +\begin{figure}[ht] + \centering + \drawScheme{T-Q-B} + \caption{Bright qualitative color scheme by Tol.} + \label{fig:T-Q-Bexample} +\end{figure} + +All colors in this model start with \texttt{T-Q-B}, indicating that it is a scheme by \textbf{T}ol, that it is a \textbf{q}ualitative scheme, and that it is the \textbf{b}right scheme. +The colors in the scheme are specified by a number following the scheme name, in this case ranging from \texttt{T-Q-B1} to \texttt{T-Q-B6} for the non-grey colors. +The additional color \texttt{T-Q-B0} provides a color that can be used, e.g., to indicate bad data. + +There are two reasons why color names are not based on natural color names (e.g., ``\hlc[T-Q-PH1]{blue}''): +\begin{enumerate} + \item Certain colors (\hlc[T-Q-PH3]{green}, \hlc[T-Q-PH5]{red}) are often used by people with full color vision to convey certain meanings (\hlc[T-Q-PH3]{good}, \hlc[T-Q-PH5]{bad}). + This meaning is difficult for people with color vision deficiencies to pick up. + By not using natural color names, it is easier to write colorblind-safe documents that do not make use of said connotations. + \item Natural color names can be cumbersome, e.g., when slight variations of a color are used. It is annoying having to look up if a color is called, e.g., \hlc[T-Q-PH1]{blue} or \hlc[T-Q-PH2]{cyan}. +\end{enumerate} + +These colors are used the same way as any other colors. To change the text color to \texttt{T-Q-B1} for example, use \cs{color\{T-Q-B1\}}. + +\section{Guidelines}\label{sec:guidelines} +In this section, we provide some general guidelines for colorblind-safe design. + +Color vision deficiencies apper in many different variations and grades of severity, up to monochromacy, where different colors can only be distinguished via their perceived brightness. +This means that while the color schemes provided by this package are easier to distinguish for the most common color vision deficiencies, information encoded only in color can never be truely colorblind safe. +This leads us to the most important rule in colorblind-safe design: +\begin{center} + \setlength{\fboxrule}{1pt} + \textbf{Rule 1}: + \fbox{\parbox{0.65\columnwidth}{ + Always provide information in more ways than just color. + }} +\end{center} + +If this rule is satisfied in a document, it is by construction guaranteed to be colorblind-safe. +However, this does not mean that it is \emph{convenient} for people with color vision deficiencies to extract the information. +In order to achieve the best possible result, a few more rules should be considered when using color. +\begin{center} + \setlength{\fboxrule}{1pt} + \textbf{Rule 2}: + \fbox{\parbox{0.65\columnwidth}{ + Stick to a color scheme. + \begin{itemize} + \item[(\textbf{a})] Do not mix colors within a scheme. + \item[(\textbf{b})] Do not use shades of colors. + \end{itemize} + }} +\end{center} + +Colors within colorblind-safe color schemes are designed to be eaily distinguishable for people with the most common color vision deficiencies, so we should only use colors from one color scheme in any given visual unit. +In extension, even colors from the same scheme should not be mixed, since this makes it harder to distinguish them. +Even if the result of the mixing is easily distinguishable for people with normal color vision, the same might not be true under certain color vision deficiencies. +For the same reaseon, shades of colors (i.e.\ mixings with black or white) should be avoided, because the brightness of colors is also used to make sure the colors are distinguishable. + +\begin{center} + \setlength{\fboxrule}{1pt} + \textbf{Rule 3}: + \fbox{\parbox{0.65\columnwidth}{ + Do not use color for information and aesthetics simultaneously. + }} +\end{center} + +Color is often also used for aesthetic reasons, e.g., on a scientific poster. +This is usually unproblematic, as the color does not convey information in this case. +However, if color is used to convey information in a visual unit, avoid using additional color for aesthetic purposes, as this makes it more difficult to extract the information encoded in the color. + +\begin{center} + \setlength{\fboxrule}{1pt} + \textbf{Rule 4}: + \fbox{\parbox{0.65\columnwidth}{ + Do not use rainbow color schemes. + }} +\end{center} + +Due to the many different colors in a rainbow color scheme, they are inevitably difficult to distinguish for people with color vision deficiencies. +Therefore, it is best to avoid them. +If a rainbow color scheme has to be used at all cost, Paul Tol (and thus also the \texttt{colorblind} package) provides both a discrete as well as a continuous version~\cite{Tol}, which are optimized to be as distinguishable as possible. + +By following these four simple rules, we can ensure that the information encoded in a document is presented in a colorblind-safe way, and that it is reasonably convenient for people affected by color vision deficiencies to extract the information. +As a side node, following these rules leads to documents that do not suffer from information loss when printed in black and white, which is usually also desirable. + +\section{Provided color schemes}\label{sec:colors} +The color schemes provided are split into three groups: +\begin{itemize} + \item Qualitative schemes:\newline + These schemes are used to convey qualitative information, such as different data sources, countries or manufacturers. + They should usually be used for coloring text or distinguishing different lines/bars in a plot. + \item Diverging color schemes:\newline + When quantitative data ranges between two extremes, and the middle is being considered ``neutral'', a diverging color scheme should be used. + Examples for this kind of data might be test grades, temperatures or pH values. + \item Sequential color schemes:\newline + For quantitative data without an important midpoint, sequential color schemes should be preferred over diverging ones. + This is especially true for quantites that start from $0$. + They can be used to denote for example velocities, concentrations or pressures. +\end{itemize} + +For each type of schemes, this package provides a range of options. +\Cref{sec:Tol_schemes} shows the schemes designed by Paul Tol~\cite{Tol}, which include qualitative, diverging and sequential schemes (see \cref{sec:T-Q,sec:T-D,sec:T-S}). +In \cref{sec:OkabeIto}, the Okabe Ito color scheme~\cite{Ichihara_2008} is provided, which is probably the most famous qualitative colorblind-safe color scheme due to it being mentioned in various articles in high-ranking journals. + +All of the schemes are colorblind-safe, and some are optimized for printout or designed for a particular purpose. +This is denoted under the scheme name.\clearpage + +\subsection{Paul Tol's color schemes}\label{sec:Tol_schemes} + +\subsubsection{Qualitative color schemes}\label{sec:T-Q} +\begin{minipage}{0.5\textwidth} + \centering + \scalebox{0.7}{\drawScheme{T-Q-B}}\\ + \textbf{B}right\\ + \phantom{pb} +\end{minipage}\hfill% +\begin{minipage}{0.5\textwidth} + \centering + \scalebox{0.7}{\drawScheme{T-Q-V}}\\ + \textbf{V}ibrant +\end{minipage} + +\begin{minipage}{0.5\textwidth} + \centering + \scalebox{0.7}{\drawScheme{T-Q-HC}}\\ + \textbf{H}igh-\textbf{C}ontrast\\ + works for black and white printout +\end{minipage}\hfill% +\begin{minipage}{0.5\textwidth} + \centering + \scalebox{0.7}{\drawScheme{T-Q-MC}}\\ + \textbf{M}edium-\textbf{C}ontrast\\ + works for black and white printout +\end{minipage} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-Q-M}}\\ + \textbf{M}uted +\end{center} + +\begin{minipage}{0.5\textwidth} + \centering + \scalebox{0.7}{\drawScheme{T-Q-PH}}\\ + \textbf{P}ale \textbf{H}ighlight\\ + specifically for text background +\end{minipage}\hfill% +\begin{minipage}{0.5\textwidth} + \centering + \scalebox{0.7}{\drawScheme{T-Q-DT}}\\ + \textbf{D}ark \textbf{T}ext\\ + specifically for text color +\end{minipage} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-Q-L}}\\ + \textbf{L}ight\\ + less distinguishable than other schemes,\\ mostly meant for filling in labelled cells +\end{center}\clearpage + +\subsubsection{Diverging color schemes}\label{sec:T-D} +For diverging schemes, when a continuous scheme is needed, the colors are allowed to be linearly interpolated. +When using the option \texttt{pgf}, the interpolations are available as colormaps with the names of their color scheme. + +\begin{center} + \scalebox{0.7}{\drawScheme{T-D-S}}\\ + \drawSchemeC[0.6\textwidth]{T-D-S}\\ + \textbf{S}unset +\end{center} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-D-N}}\\ + \drawSchemeC[0.9\textwidth]{T-D-N}\\ + \textbf{N}ightfall +\end{center} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-D-BR}}\\ + \drawSchemeC[0.5\textwidth]{T-D-BR}\\ + \textbf{B}u\textbf{R}d +\end{center} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-D-PG}}\\ + \drawSchemeC[0.5\textwidth]{T-D-PG}\\ + \textbf{P}R\textbf{G}n +\end{center}\clearpage + +\subsubsection{Sequential color schemes}\label{sec:T-S} +For most sequential schemes, a continuous scheme can be obtained again by linearly interpolating the colors. +The only exception to this is the \emph{discrete rainbow} scheme, which has an explicitly continuos variation, the \emph{smooth rainbow} scheme. +When using the option \texttt{pgf}, the interpolations are available as colormaps with the names of their color scheme. + +When the discrete scheme is not shown, this is because there are too many colors in it. + +\begin{center} + \scalebox{0.7}{\drawScheme{T-S-YOB}}\\ + \drawSchemeC[0.5\textwidth]{T-S-YOB}\\ + \textbf{Y}l\textbf{O}r\textbf{B}r +\end{center} + +\begin{center} + \drawSchemeC[0.9\textwidth]{T-S-IR}\\ + \textbf{Ir}idescent +\end{center} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-S-IN}}\\ + \drawSchemeC[0.6\textwidth]{T-S-IN}\\ + \textbf{In}candescent\\ + not print-friendly +\end{center} + +\begin{center} + \scalebox{0.7}{\drawScheme{T-S-DR}}\\ + \textbf{D}iscrete \textbf{R}ainbow\\ + Do not interpolate! +\end{center} + +\begin{center} + \drawSchemeC[\textwidth]{T-S-SR}\\ + \textbf{S}mooth \textbf{R}ainbow\\ +\end{center}\clearpage + +\subsection{Okabe Ito qualitative color scheme}\label{sec:OkabeIto} +This is the qualitative color scheme commonly known as the \emph{Okabe Ito} color palette~\cite{Ichihara_2008}. + +\begin{center} + \scalebox{0.7}{\drawScheme{OI}}\\ + \textbf{O}kabe \textbf{I}to +\end{center} + +\section{Provided commands} +\marg{\cs{drawScheme\{...\}}}% +The discrete visualizations of color schemes given in this documentation are created with the command \cs{drawScheme\{...\}}. +The name of the color scheme should be provided to the command, e.g.\ \cs{drawScheme\{T-Q-B\}} to print the \emph{qualitative bright} scheme by Tol. +Note that this command is not available when the package option \texttt{no-tikz} is used. + +\marg{\cs{drawSchemeC\{...\}}}% +The continuous visualizations of color schemes given in this documentation are created with the command \cs{drawSchemeC\{...\}}. +The name of the color scheme should be provided to the command, e.g.\ \cs{drawSchemeC\{T-D-S\}} to print the \emph{diverging sunset} scheme by Tol. +Note that this command only works for color schemes that are allowed to be interpolated, and that the command is only available when the package option \texttt{pgf} is used. + +\clearpage +\printbibliography + +\end{document} diff --git a/macros/latex/contrib/colorblind/documentation.pdf b/macros/latex/contrib/colorblind/documentation.pdf deleted file mode 100644 index f35c947328..0000000000 Binary files a/macros/latex/contrib/colorblind/documentation.pdf and /dev/null differ diff --git a/macros/latex/contrib/colorblind/documentation.tex b/macros/latex/contrib/colorblind/documentation.tex deleted file mode 100644 index a04188b570..0000000000 --- a/macros/latex/contrib/colorblind/documentation.tex +++ /dev/null @@ -1,365 +0,0 @@ -%% -%% ---------------------------------------------------------------- -%% Copyright (C) 2023-2024 by Simon Pfahler -%% ---------------------------------------------------------------- -%% -%! TeX program = lualatex -\documentclass{scrartcl} -\usepackage[left=4cm,right=3cm,top=3cm,bottom=3cm, marginpar=3cm]{geometry} -\setlength{\parindent}{0pt} -\setlength{\parskip}{1ex} - -\usepackage{cprotect} -\usepackage{tikz} -\usetikzlibrary{math} - -\usepackage{xcolor} -\usepackage{soul} - -\usepackage{tikz} -\usetikzlibrary{positioning, shapes, fit, arrows.meta, decorations.pathmorphing} -\pgfdeclarelayer{bg} -\pgfsetlayers{bg,main} - -\usepackage{pgfplots, pgfplotstable} -\pgfplotsset{compat=1.18} - -%%%% from https://tex.stackexchange.com/questions/355713/pgfplots-show-error-marker-in-legend -\pgfplotsset{error bar legend/.style={% - /pgfplots/legend image code/.prefix code={% - \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% - \draw[% - /pgfplots/every error bar, - mark=\pgfplotserrorbarsmark, - /pgfplots/error bars/error mark options, - sharp plot, - ##1 - ] plot coordinates {(0.3cm, -0.15cm) (0.3cm, 0.15cm)};% - } - } -} -%%%% - -\pgfplotsset{custom area legend/.style={% - /pgfplots/legend image code/.prefix code={% - \fill[##1, draw=white] plot coordinates {(0cm, -0.1cm) (0.6cm,-0.1cm) (0.6cm, 0.1cm) (0cm, 0.1cm)};% - } - } -} - -\def\w{420pt} - -\usepackage{hyperref} -\hypersetup{ - pdftitle={Easy colorblind-safe typesetting: the colorblind package}, - pdfauthor={Simon Pfahler}, -} -\usepackage{cleveref} - -\usepackage{csquotes} -\usepackage[backend=biber, style=numeric-comp, seconds=true, sorting=none, subentry=true, doi=false, alldates=iso]{biblatex} -\renewcommand*{\entrysetpunct}{\\[5pt]} -\addbibresource{bib.bib} - -\usepackage[Tol, OkabeIto]{colorblind} - -\newcommand\colorblind{\textbf{colorblind} } -\newcommand\hlc[2][T-Q-PH4]{{% - \colorlet{foo}{#1}% - \sethlcolor{foo}\hl{#2}}% -} - -\reversemarginpar -\newcommand\marg[1]{\leavevmode\marginpar{\raggedleft #1}} -\newcommand\tbs{\textbackslash} - -\title{Easy colorblind-safe typesetting:\\ the \colorblind package} -\author{Simon Pfahler} -\date{\today\\Version 1.0} - - -\begin{document} - -\maketitle - -\begin{abstract} - In colorblind-safe documents, the contents are presented in a way that the same information is conveyed to readers regardless of a potential color vision deficiency. - This package provides the tools necessary for colorblind-safe typesetting in \LaTeX. - It provides color schemes for a wide range of applications. - The most commonly used schemes are qualitative schemes, providing easily distinguishable colors for use in graphics, but also for text coloring or highlighting. - Additionally, diverging and sequential schemes are included which can be used for encoding quantitative information using colors. - This package incorporates colorblind-safeness into the writing process, making it both less cumbersome and less error-prone. -\end{abstract} - -\tableofcontents -\clearpage - -\section{Introduction} -\subsection{Package options} -\cprotect\marg{\verb!Tol!\\\verb!OkabeIto!}% -The \colorblind package provides the color schemes by Paul Tol~\cite{Tol} and the Okabe Ito color palette~\cite{Ichihara_2008}. -By default, no schemes are loaded. -Providing one of the options \verb!Tol! or \verb!OkabeIto! loads all corresponding schemes. - -\subsection{Overview} -As an example for how to use the colors, we look at the \emph{bright qualitative} color scheme by Tol. -\cref{fig:T-Q-Bexample} shows the colors in the scheme - -\begin{figure}[ht] - \centering - \drawScheme{T-Q-B} - \caption{Bright qualitative color scheme by Tol.} - \label{fig:T-Q-Bexample} -\end{figure} - -All colors in this model start with \verb!T-Q-B!, indicating that it is a scheme by \textbf{T}ol, that it is a \textbf{q}ualitative scheme, and that it is the \textbf{b}right scheme. -The colors in the scheme are specified by a number following the scheme name, in this case ranging from \verb!T-Q-B1! to \verb!T-Q-B6! for the non-grey colors. -The additional color \verb!T-Q-B0! provides a color that can be used, e.g., to indicate bad data. - -There are two reasons why color names are not based on natural color names (e.g., ``\hlc[T-Q-PH1]{blue}''): -\begin{enumerate} - \item Certain colors (\hlc[T-Q-PH3]{green}, \hlc[T-Q-PH5]{red}) are often used by people with full color vision to convey certain meanings (\hlc[T-Q-PH3]{good}, \hlc[T-Q-PH5]{bad}). - This meaning is difficult for people with color vision deficiencies to pick up. - By not using natural color names, it is easier to write colorblind-safe documents that do not make use of said connotations. - \item Natural color names can be cumbersome, e.g., when multiple variations of a primary color are used. It is annoying having to look up if a color is called, e.g., \hlc[T-Q-PH1]{blue} or \hlc[T-Q-PH2]{cyan}. -\end{enumerate} - -These colors are used the same way as any other colors. To change the text color to \verb!T-Q-B1! for example, use \verb!\color{T-Q-B1}!. - -\section{Guidelines} -On its own, using colorblind-safe colors is not sufficient for making a document truly colorblind-safe. -This section provides some general rules to follow for colorblind-safe typesetting. - -These rules apply to each visual unit of a document individually. -A visual unit may be a graphic, a table or a paragraph of text. -It might be advisable to be consistent also between different visual units (e.g., use the same color scheme for all graphics), but this is more of an aesthetic argument and is not strictly necessary for a colorblind-safe document. - -The most important rules are: -\begin{enumerate} - \item \hlc{Do not mix the colors in qualitative schemes!}\newline - The colors in each scheme are defined with the purpose of being easily distinguishable. - Mixing of colors, e.g., \verb?T-Q-B1!50!T-Q-B5? interferes with this. - A special case of this is that qualitative colors should not be mixed in order to convey quantitative information. - In this case, a suitable non-qualitative color scheme (i.e.\ a diverging or sequential scheme) should be used. - \item \hlc{Only use colors from one color scheme for a given visual unit!}\newline - The colors between different schemes are not tuned to be distinguishable. - Using colors from multiple schemes therefore defies the point of this package. - \item \hlc{Do not use shades of colors!}\newline - Saturation and brightness are also used for distinguishability, so mixings involving \verb!white! and \verb!black! should also be avoided. -\end{enumerate} - -The first two rules should be ensured in any visual unit. If the need for more colors arises, a different color scheme should be used alltogether. -While the third rule should also be followed in most scenarios, there are some situations that might allow for breaking this rule. As an example, consider \cref{fig:errorbar_plot}, where the error band is colored with a lighter shade of the original color. -This is ok because only few colors are used in the plot and the colors are not necessary for conveying the message of the plot. - -\begin{figure}[ht] - \centering - \begin{tikzpicture} - \begin{axis}[ - width=0.4*\w, - height=0.28*\w, - scale only axis=true, - xlabel = {x}, - ylabel = {y}, - x label style = {yshift=2mm}, - y label style = {yshift=-2mm}, - clip marker paths=true, - axis on top - ] - - \fill[T-Q-B5!20] (0,0.1068558) -- (40,0.1068558) -- (40,0.0668558) -- (0,0.0668558) -- cycle; - \draw[T-Q-B5] (0,0.0868558) -- (40,0.0868558); - - \addplot[color=T-Q-B1, mark=*, only marks, forget plot] - plot[/pgfplots/error bars/.cd, x dir=none, y dir=both, y explicit, - error mark=-, error bar style={color=T-Q-B1}] - coordinates { - (4,0.263148) +- (0.120064,0.120064) - (8,0.159158) +- (0.0621894,0.0621894) - (12,0.129892) +- (0.0543303,0.0543303) - (16,0.112302) +- (0.0358508,0.0358508) - (20,0.098435) +- (0.02648,0.02648) - (24,0.0909784) +- (0.0215048,0.0215048) - (28,0.0894657) +- (0.0212992,0.0212992) - (32,0.0869343) +- (0.0202553,0.0202553) - }; - \addlegendimage{T-Q-B1, mark=*, only marks, error bar legend}; - \addlegendentry{data}; - \addlegendimage{draw=T-Q-B5, fill=T-Q-B5!20, custom area legend}; - \addlegendentry{reference}; - - \end{axis} - \end{tikzpicture} - \cprotect\caption{This plot breaks rule 3 by using the shade \verb?T-Q-B5!20? for the error band of the reference, but it is still colorblind-safe.} - \label{fig:errorbar_plot} -\end{figure} - -There are additional guidelines that should be kept in mind when typesetting colorblind-safe documents. -Their importance may vary between different applications, so try to follow them as best as possible, at your own judgement. -In no particular order, they are: -\begin{itemize} - \item \hlc{Do not convey information only through color!}\newline - When possible, encode the information the color provides also in a different way, e.g., through text, patterns or symbols. - \item \hlc{Do not use color for information and aesthetics simultaneously!}\newline - Color is often also used for aesthetic reasons, e.g., on a scientific poster. - While this is ok in principle, do not mix information and aesthetics within the same visual unit, as this makes it more difficult to extract the encoded information. - \item \hlc{Do not use rainbow color schemes!}\newline - Due to the many different colors in a rainbow color scheme, they are very difficult to distinguish for people with color vision deficiencies (even when the scheme is tuned for this purpose). - Therefore, it is best to avoid them. - If you insist on using them, Paul Tol provides both a sequential as well as a continuous version, which are optimized to be as distinguishable as possible. -\end{itemize} - -\section{Provided color schemes}\label{sec:colors} -The color schemes provided are split into three groups: -\begin{itemize} - \item Qualitative schemes:\newline - These schemes are used to convey qualitative information, such as different data sources, countries or manufacturers. - They should usually be used for coloring text or distinguishing different lines/bars in a plot. - \item Diverging color schemes:\newline - When quantitative data ranges between two extremes, and the middle is being considered ``neutral'', a diverging color scheme should be used. - Examples for this kind of data might be test grades, temperatures or pH values. - \item Sequential color schemes:\newline - For quantitative data without an important midpoint, sequential color schemes should be preferred over diverging ones. - This is especially true for quantites that start from $0$. - They can be used to denote for example velocities, concentrations or pressures. -\end{itemize} - -For each type of schemes, this package provides a range of options. -\Cref{sec:Tol_schemes} shows the schemes designed by Paul Tol~\cite{Tol}, which include qualitative, diverging and sequential schemes (see \cref{sec:T-Q,sec:T-D,sec:T-S}). -In \cref{sec:OkabeIto}, the Okabe Ito color scheme~\cite{Ichihara_2008} is provided, which is probably the most famous qualitative colorblind-safe color scheme due to it being mentioned in various articles in high-ranking journals. - -All of the schemes are colorblind-safe, and some are optimized for printout or designed for a particular purpose. -This is denoted under the scheme name.\clearpage - -\subsection{Paul Tol's color schemes}\label{sec:Tol_schemes} - -\subsubsection{Qualitative color schemes}\label{sec:T-Q} -\begin{minipage}{0.5\textwidth} - \centering - \scalebox{0.7}{\drawScheme{T-Q-B}}\\ - \textbf{B}right\\ - \phantom{pb} -\end{minipage}\hfill% -\begin{minipage}{0.5\textwidth} - \centering - \scalebox{0.7}{\drawScheme{T-Q-V}}\\ - \textbf{V}ibrant -\end{minipage} - -\begin{minipage}{0.5\textwidth} - \centering - \scalebox{0.7}{\drawScheme{T-Q-HC}}\\ - \textbf{H}igh-\textbf{C}ontrast\\ - works for black and white printout -\end{minipage}\hfill% -\begin{minipage}{0.5\textwidth} - \centering - \scalebox{0.7}{\drawScheme{T-Q-MC}}\\ - \textbf{M}edium-\textbf{C}ontrast\\ - works for black and white printout -\end{minipage} - -\begin{center} - \scalebox{0.7}{\drawScheme{T-Q-M}}\\ - \textbf{M}uted -\end{center} - -\begin{minipage}{0.5\textwidth} - \centering - \scalebox{0.7}{\drawScheme{T-Q-PH}}\\ - \textbf{P}ale \textbf{H}ighlight\\ - specifically for text background -\end{minipage}\hfill% -\begin{minipage}{0.5\textwidth} - \centering - \scalebox{0.7}{\drawScheme{T-Q-DT}}\\ - \textbf{D}ark \textbf{T}ext\\ - specifically for text color -\end{minipage} - -\begin{center} - \scalebox{0.7}{\drawScheme{T-Q-L}}\\ - \textbf{L}ight\\ - less distinguishable than other schemes,\\ mostly meant for filling in labelled cells -\end{center}\clearpage - -\subsubsection{Diverging color schemes}\label{sec:T-D} -For diverging schemes, when a continuous palette is needed, the colors are allowed to be linearly interpolated. -When using \verb!pgfplots! (or \verb!TikZ!), the interpolations are available as colormaps with the names of their color scheme. - -\begin{center} - \scalebox{0.7}{\drawScheme{T-D-S}}\\ - \drawSchemeC[0.6\textwidth]{T-D-S}\\ - \textbf{S}unset -\end{center} - -\begin{center} - \scalebox{0.7}{\drawScheme{T-D-N}}\\ - \drawSchemeC[0.9\textwidth]{T-D-N}\\ - \textbf{N}ightfall -\end{center} - -\begin{center} - \scalebox{0.7}{\drawScheme{T-D-BR}}\\ - \drawSchemeC[0.5\textwidth]{T-D-BR}\\ - \textbf{B}u\textbf{R}d -\end{center}\clearpage - -\subsubsection{Sequential color schemes}\label{sec:T-S} -For most sequential schemes, a continuous palette can be obtained again by linearly interpolating the colors. -The only exception to this is the \emph{discrete rainbow} scheme, which has an explicitly continuos variation, the \emph{smooth rainbow} scheme. -When using \verb!pgfplots!, the interpolations are available as colormaps with the names of their color scheme. - -When the discrete scheme is not shown, this is because there are too many colors in them. - -\begin{center} - \scalebox{0.7}{\drawScheme{T-S-YOB}}\\ - \drawSchemeC[0.5\textwidth]{T-S-YOB}\\ - \textbf{Y}l\textbf{O}r\textbf{B}r -\end{center} - -\begin{center} - \drawSchemeC[0.9\textwidth]{T-S-IR}\\ - \textbf{Ir}idescent -\end{center} - -\begin{center} - \scalebox{0.7}{\drawScheme{T-S-IN}}\\ - \drawSchemeC[0.6\textwidth]{T-S-IN}\\ - \textbf{In}candescent\\ - not print-friendly -\end{center} - -\begin{center} - \scalebox{0.7}{\drawScheme{T-S-DR}}\\ - \textbf{D}iscrete \textbf{R}ainbow\\ - Do not interpolate! -\end{center} - -\begin{center} - \drawSchemeC[\textwidth]{T-S-SR}\\ - \textbf{S}mooth \textbf{R}ainbow\\ -\end{center} - -\subsection{Okabe Ito qualitative color scheme}\label{sec:OkabeIto} -This is the qualitative color scheme commonly known as the \emph{Okabe Ito} color palette~\cite{Ichihara_2008}. - -\begin{center} - \scalebox{0.7}{\drawScheme{OI}}\\ - \textbf{O}kabe \textbf{I}to -\end{center} - -\section{Provided commands} -\cprotect\marg{\verb!\drawScheme{...}!}% -The discrete visualizations of color schemes given in this documentation are created with the command \verb!\drawScheme{...}!. -The name of the color scheme should be provided to the command, e.g.\ \verb!\drawScheme{T-Q-B}! to print the \emph{qualitative bright} scheme by Tol. - -\cprotect\marg{\verb!\drawSchemeC{...}!}% -The continuous visualizations of color schemes given in this documentation are created with the command \verb!\drawSchemeC{...}!. -The name of the color scheme should be provided to the command, e.g.\ \verb!\drawSchemeC{T-D-S}! to print the \emph{diverging sunset} scheme by Tol. -Note that this command only works for color schemes that are allowed to be interpolated. - -\clearpage -\printbibliography - -\end{document} diff --git a/macros/latex/contrib/easybook/README.md b/macros/latex/contrib/easybook/README.md index dce421d3b4..bd0b1b68e2 100644 --- a/macros/latex/contrib/easybook/README.md +++ b/macros/latex/contrib/easybook/README.md @@ -1,5 +1,5 @@ # The `easybook` document class -Easily typesetting Chinese theses or books (v2024hx) +Easily typesetting Chinese theses or books (v2024hz) ## Abstract `easybook` is a pure academic template created based on the `ctexbook` book document class. It also has the functions of `book` and `article` document class. Combined with the general framework design of the theses of many universities in China, providing multiple commands and interfaces allows users to easily customize the theses templates. Its basic macro package `easybase` can also be used with `ctex` and standard document classes. diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 2cd88bcc15..e3146b967d 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -14,7 +14,7 @@ % This work has the LPPL maintenance status `maintained'. %\NeedsTeXFormat{LaTeX2e}[2021/11/15] %<*class> -\ProvidesExplClass{easybook}{2024/12/22}{2024hx} +\ProvidesExplClass{easybook}{2024/12/23}{2024hz} {Easily typesetting Chinese theses or books} \bool_new:N \l__eb_compile_draft_bool @@ -308,7 +308,7 @@ % %<*package> \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2024/12/22}{2024hx} +\ProvidesExplPackage{easybase}{2024/12/23}{2024hz} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -1647,7 +1647,7 @@ \clist_if_exist:cT { l__eb_toc_outer_kv_#1_clist } { \keys_set:nv { eb/tocouter } { l__eb_toc_outer_kv_#1_clist } } } -\cs_new_protected:Npn \eb_toc_kv_set:nn +\cs_new_protected:Npn \eb_toc_kv_set:nn #1#2 { \eb_toc_outer_kv_initial:n {#1} \IfValueT{#2}{\keys_set:nn { eb/tocouter } {#2}} @@ -3008,7 +3008,7 @@ } % %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/12/22}{2024hx} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/12/23}{2024hz} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf index 686760c0a4..01f70dc7a8 100644 Binary files a/macros/latex/contrib/easybook/easybook.pdf and b/macros/latex/contrib/easybook/easybook.pdf differ diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 2ca7066d43..0dcf45bc12 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -23,8 +23,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v2024hx, - date = 2024/12/22, + version = v2024hz, + date = 2024/12/23, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = toquyi@163.com, diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx index d3c92b9ef3..00a2b3afd8 100644 --- a/macros/latex/contrib/exesheet/exesheet.dtx +++ b/macros/latex/contrib/exesheet/exesheet.dtx @@ -23,16 +23,17 @@ %\ProvidesClass{exesheet} %\ProvidesPackage{exesheet} %<*class|package> -[2024/02/13 v2.7 .dtx Typesetting exercise or exam sheets] +[2024/12/22 v2.8 Typesetting exercise or exam sheets] % %<*driver> -\documentclass{ltxdoc} -% -% uncomment the following lines if you want to use the exesheet class instead of ltxdoc -%\usepackage{doc} -%\AtBeginDocument{\MakeShortVerb{\|}} -%\providecommand\marg[1]{{\ttfamily\{}\meta{#1}{\ttfamily\}}} -%\providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}} +\documentclass{article} + +% comment the following lines to use the ltxdoc class instead of the doc package +\usepackage{hypdoc} +\AtBeginDocument{\MakeShortVerb{\|}} +\providecommand\marg[1]{{\ttfamily\{}\meta{#1}{\ttfamily\}}} +\providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}} + \usepackage[exetoc=false,marginwidth=unset,display=notes]{exesheet} \usepackage{schooldocs} \usepackage[utf8]{inputenc} @@ -85,24 +86,6 @@ % % \fi % -% \CheckSum{1206} -% -% \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{v0.0}{2010/09/01}{Initial personal version} % \changes{v0.9}{2020/01/02}{Initial documentation in French} % \changes{v1.0}{2020/07/22}{Initial public version with documentation in English} @@ -184,6 +167,11 @@ % - babel-french option 'StandardLists=true' works now if french is passed in documentclass % - completion of the comparison with other packages} % +% \changes{v2.8}{2024/12/22}{ +% - improvements in answers environment +% - starred environments tablenuma* and tablitem* no longer supported +% - character table and checksum removed from dtx file (useless)} +% % \GetFileInfo{exesheet.dtx} % % \maketitle @@ -259,6 +247,7 @@ % \psframe(-0.25,1.3)(12.75,-0.3) % Try this first command; easy! % +% \bigskip % To bring optional text closer to the exercise number, % you can employ |\unskip| which removes any preceding space. % Take a look at the following example, achieved with @@ -269,13 +258,13 @@ % % \bigskip % \DescribeMacro{\exercisename} -% The term ``\exercisename'' is automatically translated into various languages +% The word ``\exercisename'' is automatically translated into various languages % \footnote{Currently, translation is integrated into the package % for the following languages: French, German, Spanish, Italian, and Portuguese.} % depending on the language that is loaded (via \textsf{babel} or \textsf{polyglossia}). % You can alter it by modifying |\exercisename|. -% A better approach is to use macros from the \textsf{translations} -% package by Clemens Niederberger~\cite{TRAN} (which allows dynamic language switching), +% A better approach is to use macros from the \mbox{\textsf{translations}} +% package by Clemens Niederberger~\cite{TRAN} (which allows language switching), % \eg |\DeclareTranslation{swedish}{exesheet-exercise}{\"Ovning}}|. % % \smallskip @@ -288,7 +277,7 @@ % \smallskip % \DescribeMacro{\theexercise} % If you wish to alter only the numbering style, you can redefine -% the |\theexercise| command based on the |exercise| counter. +% |\theexercise| which is based on the |exercise| counter. % % \smallskip % \DescribeMacro{\labelexercisestyle} @@ -442,7 +431,7 @@ % that allows, among others things, % the typesetting of alternative list labels. For instance, typing % |\begin{enumerate}[label=\alph*),font=\itshape\normalfont]| -% will yield the labels ``\emph{a)}, \emph{b)}, \emph{c)}\ldots''. +% will produce the labels ``\emph{a)}, \emph{b)}, \emph{c)}\ldots''. % There are many other options available % (see the \textsf{enumitem}~\cite{ENUM} package documentation) % \footnote{Labels can also be modified using a ``shortlabel'' argument, @@ -522,7 +511,7 @@ % Clemens Niederberger~\cite{TASK}. % The usage of the optional argument \meta{opt} is % explained in the documentation of this package. -% For example, similar to the \textsf{enumitem} package~\cite{ENUM}, +% For example, similar to the \mbox{\textsf{enumitem}} package~\cite{ENUM}, % |label=\arabic*)| produces an Arabic numbering % followed by a closing parenthesis. % Additionally there are numerous possibilities for arranging items in original ways. @@ -534,7 +523,7 @@ % Notice that numbering occurs line by line in this context. % % \exercise -% \psframe(-0.25,1.3)(12.75,-2.8) +% \psframe(-0.25,1.3)(12.75,-2.7) % Calculate the derivative of the following functions: % \begin{tablenum1}(3) % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$, @@ -568,26 +557,31 @@ % When \texttt{setlist=true}, place these commands \emph{after} |\begin{document}|. % % \medskip -% \DescribeEnv{tablenuma*} \DescribeEnv{tablitem*} % When you intend to utilize \texttt{tablenuma} (or \texttt{tablitem}) % immediately after inserting the |\item| command % within an \texttt{enumerate} environment, -% a vertical misplacement may occur. -% To achieve proper vertical spacing in such cases, we offer -% the starred environments \texttt{tablenuma*} and \texttt{tablitem*}, -% with corrected alignment as shown below: -% -% \noindent\psframe(-0.25,0.05)(12.75,-0.97) -% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0, -0.6)(10.5, -0.6) +% a vertical misplacement may occur as shown below: % \begin{enumerate} % \item -% \begin{tablenuma*}(3) \item One \item Two \item Three \end{tablenuma*} +% \begin{tablenuma}(3) \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$ +% \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$, +% \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$. +% \end{tablenuma} % \end{enumerate} +% To adjust the vertical alignment, include +% |\mbox{}\vspace|\marg{height} just after |\item| and before invoking |\begin{tablenuma}| +% (or |\begin{tablitem}|), where \meta{height} can be a positive or negative length. +% Here we used |\vspace{-5.4ex}|. % -% \medskip -% If the vertical alignment is still not perfect, include -% |\mbox{}\vspace|\marg{height} just after |\item| and before invoking |\begin{tablenuma*}| -% (or |\begin{tablitem*}|), where \meta{height} can be a positive or negative length. +% \noindent\psframe(-0.25,0.15)(12.75,-1.05) +% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0,-0.57)(12,-0.57) +% \begin{enumerate} +% \item \mbox{}\vspace{-5.4ex} +% \begin{tablenuma}(3) \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$ +% \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$, +% \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$. +% \end{tablenuma} +% \end{enumerate} % % \subsection{Items aligned by column: \texttt{colsenum}, \texttt{colsitem}} % \DescribeEnv{colsenum} @@ -602,7 +596,7 @@ % Here's an example with |\begin{colsenum}{3}|: % % \exercise -% \psframe(-0.25,1.3)(12.75,-2.65) +% \psframe(-0.25,1.3)(12.75,-2.7) % Calculate the derivative of the following functions: % \begin{colsenum}{3} % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$, @@ -731,21 +725,21 @@ % % \subsection{More about \texttt{answers} environments} % Internally, we have utilized the |\comment| and |\endcomment| macros -% from the \textsf{versions} package by Uwe Lück~\cite{VERS}. -% ^^A Several other packages also enable selective management of code portions. -% ^^A Notably, the \textsf{verbatim} package by Rainer Schöpf, -% ^^A \textsf{comment} by Victor Eijkhout, -% ^^A \textsf{version} by Donald Arseneau and Stephen Bellantoni, -% ^^A \textsf{optional} by Donald Arseneau -% ^^A and \textsf{codesection} by Matthias Pospiech. +% from the \mbox{\textsf{versions}} package by Uwe Lück~\cite{VERS}. +% Several other packages also enable selective management of code portions. +% Notably, the \textsf{verbatim} package by Rainer Schöpf, +% \textsf{comment} by Victor Eijkhout, +% \textsf{version} by Donald Arseneau and Stephen Bellantoni, +% \textsf{optional} by Donald Arseneau +% and \textsf{codesection} by Matthias Pospiech. % Moreover, the \textsf{versions} package~\cite{VERS} offers % the |\excludeversion|\marg{env} and % |\includeversion|\marg{env} macros which allow for the exclusion or inclusion of % any environment \meta{env}. These ``optional'' environments -% can be nested. -% ^^A \footnote{The \textsf{codesection} package also supports -% ^^A such nesting, including within the preamble, as well as the \textsf{optional} package, -% ^^A but the latter manages only short sections of optional code.}. +% can be nested +% \footnote{The \textsf{codesection} package also supports +% such nesting, including within the preamble, as well as the \textsf{optional} package, +% but the latter manages only short sections of optional code.}. % % However the \texttt{questions} and \texttt{answers} environments % serve a broader purpose beyond merely displaying or hiding text. @@ -769,15 +763,6 @@ % other numbers for lower levels % (which won't appear in the table of contents or in the PDF file’s summary). % -% Caution should be taken that, if the \texttt{questions} environment is not used -% beforehand in the same exercise (or part), -% the \texttt{answers} environment will consider the correction as global -% for the entire sheet (or exercise) and will reset the \texttt{exercise} -% (or \texttt{part}) counter. -% This can be managed properly with the optional argument. -% For example, use |\begin{answers}[2]| to prevent \texttt{exercise} counter reset, -% or |\begin{answers}[3]| to prevent \texttt{subpart} counter reset. -% % \medskip % \DescribeMacro{answers*} % The starred version \texttt{answers*} doesn't display the @@ -840,7 +825,7 @@ % In the following example, we used % |\exercise[\points{5}]|: % \exercise[\points{5}] -% \psframe(-0.25,1.3)(12.75,-0.4) +% \psframe(-0.25,1.3)(12.75,-0.35) % Try to read this document to the end without drinking tea and you get five points. % % \bigskip @@ -965,7 +950,7 @@ % single one by specifying the number of points as an optional argument of the |\note| command: % |\note|\oarg{num}\marg{comment}. % -% The initial comment in the following example is generated (immediately after |\item|) using +% The first comment in the following example is obtained using (immediately after |\item|) % |\note[1]{0.5 for the anti-derivative\\0.5 for simplifying}|. % % \exercise[\totalexe{4}] \label{totalexe} @@ -1266,7 +1251,8 @@ % % \subsection{Comparison with other packages}\label{comparison} % -% In this section, we will provide an overview of the functionalities (as of today \today) +% In this section, we will provide an overview of the functionalities (when version 2.7 of +% this package was published, at February 13, 2024) % of various packages or classes found in the `Exercise' or `Exam' sections % of the CTAN archives % (Comprehensive \TeX\ Archive Network). @@ -1751,7 +1737,8 @@ \@ifundefined{frenchsetup}{}{\frenchsetup{StandardLists=true}} % executed at begin doc if loaded before babel \setlist[enumerate]{font=\enumfont} - \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em} + \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex, + leftmargin=1.5em} \fi % \end{macrocode} @@ -1795,22 +1782,6 @@ label-align=right, item-indent=2.5em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2) - -% \end{macrocode} -% \DescribeEnv{tablenuma*} \DescribeEnv{tablitem*} -% The starred environments \texttt{tablenuma*} and \texttt{tablitem*} -% are designed to be employed within an \texttt{enumerate} environment, -% precisely at the outset of an |\item|, in order to achieve correct horizontal -% alignment. -% The length of |-1.667\baselineskip| has been tested with various font families and sizes. -% The alignment is generally good. -% \begin{macrocode} -\newenvironment{tablenuma*}{% - \mbox{}\vspace{-1.667\baselineskip}\begin{tablenuma}}{ - \end{tablenuma}} -\newenvironment{tablitem*}{% - \mbox{}\vspace{-1.667\baselineskip}\begin{tablitem}}{ - \end{tablitem}} % \end{macrocode} % \DescribeEnv{colsenum}\DescribeEnv{colsenum*} @@ -1946,7 +1917,8 @@ \newcounter{@toclevel} \newcommand{\set@toclevel}[1][]{ \ifthenelse{\equal{#1}{}}{ - \ifthenelse{\value{exercise} > \value{exe@ini}}{ + \ifthenelse{\(\value{exercise} > \value{exe@ini}\) + \and \(\value{exe@ini} > 0 \)}{ \setcounter{@toclevel}{1} }{% else \ifthenelse{\equal{\the\@enumdepth}{0}}{ @@ -1971,14 +1943,14 @@ \ifexesheet@exetoc \addcontentsline{toc}{section}{\correctionname} \fi - \setcounter{exercise}{0} + \setcounter{exercise}{\value{exe@ini}} }{% else if \ifthenelse{\value{@toclevel} = 2}{% \subsection*{\correctionstyle\correctionname} \ifexesheet@exetoc \addcontentsline{toc}{subsection}{\correctionname} \fi - \setcounter{subpart}{0} + \setcounter{subpart}{\value{subpart@ini}} }{% else if \ifthenelse{\value{@toclevel} = 3}{% \subsubsection*{\correctionstyle\correctionname} @@ -1997,9 +1969,9 @@ % \begin{macrocode} \newenvironment{answers}[1][]{% #1 is the optional level \ifthenelse{\boolean{exesheet@answers}}{% - \ifthenelse{\boolean{exesheet@questions}}{ - \set@toclevel[#1] - \typeset@correctionname + \ifthenelse{\boolean{exesheet@questions}}{% + \set@toclevel[#1]% + \typeset@correctionname% \correctionstyle% \ifexesheet@setlist \settasks{ @@ -2016,9 +1988,12 @@ \renewcommand{\columnseprulecolor}{% \color{correctioncolor}} \fi% - }{} + }{}% }{\comment} -}{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}} +}{\ifthenelse{\boolean{exesheet@answers}}{% + \setcounter{exe@ini}{0} + \setcounter{subpart@ini}{0} + }{\endcomment}} \newenvironment{answers*}{ \ifthenelse{\boolean{exesheet@answers}}{\correctionstyle}{\comment} @@ -2096,7 +2071,7 @@ % and \texttt{noteragged} are handled using the following internal commands. % % \medskip -% The \texttt{display} key option determines the value of the two booleans +% The \texttt{display} key option determines the value of the booleans % |exesheet@pts| and |exesheet@notes|. % The |exesheet@pts| boolean controls the display of the content of |\pts| % and optional arguments of |\note|, @@ -2477,7 +2452,7 @@ % The test |#1 < 2| doesn't work with decimal numbers without |\lengthtest|, % but it works with lengths. % \end{macro} -% \DescribeMacro{\pts} +% \begin{macro}{\pts} % \begin{macrocode} \definecolor{ptscolor}{named}{red} \newcommand{\ptsstyle}[1]{% @@ -2496,7 +2471,7 @@ } % \end{macrocode} -% +% \end{macro} % \begin{macro}{\totalexe} % In the subsequent macros that utilize % |\marginpar|, the presence of percent symbols and |\ignorespaces| is essential diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf index 8f1760acc1..0335f5f818 100644 Binary files a/macros/latex/contrib/exesheet/exesheet.pdf and b/macros/latex/contrib/exesheet/exesheet.pdf differ diff --git a/macros/latex/contrib/pageslts/README b/macros/latex/contrib/pageslts/README index 490ea9aaa5..8a28405692 100644 --- a/macros/latex/contrib/pageslts/README +++ b/macros/latex/contrib/pageslts/README @@ -1,4 +1,4 @@ -README for pageslts package, 2024-12-07, v2.0b +README for pageslts package, 2024-12-23, v2.0c TABLE OF CONTENTS @@ -143,7 +143,7 @@ h) Copy the documentation files to The pageslts.sty for LaTeX2e (i.e. all documents using the pageslts package) requires: -- TeXFormat LaTeX2e, 2024-06-01 +- TeXFormat LaTeX2e, 2024-11-01 - package undolabl, 2024-12-05, v1.0n, https://ctan.org/pkg/undolabl - if any of the options alphMult, AlphMulti, or fnsymbolmult @@ -152,12 +152,12 @@ pageslts package) requires: The pageslts-example.tex requires the same files as all documents using the pageslts package, and additionally: -- class article, 2024/02/08, v1.4n, from classes.dtx: https://ctan.org/pkg/classes +- class article, 2024/06/29, v1.4n, from classes.dtx: https://ctan.org/pkg/classes - package alphalph, 2019/12/09, v2.6, https://ctan.org/pkg/alphalph - package lipsum, 2021-09-20, v2.7, https://ctan.org/pkg/lipsum - package showkeys, 2024/05/23, v3.21, https://ctan.org/pkg/showkeys -- package hyperref, 2024-10-30, v7.01k, https://ctan.org/pkg/hyperref -- package pageslts, 2024-12-06, v2.0b, https://ctan.org/pkg/pageslts +- package hyperref, 2024-11-05, v7.01l, https://ctan.org/pkg/hyperref +- package pageslts, 2024-12-23, v2.0c, https://ctan.org/pkg/pageslts (Well, it is the example file for this package, and because you are reading the README for the pageslts package, it can be assumed that you already have some version of it diff --git a/macros/latex/contrib/pageslts/pageslts-example.pdf b/macros/latex/contrib/pageslts/pageslts-example.pdf index ec37cf643a..780b255316 100644 Binary files a/macros/latex/contrib/pageslts/pageslts-example.pdf and b/macros/latex/contrib/pageslts/pageslts-example.pdf differ diff --git a/macros/latex/contrib/pageslts/pageslts.dtx b/macros/latex/contrib/pageslts/pageslts.dtx index ac421fabe2..b2944ddc63 100644 --- a/macros/latex/contrib/pageslts/pageslts.dtx +++ b/macros/latex/contrib/pageslts/pageslts.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % File: pageslts.dtx -% Version: 2024-12-07 v2.0b +% Version: 2024-12-23 v2.0c % Info: Variants of last page labels % % Copyright © 2010 - 2024 by @@ -54,7 +54,7 @@ \input docstrip.tex \Msg{**********************************************************************************} \Msg{* Installation *} -\Msg{* Package: pageslts 2024-12-07 v2.0b Refers to special pages' numbers/names (HMM)*} +\Msg{* Package: pageslts 2024-12-23 v2.0c Refers to special pages' numbers/names (HMM)*} \Msg{**********************************************************************************} \keepsilent @@ -66,7 +66,7 @@ This is a generated file. Project: pageslts -Version: 2024-12-07 v2.0b +Version: 2024-12-23 v2.0c Info: Variants of last page labels Copyright (C) 2010 - 2024 by @@ -174,9 +174,9 @@ In memoriam % % \begin{macrocode} %<*driver> -\NeedsTeXFormat{LaTeX2e}[2022-11-01] +\NeedsTeXFormat{LaTeX2e}[2024-11-01] \ProvidesFile{pageslts.drv}% - [2024-12-07 v2.0b Refers to special pages' numbers/names (HMM)] + [2024-12-23 v2.0c Refers to special pages' numbers/names (HMM)] \documentclass[landscape]{ltxdoc}[2024/02/08]% v2.1j Standard LaTeX documentation class \usepackage{geometry}[2020/01/02]% v5.9 Page Geometry \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) @@ -251,7 +251,7 @@ In memoriam % \renewcommand{\indent}{\hspace*{\ltsindent}} % % \title{The \xpackage{pageslts} package} -% \date{2024-12-07 v2.0b} +% \date{2024-12-23 v2.0c} % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}} % % \maketitle @@ -901,7 +901,7 @@ In memoriam % % \item[-]\DescribeMacro{totpages} % The \xpackage{totpages} package provides a \texttt{totpages} label similar to -% \texttt{LastPages}, but |\AtEndDocument| instead of hook |enddocument/afterlastpage|. +% \texttt{LastPages}, but |\AtEndDocument| instead of hook |enddocument/|\linebreak |afterlastpage|. % Therefore you should stay with \xpackage{pageslts}. % The \xpackage{totpages} package additionally computes the number of paper sheets % needed to (double) print the document (with one, two, three,\ldots{} pages on @@ -980,11 +980,11 @@ In memoriam % \section{Example} % \begin{macrocode} %<*example> -\documentclass[british]{article}[2024/02/08]% v1.4n +\documentclass[british]{article}[2024/06/29]% v1.4n \usepackage{lipsum}[2021-09-20]% v2.7 \usepackage[draft]{showkeys}[2024/05/23]% v3.21 %% Use final instead of draft to hide the keys. %% -\usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2024-10-30]% v7.01k +\usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2024-11-05]% v7.01l \makeatletter \@ifpackageloaded{hyperref}{% Hypertext links for LaTeX \hypersetup{extension=pdf,% @@ -1001,7 +1001,7 @@ In memoriam }}{\usepackage{url}[2013/09/16]}% v3.4 \makeatother \usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,fnsymbolmult=true,% - romanMult=true,RomanMulti=true]{pageslts}[2024-12-07]% v2.0b + romanMult=true,RomanMulti=true]{pageslts}[2024-12-23]% v2.0c %% These are the default options. %% \makeatletter @@ -1043,7 +1043,7 @@ In memoriam \markboth{Example for pageslts}{Example for pageslts} This example demonstrates the most common uses of package\newline -\textsf{pageslts}, v2.0b as of 2024-12-07 (HMM);\newline +\textsf{pageslts}, v2.0c as of 2024-12-23 (HMM);\newline \url{https://ctan.org/pkg/pageslts}.\bigskip The used options were \texttt{pagecontinue=true}, @@ -2361,7 +2361,7 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2024-06-01] -\ProvidesPackage{pageslts}[2024-12-07 v2.0b Refers to special pages' numbers/names (HMM)] +\ProvidesPackage{pageslts}[2024-12-23 v2.0c Refers to special pages' numbers/names (HMM)] % \end{macrocode} % @@ -2386,10 +2386,10 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % % \begin{macrocode} \DeclareKeys[pagesLTS] - {alphMult .store = \pagesLTS@alphMult , - alphMult .usage = preamble , - AlphMulti .store = \pagesLTS@AlphMulti , - AlphMulti .usage = preamble , + {alphMult .store = \pagesLTS@alphMult , + alphMult .usage = preamble , + AlphMulti .store = \pagesLTS@AlphMulti , + AlphMulti .usage = preamble , pagecontinue .if = pagesLTS@pagecontinue , pagecontinue .usage = load , romanMult .if = pagesLTS@romanMult , @@ -2397,10 +2397,10 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } RomanMulti .if = pagesLTS@RomanMulti , RomanMulti .usage = load , fnsymbolmult .if = pagesLTS@fnsymbolmult , - fnsymbolmult .usage = load , + fnsymbolmult .usage = load } -\SetKeys[pagesLTS]{alphMult=ab,AlphMulti=AB,pagecontinue=true,romanMult=true,romanMult=true,RomanMulti=true,fnsymbolmult=true} +\SetKeys[pagesLTS]{alphMult=ab,AlphMulti=AB,pagecontinue=true,romanMult=true,RomanMulti=true,fnsymbolmult=true} \DeclareUnknownKeyHandler[pagesLTS]{% \PackageError{pageslts}{Unknown option "\CurrentOption"}{% @@ -2847,7 +2847,8 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % % \begin{macrocode} \AddToHookWithArguments{cmd/pagesLTS@ifcounter/before}{% - \PackageError{pageslts}{Old command \string\pagesLTS@ifcounter\space used}{Replace by \string\pagesLTS@providecounter.}% + \PackageError{pageslts}{Old command \string\pagesLTS@ifcounter\space used}{% + Replace by \string\pagesLTS@providecounter.}% }% } @@ -3797,7 +3798,7 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % page numbering scheme as argument: % % \begin{macrocode} - \pagenumbering{\pagesLTS@tmpQ}% + \expandafter\pagenumbering\expandafter{\pagesLTS@tmpQ}% % \end{macrocode} % % This resets the page to one (if option |pagecontinue=false| was chosen), @@ -4521,7 +4522,7 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % \DescribeMacro{pageslts.dtx} % For unpacking the |pageslts.dtx| file and constructing the documentation it is required: % \begin{description} -% \item[-] \TeX Format \LaTeXe{} 2024-06-01: \url{https://CTAN.org} +% \item[-] \TeX Format \LaTeXe{} 2024-11-01: \url{https://CTAN.org} % % \item[-] document class \xclass{ltxdoc}, 2024/02/08, v2.1j, \url{https://ctan.org/pkg/ltxdoc} % @@ -4535,12 +4536,12 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % \end{description} % % \DescribeMacro{pageslts.sty} -% The |pageslts.sty| for \LaTeXe{} $\geq$ 2024-06-01 (i.\,e.~all documents using the +% The |pageslts.sty| for \LaTeXe{} $\geq$ 2024-11-01 (i.\,e.~all documents using the % \xpackage{pageslts} package) requires: % \begin{description} -% \item[-] \TeX{} Format \LaTeXe{} 2024-06-01, \url{https://CTAN.org} +% \item[-] \TeX{} Format \LaTeXe{} 2024-11-01, \url{https://CTAN.org} % -% \item[-] package \xpackage{undolabl}, 2023-02-14, v1.0m, \url{https://ctan.org/pkg/undolabl} +% \item[-] package \xpackage{undolabl}, 2024-12-05, v1.0n, \url{https://ctan.org/pkg/undolabl} % % \item[-] package \xpackage{kvoptions}, 2022-06-15, v3.15, \url{https://ctan.org/pkg/kvoptions} % @@ -4548,14 +4549,14 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % package \xpackage{alphalph}, 2019/12/09, v2.6,\newline \url{https://ctan.org/pkg/alphalph} % % \item[-] if |\pagenumbering{silly}| shall be used, the \xpackage{sillypage} package -% must be loaded, 2023-07-23, v1.7,\newline \url{https://www.ctan.org/pkg/sillypage} +% must be loaded, 2024-07-23, v1.7,\newline \url{https://www.ctan.org/pkg/sillypage} % \end{description} % % \DescribeMacro{pageslts-example.tex} % The |pageslts-example.tex| requires the same files as all documents using the % \xpackage{pageslts} package, and additionally: % \begin{description} -% \item[-] class \textsf{article}, 2024/02/08, v1.4n, from \textsf{classes.dtx}: \url{https://ctan.org/pkg/classes} +% \item[-] class \textsf{article}, 2024/06/29, v1.4n, from \textsf{classes.dtx}: \url{https://ctan.org/pkg/classes} % % \item[-] package \xpackage{alphalph}, 2019/12/09, v2.6, \url{https://ctan.org/pkg/alphalph} % @@ -4563,9 +4564,9 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % % \item[-] package \xpackage{showkeys}, 2024/05/23, v3.21, \url{https://ctan.org/pkg/showkeys} % -% \item[-] package \xpackage{hyperref}, 2024-10-30, v7.01k, \url{https://ctan.org/pkg/hyperref} +% \item[-] package \xpackage{hyperref}, 2024-11-05, v7.01l, \url{https://ctan.org/pkg/hyperref} % -% \item[-] package \xpackage{pageslts}, 2024-12-07, v2.0b, \url{https://ctan.org/pkg/pageslts}\newline +% \item[-] package \xpackage{pageslts}, 2024-12-23, v2.0c, \url{https://ctan.org/pkg/pageslts}\newline % (Well, it is the example file for this package, and because you are reading the % documentation for the \xpackage{pageslts} package, it can be assumed that you already % have some version of it~-- is it the current one?) @@ -5036,6 +5037,10 @@ Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } % \item Missing |\if@filesw \fi| added. % \item Recent \xpackage{undolabl} package ($\geq$ 2024-12-05 v1.0n) required! % \end{Version} +% \begin{Version}{2024-12-23 v2.0c} +% \item Bug fix: Error handling for missing |\pagenumbering| now needs +% two \mbox{\texttt{\textbackslash}|expandafter|\,s.} +% \end{Version} % \end{History} % \bigskip % diff --git a/macros/latex/contrib/pageslts/pageslts.pdf b/macros/latex/contrib/pageslts/pageslts.pdf index 491793e218..7046225de5 100644 Binary files a/macros/latex/contrib/pageslts/pageslts.pdf and b/macros/latex/contrib/pageslts/pageslts.pdf differ diff --git a/macros/xetex/latex/hduthesis/README.md b/macros/xetex/latex/hduthesis/README.md index ed26215292..6a92084e29 100644 --- a/macros/xetex/latex/hduthesis/README.md +++ b/macros/xetex/latex/hduthesis/README.md @@ -1,7 +1,6 @@ ## 杭州电子科技大学学位论文 LaTeX 模板 -杭州电子科技大学学位论文 LaTeX 模板以 `LaTeX-expl3` 构建. -模板提供杭州电子科技大学学士和硕士学位论文模板. +杭州电子科技大学学位论文 LaTeX 模板以 `LaTeX-expl3` 构建,提供杭州电子科技大学学士和硕士学位论文格式. `hduThesiS` 的模块提供以下支持: @@ -39,7 +38,7 @@ Modules of `hduThesiS` provide the following supports: - `hdu.l3doc`: Configuration for class's `l3doc` manual -**Welcome to pull requests [here](https://github.com/xiamyphys/hduthesis).** +**Welcome to pull requests [here](https://github.com/myhsia/hduthesis).** ## License @@ -53,18 +52,18 @@ The Current Maintainer of this work is [Mingyu Xia](https://www.ctan.org/author/ #### References -> [1]. The LaTeX3 Interfaces +> \[1\]. The LaTeX3 Interfaces -> [2]. CTeX 宏集 +> \[2\]. CTeX 宏集 -> [3]. LaTeX for package and class authors current version +> \[3\]. LaTeX for package and class authors current version -> [4]. The LaTeX2e Sources +> \[4\]. The LaTeX2e Sources -> [4]. The LaTeX3 kernel: style guide for code authors +> \[5\]. The LaTeX3 kernel: style guide for code authors -> [5]. Package `etoolbox`, `geometry`, `tocloft`, `fancyhdr`, etc. +> \[6\]. Package `etoolbox`, `geometry`, `tocloft`, `fancyhdr`, etc. -> [6]. [毕业设计(论文)的写作规范及格式要求(含写作模板)](https://jwc.hdu.edu.cn/2022/0428/c4555a153813/page.htm) +> \[7\]. [毕业设计(论文)的写作规范及格式要求(含写作模板)](https://jwc.hdu.edu.cn/2022/0428/c4555a153813/page.htm) -> [7]. [杭州电子科技大学研究生学位论文格式统一要求(杭电研〔2012〕311号)](https://grs.hdu.edu.cn/2013/0507/c1730a51754/page.htm) +> \[8\]. [杭州电子科技大学研究生学位论文格式统一要求(杭电研〔2012〕311号)](https://grs.hdu.edu.cn/2013/0507/c1730a51754/page.htm) diff --git a/macros/xetex/latex/hduthesis/doc/cha/abstract.tex b/macros/xetex/latex/hduthesis/doc/cha/abstract.tex new file mode 100644 index 0000000000..3bf688b19b --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/abstract.tex @@ -0,0 +1,12 @@ +\begin{abstract} + \hologo{hduthesis} 是杭州电子科技大学学位论文 \hologo{LaTeX} 模板,支持学士、硕士学位论文排版. +\end{abstract} + +\begin{center} + \small\bfseries 用户协议 +\end{center} +\begin{enumerate} [ itemsep = 0pt ] \small + \item 本模板通过 LPPL 1.3c 协议开放源代码,您可以随意使用编译出的 PDF 文件. + \item 本模板根据杭州电子科技大学教务处颁发的 \href{https://jwc.hdu.edu.cn/2022/0428/c4528a153813/page.htm}{杭电理工类毕业论文写作规范} 编写而成,作者不对使用本模板产生的格式审查问题负责. \emph{如果您所在的学院因论文查重、收录等原因要求提交 \file{.docx} 格式,不接收 \file{.pdf} 论文稿件,请勿执意使用本模板,避免因格式转换带来不必要的麻烦.} 使用本模板时,请按编译错误提示操作来勾选同意用户协议. + \item 欢迎前往 GitHub 提交反馈意见,为推动学校认证与规范化 \hologo{hduthesis} 贡献力量. +\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/contents.tex b/macros/xetex/latex/hduthesis/doc/cha/contents.tex new file mode 100644 index 0000000000..72a5eb84da --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/contents.tex @@ -0,0 +1,345 @@ +\section{\hologo{hduthesis} 模板介绍} + +\hologo{hduthesis}(\textbf Hangzhou \textbf Dianzi \textbf University \hologo{LaTeX} \textbf{Thesis} Template) 是杭州电子科技大学学位论文 \underline{非官方} \hologo{LaTeX} 模板,以 \hologo{LaTeX3} 构建,支持学士和硕士学位论文排版. + +本模板文档将尽量完整地介绍模板的使用方法,如有不清楚之处,或者想提出改进建议,可以在 \href{https://github.com/myhsia/hduthesis/issues}{GitHub Issues} 提交反馈意见及贡献代码. + +对于未接触过 \hologo{LaTeX} 的初学者,推荐阅读 +\href{https://tug.ctan.org/info/lshort/english/lshort.pdf} + {\emph{The Not So Short Introduction to \hologo{LaTeX2e}}} +(可在终端执行 \cmd{texdoc lshort} 获取)或者其中文版 +\href{http://mirrors.ctan.org/info/lshort/chinese/lshort-zh-cn.pdf} + {\emph{《一份(不太)简短的 \hologo{LaTeX2e} 介绍》}} +(可在终端执行 \cmd{texdoc lshort-zh-cn} 获取). + +\subsection{模板组成} + +\hologo{hduthesis} 模板的 \file{./tex/} 文件夹中包含了模板的所有 Runtime 文件. +其中,\file{hduthesis.cls} 是模板的核心文件,实质上并不提供主要功能,只用于对全局选项的控制加载模板的各个模块. 模板的功能模块如下 + +\begin{tasks}(2) + \task! \file{typeset}:排版模块,用于控制字体和公式设置. + \task! \file{layout}:版面模块,用于提供封面所用到的盒子和对输入文档信息的处理. + \task \file{bc.config}:本科学位论文配置模块. + \task \file{pg.config}:硕士学位论文配置模块. + \task \file{hdu.l3doc}:用户手册模块. + \task \file{hdu.stationery}:信纸模块. +\end{tasks} + +以上模块包含在 \file{hduthesis-}\meta{模块名}\file{-module.code.tex} 文件中. +同时,\file{./tex/} 文件夹中还包含了 \file{hdulogo.pdf}、\file{hdutitle.pdf}、\file{hdumotto.pdf}、\file{hdubadge.pdf},分别提供杭州电子科技大学校徽、校名、校训和校牌的矢量图. +\footnote + { + 这些矢量图均由 \href{https://www.hdu.edu.cn/666/list.htm}{校情纵览/校标规范} 所提供素材用 \href{https://inkscape.org}{Inkscape} 裁切制成. 如果你通过 \cmd{tlmgr} 安装了此模板,在其他文档类中也可以调用这些素材,并支持在 \hologo{XeLaTeX} 和 \hologo{pdfLaTeX} 编译器下使用 \cmd{Ti\textit k\/Z} 等方式设置透明度. + } + +模板预制的宏包有 + +\begin{table}[htbp] + \centering \renewcommand* \arraystretch {.72} + \begin{tabularx}{\linewidth}{*{9}{>{\footnotesize}X}} + \toprule + \pkg{amssymb} & \pkg{bm} & \pkg{booktabs} & + \pkg{cancel} & \pkg{circuitikz} & \pkg{cleveref} & + \pkg{derivative} & \pkg{extarrows} & \pkg{fixdif} \\ + \midrule + \pkg{hyperref} & \pkg{listings} & \pkg{mathtools} & + \pkg{multicol} & \pkg{pgfplots} & \pkg{physics2} & + \pkg{siunitx} & \multicolumn{2}{>{\footnotesize}l}{\pkg{unicode-math}}\\ + \bottomrule + \end{tabularx} +\end{table} + +\subsection{文件结构} + +\subsubsection{用户手册} + +\begin{center} + \begin{minipage}{.36\linewidth} + \dirtree + {% + .1 ./doc/. + .2 hduthesis.tex. + .2 hduthesis.pdf. + } + \end{minipage} + \hfill + \begin{minipage}{.6\linewidth} + \dirtree + {% + .1 ./example/. + .2 hduthesis-bc.tex, hduthesis-bc.pdf. + .2 hduthesis-pg.tex, hduthesis-pg.pdf. + } + \end{minipage} +\end{center} + +\subsubsection{Runtime 文件} + +\dirtree + {% + .1 ./tex/. + .2 hduthesis.cls. + .2 hduthesis-typeset-module.code. + .2 hduthesis-layout-module.code. + .2 hduthesis-bc.config-module.code. + .2 hduthesis-pg.config-module.code. + .2 hduthesis-hdu.l3doc-module.code. + .2 hduthesis-hdu.stationery-module.code. + .2 hdulogo.pdf, hdutitle.pdf, hdumotto.pdf, hdubadge.pdf. + } + +\subsubsection{许可证} + +\dirtree + {% + .1 ./LICENSE, README.md. + } +\section{模板安装} + +\subsection{系统要求} + +本模板支持在 \cmd{macOS}、\cmd{Windows}、\cmd{Linux}、\cmd{Overleaf}、\cmd{TeXPage} 等平台使用. +\footnote + { + 所使用的测试平台为 \cmd{macOS Sequoia Version 15.3}、\cmd{Ubuntu 24.04.1 LTS}、\cmd{Overleaf} 上的 \hologo{TeX} Live 2024 发行版,本模板均可顺利编译. + } +本模板最低兼容发行版 \hologo{TeX} Live 2022,推荐使用 \hologo{TeX} Live 2023 或更新版本. +\footnote + { 发行版 \hologo{TeX} Live 2022 中不包含 \pkg{physics2} 宏包,无法快捷输入等高括号. } +\footnote + { + 发行版 \hologo{TeX} Live 2022 中通过导言区设置中文字体伪粗体和伪斜体时可能遇到报错. 详情请见 3.2 节. + } +\footnote + { + 根据 \emph{Plan for \hologo{TeX} Live 2025: 22feb: code freeze for final build, major bug fixes only; 1mar: final updates from CTAN, final doc tweaks.} 本模板将于 2025 年 2 月 22 日移除对 \hologo{TeX} Live 2022 的兼容,建议 \hologo{TeX} Live 2022 用户尽快升级至最新发行版. + } +使用本模板生成学位论文,仅支持 \hologo{XeLaTeX} 编译;使用本模板生成信纸,支持 \hologo{pdfLaTeX} 编译. + +\subsection{标准安装} + +强烈建议您使用 \cmd{tlmgr} 进行安装与升级. 在终端(Terminal)执行以下命令即可安装最新版本的 \hologo{hduthesis} 模板. + +\begin{framed} + \begin{verbatim} + sudo tlmgr install hduthesis + \end{verbatim} +\end{framed} + +Windows 系统用户无需 \verb|sudo|,请以管理员身份运行命令提示符. 有些时候,您需要手动更新 \cmd{tlmgr} + +\begin{framed} + \begin{verbatim} + sudo tlmgr update --self + \end{verbatim} +\end{framed} + +才能正常使用 \cmd{tlmgr} 命令安装宏包. +如果您的 \hologo{TeX} 发行版不支持 \cmd{tlmgr},请尽快升级您的 \hologo{TeX} 发行版. +升级该模板,在终端(Terminal)执行以下命令即可 + +\begin{framed} + \begin{verbatim} + sudo tlmgr update hduthesis + \end{verbatim} +\end{framed} + +\subsection{手动安装} + +本模板已上传至 CTAN、GitHub 和 Gitee 平台. 可以直接从三个平台下载最新版本的 \hologo{hduthesis} 模板. 下载后,将 \file{./hduthesis/tex/} 文件夹中的所有 (runtime) 文件复制到 \file{./hduthesis/example/} 目录下,即可编译 \file{./hduthesis/example/} 文件夹中的样例. + +\section{全局选项} + +\subsection{用户协议} + +使用本模板编译本科、硕士学位论文时遇到``编译受阻''报错,请认真阅读封面的用户协议. +添加选项 \cmd{agreed} 后(即\verb|\documentclass [ agreed ] { hduthesis }|),方可顺利编译,\emph{并默认您已同意用户协议}. + +使用 \hologo{hduthesis} 编译信纸和本用户手册时,无需 \cmd{agreed} 选项. + +\subsection{字体设置} + +用户可通过全局选项设置文档的数学和中文字体. 设置的方式为键值对,键 \keys{\cmdmac~math-font} 用于设置数学字体,键 \keys{\cmdmac~CJKmain-font} 用于设置中文字体,键 \keys{\cmdmac~CJKsans-font} 用于设置中文无衬线字体. 以下是设置示例. + +\begin{framed} + \begin{verbatim} + \documentclass + [ + math-font = STIX Two Math, agreed, + CJKmain-font = {{Songti SC}[AutoFakeBold = 2.5, AutoFakeSlant]}, + CJKsans-font = {{STHeiti}[AutoFakeBold = 2]} + ] {hduthesis} + \end{verbatim} +\end{framed} + +如果你使用的是 \hologo{TeX} Live 2022,设置中文字体的伪粗体和伪斜体时可能会遇到报错. +在此发行版中,最多能对两个选项中的其一赋强度值,且被赋值选项需放在未被赋值选项前. + +更加详细的字体设置请参考 \pkg{xeCJK} 宏包的文档. + +\section{文档信息设置} + +\begin{function}{\DocInfo} + \begin{syntax} + \cs{DocInfo}\marg{keyvals} + \end{syntax} + + 此命令接收键值,用于设置文档信息. 键 \keys{\cmdmac~title} 用于设置论文标题,键 \keys{\cmdmac~department} 用于设置学院,键 \keys{\cmdmac~major} 用于设置专业,键 \keys{\cmdmac~class} 用于设置班级,键 \keys{\cmdmac~stdntid} 用于设置学号,键 \keys{\cmdmac~author} 用于设置作者,键 \keys{\cmdmac~supervisor} 用于设置导师,键 \keys{\cmdmac~bibsource} 用于设置插入参考文献文件源. 命令会根据输入的学号自动判断使用者为本科生/研究生. + + 命令 \cs{DocInfo} 需在导言区中执行. 完成文档信息输入后,在 \verb|\begin{document}| 后执行命令 \cs{maketitle} 会调用所设置的键值自动生成 \emph*{论文封面} 和 \emph*{目录}. +\end{function} + +本科生输入样例如下. 需要使用键 \keys{\cmdmac~title} 设置类型为毕业设计/毕业论文,使用斜线 (/) 分隔,如 \cmd{title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/毕业论文}. + +\begin{framed} + \begin{verbatim} + \DocInfo + { + title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/ + 本科毕业设计, department = 理学院, major = 物理学, + bibsource = reference, class = 英才班, stdntid = C668668E, + author = 申智能, supervisor = 教授:葉芷晴, + } + \end{verbatim} +\end{framed} + +研究生输入样例如下. 硕士学位论文扉页需同时有英文版,因此需要在键 \keys{\cmdmac~title} \keys{\cmdmac~author} \keys{\cmdmac~supervisor} 中分别输入中文和英文信息,中英信息使用斜线 (\cmd/) 分隔,指导教师职称和姓名之间用半角冒号 (\cmd:) 分隔. + +\begin{framed} + \begin{verbatim} + \documentclass { hduthesis } + \DocInfo + { + title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/ + \hologo{LaTeX} Template for Thesis at + Hangzhou Dianzi University, + major = 物理学, stdntid = 216686680, + author = 申智能/SAN Chi Nan, bibsource = reference + supervisor = 教授:葉芷晴/Prof.:YIP Tsz Ching, + } + \end{verbatim} +\end{framed} + +\subsection{生成封面 \& 扉页} + +在正文区域,使用命令 \cmd{maketitle} 即可生成论文封面和扉页. 生成的封面和扉页会根据所设置的文档信息自动生成. + +\DescribeMacro{\l__hduthesis_grade_int} +封面上的论文完成日期和学生毕业年份会根据当前系统时间自动生成. +针对本科论文,如果当前月份在8月及以前,毕业年份会显示今年;如果当前月份在9月及以后,毕业年份会显示次年. 在 \cs{DocInfo} 后对整型 \cs{l__hduthesis_grade_int} 重新赋值可手动更改毕业年份. + +\begin{syntax} + \cs{ExplSyntaxOn} \cs{int_set:Nn} \cs{l__hduthesis_grade_int} \marg{Year} \cs{ExplSyntaxOff} +\end{syntax} + +\subsection{生成承诺书} + +\begin{function}{\commitment} + \begin{syntax} + \cs{commitment} \oarg{file1/yyyy-mm-dd, file2/yyyy-mm-dd, file3/yyyy-mm-dd} + \end{syntax} + + 此命令用于生成承诺书. 命令的可选参数接收数组,用于指定签名文件和输入签名的日期. 签名文件和签名的日期之间用 \cmd{/} 分隔,多组签名之间用 \cmd{,} 分隔. 签名文件接收 \file{.pdf} / \file{.png} / \file{.jpg} 等格式. 日期的输入格式为 \texttt{yyyy-mm-dd}. +\end{function} + +对于本科生,只需要签署 ``\emph*{诚信承诺}'' 一组签名;对于研生,则需要签署 ``\emph*{原创性声明}''、``\emph*{(作者同意)学位论文使用授权声明}'' 和 ``\emph*{(导师同意)学位论文使用授权声明}'' 三组签名. 使用用例如下 + +\begin{framed} + \begin{verbatim} + % 本科生使用用例 + ... \maketitle ... \commitment [ example-image-a/2024-05-31 ] ... + % 研究生使用用例 + ... \maketitle ... + \commitment + [ + example-image-a/2025-05-31, example-image-a/2025-05-31, + example-image-b/2025-06-01 + ] + \end{verbatim} +\end{framed} + +如果使用者暂未生成签名但是需要添加日期,则将签名文件留空即可,但分隔符 \cmd{/} 仍需保留. 例如 +\verb|\commitment [ /2024-05-31 ]|. 如果不需要添加日期,则直接留空即可. + +下两页分别为所生成的本科和硕士学位论文封面、扉页和承诺书缩略图. 可在终端执行 \cmd{texdoc hduthesis-bc} 和 \cmd{texdoc hduthesis-pg} 分别获取本科和硕士学位论文样例文件. + +\includepdfmerge + [ nup = 2x3, frame, linktodoc, scale = 0.96, delta = 1in .25in ] + { /Users/myhsia/Documents/GitHub/hduthesis/example/hduthesis-bc.pdf, 1-2, + /Users/myhsia/Documents/GitHub/hduthesis/example/hduthesis-pg.pdf, 1-4 } + +\section{章节设置} + +\subsection{输入中 / 英摘要} + +\DescribeEnv{abstract} +环境 \env{abstract} 用于生成摘要,其可选参数可设置语言格式. + +\DescribeMacro{\keywords} +命令 \cs{keywords} 需在 \env{abstract} 环境内执行,其会根据 \env{abstract} 环境所选择的语言,自动生成英文 / 中文格式的关键词. + +\begin{framed} + \begin{verbatim} + \begin{abstract}[en]...\keywords{keyword1, keyword2} \end{abstract} + \begin{abstract}[cn]...\keywords{关键词1, 关键词2} \end{abstract} + \end{verbatim} +\end{framed} + +通过命令 \cs{keywords} 以半角逗号 (,) 为分隔输入关键词列表,输出时会根据所处 \env{abstract} 环境选择的语言不同,自动以半 / 全角分号分隔. + +\subsection{输入目录 \& 正文} + +通过命令 \cs{tableofcontents} 可生成目录. \cs{chapter}、\cs{section}、\cs{subsection} 等章节级次均按照 \href{https://jwc.hdu.edu.cn/2022/0428/c4528a153813/page.htm}{杭电理工类毕业论文写作规范} 定制. + +\subsection{参考文献 \& 附录} + +通过命令 \cs{DocInfo} 指定 \file{.bib} 文件后使用命令 \cs{printbiblography} 即可输出参考文献列表. 参考文献格式已设置为 \cmd{gb7714-2015}. 若未指定参考文献 \file{.bib} 文件,为加速编译,\pkg{gbt7714} 宏包将不会加载. + +可以直接使用带有星号的章节命令生成附录章节,如 \verb|\chapter*{附录}|. + +\clearpage + +\section{附加模块} + +\subsection{杭州电子科技大学信纸} + +加载全局选项 \pkg{stationery},并进行文档信息设置,即可生成信纸. 可用于推荐信撰写或生成笔记纸. +此模块无需 \pkg{agreed} 选项. + +\begin{framed} + \begin{verbatim} + \documentclass [ stationery ] { hduthesis } + \end{verbatim} +\end{framed} + +与学士 / 硕士学位论文文档信息设置类似,使用 \cs{DocInfo} 命令,对信件主题、发件人、邮箱、日期和水印进行设置. 此时 \cs{DocInfo} 命令接受键 +\keys{\cmdmac~title} \keys{\cmdmac~author} \keys{\cmdmac~mail} +\keys{\cmdmac~date} \keys{\cmdmac~watermark}. 下页为生成信纸的样例. + +\begin{framed} + \begin{verbatim} + \DocInfo + { + title = Recommendation Letter for SAN Chi Nan, + author = YIP Tsz Ching, mail = email@server.domain, + date = {23\textsuperscript{th} December, 2024}, + watermark = true + } + \end{verbatim} +\end{framed} + +若要在信纸上添加笔记线,可使用命令 \cs{noteLine}\oarg{num},其可选参数接收笔记线的数量,默认值为20. 下两页分别为生成的信纸和笔记纸样例,可在终端执行 \cmd{texdoc hduthesis-stationery} 获取此样例文件. + +\subsection{用户手册} + +本手册为 \cls{hduthesis} 加载选项 \pkg{l3doc} 后生成,此模块无需 \pkg{agreed} 选项. + +\begin{framed} + \begin{verbatim} + \documentclass [ l3doc ] { hduthesis } + \end{verbatim} +\end{framed} + +\includepdf[pages = -, nup = 1x2, angle = -90, frame, linktodoc, scale = 0.96, delta = 0in .25in] + {/Users/myhsia/Documents/GitHub/hduthesis/example/hduthesis-stationery} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/source.tex b/macros/xetex/latex/hduthesis/doc/cha/source.tex new file mode 100644 index 0000000000..c92777877f --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source.tex @@ -0,0 +1,18 @@ +\ExplSyntaxOn +\pagecolor{black!\fpeval{100-3200/255}} +\color{black!10} \color_select:n{black!10} \appendix +\colorlet{bg}{black!\fpeval{100-2400/255}} +\hypersetup + { filecolor = DarkGreen!40, urlcolor = MidnightBlue!40, + linkcolor = FireBrick!40 } +\cfoot{\color_select:n{black!10} \thepage} +\lhead{} \rhead{} \let \headrule \relax +\pagestyle{fancy} +\ExplSyntaxOff +\section{实现细节} + +恭喜你已经阅读到了这部分!如你所见,页面已经变成了程序员视力友好颜色. 下面这些内容面向 \hologo{LaTeX} 宏包开发者或者对 \hologo{hduthesis} 开发感兴趣的用户,如果您有任何意见或建议或想法,都欢迎到 \href{https://github.com/myhsia/hduthesis/issues}{GitHub} 提交Issue. 您对模板开发或者本文档的撰写的任何贡献都会受到诚挚欢迎! + +\setlength {\parindent} {0em} + +\foreach \i in {1,...,7} { \input{cha/source/a\i.tex} } \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a1.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a1.tex new file mode 100644 index 0000000000..4bb5fd10be --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a1.tex @@ -0,0 +1,224 @@ +\subsection{\file{hduthesis.cls} 的实现} + +文档类日期/版本号/开发者id +\begin{minted} [ linenos, bgcolor = bg, breaklines ] {tex} + \def\hduthesis@date{2024/12/23} + \def\hduthesis@version{0.5.0} + \def\hduthesis@maintainerid{myhsia} +\end{minted} + +调用 \pkg{etoolbox} 宏包用于给命令打补丁 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage{etoolbox} +\end{minted} + +提供 \cls{hduthesis} 文档类,设置文档类日期、版本号 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \ProvidesExplClass{hduthesis} {\hduthesis@date} {\hduthesis@version} + {LaTeX Class for Thesis at Hangzhou Dianzi University} +\end{minted} + +兼容 \hologo{TeX} Live 2022 及之后的版本. 当对应命令不存在时,在已有命令基础上新增变体 + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_if_exist:NF \seq_set_split:Nne + { \cs_generate_variant:Nn \seq_set_split:Nnn { Nne } } + \cs_if_exist:NF \seq_set_split:Nee + { \cs_generate_variant:Nn \seq_set_split:Nnn { Nee } } + \cs_if_exist:NF \tl_set:Ne + { \cs_generate_variant:Nn \tl_set:Nn { Ne } } + \cs_if_exist:NF \tl_gset:Ne + { \cs_generate_variant:Nn \tl_gset:Nn { Ne } } +\end{minted} + +定义新命令 \cs{hduthesis_msg_new:nn} 和 \cs{hduthesis_msg_error:nn} 用于新增错误消息和将错误消息广播到 Workspace +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected:Npn \hduthesis_msg_new:nn #1#2 + { \msg_new:nnn { hduthesis } {#1} {#2} } + \cs_new_protected:Npn \hduthesis_msg_error:nn #1#2 + { \msg_error:nnn { hduthesis } {#1} {#2} } +\end{minted} + +新增错误消息:用户协议 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \hduthesis_msg_new:nn { 用户协议 } + { \exp_not:n + { + hduThesiS~ 编译受阻.~ + 使用模板前请认真阅读模板说明文档封面上的「用户协议」~ + 模板作者不对使用本模板产生的格式审查问题负责~ + 添加选项 `agreed'[\documentclass[agreed]{hduthesis}]~ + 即可顺利编译并默认代表您已同意本协议.~ 祝君科研顺利!~ + 如遇问题,可邮件反馈至 xiamyphys@gmail.com. + } + } +\end{minted} + +对命令 \cs{hduthesis_msg_error:nn} 新增 \cmd{nx} 变体 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_generate_variant:Nn \hduthesis_msg_error:nn { nx } +\end{minted} + +新增错误消息:未找到模块 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \hduthesis_msg_new:nn { not found module } + { The~hduthesis~module~`#1'~not~found. } +\end{minted} + +定义命令 \cs{hduthesis_load_module:n} 用于加载模块,若模块不存在则输出错误消息 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected_nopar:Npn \hduthesis_load_module:n #1 + { + \file_if_exist_input:nF { hduthesis-##1-module.code.tex } + { \hduthesis_msg_error:nn { not found module } {##1} } + } +\end{minted} + +定义命令 \cs{hduthesis_provide_module:n} 用于提供模块 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected_nopar:Npn \hduthesis_provide_module:n #1 + { + \ProvidesExplFile{hduthesis-#1-module.code.tex} + {\hduthesis@date}{\hduthesis@version} + {hduThesiS~ \text_titlecase:n {#1} ~Module} + } +\end{minted} + +定义新数组 \cs{g__hdu_base_class_options_clist},用于存储文档类选项 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \clist_new:N \g__hdu_base_class_options_clist +\end{minted} + +定义文档类选项的键: +\begin{enumerate} + \item 布尔(Bool)值 \keys{\cmdmac~ agreed}:用户是否同意用户协议,初始值 \cmd{false}. 一旦输入 \cmd{agreed} 选项,则将 \cmd{agreed} 设置为 \cmd{true},即 \cmd{agreed} 等价于 \cmd{agreed = true} + \item 布尔(Bool)值 \keys{\cmdmac~ l3doc}:是否启用 \cls{l3doc} 文档类,初始值 \cmd{false}. 一旦输入 \cmd{l3doc} 选项,则将 \cmd{l3doc} 设置为 \cmd{true},即 \cmd{l3doc} 等价于 \cmd{l3doc = true} + \item 布尔(Bool)值 \keys{\cmdmac~ stationery}:是否启用 \cls{letter} 文档类,初始值 \cmd{false}. 一旦输入 \cmd{stationery} 选项,则将 \cmd{stationery} 设置为 \cmd{true},即 \cmd{stationery} 等价于 \cmd{stationery = true} + \item 令牌(token list)\keys{\cmdmac~ math-font}:数学字体 + \item 令牌(token list) \keys{\cmdmac~ CJKmain-font}:中文主字体 + \item 令牌(token list) \keys{\cmdmac~ CJKsans-font}:中文无衬线字体 + \item 令牌(token list) \keys{\cmdmac~ CJKmono-font}:中文等宽字体 + \item 未知选项 \keys{\cmdmac~ unknown}:将未知选项交给 \cs{__hduthesis_unknown_option:n} 处理 +\end{enumerate} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \keys_define:nn { hduthesis / classoption } + { + agreed .bool_set:N = \g__hduthesis_agreement_bool, + agreed .initial:n = false, + agreed .default:n = true, + l3doc .bool_set:N = \g__hduthesis_doc_bool, + l3doc .initial:n = false, + l3doc .default:n = true, + stationery .bool_set:N = \g__hduthesis_stationery_bool, + stationery .initial:n = false, + stationery .default:n = true, + math-font .tl_set:N = \g__hduthesis_math_font, + CJKmain-font .tl_set:N = \g__hduthesis_main_CJK_font, + CJKsans-font .tl_set:N = \g__hduthesis_sans_CJK_font, + CJKmono-font .tl_set:N = \g__hduthesis_mono_CJK_font, + unknown .code:n = \__hduthesis_unknown_option:n {#1}, + } +\end{minted} + +定义命令 \cs{__hduthesis_unknown_option:n} 用于处理未知选项 + +若未知选项为空,则将 \cs{l_keys_key_str} 加入 \cs{g__hdu_base_class_options_clist} 列表;否则设置 \cs{l_keys_key_str} 为未知选项,并将其加入 \cs{g__hdu_base_class_options_clist} 列表 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected_nopar:Npn \__hduthesis_unknown_option:n #1 + { + \tl_if_empty:nTF { #1 } + { + \clist_gput_right:NV \g__hdu_base_class_options_clist \l_keys_key_str + } + { + \exp_args:NNx \clist_gput_right:Nn \g__hdu_base_class_options_clist + { \l_keys_key_str = \exp_not:n {#1} } + } + } +\end{minted} + +处理文档类选项 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \ProcessKeyOptions [ hduthesis / classoption ] +\end{minted} + +若启用 \cmd{l3doc} 选项,加载 \cls{l3doc} 文档类为基底,加载 \file{hdu.l3doc} 模块并结束输入 + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \bool_if:NT \g__hduthesis_doc_bool + { + \PassOptionsToClass { 11pt, letterpaper } { l3doc } + \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { l3doc } + \hduthesis_load_module:n { hdu.l3doc } + \endinput + } +\end{minted} + +若启用 \cmd{stationery} 选项,加载 \cls{letter} 文档类为基底,加载 \file{hdu.stationery} 模块并结束输入 + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \bool_if:NT \g__hduthesis_stationery_bool + { + \PassOptionsToClass { 12pt } { letter } + \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { letter } + \hduthesis_load_module:n { hdu.stationery } + \endinput + } +\end{minted} + +为基本文档类 \cls{ctexrep} 添加选项 \keys{a4paper, zihao = -4},为 \pkg{xeCJK} 宏包添加选项 \keys{quiet, no-math},加载 \cls{ctexrep} 文档类为基底,并用 \cs{exp_args:NNV} 将未知选项展开加载到 \cls{ctexrep} 文档类上 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \PassOptionsToClass { a4paper, zihao = -4 } { ctexrep } + \PassOptionsToPackage { quiet, no-math } { xeCJK } + \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { ctexrep } +\end{minted} + +如果用户未确认用户协议,输出错误消息,并不加载 \pkg{hyperref} 宏包,以免因``遇到报错而停止编译''而产生额外的 \pkg{hyperref} 警告. 否则,加载 \pkg{hyperref} 宏包,设置 \pkg{hyperref} 宏包选项 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \bool_if:NTF \g__hduthesis_agreement_bool + { + \RequirePackage{hyperref} + \pdfstringdefDisableCommands + { + \def \cite#1 {<#1>} + \def \hologoRobust#1 {<#1>} + } + \AtBeginDocument + { \hypersetup { hidelinks, pdfproducer = hduThesiS~by~Mingyu~Xia } } + } { \hduthesis_msg_error:nn { 用户协议 } { 未确认 } } +\end{minted} + +预加载部分常用包,设置 \pkg{pgfplots} 宏包版本,设置 \pkg{hologo} 宏包字体,设置 \cs{graphicx} 包的相对路径 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage { siunitx, circuitikz, pgfplots, listings, + hologo, lipsum, zhlipsum, booktabs, multicol } + \pgfplotsset { compat = newest } + \hologoFontSetup { general = \sffamily } + \graphicspath + { + {./figure/}{./figures/}{./image/}{./images/} + {./graphics/}{./graphic/}{./pictures/}{./picture/} + } +\end{minted} + +加载 \cmd{typeset} 和 \cmd{layout} 模块. +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \hduthesis_load_module:n { typeset } + \hduthesis_load_module:n { layout } +\end{minted} + +定义命令 \cs{__hduthesis_docinfo_degree_if_aux} 用于判断学号长度,若学号长度为 8,则加载 \cmd{bc.config} 模块;否则加载 \cmd{bc.config} 或 \cmd{pg.config} 模块. 此命令将用在 \file{hduthesis-docinfo-module.code} 模块中,因为学号长度的判断必须发生在设置文档信息后 + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected:Nn \__hduthesis_docinfo_degree_if_aux: + { + \int_compare:nNnTF { \tl_count:N \l__docinfo_stdntid_tl } = { 8 } + { \hduthesis_load_module:n { bc.config } } + { \hduthesis_load_module:n { pg.config } } + } +\end{minted} + +结束 \file{hduthesis.cls} 文件 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \endinput +\end{minted} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a2.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a2.tex new file mode 100644 index 0000000000..8c78b072a8 --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a2.tex @@ -0,0 +1,88 @@ +\subsection{\file{hduthesis-typeset-module.code} 的实现} + +提供模块 \file{typeset} 文件 +\begin{minted} [ linenos, bgcolor = bg, breaklines ] {tex} + \hduthesis_provide_module:n {typeset} +\end{minted} + +设置行间距 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \linespread{1.39} +\end{minted} + +设置首行缩进 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \dim_set:Nn \parindent { 2\ccwd } +\end{minted} + +新定义字体大小 \cs{semilarge} 和 \cs{semiLarge} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \newcommand \semilarge { \@setfontsize \semilarge{14}{16.5} } + \newcommand \semiLarge { \@setfontsize \semiLarge{16.5}{17.5} } +\end{minted} + +设置英文字体 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage{fontspec} + \setmainfont{texgyretermes} + [ + Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, + ItalicFont = *-italic, BoldItalicFont = *-bolditalic + ] + \setsansfont{texgyreheros} + [ + Extension = .otf, BoldItalicFont = *-bolditalic, + UprightFont = *-regular, BoldFont = *-bold, + ItalicFont = *-italic, Scale = .9, + ] +\end{minted} + +调用 \pkg{amssymb}, \pkg{mathtools}, \pkg{cancel}, \pkg{fixdif}, \pkg{derivative} 宏包 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage { amssymb, mathtools, cancel, fixdif, derivative } +\end{minted} + +如果存在 \pkg{physics2} 宏包,则调用并配置 \pkg{physics2} 宏包 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \file_if_exist:nTF { physics2.sty } + { + \RequirePackage{physics2} + \usephysicsmodule{ ab, braket, ab.legacy, op.legacy, bm-um.legacy } + } { \RequirePackage{bm} } +\end{minted} + +调用 \pkg{unicode-math} 宏包,并关闭警告 \texttt{mathtools-colon} 和 \texttt{mathtools-overbracket} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage + [ warnings-off = { mathtools-colon, mathtools-overbracket } ] {unicode-math} +\end{minted} + +设置数学环境的间距 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \AtBeginDocument + { + \dim_set:Nn \abovedisplayskip {3pt} + \dim_set:Nn \belowdisplayskip {3pt} + } +\end{minted} + +设置数学字体 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \tl_if_empty:NF \g__hduthesis_math_font + { \setmathfont { \g__hduthesis_math_font } } +\end{minted} + +设置中文字体,保留全局选项键值中的扩号以对应 \pkg{xeCJK} 宏包的接口. +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \tl_if_empty:NF \g__hduthesis_main_CJK_font + { \exp_last_unbraced:No \setCJKmainfont \g__hduthesis_main_CJK_font } + \tl_if_empty:NF \g__hduthesis_sans_CJK_font + { \exp_last_unbraced:No \setCJKsansfont \g__hduthesis_sans_CJK_font } + \tl_if_empty:NF \g__hduthesis_mono_CJK_font + { \exp_last_unbraced:No \setCJKmonofont \g__hduthesis_mono_CJK_font } +\end{minted} + +结束 \file{hduthesis-typeset-module.code} 文件 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \endinput +\end{minted} diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a3.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a3.tex new file mode 100644 index 0000000000..979f48225f --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a3.tex @@ -0,0 +1,231 @@ +\subsection{\file{hduthesis-layout-module.code} 的实现} + +提供模块 \file{layout} 文件 +\begin{minted} [ linenos, bgcolor = bg, breaklines ] {tex} + \hduthesis_provide_module:n {layout} +\end{minted} + +调用 \pkg{geometry}、\pkg{array}、\pkg{setspace}、\pkg{fancyhdr}、\pkg{enumitem}、\pkg{cleveref} 宏包 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage{geometry, array, setspace, fancyhdr, enumitem, cleveref} +\end{minted} + +调用并配置 \pkg{caption} 宏包 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage[skip = 1.75ex, labelsep = quad, font = small]{caption} +\end{minted} + +清空页眉页脚,设置页面样式为 \cmd{fancy} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \fancyhf{} + \pagestyle{fancy} +\end{minted} + +设置页眉线宽为 \cmd{.8pt} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \renewcommand*\headrulewidth{.8pt} +\end{minted} + +设置图表编号格式为 \texttt{\meta{chapter}-\meta{figure/table}} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \renewcommand*\thefigure {\arabic{chapter}-\arabic{figure}} + \renewcommand*\thetable {\arabic{chapter}-\arabic{table}} +\end{minted} + +设置公式编号格式为 \texttt{\meta{chapter}-\meta{equation}} +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \renewcommand*\theequation {\arabic{chapter}-\arabic{equation}} +\end{minted} + +减小图表后方与正文的间距 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \AddToHook{env/figure/after}{\vspace*{-2.3ex}} + \AddToHook{env/table/after}{\vskip-1.9ex} +\end{minted} + +设置 \cmd{enumerate} 环境的编号格式和缩进 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \setlist[enumerate,1] + { + label = (\,\arabic*\,), itemindent = 4em, leftmargin = 0em, + labelsep = 1ex, topsep = 0pt, itemsep = 0pt, partopsep = 0pt, + parsep = 0em, listparindent = 2\ccwd + } +\end{minted} + +设置引用格式 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \crefformat{figure}{图#2#1#3} + \crefformat{table}{表#2#1#3} +\end{minted} + +定义命令 \cs{__hduthesis_cover_spread_box:nn} 和 \cs{__hduthesis_cover_center_box:nn},用于生成封面中的分散与下划线居中对齐盒子. +\footnote + { \color{black!10} + 下划线居中对齐盒子的实现参考自 \href{https://tex.stackexchange.com/users/4427/egreg}{@egreg} 在 + \href{https://tex.stackexchange.com/questions/727960/how-to-center-a-series-of-text-width-a-fixed-width-that-can-automatically-linebr}{tex.stackexchange.com} 的解答. + } + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected:Npn \__hduthesis_cover_spread_box:nn #1#2 + { + \mode_leave_vertical: + \hbox_to_wd:nn {#1} + { \exp_args:Nee \tl_map_inline:nn {#2} { ##1 \hfil } \unskip } + } + \cs_new_protected:Npn \__hduthesis_cover_center_box:nn #1#2 + { % by @egreg on tex.stackexchange.com + \mode_leave_vertical: + \dim_set:Nn \l_tmpa_dim {#1} + \global\setbox1 = \box\voidb@x + \group_begin: + \setbox0 = \vbox + { + \dim_set:Nn \hsize {#1}\relax + \dim_set:Nn \parindent {0pt} + \skip_set:Nn \leftskip {0pt plus 1fil} + \skip_set:Nn \rightskip {0pt plus -1fil} + \skip_set:Nn \parfillskip {0pt plus 2fil} + #2 \par + \loop + \setbox2 = \lastbox + \unless\ifvoid2 + \global\setbox1 = \vtop + { \hbox to\hsize{\strut\unhbox2} + \vskip-4pt \hrule height .5pt + \vskip9.6pt \unvbox1 + } + \unskip\unpenalty + \repeat + } + \group_end: + \box1 + } +\end{minted} + +定义命令 \cs{__hduthesis_process_array:NnnN},用于处理一维或二维数组. 其中一级分隔符为 \texttt{:},二级分隔符为 \texttt{/}. +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected_nopar:Npn \__hduthesis_process_array:NnnN #1#2#3#4 + { + \seq_set_split:Nee \l__hduthesis_process_array_seq { / } {#1} + \seq_set_split:Nee \l__hduthesis_process_array_row_seq { \c_colon_str } + { \seq_item:Nn \l__hduthesis_process_array_seq {#2} } + \tl_if_eq:nnTF {#3} {:} + { \tl_gset:Ne #4 { \seq_use:Nn \l__hduthesis_process_array_row_seq {} } } + { + \tl_gset:Ne #4 { \seq_item:Nn \l__hduthesis_process_array_row_seq {#3} } + } + \seq_clear:N \l__hduthesis_process_array_seq + \seq_clear:N \l__hduthesis_process_array_row_seq + } +\end{minted} + +将十二个 \meta{month} 的英文名称存入 \cs{g_system_month_clist} 中 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \clist_set:Nn \g_system_month_clist + { + January, February, March, April, May, June, July, + August, September, October, November, December + } +\end{minted} + +定义文档信息的键 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \keys_define:nn { hduthesis / docinfo } + { + title .clist_set:N = \l__docinfo_title_tl, + department .tl_set:N = \l__docinfo_department_tl, + major .tl_set:N = \l__docinfo_major_tl, + class .tl_set:N = \l__docinfo_class_tl, + stdntid .tl_set:N = \l__docinfo_stdntid_tl, + author .clist_set:N = \l__docinfo_author_tl, + supervisor .tl_set:N = \l__docinfo_supervisor_tl, + bibsource .tl_set:N = \l__docinfo_bibsource_tl, + } +\end{minted} + +定义用户端文档信息的输入命令 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \NewDocumentCommand \DocInfo { m } + { + \keys_set:nn { hduthesis / docinfo } {#1} + \__hduthesis_docinfo_process_aux: + \__hduthesis_docinfo_degree_if_aux: + } +\end{minted} + +定义处理文档信息的辅助命令. 其中论文标题与作者信息为一维数组,指导教师信息为二维数组. +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_set_protected_nopar:Nn \__hduthesis_docinfo_process_aux: + { + \__hduthesis_process_array:NnnN \l__docinfo_title_tl {1} {:} \@title + \__hduthesis_process_array:NnnN \l__docinfo_title_tl {2} {:} + \l__docinfo_entitle_tl + \__hduthesis_process_array:NnnN \l__docinfo_author_tl {1} {:} \@author + \__hduthesis_process_array:NnnN \l__docinfo_author_tl {2} {:} + \l__docinfo_enauthor_tl + \__hduthesis_process_array:NnnN \l__docinfo_supervisor_tl {1} {1} + \l__docinfo_cnrole_tl + \__hduthesis_process_array:NnnN \l__docinfo_supervisor_tl {1} {2} + \l__docinfo_cnsupervisor_tl + \__hduthesis_process_array:NnnN \l__docinfo_supervisor_tl {2} {1} + \l__docinfo_enrole_tl + \__hduthesis_process_array:NnnN \l__docinfo_supervisor_tl {2} {2} + \l__docinfo_ensupervisor_tl + \bool_if:NF \g__hduthesis_agreement_bool + { \tl_clear:N \l__docinfo_bibsource_tl } + \tl_if_empty:NTF \l__docinfo_bibsource_tl + { + \newcommand*\printbibliography{\chapter*{参考文献}} + \renewcommand*\cite[1]{\textsuperscript{[##1]}} + } + { + \RequirePackage[sort&compress]{gbt7714} + \bibliographystyle{gbt7714-numerical} + \dim_set:Nn \bibsep {.35ex} + \newcommand*\printbibliography + { + \nocite{*} \bibliography { \l__docinfo_bibsource_tl } + \addcontentsline{toc}{chapter}{参考文献} + } + } + } +\end{minted} + +定义处理承诺书签名数组的辅助命令. 其中签名文件名需要展开后存入 \cs{g__hduthesis_signature_file_tl} 中. +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \cs_new_protected_nopar:Npn \__hduthesis_signature_process_aux:nnn #1#2#3 + { + \clist_set:Nn \l__hduthesis_signature_process_clist {#1} + \seq_set_split:Nne \l__hduthesis_signature_figure_seq {/} + { \clist_item:Nn \l__hduthesis_signature_process_clist {#2} } + \int_compare:nNnTF {#3} = {0} + { + \tl_set:Ne \l__hduthesis_signature_figure_tl + { \seq_item:Nn \l__hduthesis_signature_figure_seq { #3 + 1 } } + \seq_clear:N \l__hduthesis_signature_figure_seq + } + { + \seq_set_split:Nne \l__hduthesis_signature_date_seq {-} + { \seq_item:Nn \l__hduthesis_signature_figure_seq {2} } + \seq_item:Nn \l__hduthesis_signature_date_seq {#3} + \seq_clear:N \l__hduthesis_signature_date_seq + } + \clist_clear:N \l__hduthesis_signature_process_clist + } +\end{minted} + +定义插入签名图片的命令 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \NewDocumentCommand \signature { m } + { + \leavevmode@ifvmode + \lower \dimexpr \f@size\p@ * 9/16 + \hbox { \includegraphics [ height = { \fp_eval:n {2*\f@size}\p@ } ] {#1} } + } +\end{minted} + +结束模块 \file{hduthesis-layout-module.code} 文件 +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \endinput +\end{minted} diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a4.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a4.tex new file mode 100644 index 0000000000..e6f25c28e8 --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a4.tex @@ -0,0 +1,4 @@ +\subsection{\file{hduthesis-bc.config-module.code} 的实现} + +\cmd{bc.config} 模块实现的过程略,主要是对前面定义的命令进行调用,并通过 \cs{ctexset} +或对标准文档类 \cls{report} 中的命令进行重定义. \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a5.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a5.tex new file mode 100644 index 0000000000..a23e800966 --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a5.tex @@ -0,0 +1,4 @@ +\subsection{\file{hduthesis-pg.config-module.code} 的实现} + +\cmd{pg.config} 模块实现的过程略,主要是对前面定义的命令进行调用,并通过 \cs{ctexset} +或对标准文档类 \cls{report} 中的命令进行重定义. \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a6.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a6.tex new file mode 100644 index 0000000000..7efec03fbb --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a6.tex @@ -0,0 +1,28 @@ +\subsection{\file{hduthesis-hdu.l3doc-module.code} 的实现} + +模块 \file{hdu.l3doc} 的代码实现与之前类似,唯独不同的是添加了两个 \cs{hologo}: + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \def \HoLogo@hduThesiS #1 + { + \raisebox{-.5pt} + { + \HOLOGO@mbox + { + \tikz [ baseline = (hduthesis.base) ] + { + \node [ inner~sep = 0pt ] (hduthesis) + {\scshape \sffamily hduThesi\scalebox{1.2}[1.2]{S}}; + \draw let \p1 = (hduthesis.west), \p2 = (hduthesis.east) + in (\x1,\y1) (\x2,\y2) [ line~width = {.028pt * (\x2 - \x1)} ] + ([yshift = -.5ex]hduthesis.north~west) to[ bend~right = 5 ] + ([yshift = .25ex]hduthesis.north~east); + } + } + } + } + \def \HoLogo@hduthesis #1 + { \raisebox{-.5pt} { \HOLOGO@mbox { \scshape \cls{hduThesiS} } } } +\end{minted} + +前者 \hologo{hduThesiS} 使用在本用户手册封面中,将字母 \textsf{S} 放大 1.2 倍,并使用 \pkg{tikz} 绘制一条搭在字母 \textsf{T} 上的曲线. 后者 \hologo{hduthesis} 则单纯地使用无衬线且缩小的大写字体. \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/doc/cha/source/a7.tex b/macros/xetex/latex/hduthesis/doc/cha/source/a7.tex new file mode 100644 index 0000000000..a1d38534b2 --- /dev/null +++ b/macros/xetex/latex/hduthesis/doc/cha/source/a7.tex @@ -0,0 +1,35 @@ +\subsection{\file{hduthesis-hdu.stationery-module.code} 的实现} + +模块 \file{stationery} 的代码实现与之前类似. 不同的部分有使用钩子 \cmd{shipout} 来实现水印的添加 + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \DeclareHookRule { shipout / background } { hduthesis / stationery } + { before } { pgfrcs } + \AddToHook { shipout / background } [ hduthesis / stationery ] + { + \bool_if:NT \g__docinfo_watermark_bool + { + \tikz [ remember~picture, overlay ] + \node [ opacity = .2 ] at (current~page) + { \includegraphics [ width = .4\linewidth ] {hdulogo} }; + } + } +\end{minted} + +调用 \pkg{tikzpagenodes} 宏包用于定位版心的边缘,用循环句柄 \cs{int_step_inline:nn} 与 \cs{draw} 命令来实现横线的绘制. + +\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex} + \RequirePackage{tikzpagenodes} + \NewDocumentCommand \notelines {O{20}} + { + \tikz [ remember~picture, overlay ] + { + \int_step_inline:nn { #1 - 1 } + { + \draw [ hdu, very~thick, opacity = .6 ] + ([yshift = -##1 * (\textheight + .6in - 15.87pt ) / #1 + .3in] + current~page~text~area.north~west) --++ (\linewidth, 0); + } + } + } +\end{minted} diff --git a/macros/xetex/latex/hduthesis/doc/hduthesis.pdf b/macros/xetex/latex/hduthesis/doc/hduthesis.pdf index acfdd8e07c..c60ae766c7 100644 Binary files a/macros/xetex/latex/hduthesis/doc/hduthesis.pdf and b/macros/xetex/latex/hduthesis/doc/hduthesis.pdf differ diff --git a/macros/xetex/latex/hduthesis/doc/hduthesis.tex b/macros/xetex/latex/hduthesis/doc/hduthesis.tex index ee4c074375..cc62600e43 100644 --- a/macros/xetex/latex/hduthesis/doc/hduthesis.tex +++ b/macros/xetex/latex/hduthesis/doc/hduthesis.tex @@ -1,251 +1,33 @@ \documentclass[l3doc]{hduthesis} +\usepackage{minted} + \DocInfo { - title = The \hologo{hduthesis} Class\\ - \hologo{LaTeX} Thesis Template for - Hangzhou Dianzi University, - author = Mingyu Xia \mailto{xiamyphys@hdu.edu.cn} - \footnote{Physics Department, Graduate in 06/2025}, + title = \hologo{hduThesiS} 文档类\\ + 杭州电子科技大学学位论文 \hologo{LaTeX} 模板 + \footnote + { + 在 杭州电子科技大学非毕业生 / 教师 中寻找模板的继承维护者, + 要求熟悉 \pkg{expl3}. 欢迎有意愿者邮件联系作者. + }, + author = Mingyu Xia \mailto{xiamyphys@gmail.com} + \footnote{Physics Department, Graduate in 06/2025}, CJKmain-font = {[AutoFakeSlant]{Songti SC}}, CJKsans-font = {[BoldFont = Hei, AutoFakeSlant]{Heiti SC}}, - CJKmono-font = {[AutoFakeSlant]{LXGW WenKai Mono}} + CJKmono-font = {[AutoFakeSlant]{Kaiti SC}} } \begin{document} \maketitle -\begin{abstract} - \hologo{hduthesis} 是杭州电子科技大学学位论文 \hologo{LaTeX} 模板,支持学士、硕士学位论文排版. -\end{abstract} - -\begin{center} - \small\bfseries User Agreement -\end{center} -\begin{enumerate}\small - \item 本模板通过 LPPL 1.3c 协议开放源代码,您可以随意使用编译出的 PDF 文件. - \item 本模板根据杭州电子科技大学教务处颁发的 \href{https://jwc.hdu.edu.cn/2022/0428/c4528a153813/page.htm}{杭电理工类毕业论文写作规范} 编写而成,作者不对使用本模板产生的格式审查问题负责. \emph{如果您所在的学院因论文查重、收录等原因要求提交 \file{.docx} 格式,不接收 \file{.pdf} 论文稿件,请勿执意使用本模板,避免因格式转换带来不必要的麻烦.} 使用本模板时,请按编译错误提示操作来勾选同意用户协议. - \item 欢迎前往 GitHub 提交反馈意见,为推动学校认证与规范化 \hologo{hduthesis} 贡献力量. -\end{enumerate} -\endtitlepage -\restoregeometry - -\section{Introduction \& Loading \hologo{hduthesis}} - -本模板为杭州电子科技大学学位论文 \underline{非官方} \hologo{LaTeX} 模板, -以 \hologo{LaTeX3} 构建,支持学士和硕士学位论文排版. -加载 \hologo{hduthesis} 时遇到``编译受阻''报错,请认真阅读上页的用户协议. -键入全局选项 \cmd{agreed} 后,方可顺利进行编译,并默认您已同意用户协议. - -\begin{framed} - \begin{verbatim} - \documentclass [ agreed, ... ] { hduthesis } - \end{verbatim} -\end{framed} - -\section{Generate the Cover} - -\begin{function}{\DocInfo} - \begin{syntax} - \cs{DocInfo}\marg{keyvals} - \end{syntax} - - 此命令接收键值,用于设置文档信息. 键 \keys{\cmdmac~title} 用于设置论文标题,键 \keys{\cmdmac~department} 用于设置学院,键 \keys{\cmdmac~major} 用于设置专业,键 \keys{\cmdmac~class} 用于设置班级,键 \keys{\cmdmac~stdntid} 用于设置学号,键 \keys{\cmdmac~author} 用于设置作者,键 \keys{\cmdmac~supervisor} 用于设置导师,键 \keys{\cmdmac~bibsource} 用于设置插入参考文献文件源. 命令会根据输入的学号自动判断使用者为本科生/研究生. - - 命令 \cs{DocInfo} 需在导言区中执行. 完成文档信息输入后,在 \verb|\begin{document}| 后执行命令 \cs{maketitle} 会调用所设置的键值自动生成 \emph{论文封面} 和 \emph{诚信承诺书}. -\end{function} - -本科生输入样例如下. 需要使用键 \keys{\cmdmac~title} 设置类型为毕业设计/毕业论文,使用斜线 (/) 分隔,如 \cmd{title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/毕业论文}. - -\begin{framed} - \begin{verbatim} - \DocInfo - { - title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/毕业论文, - department = 理学院, major = 物理学, stdntid = 21668668, - author = 申智能, supervisor = 李智能, bibsource = reference - } - \end{verbatim} -\end{framed} - -下页的缩略图为本科毕业论文文档样例 \cmd{hduthesis-bc} 中的封面、扉页和承诺书. - -\includepdfmerge - [ angle = -90, nup = 1x2, frame, linktodoc, scale = 0.96, delta = 0 .25in ] - { /Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-bc.pdf, 1-2 } - -研究生输入样例如下. 硕士学位论文扉页需同时有英文版,因此需要在键 \keys{\cmdmac~title} \keys{\cmdmac~author} \keys{\cmdmac~supervisor} 中分别输入中文和英文信息,中英信息使用斜线 (\cmd/) 分隔. 如作者中文姓名为 \cmd{申智能},英文姓名为 \cmd{SAN Chi Nan},则键值输入格式为 \cmd{author = 申智能/SAN Chi Nan}. 指导教师职称和姓名之间用半角冒号 (\cmd:) 分隔. - -\begin{framed} - \begin{verbatim} - \documentclass { hduthesis } - \DocInfo - { - title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/ - \hologo{LaTeX} Template for Thesis at - Hangzhou Dianzi University, - major = 物理学, stdntid = 216686680, - author = 申智能/SAN Chi Nan, bibsource = reference - supervisor = 教授:葉芷晴/Prof.:YIP Tsz Ching, - } - \begin{document} \maketitle ... \end{document} - \end{verbatim} -\end{framed} - -\DescribeMacro{\l__hduthesis_grade_int} -论文完成日期和学生毕业年份会根据当前系统时间自动生成. 如果当前月份在8月及以前,毕业年份会显示今年;如果当前月份在9月及以后,毕业年份会显示次年. 在 \cs{DocInfo} 后对整型 \cs{l__hduthesis_grade_int} 重新赋值可手动更改毕业年份. - -\begin{verbatim} - \ExplSyntaxOn \int_set:Nn \l__hduthesis_grade_int \ExplSyntaxOff -\end{verbatim} - -下页包含所生成的硕士学位论文封面、扉页和承诺书缩略图. 此文档样例可在终端执行 \cmd{texdoc hduthesis-pg} 获取. - -文档类同时提供了校徽 (\file{hdulogo.pdf})、校名 (\file{hdutitle.pdf}) 、校训 (\file{hdumotto.pdf})和校牌 (\file{hdubadge.pdf}) 的矢量素材,可直接使用. 以上文件均由 \href{https://www.hdu.edu.cn/666/list.htm}{校情纵览/校标规范} 所提供素材裁切制成,均支持在 \hologo{XeLaTeX} 和 \hologo{pdfLaTeX} 编译器下使用 \pkg{Ti\textit k\/Z} 等方式设置透明度. - -\includepdfmerge - [ nup = 2x2, frame, linktodoc, scale = 0.96, delta = .25in .25in ] - { /Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-pg.pdf, 1-8 } - -\section{Enter Abstract in EN / CN} - -\DescribeEnv{abstract} -环境 \env{abstract} 用于生成摘要,其可选参数可设置语言格式. - -\DescribeMacro{\keywords} -命令 \cs{keywords} 需在 \env{abstract} 环境内执行,其会根据 \env{abstract} 环境所选择的语言,自动生成英文 / 中文格式的关键词. - -\begin{framed} - \begin{verbatim} - \begin{abstract}[en]...\keywords{keyword1, keyword2} \end{abstract} - \begin{abstract}[cn]...\keywords{关键词1, 关键词2} \end{abstract} - \end{verbatim} -\end{framed} - -通过命令 \cs{keywords} 以半角逗号 (,) 为分隔输入关键词列表,输出时会根据所处 \env{abstract} 环境选择的语言不同,自动以半 / 全角分号分隔. 下图为生成的中/英摘要样例,可在终端执行 \cmd{texdoc hduthesis-bc} 获取此样例文件. - -\begin{figure}[htbp] - \centering - \fbox - { - \includegraphics[page = 3, width = .42\linewidth] - {/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-bc.pdf} } - \hfill - \fbox - { - \includegraphics[page = 4, width = .42\linewidth] - {/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-bc.pdf} } - \caption{样例文件 \file{hduthesis-bc.pdf}, Page 3 -- 4} -\end{figure} - -\section{Input Text} - -\hologo{hduthesis} 的 {chapter}、\cs{section}、\cs{subsection}、\cs{enumerate} 等段落级次均已按``\href{https://jwc.hdu.edu.cn/2022/0428/c4528a153813/page.htm}{杭电理工类毕业论文写作规范}''定制,可直接使用. - -如需插入参考文献,通过命令 \cs{DocInfo} 指定 \file{.bib} 文件后在要插入参考文献等地方输入 \cs{printbiblography} 即可输出参考文献列表. 参考文献格式已设置为 \cmd{gb7714-2015}. 若未指定参考文献 \file{.bib} 文件,为加速编译,\pkg{gbt7714} 宏包将不会加载. 同时,模板额外预置了以下宏包 - -\begin{table}[htbp] - \centering - \begin{tabular}{*{8}{>{\small}p{.096\linewidth}}} - \toprule - \pkg{amsmath} & \pkg{amssymb} & \pkg{bm} & \pkg{booktabs} & - \pkg{cancel} & \pkg{circuitikz}& \pkg{cleveref} & \pkg{derivative} \\ - \midrule - \pkg{extarrows} & \pkg{fixdif} & \pkg{listings} & \pkg{mathtools} & \pkg{multicol} & \pkg{pgfplots} & \pkg{physics2} & \pkg{siunitx}\\ - \bottomrule - \end{tabular} -\end{table} - -\begin{figure}[htbp] - \begin{subfigure}{.32\linewidth} - \centering - \fbox - { - \includegraphics[page = 5, width = .9\linewidth] - {/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-bc.pdf} - } - \caption{Table of Contents} - \end{subfigure} - \hfill - \begin{subfigure}{.32\linewidth} - \centering - \fbox - { - \includegraphics[page = 11, width = .9\linewidth] - {/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-bc.pdf} - } - \caption{Text} - \end{subfigure} - \hfill - \begin{subfigure}{.32\linewidth} - \centering - \fbox - { - \includegraphics[page = 12, width = .9\linewidth] - {/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-bc.pdf} - } - \caption{Text with figures} - \end{subfigure} -\end{figure} - -\hrule - -\begin{center} - \fbox - { \parbox[c][1.5em]{34ex}{\centering\file{hduthesis-pg.config-module}} } - \fbox { \parbox[c][1.5em]{32ex}{\centering\file{hduthesis-typeset-module}} } - \fbox { \parbox[c][1.5em]{15ex}{\centering\file{hdulogo.pdf}} }\\[2ex] - \fbox { \parbox[c][1.5em]{33ex}{\centering\file{hduthesis-bc.config-module}} } - \qquad \fbox { \parbox[c][1.5em]{16ex}{\centering\file{hdubadge.pdf}} } \qquad - \fbox { \parbox[c][1.5em]{16ex}{\centering\file{hdumotto.pdf}} }\\[2ex] - \fbox { \parbox[c][1.5em]{30ex}{\centering\file{hduthesis-layout-module}} }~ - \fbox { \parbox[c][1.5em]{16ex}{\centering\file{hdutitle.pdf}} } - \fbox - { \parbox[c][1.5em]{34ex}{\centering\file{hduthesis-stationery-module}} }~ -\end{center} - -\hrule - -\section{杭州电子科技大学信纸} - -加载全局选项 \pkg{stationery},并进行文档信息设置,即可生成信纸. 可用于推荐信撰写. -此模块无需 \pkg{agreed} 选项. - -\begin{framed} - \begin{verbatim} - \documentclass [ stationery ] { hduthesis } - \end{verbatim} -\end{framed} - -与学士 / 硕士学位论文文档信息设置类型,使用 \cs{DocInfo} 命令,对信件标题、发件人、机构、日期、电话和邮件信息进行设置. 此时 \cs{DocInfo} 命令接受键 -\keys{\cmdmac~title} \keys{\cmdmac~author} \keys{\cmdmac~affliction} -\keys{\cmdmac~date} \keys{\cmdmac~tel} \keys{\cmdmac~mail}. 下页为生成信纸的样例. - -\begin{framed} - \begin{verbatim} - \DocInfo - { - title = Recommendation Letter for SAN Chi Nan, - author = YIP Tsz Ching, - affliction = {Physics Department, Hangzhou Dianzi University}, - date = {25\textsuperscript{th} November, 2024}, - tel = (852) 3141-5926, - mail = xiamyphys@gmail.com - } - \end{verbatim} -\end{framed} - -\section{For Developers} +\input{cha/abstract.tex} -本手册为 \cls{hduthesis} 加载选项 \pkg{l3doc} 后生成,基于 \cls{l3doc} 文档类. +\setcounter{tocdepth}{2} \tableofcontents -\begin{framed} - \begin{verbatim} - \documentclass [ l3doc ] { hduthesis } - \end{verbatim} -\end{framed} +\input{cha/contents.tex} -\includepdf{/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-stationery} +\input{cha/source.tex} \end{document} diff --git a/macros/xetex/latex/hduthesis/example/cha/abstract.tex b/macros/xetex/latex/hduthesis/example/cha/abstract.tex new file mode 100644 index 0000000000..6b78b6d13a --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/abstract.tex @@ -0,0 +1,25 @@ +\begin{abstract}[cn] + + 本毕业设计主要设计自主研发的激光打靶系统的信号处理过程,继而实现整个打靶系统。激光打靶系统主要包括半导体激光枪、光电探测器和信号处理电路,信号处理过程是整个系统的关键。激光打靶的打靶过程,由激光枪发射激光脉冲信号,光电靶接收激光脉冲信号,经过系列信号处理过程最终得到打靶的结果。光电靶由许多块的光电探测器组成,每块不同位置的光电探测器对应不同编号,从打靶的实际情况出发,确定了相应的编号规则。打靶的成绩由激光所击中的光电探测器的编号来判定。 + + 激光打靶系统的主要信号处理过程包括:信号的放大、编码和数据传输。信号由光电探测器检测后传送到相应的放大电路,放大电路采用集成运算放大器。按原先对光电探测器的编码规则采用多路优先编码器对信号进行编码。最后把编码值以串口的形式传送到计算机,利用计算机的强大功能对打靶结果进行各种处理。与计算机之间的串行数据传输由89C2051单片机实现。89C2051单片机的程序,使用keil编译器进行设计和调试完成,其主要功能是控制数据的串行传送,实现与计算机的串口通信。 + + 该信号处理系统实现了对信号的良好检测。与计算机之间的串口通信可以实现数据在计算机上的显示、统计、储存等功能,为打靶者提供非常直接、准确的打靶结果,有利于提高打靶效果。 + + \keywords{激光打靶, 信号处理, 信号编码, 串行传输} +\end{abstract} + +\begin{abstract}[en] + + The main aim of this thesis is to design and realize signal processing of a self-developed laser target shooting system and then realize the whole laser target shooting system. The laser target shooting system consists of semiconductor laser gun, photoelectric detector, and signal processing circuit, which is the key part of the whole system. Laser target shooting process go though following steps: laser gun emitted a pulse of laser, which would be received by the laser target and the results of shooting will be shown on screen of computer by series signal processing. The laser target consists of some silicon photoelectric units that were encoded with different numbers according to certain rule. The result of the shooting will be got when detecting the number of the photoelectric unit that receives the laser pulse. + + The signal processing of the laser target shooting system mainly consists of signal amplification, signal encoding and data transmission. The inspected photoelectric signal was then amplified by operator amplifiers, coded by multiplex priority encoder according to the prearranged rule, and then transferred to computer by 89C2051 MCU through its serial port. And then computer can process the signal. The program of 89C2051 MCU is designed in keil and debugged using keil compiler. It is designed to control the data transmission with computer. + + The designed signal processing system can detect signal effectively. Through the serial data transmission, computer can process the shooting result, such as display, statistics and storage etc. It provide direct and exact shooting result for trainer, so it can increase the efficiency of the shooting training. + +\keywords +{ + laser target shooting, signal amplification, + signal encode, serial data transmission +} +\end{abstract} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha1.tex b/macros/xetex/latex/hduthesis/example/cha/cha1.tex new file mode 100644 index 0000000000..864fd1b3db --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha1.tex @@ -0,0 +1,9 @@ +\chapter{引言} + +目前的射击打靶训练,基本以实弹训练为主,国防开支大,危险系数高。传统的报靶方法是人工报靶,由报靶员根据经验确定靶数,带有很大的个人主观因素,可靠性、公正性差,效率低。因此有必要研制一种切合部队实际的,在非实弹射击条件下进行射击精度训练的打靶训练器,这样既能保证部队训练质量又能减少弹药消耗、节约国防费用,具有重大的国防意义。 + +以光代弹,可以模拟多种武器的射击情况,并可检验射击效果。这种新型的部队训练模拟器材是部队训练器材的一次革命,是和平时期部队训练的有效手段之一。一些发达国家,如美国、英国、德国等都在积极进行激光射击模拟训练器材的研制,并已开发出多种系列产品,其中最突出的是美国的“米勒斯”系列,它可模拟 36 种武器,性能好、准确而且逼真,大大推动了部队的训练工作。 + +八十年代以来,我国也有单位在进行激光模拟训练器的研究和探索,将激光射击模拟器用于部队训练,取得了很好的训练效果,提高了部队的战斗力。但在可靠性和数据处理等方面尚有许多技术问题有待改进,主要是以下几点:激光光斑太大,与实际步枪子弹口径$\qty{7.62}\mm$相差太多;探测器数量少会导致设计精度不高;探测器数量多会使得价格昂贵,无法推广;只能粗略指示命中与否,不能准确显示命中靶环环数和方位。因此,我们拟从这些方向作进一步的研究探索。 + +本设计采用半导体激光器和半导体面阵列探测器来模拟子弹射击和射击靶标,具有模拟逼真,精度高等特点。主要从信号处理部分来设计实现激光打靶系统,每次射击能精确的显示 5 -- 10 环的结果及脱靶情况,每个环数又可分为八个偏移方向。该系统简单实用,既能保证训练的质量又能减少弹药的消耗,是理想的公安、军队等部门训练使用的模拟打靶系统。 \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha2.tex b/macros/xetex/latex/hduthesis/example/cha/cha2.tex new file mode 100644 index 0000000000..d7d50c5455 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha2.tex @@ -0,0 +1,60 @@ +\chapter{概述} + +\section{激光打靶系统概述} + +激光打靶系统\cite{cn1,cn2,cn3}的工作原理是采用激光脉冲来模拟枪弹的射击,该系统一般包括激光发射部分、激光信号检测模块、打靶成绩处理和显示部分。如图 2-1 所示,当射手瞄准完毕扣动扳机时,半导体激光器会发出激光脉冲,射向目标上的光电探测器,如果击中目标,则激光脉冲被光电探测器接收并转换为电信号,经电路处理能识别射击的弹着点,信号经处理编码后传输到计算机。 + +\begin{figure}[htbp] + \centering + \begin{tikzpicture} + [ + every node/.style = { font = \small, inner sep = 1ex } + ] + \node (a) [draw, rectangle] at (0,0) {光电探测器}; + \node (b) [draw, rectangle] at (3.5,0) {信号处理电路}; + \node (c) [draw, rectangle] at (7,0) {计算机处理}; + \node (d) [draw, rectangle] at (0,-1.5) {半导体激光器}; + \node (e) [draw, rectangle] at (4,-1.5) {激光枪扳机}; + \draw [->, thick] (a.east) -- (b.west); + \draw [->, thick] (b.east) -- (c.west); + \draw [->, thick] (d.north) -- (a.south); + \draw [->, thick] (e.west) -- (d.east); + \end{tikzpicture} + \caption{激光打靶系统原理图} +\end{figure} + +半导体激光器\cite{cn4,en5}一般平行地安装在武器装备的枪管、炮管或导弹发射架上,它可以发射一束与武器射击方向一致的激光脉冲。目前的激光器一般都采用半导体激光器,因为这种激光器的输出功率低,不会伤害眼睛,而且效率高、功耗小,不但可以摆脱大而重的电源设备,激光器本身也可以制作得很小、很轻。光电探测器\cite{en6}具有射击靶的形状,可以是点探测器和面探测器,通常数量较多,构成多个信号检测通路。根据光电探测器的响应位置来判断激光射击击中的靶位。 + +激光打靶采用以光代弹的形式进行射击训练,是激光武器模拟器中最常见的一种。最初的激光打靶系统只能进行瞄准射击训练,随着计算机和微处理器技术的发展,其用途扩大到可进行多种武器的模拟训练。随着研究和探索的深入,激光打靶系统的功能将进一步完善,能够更接近于武器装备在实际使用中的表现,增强真实感。同时,通过与电子技术相结合,进一步提高激光模拟的自动化、智能化水平。 + +激光武器模拟器有以下几个方面的发展趋势: + +\begin{enumerate} + \item 可以模拟的武器越来越多,激光武器模拟器正朝着系列化、组件化的方向发展,一个基本的激光射击模拟器只要稍加改动就可适用于其他武器系统。系列化、组件化的好处是便于使用、更换和维修,同时价格也便宜。 + \item 从激光射击模拟器向激光交战模拟器发展,先进的激光交战模拟器能使坦克、战斗车辆、反坦克武器等有机的结合在一起进行训练,每部兵器既是攻击者,又是被攻击者,完全模仿实战中的作战环境,不仅能提高战士使用武器的技能,还可以教会他们如何在战争中保护自己。 + \item 采用各种新技术增加模拟的逼真性,例如用计算机来记录、控制整个训练演习的进程,评定战士在演习中的表现等。 +\end{enumerate} + +\section{本设计方案思路} + +本设计以实现信号的良好检测和数据转换、传输为主要目的;以信号检测,信号编码和数据传输为主要设计内容。 + +在信号检测方面设计单脉冲小信号的放大电路和信号整形电路;在信号编码方面,要解决多路信号的编码问题,还要考虑到编码的优先选择问题;在脱靶问题的处理方法上,对打靶和信号采集传送进行同步化处理(详见第二章的硬件设计部分),把脱靶的情况与中靶的情况归为一类处理;数据传输采用 UART 串口通信。 + +\section{研发方向和技术关键} + +\begin{enumerate} + \item 合理划分激光靶的光电探测器,提高系统的精度; + \item 单脉冲小信号的放大和整形; + \item 多路优先编码器的扩展; + \item 与微机进行数据传输,方便成绩的统计、保存、显示和查询。 +\end{enumerate} + +\section{主要技术指标} + +\begin{enumerate} + \item \makebox[9\ccwd][l]{激光脉宽:}大于$\qty1\ms$ + \item \makebox[9\ccwd][l]{激光脉冲响应幅度:}约$\qty{10}\mV$ + \item \makebox[9\ccwd][l]{打靶距离:}$\qty{30}\m$ + \item \makebox[9\ccwd][l]{串行输出帧格式:}射击次数\ensuremath+所击中的光电探测器的编号 +\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha3.tex b/macros/xetex/latex/hduthesis/example/cha/cha3.tex new file mode 100644 index 0000000000..bfa795380f --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha3.tex @@ -0,0 +1,108 @@ +\chapter{总体设计} + +激光打靶系统是一种集光、电于一体的系统,其工作原理是激光枪发出的激光束,打到光电 +传感器上,经光电传感器将光信号转换为电信号,电信号经过信号处理后由单片机发送到计 +算机的串行口,然后在计算机上完成成绩显示、查询和保存等功能。 + +激光打靶系统结构的组成框图如\cref{3-1}所示。该系统包括半导体激光枪、模块式 +探测器、数字信号处理和发送电路、计算机数据处理程序等四部分。 + +\begin{figure}[htbp] + \centering + \begin{tikzpicture} + [ + every node/.style = {font = \small, minimum height = 4.4em, minimum width = 3em} + ] + \linespread{1} + \node (a) [draw, rectangle, align = center] at (0,0) {激\\光\\枪}; + \node (b) [draw, rectangle, align = center] at (2.5,0) {探测\\器\\模块}; + \node (c) [draw, rectangle, align = center] at (5,0) {滤波\\电路}; + \node (d) [draw, rectangle, align = center] at (7.5,0) {放大\\电路}; + \node (e) [draw, rectangle, align = center] at (10,0) {整形\\电路}; + \node (f) [draw, rectangle, align = center] at (12.5,0) {优先\\编码\\电路}; + \node (g) [draw, rectangle, align = center] at (2.5,-2.3) {串行\\收发\\模块}; + \node (h) [draw, rectangle, align = center] at (5,-2.3) {电平\\转换}; + \node (i) [draw, rectangle, align = center, above right] at ([yshift = -2.3cm]e.south west) {计\\算\\机}; + \draw [->, thick] (a.east) -- (b.west); + \draw [->, thick] (b.east) -- (c.west); + \draw [->, thick] (c.east) -- (d.west); + \draw [->, thick] (d.east) -- (e.west); + \draw [->, thick] (e.east) -- (f.west); + \draw [<-, thick] (g.west) --++ (-1.5,0); + \draw [->, thick] (g.east) -- (h.west); + \draw [->, thick] (h.east) -- node [above = -1.5em] {串口} (i.west); + \end{tikzpicture} + \caption{系统总体结构框图} + \label{3-1} +\end{figure} + +\section[激光的检测]{激光的检测\cite{cn7,cn8}} + +每次打靶,激光枪发出一个激光脉冲。如果激光脉冲击中光电靶,利用光生伏特效应,光电 +靶上的探测器把光信号转换成电信号,因此激光的检测就是对探测器响应电信号的检测。光 +电探测器的响应是一个单脉冲小信号,整个检测过程包括:信号放大、波形整形,检测输出 +是标准的脉冲数字信号。 + +\section{靶位的划分} + +把一个激光靶划分为 38 块探测器,中心 10 环为一块探测器;9.8.7.6 环分别有 8 块 +探测器;5 环有 5 块探测器。根据不同靶位上的探测器来判断所击中的位置,包括环数: +10.9.8.7.6.5;偏离方向:上.下.左.右.左上.左下.右上.右下。 + +若信号击中两块或四块探测器的交界,则只取其中一块为有效,记为有效的探测器满足以下 +条件: + +\begin{enumerate} + \item 环数高; + \item 偏离方向为斜向(例如:上和右上两方向,选择右上)。 +\end{enumerate} + +根据上述要求,以及硬件电路设计的需要,对不同的探测器进行编码,见\cref{3-2}(右)。 + +\newpage +\begin{figure}[htbp] + \centering + \includegraphics[width = .86\linewidth]{image-0145} + \caption{靶位划分与编号} + \label{3-2} +\end{figure} + +\section{编码标准} + +对 38 路信号按以上原则编码,编码结果如表 3-1。若脱靶无信号则记为 0 号。编码后, +每一个号码对应了每一个探测器的位置信息,包括环数和偏移方向。对信号击中两块或四块 +探测器的交界的情况,只需取码号大的探测器为有效。这样,打靶的结果在硬件电路上的实现 +便可由 40--6 线优先编码器完成。 + +\begin{table}[htbp] + \centering + \renewcommand{\arraystretch}{1.3} + \caption{靶位编码} + \begin{tabular}{*{9}{@{}|@{}>{\small\centering\arraybackslash}p{.107\linewidth}}@{}|@{}} + \hline + & 上 & 右上 & 右 & 右下 & 下 & 左下 & 左 & 左上\\ + \hline + 10环 & \multicolumn{8}{c|}{38}\\ + \hline + 9环 & 33 & 37 & 32 & 36 & 31 & 35 & 30 & 34\\ + \hline + 8环 & 25 & 29 & 24 & 28 & 23 & 27 & 22 & 26\\ + \hline + 7环 & 17 & 21 & 16 & 20 & 15 & 19 & 14 & 18\\ + \hline + 6环 & 9 & 13 & 8 & 12 & 7 & 11 & 6 & 10\\ + \hline + 5环 & 3 & --- & 2 & 5 & --- & 4 & 1 & ---\\ + \hline + \end{tabular} +\end{table} + +\section{成绩的传送和处理} + +信号经编码后发送到计算机,由计算机进行译码,在计算机上模拟显示出射击位置,对一组 +结果进行统计(包括环数和方向偏移),并进行储存。 + +\section{其他说明} + +系统分为硬件部分和软件部分。本论文主要设计制作硬件部分以及与微机的通讯的 2051 单 +片机程序。微机软件部分,包括数据的处理和显示等有另外一名毕业设计同学实现。 \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha4.tex b/macros/xetex/latex/hduthesis/example/cha/cha4.tex new file mode 100644 index 0000000000..68cd5a048f --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha4.tex @@ -0,0 +1,301 @@ +\chapter{硬件设计} + +\section{信号放大电路} + +在光电探测系统中,探测器输出的电信号非常微弱,一般为毫伏级。为记录每一次打靶的结果,信号放大与处理电路是打靶系统中不可或缺的。在探测器上直接进行信号处理十分困 +难,一种常用的解决办法是在探测器后接前置放大器,用来放大探测器的输出信号,然后成 +功地传输到信号处理系统的有关电路部分。前置放大器的设计要求是低噪声,高增益,低输 +出阻抗,大的动态范围,和较好的抗噪声能力。 + +在激光打靶系统中,对光电池产生的脉冲信号的具体大小值要求不高,只需检测出有效的脉 +冲信号,因此可选用集成运放来组成运算放大电路。 + +通过测试,得到光电探测器对的激光脉冲的响应幅度典型值约为$\qty5\mV$,若激光击中 +在两块或多块探测器边界处,则任何一块光电探测器的响应幅度会减少,因此所检测的脉冲 +幅度范围大约是$\num3\sim\qty5\mV$.为使每块光电探测器均能检测出信号,使之达到 +TTL 电平要求,实现信号检测,必须对信号放大约 1000 倍。单级运放难以达到这么高的 +放大倍数,因此采用二级运放进行放大,第一级为前置放大器。为减少前级放大器的偏移对 +后级放大器的影响,设计其放大倍数$A_1=100$;从而次级放大器的放大倍数$A_2=10$。 + +\subsection{集成运算放大器(LM324)} + +集成运算放大器是实现高增益放大功能的一种集成器件\cite{cn9},早期主要用来实现对模拟量进行 +数学运算的功能,目前随着器件性能的改进,它已成为通用的增益器件,应用范围非常广泛。 + +从电特性来看,集成运放接近理想的电压放大器件,它不仅有很大的输入电阻和很小的输出 +电阻,而且还有很高的电压增益,此外,静态工作时,它的输入和输出电位均为零,这样, +在与其它集成运放连接时,就不需要考虑它们之间的电平配置问题。 + +LM324 是四通道的低功耗运算放大器,它的内部包含四组形式完全相同的运算放大器,除电 +源共用外,四组运放相互独立,其性能参数有以下几个方面: + +\begin{enumerate} + \item 单电源工作方式,工作电平$\qty3\V\sim\qty{30}\V$ + \item 低消耗电流:约$\qty{0.8}\mA$ + \item 低输入偏移:输入电压偏移:$\qty3\mV$(Typ);输入电流偏移:$\qty2\nA$(Typ) + \item 开环增益:$\qty{100}\V/\unit\mV=\qty{100}\dB$(Typ) + \item 宽响应频带 +\end{enumerate} + +\newpage +\begin{figure}[htbp] + \centering + \includegraphics[width = .595\linewidth]{image-0162} + \caption{LM324内部结构} + \label{4-1} +\end{figure} + +\subsection{放大电路图} + +\begin{figure}[htbp] + \centering + \includegraphics[width = .93\linewidth]{image-0163} + \caption{运算放大器电路图} + \label{4-2} +\end{figure} + +放大器电路如\cref{4-2} 所示。它由两级结构相同的同相放大器组成,集成放大器选用 +LM324(\cref{4-1})。信号经隔直流电容C1从第一级放大器的正端 +``\ensuremath+''输入,经过放大后输出,再经过级间耦合电容C2输入第二级放大器 +的正端。前级的放大倍数$A_1=R_2/R_1=100$,后级的放大倍数$A_2=R_6/R_5=10$, +$R_3$和$R_7$为输入匹配电阻。 + +\subsection{电路原理} + +\begin{enumerate} + \item 同相放大器\cite{cn10}(\cref{4-3}) + + 集成运放是一种十分理想的增益器件,性能好,使用方便。该电路采用 2 级放大器级 + 联,每级的放大器均采用同相放大。 + + 由集成运放构成的同相放大器,其特点是输入信号加在同相输入端,而反馈信号加在反相端。根据理想化条件,由于$v_+=v_s$,因而$v_-\approx v_s$。更具$i\to0$(虚断),$v_-$又是$v_o$在$R_1$上的分压值,即: + \begin{equation} + v_-=v_o\frac{R_1}{R_1+R_f} + \end{equation} + 因而,放大器的增益: + \begin{equation} + A_{V_f}=\frac{v_o}{v_s}=\frac{R_1+R_f}{R_1}=1+\frac{R_f}{R_1} + \end{equation} + $\because A_{V_f}>0$,所以$v_o$与$v_s$同相。 + + \begin{figure}[htbp] + \centering + \includegraphics[width = .54\linewidth]{image-0236} + \caption{同相放大器} + \label{4-3} + \end{figure} + \item 外围电路 + + 光电传感器对外部光线也有响应,因此必须滤除这种干扰。由于背景光线是持续信号,其 + 响应主要是直流量,在第一级放大器输入端的前面设计接入一个$\qty1\uF$电容C1起到 + 隔离直流作用,能起到很好的效果。第二级的$\qty1\uF$电容C2用于两级放大器的耦合。 + + 第一级放大器输入端和地之间接 R3;第二级放大器输入端和地之间接 R7。使得: + \begin{equation} + \begin{cases} + R_3\approx R_1//R_2\\ + R_7\approx R_5//R_6 + \end{cases} + \end{equation} + 这样,运放的正、负输入端对地的等效电阻相等,从而降低运放的电压偏移。 +\end{enumerate} + +\subsection{电路参数} + +\begin{enumerate} + \item \makebox[9em][l]{输入脉冲幅度:} $U_i\approx\num3\sim\qty5\mV$ + \item \makebox[9em][l]{输入电阻:} $R_i\approx\qty{10}\kohm$ + \item \makebox[9em][l]{输出电阻:} $R_o\approx\qty1\kohm$ + \item \makebox[9em][l]{放大倍数:} $A=A_1\cdot A_2\approx10\times100=1000$ + \item \makebox[9em][l]{放大器级数:} 两级,前级$A_1\approx100$;后级$A_2\approx10$ + \item \makebox[9em][l]{耦合方法:} 电容耦合 +\end{enumerate} + +\clearpage +\vspace*{-1.5em} +\section[整形电路]{整形电路\cite{cn11}} + +光电池的输出脉冲并不是规则的矩形脉冲信号,而是类似升余弦信号。再经放大后也会产生 +失真,因此必须对信号进行整形。采用常用的 CD4093 施密特触发器便可实现整形功能,改 +善脉冲波形,确保后续编码器的正常编码。 + +施密特触发器不仅可以进行波形整形,它的迟滞特性还可以有效地克服噪声和干扰的影响,只要噪声和干扰的大小处在迟滞宽度内,就不会有错误的输出。施密特触发器属于电平触 +发,对于缓慢变化的信号仍然适用,当输入信号达到阈值电压时,电路状态发生转换,通过 +电路内部的正反馈过程使得输出电压的波形的边沿变得很陡峭。利用施密特触发器可以实现 +有效脉冲的识别见\cref{4-5}。 + +\begin{figure}[htbp] + \centering + \includegraphics[width = .65\linewidth]{image-0284} + \caption{施密特触发器的电压传输特性\quad (a) 同相输出;(b) 反相输出} + \label{4-4} +\end{figure} + +\begin{figure}[htbp] + \centering + \includegraphics[width = .95\linewidth]{image-0285} + \caption{利用施密特触发器实现有效脉冲的识别} + \label{4-5} +\end{figure} + +\section[编码电路]{编码电路\cite{cn11}} + +对于 38 路信号通道,必须对其进行编码以便于信号识别和传输。38 路信号按照设计方案 +编码为 1--38 号,脱靶无信号记为 0 号。对多个探测器同时接收到信号的情况,对应于 +探测器的码号就是取码号大的探测器为有效,采用优先编码器便可实现编码的优先选择。 + +商用的单个优先编码器的编码输入最多只有 8 路,要构成更多路的优先编码 +器,可以采用 6 片 8-3 优先编码器进行扩展为 40-6 优先编码器。 + +\subsection{编码电路图} + +\begin{figure}[htbp] + \centering + \includegraphics[width = .93\linewidth]{image-0289} + \caption{40-6 优先编码器电路图} + \label{4-6} +\end{figure} + +\subsection{电路原理} + +\begin{enumerate} + \item 优先编码器(74HC148) + + 8-3 线优先编码器的功能表如\cref{4-7}。待编码的 8 条输入线 采用 8 中取 1 + 码,逻辑 0 有效,编码后的输出 用反码表示。可以看出,编码器是以输入为 0 的最高 + 优先编码的,而低位若同时输入 0,则是无意义的。此外,电路还设有选通输入,即使能 + 端 EI,它也是逻辑 0 有效;输出还设有允许输出端 Eo 及允许扩展端 Gs,利用它们 + 可判断出 是否有效,以及是否允许扩展编码。根据真值表,写出编码器的逻辑表达式如下: + \begin{equation} + \begin{aligned} + \overline{A_2}&=\overline{EI}\cdot I_7+\overline{EI}\cdot I_7\cdot I_6\cdot\overline{I_5}+\overline{EI}\cdot I_7\cdot I_6\cdot I_5\cdot\overline{I_4}\\ + &=\overline{EI}(\overline{I_7}+I_7\overline{I_6}+I_7I_6I_5\overline{I_4})=\overline{EI}(\overline{I_7}+\overline{I_6}+\overline{I_5}+\overline{I_4}) + \end{aligned} + \end{equation} + 故: + \begin{equation} + A_2=\overline{\overline{EI}(\overline{I_7}+\overline{I_6}+\overline{I_5}+\overline{I_4})} + \end{equation} + 同理: + \begin{gather} + A_1=\overline{\overline{EI}(\overline{I_7}+\overline{I_6}+I_5I_4\overline{I_3}+I_5I_4I_2)}\\ + A_0=\overline{\overline{EI}(\overline{I_7}+I_6\overline{I_5}+I_6I_4\overline{I_3}+I_6I_4I_2\overline{I_1})} + \end{gather} + 而允许输出为: + \begin{equation} + E_OE_0=\overline{\overline{EI}\cdot I_7I_6I_5I_4I_3I_2I_1I_0} + \end{equation} + 允许扩展端是: + \begin{equation} + Gs=EI+\overline{EI}\cdot I_7\;I_6\;I_5\;I_4\;I_3\;I_2\;I_1\;I_0=\overline{\overline{EI}\cdot E_O} + \end{equation} + + \begin{table}[htbp] + \centering\scriptsize + \renewcommand\arraystretch{1.12} + \begin{tabular}{|>{\centering\arraybackslash\sffamily}p{.04\linewidth}|*{8}{>{\centering\arraybackslash\sffamily}p{.04\linewidth}}|*{3}{>{\centering\arraybackslash\sffamily}p{.04\linewidth}}|*{2}{>{\centering\arraybackslash\sffamily}p{.04\linewidth}}|} + \hline + \multicolumn{9}{|>{\sffamily\bfseries}c|}{INPUTS} & \multicolumn{5}{>{\sffamily\bfseries}c|}{OUTPUTS}\\ + \hline + EI & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & A2 & A1 & A0 & GS & EO\\ + \hline + H & X & X & X & X & X & X & X & X & H & H & H & H & H\\ + L & H & H & H & H & H & H & H & H & H & H & H & H & L\\ + L & X & X & X & X & X & X & X & L & L & L & L & L & H\\ + L & X & X & X & X & X & X & L & H & L & L & H & L & H\\ + L & X & X & X & X & X & L & H & H & L & H & L & L & H\\ + L & X & X & X & X & L & H & H & H & L & H & H & L & H\\ + L & X & X & X & L & H & H & H & H & X & L & L & L & H\\ + L & X & X & L & H & H & H & H & H & X & L & H & L & H\\ + L & X & L & H & H & H & H & H & H & X & H & L & L & H\\ + L & L & H & H & H & H & H & H & H & X & H & H & L & H\\ + \hline + \end{tabular} + \caption{8-3 线优先编码器真值表(74HC148)} + \label{4-7} + \end{table} + \item 8-3 线优先编码器扩展为 40-6 线优先编码器(\cref{4-6}) + + 5 片 74HC148 并排用作输入,其输入从低位片到高位片排列为 + $I_0\sim I_{39}$ 。每一个高位片的输出允许端 Eo 接其相对低位片的使能端 EI。这样,当总使能$\text{EI}=0$时,允许电路进行编码工作,若高位片的诸输入中有一 + 个为$0$时,该片的 $\text{Eo}=1$,$\text{Gs}=0$,这样就禁止了低位片的编 + 码,以此类推,5 片 74HC148 的输入端编码便具有了优先性。 + + 5 片 74HC148 的允许扩展端 Gs 按低位片至高位片的顺序分别接到第六片74HC148 + 的$I_0$、$I_1$、$I_2$、$I_3$、$I_4$输入端,而$I_5$、$I_6$、$I_7$端则接 + 高电平(表示无输入)。这样第六片 74HC148 的三位输出便表示整个 40-6 线优先编 + 码器的高三位$A_5$、$A_4$、$A_3$。而 40-6 线优先编码器的低三位输出$A_2$、$A_1$、$A_0$与前 5 片 74HC148 的输出端一致。 + + 由于 74HC148 的输出端不是三态门,不能直接连接在一起。而把 5 片 74HC148的同 + 名输出端接到 74LS30(8 输入的与非门)取与非便可以解决这个问题。同时输出取反, + 输出为逻辑 1 有效。为使高三位输出与低三位输出一致,用 CD4049反相器对高三位取 + 反。 + + 40-6 线优先编码器的六个输出均为逻辑 1 有效,可以接到后续的 2051 单片机进行串 + 行传输。 +\end{enumerate} + +\section{串行传送} + +为实现将编码器输出的 6 位并行信号串行传送,同时实现数据发送和打靶射击的同步性。采 +用 89C2051 单片机便可实现要求。 + +\subsection{单片机及外围电路图} + +\begin{figure}[htbp] + \centering + \includegraphics[width = .9\linewidth]{image-0419} + \caption{2051 单片机及其外围电路图}\label{4-8} +\end{figure} + +\subsection{电路原理} + +\begin{enumerate} + \item 编码器的输出通过 2051 P1 口的低 6 位(高 2 位接地为逻辑 0)输入。 + \item 选用 $\qty{11.0592}\MHz$ 的晶振构成单片机的时钟,这样在串口工作方式 1 下可得到准确的 $\qty{9600}{bps}$ 的串行波特率,方便计算机的接收。 + \item 单片机接有复位开关按钮。 + \item 实现打靶和信号采集传送的同步化。 +\end{enumerate} + +由于采用单片机的外部中断 0($\overline{INTO}$)作为数据串行传送的使能端,且 +$\overline{INTO}$设为下降的跳变沿有效。使能开关(激光枪的开关)一端接地,另一 +端接$\overline{INTO}$,又经上拉电阻接到电源,这样当开关按下时,便有下降沿的跳变信号输入$\overline{INTO}$,产生中断。 + +同时,开关又要同步控制激光枪的发射。因此开关又接激光头的负端,从而控制激光头负端 +的接地,只有当开关按下时,激光头两端才有工作电压。 + +这样,同一个开关既控制单片机的中断,又同时控制激光枪的发射,从而达到打靶和信号采 +集传送这两个“动作”的同步化。 + +\subsection{AT89C2051 单片机\cite{cn12}} + +AT89C2051 单片机是 AT89C51 的简化型号,其指令系统和内部 RAM 均与 AT89C51相 +同。不同的是它的内部 ROM 为 2k,而 89C51 为 4k,而且 2051 比 89C51 少了 P0 +和 P2 输入/输出口以及外部 ROM、RAM 的扩展端,因此在引脚上 2051 只有 20 个脚。 +AT89C2051 单片机主要适用于较为简单的微控制系统。在本系统中,用到 AT89C2051的 +6 个外部 I/O 口,一个外部中断和串行输出口。 + +\newpage +\begin{figure}[htbp] + \centering + \includegraphics[width = .53\linewidth]{image-0439} + \caption{2051 信号引脚图} + \label{4-9} +\end{figure} + +\section{电平转换} + +在不同的数字系统中,其电平标准是不同的。该系统中就包括了 TTL 电平标准和 RS-232 +电平标准,要实现两个标准的正常通信,必须进行电平转换。该系统采用使用简单的 +MAX232CPE 芯片。 + +一片MAX232CPE芯片可完成2路TTL/CMOS~RS-23 的电平转换和2路RS-232~TTL/CMOS +的电平转换。实际电路中只有一路单片机的 TXD 串口输出,不进行RXD串口输入。因此,选 +用引脚 11 接 2051 TXD 串口输出;而对应的 14 脚则接到计算机的串口输入端。 + +\begin{figure}[htbp] + \centering + \includegraphics[width = .52\linewidth]{image-0440} + \caption{MAX232CPE 芯片内部结构} + \label{4-10} +\end{figure} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha5.tex b/macros/xetex/latex/hduthesis/example/cha/cha5.tex new file mode 100644 index 0000000000..9d2e255e86 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha5.tex @@ -0,0 +1,135 @@ +\chapter{软件设计} + +\section{总体方案} + +该系统的信号检测与数据传送部分,涉及的软件部分较少。主要是 2051 单片机数据串行通信及通信协议的程序设计。 + +对于 2051 的程序设计\cite{cn12},由于所需实现的功能较简单,采用汇编的形式。编译器采用 Keil 7.02b。该编译器是 51 系列单片机程序设计的常用工具,既可用汇编,也支持 C 语言编译。同时具有完善的调试功能。 + +\section{程序流图} + +\begin{figure}[!ht] + \centering + \begin{tikzpicture} + [ every node/.style = { font = \small, minimum height = 2.5em } ] + \node [draw, rectangle, minimum width = 11em, minimum height = 2em] (a) at (0,0) {初始参数设置}; + \node [draw, rectangle, minimum width = 11em, rounded corners = 1.2em, below = of a] (b) {等待中断}; + \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of b] (c) {中断服务程}; + \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of c, yshift = 2ex] (d) {读取 P1 口值}; + \node [draw, rectangle, minimum width = 11em, rectangle, below = of d, minimum height = 2em] (e) {发送数据帧}; + \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of e] (f) {延时$\qty{200}\ms$}; + \node [draw, rectangle, minimum width = 11em, rectangle, below = of f, minimum height = 2em, yshift = 2ex] (g) {清中断标志}; + \node [draw, rectangle, minimum width = 10em, rounded corners = 1.2em, below = of g] (h) {中断返回}; + \draw [->] (a.south) -- (b.north); + \draw [->] (b.south) -- (c.north); + \draw [->] (c.south) -- (d.north); + \draw [->] (d.south) -- (e.north); + \draw [->] (e.south) -- (f.north); + \draw [->] (f.south) -- (g.north); + \draw [->] (g.south) -- (h.north); + \draw [->] (h.east) --++ (1,0) |- (b.east); + \end{tikzpicture} + \caption{串行发送流程图} + \label{5-1} +\end{figure} + +\section{模块说明} + +\begin{enumerate} + \item 主程序: + \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] + MAIN: + MOV SP,#0X60 ;堆栈初始化 + CALL INIT ;各寄存器参数设置 + MOV 40H,#0x01 ;打靶次数置 1 + AJMP $ ;等待中断 + \end{lstlisting} + \item 初始化程序: + \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] + INIT: + MOV TMOD,#0X21;波特率发生器 + MOV TL1,#0XFD ;波特率 9600bps + MOV TH1,#0XFD + CLR ET1 ;禁止 timer1 + SETB PT1 ;时钟 1 优先级:高 + MOV SCON,#0x40;串口工作模式 1,SM2=0,REN=0 + MOV PCON,#0 ;波特率 9600bps + SETB EA ;中断允许 + CLR PS ;关闭串口中断 + CLR ES ;串口优先级:低 + SETB EX0 ;开外部中断 INT0 SETB IT0 ;下降沿有效 + CLR PX0 ;INT0 优先级:低 + SETB TR1 ;时钟 1 开始计数 + RET + \end{lstlisting} + \item 中断服务程序: + \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] + _INT0: ;ISR 中断服务程序 + NOP + CALL DELAY_2MS;同步延时 + MOV P1,#0xff ;读 P1 口前先置 1 + MOV A,P1 ;读 P1 口 + CALL INT0_SEND + RET + \end{lstlisting} + \item 数据帧传送子程序: + \begin{figure}[htbp] + \centering\small + \setstretch{1.4} + \caption{数据帧格式} + \begin{tabular}{|*{4}{>{\centering\arraybackslash}p{.22\linewidth}|}} + \hline + 标志位SYNC & 打靶次数 & 打靶成绩 & 校验位CHECKSUM\\ + \hline + \#0x30 & TIMES & RESULT & TIMES\ensuremath+RES\\ + \hline + \end{tabular} + \end{figure} + \clearpage + 例:30 02 15 17(十六进制) + + 表示第二次打靶,击中第 21 号(对应环数:7 环 偏移方向:右上)。 + \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] + INT0_SEND: ;数据帧传送子程序 + PUSH ACC ;保护 ACC + CLR A + ADD A,#0X30 + CALL UART_SEND ;发送标志位 + MOV A,40H + CALL UART_SEND ;发送打靶次数 + POP ACC + CALL UART_SEND ;发送打靶成绩 + ADD A,#0X30 + ADD A,0040H + CALL UART_SEND ;发送校验位 + INC 0040H ;打靶次数累加 1 + CALL DELAY_200MS;延时 200ms + CLR EX0 ;关外部中断 + CLR IE0 ;清INT0外部中断请求标志位—防止外部中断寄存 + 而引起多次中断。 + SETB EX0 ;开中断 + RETI + \end{lstlisting} + \item 串行发送字节 + \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] + UART_SEND: ;串行发送一个字节 + MOV SBUF,A + JNB TI,$ ;等待发送完毕 + CLR TI ; + RET + \end{lstlisting} + \item 定时程序: + \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] + DELAY_2MS: ;用定时器延时 2ms + MOV R7,#21;21 + DLY1:MOV R6,#42 + DLY2:DJNZ R6,DLY2 + DJNZ R7,DLY1 + RET + DELAY_10MS: ;调用 DELAY_2MS,实现延时 10ms + MOV R5,#5 + DLY: CALL DELAY_2MS + DJNZ R5,DLY + RET +\end{lstlisting} +\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha6.tex b/macros/xetex/latex/hduthesis/example/cha/cha6.tex new file mode 100644 index 0000000000..1c5c628ad6 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha6.tex @@ -0,0 +1,40 @@ +\chapter{制作与调试} + +\section{硬件电路的布线与焊接} + +\subsection{总体特点} + +该系统所涉及的各部分硬件电路,总体的特点是: + +\begin{enumerate} + \item 电路原理简单,所用的器件均为常用器件。 + \item 由于路数较多(38 路),电路的规模较大,因此在制作中只做了 8 路。 + + 因此,应合理布线,以降低焊接难度,降低出错率,同时防止干扰。 +\end{enumerate} + +\subsection{电路划分} + +为方便焊接与调试,把电路划分为两大块: + +\begin{enumerate} + \item 探测器接收,放大电路和整形电路为一块电路板; + \item 编码器、2051 单片机和控制开关为一块电路板。 +\end{enumerate} + +\subsection{焊接} + +焊接前应熟悉各芯片的引脚,焊接时参照电路图,仔细地连接引脚。按照以下原则进行焊接: + +\begin{enumerate} + \item 先焊接各芯片的电源线和地线,这样确保各芯片有正确的工作电压; + \item 同类的芯片应顺序焊接,在一片焊接并检查好之后,其他的同类芯片便可以参照第一片进行焊接。这样便可大大节省时间,也可降低出错率。 +\end{enumerate} + +\section{调试} + +\begin{enumerate} + \item 在 40-6 线优先编码器,由于没有详细阅读优先编码器的真值表,我认为优先编码器为低位优先,因此所设计的编码标准(取小号有效)不符合标准。不过发现错误后,对硬件电路无需修改,只要修改编码标准为取大号有效,便可以解决问题。 + \item 由于光电池的响应信号经放大、编码,到达单片机 P1 口时有一定的延时,为使单片机准确地通过外部中断进行有效数据的采集,应知道延时的大概范围。编写单片机程序时,编写了一个延时$\qty2\ms$的子程序,可以调用进行一定的延时,通过延时时间不同的程序进行多次烧录并进行调试,然后比较所得的不同结果,这样便可以大概知道要采集正确的数所需的延时时间(最后程序采用的延时时间为$\qty2\ms$)。 + \item 电路中同时控制激光发射和单片机外部中断的开关为普通的按钮开关,因此在按下和弹起都有颤动,这样会引起单片机外部中断的多次响应,使一次``射击动作''引起多次响应,单片机输出多个值。通常的消颤方法有两种:硬消颤和软消颤。硬消颤指通过硬件上的消颤电路使开关的一次动作只能产生一个脉冲跳变;而软消颤主要通过延时或对响应的屏蔽来实现。在该设计中采用较为简便的软消颤,具体的方案见第五章。 +\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/cha7.tex b/macros/xetex/latex/hduthesis/example/cha/cha7.tex new file mode 100644 index 0000000000..17d113c0f7 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/cha7.tex @@ -0,0 +1,11 @@ +\chapter{结论} + +本设计方案达到了任务书的要求,实现了激光信号的检测、编码和串行传输,实现了较为完整的激光打靶系统的信号处理: +\begin{enumerate} + \item 前端放大器的放大倍数适中,放大后,有效电压脉冲的幅度达到施密特触发器的上门限电压,背景干扰信号没有引起电路的误响应; + \item 经过调试,实现 40-6 优先编码器的扩展,编码值输出符合真值表,编码有效脉冲下降沿的波形正常; + \item 由开关按钮(模拟激光枪的扳机)控制的编码采集和串行传送也调试实现(通过与计算机的串口相连,用``串口调试程序''调试); + \item 信号处理电路通过串口连接到计算机,应用张雪荣同学设计的``激光打靶成绩统计''软件进行总体调试,实现对打靶成绩的显示统计和储存。 +\end{enumerate} + +由于时间、水平和经验有限,在信号的放大、编码及抗干扰等方面仍有不足之处,有改进的余地,比如电路规模的精简,其他的光干扰处理。另外在系统的调试方面,由于时间和设备的原因,只进行了短距离的调试,有待进一步的调试。这次毕业设计对于我来说,既是一次机遇,又是一次挑战。通过这次的毕业设计,我学到了很多东西,通过自己的实践,增强了动手能力。通过实际工程的设计也使我了解到书本知识和实际应用的差别。在实际应用中遇到很多的问题,这都需要我对问题进行具体的分析,并一步一步地去解决它。 \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/cha/thanks.tex b/macros/xetex/latex/hduthesis/example/cha/thanks.tex new file mode 100644 index 0000000000..303f13d429 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/cha/thanks.tex @@ -0,0 +1,14 @@ +\chapter*{致谢} +\addcontentsline{toc}{chapter}{致谢} + +在这几个月的时间里,从对课题的理解,方案的设计,到电路的制作,再到论文的写作,中间有着自己的努力,更有着老师和同学的关心和巨大的帮助。 + +感谢秦会斌老师在很忙的情况下,为我讲解课题的要点,引领设计的思路。他对学生认真负责的态度让我由衷地敬佩。 + +感谢唐大勇和章国平同学给予我无私的帮助,他们对我所遇到的难题的解答让我受益匪浅。 + +感谢罗老师对我们的关心照顾。 + +感谢母校和老师们在大学四年中对我的培养。 + +...... \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0145.png b/macros/xetex/latex/hduthesis/example/figures/image-0145.png new file mode 100644 index 0000000000..7d390d38de Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0145.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0162.png b/macros/xetex/latex/hduthesis/example/figures/image-0162.png new file mode 100644 index 0000000000..75ed76eafc Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0162.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0163.png b/macros/xetex/latex/hduthesis/example/figures/image-0163.png new file mode 100644 index 0000000000..9be35b5e63 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0163.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0236.png b/macros/xetex/latex/hduthesis/example/figures/image-0236.png new file mode 100644 index 0000000000..5bed2083f9 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0236.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0284.png b/macros/xetex/latex/hduthesis/example/figures/image-0284.png new file mode 100644 index 0000000000..59bca2a597 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0284.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0285.png b/macros/xetex/latex/hduthesis/example/figures/image-0285.png new file mode 100644 index 0000000000..c1aae56755 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0285.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0289.png b/macros/xetex/latex/hduthesis/example/figures/image-0289.png new file mode 100644 index 0000000000..5860708d8f Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0289.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0419.png b/macros/xetex/latex/hduthesis/example/figures/image-0419.png new file mode 100644 index 0000000000..2af2fefab6 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0419.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0439.png b/macros/xetex/latex/hduthesis/example/figures/image-0439.png new file mode 100644 index 0000000000..de4cc1538b Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0439.png differ diff --git a/macros/xetex/latex/hduthesis/example/figures/image-0440.png b/macros/xetex/latex/hduthesis/example/figures/image-0440.png new file mode 100644 index 0000000000..4ccc02ea57 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/figures/image-0440.png differ diff --git a/macros/xetex/latex/hduthesis/example/hduthesis-bc.pdf b/macros/xetex/latex/hduthesis/example/hduthesis-bc.pdf new file mode 100644 index 0000000000..8d6248c1ff Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/hduthesis-bc.pdf differ diff --git a/macros/xetex/latex/hduthesis/example/hduthesis-bc.tex b/macros/xetex/latex/hduthesis/example/hduthesis-bc.tex new file mode 100644 index 0000000000..b25278428b --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/hduthesis-bc.tex @@ -0,0 +1,45 @@ +\documentclass + [ + math-font = STIX Two Math, agreed, + CJKmain-font = { {Songti SC}[AutoFakeBold = 2.5, AutoFakeSlant] }, + CJKsans-font = { {STHeiti}[AutoFakeBold = 2] } + ] {hduthesis} +\tikzset{ > = stealth } +\usetikzlibrary{positioning,shapes.geometric} + +\DocInfo + { + title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/本科毕业设计, + department = 理学院, + major = 物理学, + class = 英才班, + stdntid = C668668E, + author = 申智能, + supervisor = 教授:葉芷晴, + bibsource = reference + } + +\begin{document} + +\maketitle +\commitment [ example-image-a/2024-05-31 ] + +\input{cha/abstract.tex} + +\tableofcontents + +\input{cha/cha1.tex} +\input{cha/cha2.tex} +\input{cha/cha3.tex} +\input{cha/cha4.tex} +\input{cha/cha5.tex} +\input{cha/cha6.tex} +\input{cha/cha7.tex} +\input{cha/thanks.tex} +\printbibliography + +\appendix +\chapter*{附录} +\addcontentsline{toc}{chapter}{附录} + +\end{document} diff --git a/macros/xetex/latex/hduthesis/example/hduthesis-pg.pdf b/macros/xetex/latex/hduthesis/example/hduthesis-pg.pdf new file mode 100644 index 0000000000..fb725211b9 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/hduthesis-pg.pdf differ diff --git a/macros/xetex/latex/hduthesis/example/hduthesis-pg.tex b/macros/xetex/latex/hduthesis/example/hduthesis-pg.tex new file mode 100644 index 0000000000..4fe8063e98 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/hduthesis-pg.tex @@ -0,0 +1,76 @@ +\documentclass + [ + math-font = STIX Two Math, agreed, + CJKmain-font = { {Songti SC}[AutoFakeSlant] }, + CJKsans-font = { {STHeiti}[AutoFakeBold = 2] } + ] {hduthesis} + +\tikzset{ > = stealth } +\usetikzlibrary{positioning,shapes.geometric} + +\DocInfo + { + title = 基于 \hologo{LaTeX3} 开发的 + 杭州电子科技大学硕士学位论文 \hologo{LaTeX} 模板/ + \hologo{LaTeX} Template for Master's Thesis at Hangzhou Dianzi University that was Developed Based on \hologo{LaTeX3}, + major = 凝聚态物理, + stdntid = C668668E0, + author = 申智能/SAN Chi Nan, + supervisor = 教授:葉芷晴/Prof.:YIP Tsz Ching, + % bibsource = reference + } + +\begin{document} + +\maketitle +\commitment + [ + example-image-a/2025-05-31, example-image-a/2025-05-31, + example-image-b/2025-06-01 + ] + +\begin{abstract}[cn] + + 设计模式被广泛用于解决软件设计和开发过程中反复出现的设计问题。设计模式在软件源码中的使用信息(即设计模式实例)能够在较大程度上反映软件系统的设计思路。准确地从软件源码中识别和挖掘设计模式实例能够帮助软件开发和维护人员快速理解软件系统的原始设计和实现,从而对软件系统的维护、升级 + 更新和二次开发等工作提供方便。 + + 近些年来软件工程领域提出了多种自动化或半自动化地挖掘设计模式实例的方法。其中部分方法将设计模式和软件源码转化为某种特定的图的形式,然后通过挖掘同构子图的方式挖掘设计模式实例。然而,由于同构子图挖掘问题是一个NP完全问题,这些方法的执行效率通常较低。 + + 为了有效解决基于子图同构的设计模式挖掘方法的效率低下问题,本文提出了一种高效的基于快速搜索序列和行为模板的结构型设计模式挖掘方法。该方法首先将设计模式和软件源码转化为一种带权有向图,即类关系图,然后从软件源码的类关系图中找出所有与设计模式的类关系图相同构的子图,每个子图的顶点所表示的类组成了一个候选设计模式实例。在挖掘过程中,本文方法为每种设计模式构建了一个快速搜索序列,该快速搜索序列描述了设计模式的结构信息并指定了一个高效的搜索设计模式角色的次序,从而大大减少了挖掘过程的搜索空间。此外,本文为每种设计模式制定了一个特定的行为模板,用于过滤候选实例集合中不满足行为特征的错误实例,进一步提高了本文方法的准确率。最后,本文选取4个常用的开源软件系统进行验证实验。实验结果表明,针对本文制定的结果基准,该方法不仅能够达到100\%的召回率和相对较高的准确率和F-measure值,而且显著提高了执行效率。 + + \keywords{设计模式, 设计模式挖掘, 快速搜索序列, 行为模板, 子图同构} +\end{abstract} + +\begin{abstract}[en] + + \setstretch{1.3} + Design patterns are widely used to address the recurring design problems during the process of software design and development. The information about design patterns used in software source code-design pattern instances reveal much about the high-level abstract design ideas. Accurately identifying and detecting design pattern instances in a software system can help developers and maintainers to understand its original design and implementation, facilitating maintenance, update and re-development. + + In recent years, many approaches have been proposed to automatically or semi-automatically detecting design pattern instances from software source code. Among these approaches, some approaches transform software source code and design patterns into certain graphs, and then exploit subgraph isomorphism techniques to detect design pattern instances. However, as mining isomorphic subgraphs is an NP-complete problem, those approaches usually fail to achieve satisfactory efficiency. + + In order to effectively solve the inefficiency of the approaches which are based on subgraph isomorphism, we propose an efficient approach to detect structural design pattern instances based on quick-search sequences and behavior templates. In the proposed approach, we transform software source code and design patterns into a certain form of weighted and directed graph namely Class Relationship Graph, and then detect all the subgraphs from the source code graph which are isomorphic to the Class Relationship Graph of a certain design pattern. The classes that each isomorphic subgraph's vertices represent then consist of a candidate instance. During the process of detecting design pattern instances, we construct a quick-search sequence for each design pattern, which describes the structural characteristics of design pattern and specify an order to efficiently search the roles of each design pattern. According to the quick-search sequence, we can greatly reduce the search space. Afterwards, we construct a specific behavior template, which is used to filter the false positives in the candidate instance set and further improve the processing efficiency. Finally, we exploit our approach on four well-known open-source software systems. The results demonstrate that our approach not only achieves nearly 100\% recall and relatively high precision and F-measure on the benchmark we construct, but also significantly. + + \keywords + { + Design Pattern, Design Pattern Detection, Quick-Search Sequence, + Behavior Template, Sub-graph Isomorphism + } +\end{abstract} + +\tableofcontents + +\chapter{绪论} + +\section{研究背景与意义} + +随着信息技术的飞速发展和广泛应用,各行各业都积累了大量的软件系统。 + +\section{国内外研究现状} + +设计模式挖掘的相关研究工作伴随着设计模式在软件工程领域的提出而应运而生,并得到了广泛的关注和研究。正如 Apostolos Ampatzoglou 的描述,关于挖掘软件源码中设计模式实例的研究是设计模式相关的所有研究工作中最受关注的一项研究课题。 + +\subsection{结构分析} + +结构分析方法是最常见的挖掘设计模式实例的方法。 + +\end{document} diff --git a/macros/xetex/latex/hduthesis/example/hduthesis-stationery.pdf b/macros/xetex/latex/hduthesis/example/hduthesis-stationery.pdf new file mode 100644 index 0000000000..b84ec14d24 Binary files /dev/null and b/macros/xetex/latex/hduthesis/example/hduthesis-stationery.pdf differ diff --git a/macros/xetex/latex/hduthesis/example/hduthesis-stationery.tex b/macros/xetex/latex/hduthesis/example/hduthesis-stationery.tex new file mode 100644 index 0000000000..4bc21e0f41 --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/hduthesis-stationery.tex @@ -0,0 +1,34 @@ +\documentclass[stationery]{hduthesis} + +\usepackage{lipsum} +\RequirePackage [ mono = false ] {libertine} + +\DocInfo + { + title = Recommendation Letter for SAN Chi Nan, + author = YIP Tsz Ching, + mail = email@server.domain, + date = {23\textsuperscript{th} December, 2024}, + watermark = true + } + +\begin{document} + +\maketitle + +Dear Prof. Wong, + +\lipsum[1-2] + +\vspace{\baselineskip} \raggedleft + +Sincerely yours,\\[4ex] +\includegraphics[ height = 2em ]{hdutitle}\\[2ex] +Professor of Department of Physics\\ +Room \meta{int}, Building \meta{int}, Hangzhou Dianzi University + +\clearpage + +\notelines[25] + +\end{document} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/example/reference.bib b/macros/xetex/latex/hduthesis/example/reference.bib new file mode 100644 index 0000000000..5775cc077f --- /dev/null +++ b/macros/xetex/latex/hduthesis/example/reference.bib @@ -0,0 +1,103 @@ +@article{cn1, + title={激光模拟射击训练器械及其射击精度的检定方法}, + author={刘伯来 and 宋作本 and 徐忠瑞}, + journal={山东体育科技}, + volume={24}, + number={4}, + pages={17--19}, + year={2002}, +} + +@article{cn2, + title={一种新型激光射击训练模拟靶的设计}, + author={任宏岩 and 戴炳明}, + journal={大连理工大学学报}, + number={增2}, + pages={186--187}, + year={1997}, +} + +@article{cn3, + title={智能型光电打靶模拟训练系统}, + author={戴炳明 and 任宏岩 and 张雏}, + journal={半导体光电}, + number={03}, + pages={196--197}, + year={1998}, +} + +@book{cn4, + title={半导体激光器及其应用}, + author={黄德修}, + publisher={半导体激光器及其应用}, + year={1999}, + pages={1--27} +} + +@inproceedings{en5, + title={An optical photo-detector using a distributed amplifier and PIN photodiode combination}, + author={Liang, Jia Yi and Aitchison, Colin S}, + booktitle={1994 IEEE MTT-S International Microwave Symposium Digest (Cat. No. 94CH3389-4)}, + pages={1101--1104}, + year={1994}, + organization={IEEE} +} + +@article{en6, + title={Photovoltaic materials, past, present, future}, + author={Goetzberger, Adolf and Hebling, Christopher}, + journal={Solar energy materials and solar cells}, + volume={62}, + number={1-2}, + pages={1--19}, + year={2000}, + publisher={Elsevier} +} + +@book{cn7, + title={光电检测技术}, + author={高稚允 and 高岳}, + year={1995}, + publisher={国防工业出版社}, + pages={172--212} +} + +@book{cn8, + title={光电技术与实验}, + author={江月松 and 阎平 and 刘振玉}, + publisher={光电技术与实验}, + year={2000}, + pages={119--152} +} + +@book{cn9, + title={集成运算放大器应用手册}, + author={W.G}, + publisher={集成运算放大器应用手册}, + year={1990}, + pages={3--72} +} + +@book{cn10, + title={电子线路}, + author={谢嘉奎}, + publisher={北京:高等教育出版社}, + year={1999}, + pages={321--323} +} + +@book{cn11, + title={数字电路}, + author={龚之春}, + publisher={成都:电子科技大学出版}, + year={1999}, + pages={123--127} +} + +@book{cn12, + title={单片机基础}, + author={李广弟}, + publisher={北京:北京航空航天大学出版社}, + year={1994}, + pages={6--28} +} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/abstract.tex b/macros/xetex/latex/hduthesis/examples/cha/abstract.tex deleted file mode 100644 index 6b78b6d13a..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/abstract.tex +++ /dev/null @@ -1,25 +0,0 @@ -\begin{abstract}[cn] - - 本毕业设计主要设计自主研发的激光打靶系统的信号处理过程,继而实现整个打靶系统。激光打靶系统主要包括半导体激光枪、光电探测器和信号处理电路,信号处理过程是整个系统的关键。激光打靶的打靶过程,由激光枪发射激光脉冲信号,光电靶接收激光脉冲信号,经过系列信号处理过程最终得到打靶的结果。光电靶由许多块的光电探测器组成,每块不同位置的光电探测器对应不同编号,从打靶的实际情况出发,确定了相应的编号规则。打靶的成绩由激光所击中的光电探测器的编号来判定。 - - 激光打靶系统的主要信号处理过程包括:信号的放大、编码和数据传输。信号由光电探测器检测后传送到相应的放大电路,放大电路采用集成运算放大器。按原先对光电探测器的编码规则采用多路优先编码器对信号进行编码。最后把编码值以串口的形式传送到计算机,利用计算机的强大功能对打靶结果进行各种处理。与计算机之间的串行数据传输由89C2051单片机实现。89C2051单片机的程序,使用keil编译器进行设计和调试完成,其主要功能是控制数据的串行传送,实现与计算机的串口通信。 - - 该信号处理系统实现了对信号的良好检测。与计算机之间的串口通信可以实现数据在计算机上的显示、统计、储存等功能,为打靶者提供非常直接、准确的打靶结果,有利于提高打靶效果。 - - \keywords{激光打靶, 信号处理, 信号编码, 串行传输} -\end{abstract} - -\begin{abstract}[en] - - The main aim of this thesis is to design and realize signal processing of a self-developed laser target shooting system and then realize the whole laser target shooting system. The laser target shooting system consists of semiconductor laser gun, photoelectric detector, and signal processing circuit, which is the key part of the whole system. Laser target shooting process go though following steps: laser gun emitted a pulse of laser, which would be received by the laser target and the results of shooting will be shown on screen of computer by series signal processing. The laser target consists of some silicon photoelectric units that were encoded with different numbers according to certain rule. The result of the shooting will be got when detecting the number of the photoelectric unit that receives the laser pulse. - - The signal processing of the laser target shooting system mainly consists of signal amplification, signal encoding and data transmission. The inspected photoelectric signal was then amplified by operator amplifiers, coded by multiplex priority encoder according to the prearranged rule, and then transferred to computer by 89C2051 MCU through its serial port. And then computer can process the signal. The program of 89C2051 MCU is designed in keil and debugged using keil compiler. It is designed to control the data transmission with computer. - - The designed signal processing system can detect signal effectively. Through the serial data transmission, computer can process the shooting result, such as display, statistics and storage etc. It provide direct and exact shooting result for trainer, so it can increase the efficiency of the shooting training. - -\keywords -{ - laser target shooting, signal amplification, - signal encode, serial data transmission -} -\end{abstract} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha1.tex b/macros/xetex/latex/hduthesis/examples/cha/cha1.tex deleted file mode 100644 index 864fd1b3db..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha1.tex +++ /dev/null @@ -1,9 +0,0 @@ -\chapter{引言} - -目前的射击打靶训练,基本以实弹训练为主,国防开支大,危险系数高。传统的报靶方法是人工报靶,由报靶员根据经验确定靶数,带有很大的个人主观因素,可靠性、公正性差,效率低。因此有必要研制一种切合部队实际的,在非实弹射击条件下进行射击精度训练的打靶训练器,这样既能保证部队训练质量又能减少弹药消耗、节约国防费用,具有重大的国防意义。 - -以光代弹,可以模拟多种武器的射击情况,并可检验射击效果。这种新型的部队训练模拟器材是部队训练器材的一次革命,是和平时期部队训练的有效手段之一。一些发达国家,如美国、英国、德国等都在积极进行激光射击模拟训练器材的研制,并已开发出多种系列产品,其中最突出的是美国的“米勒斯”系列,它可模拟 36 种武器,性能好、准确而且逼真,大大推动了部队的训练工作。 - -八十年代以来,我国也有单位在进行激光模拟训练器的研究和探索,将激光射击模拟器用于部队训练,取得了很好的训练效果,提高了部队的战斗力。但在可靠性和数据处理等方面尚有许多技术问题有待改进,主要是以下几点:激光光斑太大,与实际步枪子弹口径$\qty{7.62}\mm$相差太多;探测器数量少会导致设计精度不高;探测器数量多会使得价格昂贵,无法推广;只能粗略指示命中与否,不能准确显示命中靶环环数和方位。因此,我们拟从这些方向作进一步的研究探索。 - -本设计采用半导体激光器和半导体面阵列探测器来模拟子弹射击和射击靶标,具有模拟逼真,精度高等特点。主要从信号处理部分来设计实现激光打靶系统,每次射击能精确的显示 5 -- 10 环的结果及脱靶情况,每个环数又可分为八个偏移方向。该系统简单实用,既能保证训练的质量又能减少弹药的消耗,是理想的公安、军队等部门训练使用的模拟打靶系统。 \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha2.tex b/macros/xetex/latex/hduthesis/examples/cha/cha2.tex deleted file mode 100644 index d7d50c5455..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha2.tex +++ /dev/null @@ -1,60 +0,0 @@ -\chapter{概述} - -\section{激光打靶系统概述} - -激光打靶系统\cite{cn1,cn2,cn3}的工作原理是采用激光脉冲来模拟枪弹的射击,该系统一般包括激光发射部分、激光信号检测模块、打靶成绩处理和显示部分。如图 2-1 所示,当射手瞄准完毕扣动扳机时,半导体激光器会发出激光脉冲,射向目标上的光电探测器,如果击中目标,则激光脉冲被光电探测器接收并转换为电信号,经电路处理能识别射击的弹着点,信号经处理编码后传输到计算机。 - -\begin{figure}[htbp] - \centering - \begin{tikzpicture} - [ - every node/.style = { font = \small, inner sep = 1ex } - ] - \node (a) [draw, rectangle] at (0,0) {光电探测器}; - \node (b) [draw, rectangle] at (3.5,0) {信号处理电路}; - \node (c) [draw, rectangle] at (7,0) {计算机处理}; - \node (d) [draw, rectangle] at (0,-1.5) {半导体激光器}; - \node (e) [draw, rectangle] at (4,-1.5) {激光枪扳机}; - \draw [->, thick] (a.east) -- (b.west); - \draw [->, thick] (b.east) -- (c.west); - \draw [->, thick] (d.north) -- (a.south); - \draw [->, thick] (e.west) -- (d.east); - \end{tikzpicture} - \caption{激光打靶系统原理图} -\end{figure} - -半导体激光器\cite{cn4,en5}一般平行地安装在武器装备的枪管、炮管或导弹发射架上,它可以发射一束与武器射击方向一致的激光脉冲。目前的激光器一般都采用半导体激光器,因为这种激光器的输出功率低,不会伤害眼睛,而且效率高、功耗小,不但可以摆脱大而重的电源设备,激光器本身也可以制作得很小、很轻。光电探测器\cite{en6}具有射击靶的形状,可以是点探测器和面探测器,通常数量较多,构成多个信号检测通路。根据光电探测器的响应位置来判断激光射击击中的靶位。 - -激光打靶采用以光代弹的形式进行射击训练,是激光武器模拟器中最常见的一种。最初的激光打靶系统只能进行瞄准射击训练,随着计算机和微处理器技术的发展,其用途扩大到可进行多种武器的模拟训练。随着研究和探索的深入,激光打靶系统的功能将进一步完善,能够更接近于武器装备在实际使用中的表现,增强真实感。同时,通过与电子技术相结合,进一步提高激光模拟的自动化、智能化水平。 - -激光武器模拟器有以下几个方面的发展趋势: - -\begin{enumerate} - \item 可以模拟的武器越来越多,激光武器模拟器正朝着系列化、组件化的方向发展,一个基本的激光射击模拟器只要稍加改动就可适用于其他武器系统。系列化、组件化的好处是便于使用、更换和维修,同时价格也便宜。 - \item 从激光射击模拟器向激光交战模拟器发展,先进的激光交战模拟器能使坦克、战斗车辆、反坦克武器等有机的结合在一起进行训练,每部兵器既是攻击者,又是被攻击者,完全模仿实战中的作战环境,不仅能提高战士使用武器的技能,还可以教会他们如何在战争中保护自己。 - \item 采用各种新技术增加模拟的逼真性,例如用计算机来记录、控制整个训练演习的进程,评定战士在演习中的表现等。 -\end{enumerate} - -\section{本设计方案思路} - -本设计以实现信号的良好检测和数据转换、传输为主要目的;以信号检测,信号编码和数据传输为主要设计内容。 - -在信号检测方面设计单脉冲小信号的放大电路和信号整形电路;在信号编码方面,要解决多路信号的编码问题,还要考虑到编码的优先选择问题;在脱靶问题的处理方法上,对打靶和信号采集传送进行同步化处理(详见第二章的硬件设计部分),把脱靶的情况与中靶的情况归为一类处理;数据传输采用 UART 串口通信。 - -\section{研发方向和技术关键} - -\begin{enumerate} - \item 合理划分激光靶的光电探测器,提高系统的精度; - \item 单脉冲小信号的放大和整形; - \item 多路优先编码器的扩展; - \item 与微机进行数据传输,方便成绩的统计、保存、显示和查询。 -\end{enumerate} - -\section{主要技术指标} - -\begin{enumerate} - \item \makebox[9\ccwd][l]{激光脉宽:}大于$\qty1\ms$ - \item \makebox[9\ccwd][l]{激光脉冲响应幅度:}约$\qty{10}\mV$ - \item \makebox[9\ccwd][l]{打靶距离:}$\qty{30}\m$ - \item \makebox[9\ccwd][l]{串行输出帧格式:}射击次数\ensuremath+所击中的光电探测器的编号 -\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha3.tex b/macros/xetex/latex/hduthesis/examples/cha/cha3.tex deleted file mode 100644 index bfa795380f..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha3.tex +++ /dev/null @@ -1,108 +0,0 @@ -\chapter{总体设计} - -激光打靶系统是一种集光、电于一体的系统,其工作原理是激光枪发出的激光束,打到光电 -传感器上,经光电传感器将光信号转换为电信号,电信号经过信号处理后由单片机发送到计 -算机的串行口,然后在计算机上完成成绩显示、查询和保存等功能。 - -激光打靶系统结构的组成框图如\cref{3-1}所示。该系统包括半导体激光枪、模块式 -探测器、数字信号处理和发送电路、计算机数据处理程序等四部分。 - -\begin{figure}[htbp] - \centering - \begin{tikzpicture} - [ - every node/.style = {font = \small, minimum height = 4.4em, minimum width = 3em} - ] - \linespread{1} - \node (a) [draw, rectangle, align = center] at (0,0) {激\\光\\枪}; - \node (b) [draw, rectangle, align = center] at (2.5,0) {探测\\器\\模块}; - \node (c) [draw, rectangle, align = center] at (5,0) {滤波\\电路}; - \node (d) [draw, rectangle, align = center] at (7.5,0) {放大\\电路}; - \node (e) [draw, rectangle, align = center] at (10,0) {整形\\电路}; - \node (f) [draw, rectangle, align = center] at (12.5,0) {优先\\编码\\电路}; - \node (g) [draw, rectangle, align = center] at (2.5,-2.3) {串行\\收发\\模块}; - \node (h) [draw, rectangle, align = center] at (5,-2.3) {电平\\转换}; - \node (i) [draw, rectangle, align = center, above right] at ([yshift = -2.3cm]e.south west) {计\\算\\机}; - \draw [->, thick] (a.east) -- (b.west); - \draw [->, thick] (b.east) -- (c.west); - \draw [->, thick] (c.east) -- (d.west); - \draw [->, thick] (d.east) -- (e.west); - \draw [->, thick] (e.east) -- (f.west); - \draw [<-, thick] (g.west) --++ (-1.5,0); - \draw [->, thick] (g.east) -- (h.west); - \draw [->, thick] (h.east) -- node [above = -1.5em] {串口} (i.west); - \end{tikzpicture} - \caption{系统总体结构框图} - \label{3-1} -\end{figure} - -\section[激光的检测]{激光的检测\cite{cn7,cn8}} - -每次打靶,激光枪发出一个激光脉冲。如果激光脉冲击中光电靶,利用光生伏特效应,光电 -靶上的探测器把光信号转换成电信号,因此激光的检测就是对探测器响应电信号的检测。光 -电探测器的响应是一个单脉冲小信号,整个检测过程包括:信号放大、波形整形,检测输出 -是标准的脉冲数字信号。 - -\section{靶位的划分} - -把一个激光靶划分为 38 块探测器,中心 10 环为一块探测器;9.8.7.6 环分别有 8 块 -探测器;5 环有 5 块探测器。根据不同靶位上的探测器来判断所击中的位置,包括环数: -10.9.8.7.6.5;偏离方向:上.下.左.右.左上.左下.右上.右下。 - -若信号击中两块或四块探测器的交界,则只取其中一块为有效,记为有效的探测器满足以下 -条件: - -\begin{enumerate} - \item 环数高; - \item 偏离方向为斜向(例如:上和右上两方向,选择右上)。 -\end{enumerate} - -根据上述要求,以及硬件电路设计的需要,对不同的探测器进行编码,见\cref{3-2}(右)。 - -\newpage -\begin{figure}[htbp] - \centering - \includegraphics[width = .86\linewidth]{image-0145} - \caption{靶位划分与编号} - \label{3-2} -\end{figure} - -\section{编码标准} - -对 38 路信号按以上原则编码,编码结果如表 3-1。若脱靶无信号则记为 0 号。编码后, -每一个号码对应了每一个探测器的位置信息,包括环数和偏移方向。对信号击中两块或四块 -探测器的交界的情况,只需取码号大的探测器为有效。这样,打靶的结果在硬件电路上的实现 -便可由 40--6 线优先编码器完成。 - -\begin{table}[htbp] - \centering - \renewcommand{\arraystretch}{1.3} - \caption{靶位编码} - \begin{tabular}{*{9}{@{}|@{}>{\small\centering\arraybackslash}p{.107\linewidth}}@{}|@{}} - \hline - & 上 & 右上 & 右 & 右下 & 下 & 左下 & 左 & 左上\\ - \hline - 10环 & \multicolumn{8}{c|}{38}\\ - \hline - 9环 & 33 & 37 & 32 & 36 & 31 & 35 & 30 & 34\\ - \hline - 8环 & 25 & 29 & 24 & 28 & 23 & 27 & 22 & 26\\ - \hline - 7环 & 17 & 21 & 16 & 20 & 15 & 19 & 14 & 18\\ - \hline - 6环 & 9 & 13 & 8 & 12 & 7 & 11 & 6 & 10\\ - \hline - 5环 & 3 & --- & 2 & 5 & --- & 4 & 1 & ---\\ - \hline - \end{tabular} -\end{table} - -\section{成绩的传送和处理} - -信号经编码后发送到计算机,由计算机进行译码,在计算机上模拟显示出射击位置,对一组 -结果进行统计(包括环数和方向偏移),并进行储存。 - -\section{其他说明} - -系统分为硬件部分和软件部分。本论文主要设计制作硬件部分以及与微机的通讯的 2051 单 -片机程序。微机软件部分,包括数据的处理和显示等有另外一名毕业设计同学实现。 \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha4.tex b/macros/xetex/latex/hduthesis/examples/cha/cha4.tex deleted file mode 100644 index 697b58bcc9..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha4.tex +++ /dev/null @@ -1,301 +0,0 @@ -\chapter{硬件设计} - -\section{信号放大电路} - -在光电探测系统中,探测器输出的电信号非常微弱,一般为毫伏级。为记录每一次打靶的结果,信号放大与处理电路是打靶系统中不可或缺的。在探测器上直接进行信号处理十分困 -难,一种常用的解决办法是在探测器后接前置放大器,用来放大探测器的输出信号,然后成 -功地传输到信号处理系统的有关电路部分。前置放大器的设计要求是低噪声,高增益,低输 -出阻抗,大的动态范围,和较好的抗噪声能力。 - -在激光打靶系统中,对光电池产生的脉冲信号的具体大小值要求不高,只需检测出有效的脉 -冲信号,因此可选用集成运放来组成运算放大电路。 - -通过测试,得到光电探测器对的激光脉冲的响应幅度典型值约为$\qty5\mV$,若激光击中 -在两块或多块探测器边界处,则任何一块光电探测器的响应幅度会减少,因此所检测的脉冲 -幅度范围大约是$\num3\sim\qty5\mV$.为使每块光电探测器均能检测出信号,使之达到 -TTL 电平要求,实现信号检测,必须对信号放大约 1000 倍。单级运放难以达到这么高的 -放大倍数,因此采用二级运放进行放大,第一级为前置放大器。为减少前级放大器的偏移对 -后级放大器的影响,设计其放大倍数$A_1=100$;从而次级放大器的放大倍数$A_2=10$。 - -\subsection{集成运算放大器(LM324)} - -集成运算放大器是实现高增益放大功能的一种集成器件\cite{cn9},早期主要用来实现对模拟量进行 -数学运算的功能,目前随着器件性能的改进,它已成为通用的增益器件,应用范围非常广泛。 - -从电特性来看,集成运放接近理想的电压放大器件,它不仅有很大的输入电阻和很小的输出 -电阻,而且还有很高的电压增益,此外,静态工作时,它的输入和输出电位均为零,这样, -在与其它集成运放连接时,就不需要考虑它们之间的电平配置问题。 - -LM324 是四通道的低功耗运算放大器,它的内部包含四组形式完全相同的运算放大器,除电 -源共用外,四组运放相互独立,其性能参数有以下几个方面: - -\begin{enumerate} - \item 单电源工作方式,工作电平$\qty3\V\sim\qty{30}\V$ - \item 低消耗电流:约$\qty{0.8}\mA$ - \item 低输入偏移:输入电压偏移:$\qty3\mV$(Typ);输入电流偏移:$\qty2\nA$(Typ) - \item 开环增益:$\qty{100}\V/\unit\mV=\qty{100}\dB$(Typ) - \item 宽响应频带 -\end{enumerate} - -\newpage -\begin{figure}[htbp] - \centering - \includegraphics[width = .595\linewidth]{image-0162} - \caption{LM324内部结构} - \label{4-1} -\end{figure} - -\subsection{放大电路图} - -\begin{figure}[htbp] - \centering - \includegraphics[width = .93\linewidth]{image-0163} - \caption{运算放大器电路图} - \label{4-2} -\end{figure} - -放大器电路如\cref{4-2} 所示。它由两级结构相同的同相放大器组成,集成放大器选用 -LM324(\cref{4-1})。信号经隔直流电容C1从第一级放大器的正端 -``\ensuremath+''输入,经过放大后输出,再经过级间耦合电容C2输入第二级放大器 -的正端。前级的放大倍数$A_1=R_2/R_1=100$,后级的放大倍数$A_2=R_6/R_5=10$, -$R_3$和$R_7$为输入匹配电阻。 - -\subsection{电路原理} - -\begin{enumerate} - \item 同相放大器\cite{cn10}(\cref{4-3}) - - 集成运放是一种十分理想的增益器件,性能好,使用方便。该电路采用 2 级放大器级 - 联,每级的放大器均采用同相放大。 - - 由集成运放构成的同相放大器,其特点是输入信号加在同相输入端,而反馈信号加在反相端。根据理想化条件,由于$v_+=v_s$,因而$v_-\approx v_s$。更具$i\to0$(虚断),$v_-$又是$v_o$在$R_1$上的分压值,即: - \begin{equation} - v_-=v_o\frac{R_1}{R_1+R_f} - \end{equation} - 因而,放大器的增益: - \begin{equation} - A_{Vf}=\frac{v_o}{v_s}=\frac{R_1+R_f}{R_1}=1+\frac{R_f}{R_1} - \end{equation} - $\because A_{Vf}>0$,所以$v_o$与$v_s$同相。 - - \begin{figure}[htbp] - \centering - \includegraphics[width = .54\linewidth]{image-0236} - \caption{同相放大器} - \label{4-3} - \end{figure} - \item 外围电路 - - 光电传感器对外部光线也有响应,因此必须滤除这种干扰。由于背景光线是持续信号,其 - 响应主要是直流量,在第一级放大器输入端的前面设计接入一个$\qty1\uF$电容C1起到 - 隔离直流作用,能起到很好的效果。第二级的$\qty1\uF$电容C2用于两级放大器的耦合。 - - 第一级放大器输入端和地之间接 R3;第二级放大器输入端和地之间接 R7。使得: - \begin{equation} - \begin{cases} - R_3\approx R_1//R_2\\ - R_7\approx R_5//R_6 - \end{cases} - \end{equation} - 这样,运放的正、负输入端对地的等效电阻相等,从而降低运放的电压偏移。 -\end{enumerate} - -\subsection{电路参数} - -\begin{enumerate} - \item \makebox[9em][l]{输入脉冲幅度:} $U_i\approx\num3\sim\qty5\mV$ - \item \makebox[9em][l]{输入电阻:} $R_i\approx\qty{10}\kohm$ - \item \makebox[9em][l]{输出电阻:} $R_o\approx\qty1\kohm$ - \item \makebox[9em][l]{放大倍数:} $A=A_1\cdot A_2\approx10\times100=1000$ - \item \makebox[9em][l]{放大器级数:} 两级,前级$A_1\approx100$;后级$A_2\approx10$ - \item \makebox[9em][l]{耦合方法:} 电容耦合 -\end{enumerate} - -\clearpage -\vspace*{-1.5em} -\section[整形电路]{整形电路\cite{cn11}} - -光电池的输出脉冲并不是规则的矩形脉冲信号,而是类似升余弦信号。再经放大后也会产生 -失真,因此必须对信号进行整形。采用常用的 CD4093 施密特触发器便可实现整形功能,改 -善脉冲波形,确保后续编码器的正常编码。 - -施密特触发器不仅可以进行波形整形,它的迟滞特性还可以有效地克服噪声和干扰的影响,只要噪声和干扰的大小处在迟滞宽度内,就不会有错误的输出。施密特触发器属于电平触 -发,对于缓慢变化的信号仍然适用,当输入信号达到阈值电压时,电路状态发生转换,通过 -电路内部的正反馈过程使得输出电压的波形的边沿变得很陡峭。利用施密特触发器可以实现 -有效脉冲的识别见\cref{4-5}。 - -\begin{figure}[htbp] - \centering - \includegraphics[width = .65\linewidth]{image-0284} - \caption{施密特触发器的电压传输特性\quad (a) 同相输出;(b) 反相输出} - \label{4-4} -\end{figure} - -\begin{figure}[htbp] - \centering - \includegraphics[width = .95\linewidth]{image-0285} - \caption{利用施密特触发器实现有效脉冲的识别} - \label{4-5} -\end{figure} - -\section[编码电路]{编码电路\cite{cn11}} - -对于 38 路信号通道,必须对其进行编码以便于信号识别和传输。38 路信号按照设计方案 -编码为 1--38 号,脱靶无信号记为 0 号。对多个探测器同时接收到信号的情况,对应于 -探测器的码号就是取码号大的探测器为有效,采用优先编码器便可实现编码的优先选择。 - -商用的单个优先编码器的编码输入最多只有 8 路,要构成更多路的优先编码 -器,可以采用 6 片 8-3 优先编码器进行扩展为 40-6 优先编码器。 - -\subsection{编码电路图} - -\begin{figure}[htbp] - \centering - \includegraphics[width = .93\linewidth]{image-0289} - \caption{40-6 优先编码器电路图} - \label{4-6} -\end{figure} - -\subsection{电路原理} - -\begin{enumerate} - \item 优先编码器(74HC148) - - 8-3 线优先编码器的功能表如\cref{4-7}。待编码的 8 条输入线 采用 8 中取 1 - 码,逻辑 0 有效,编码后的输出 用反码表示。可以看出,编码器是以输入为 0 的最高 - 优先编码的,而低位若同时输入 0,则是无意义的。此外,电路还设有选通输入,即使能 - 端 EI,它也是逻辑 0 有效;输出还设有允许输出端 Eo 及允许扩展端 Gs,利用它们 - 可判断出 是否有效,以及是否允许扩展编码。根据真值表,写出编码器的逻辑表达式如下: - \begin{equation} - \begin{aligned} - \overline{A_2}&=\overline{EI}\cdot I_7+\overline{EI}\cdot I_7\cdot I_6\cdot\overline{I_5}+\overline{EI}\cdot I_7\cdot I_6\cdot I_5\cdot\overline{I_4}\\ - &=\overline{EI}(\overline{I_7}+I_7\overline{I_6}+I_7I_6I_5\overline{I_4})=\overline{EI}(\overline{I_7}+\overline{I_6}+\overline{I_5}+\overline{I_4}) - \end{aligned} - \end{equation} - 故: - \begin{equation} - A_2=\overline{\overline{EI}(\overline{I_7}+\overline{I_6}+\overline{I_5}+\overline{I_4})} - \end{equation} - 同理: - \begin{gather} - A_1=\overline{\overline{EI}(\overline{I_7}+\overline{I_6}+I_5I_4\overline{I_3}+I_5I_4I_2)}\\ - A_0=\overline{\overline{EI}(\overline{I_7}+I_6\overline{I_5}+I_6I_4\overline{I_3}+I_6I_4I_2\overline{I_1})} - \end{gather} - 而允许输出为: - \begin{equation} - E_OE_0=\overline{\overline{EI}\cdot I_7I_6I_5I_4I_3I_2I_1I_0} - \end{equation} - 允许扩展端是: - \begin{equation} - Gs=EI+\overline{EI}\cdot I_7\;I_6\;I_5\;I_4\;I_3\;I_2\;I_1\;I_0=\overline{\overline{EI}\cdot E_O} - \end{equation} - - \begin{table}[htbp] - \centering\scriptsize - \renewcommand\arraystretch{1.12} - \begin{tabular}{|>{\centering\arraybackslash\sffamily}p{.04\linewidth}|*{8}{>{\centering\arraybackslash\sffamily}p{.04\linewidth}}|*{3}{>{\centering\arraybackslash\sffamily}p{.04\linewidth}}|*{2}{>{\centering\arraybackslash\sffamily}p{.04\linewidth}}|} - \hline - \multicolumn{9}{|>{\sffamily\bfseries}c|}{INPUTS} & \multicolumn{5}{>{\sffamily\bfseries}c|}{OUTPUTS}\\ - \hline - EI & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & A2 & A1 & A0 & GS & EO\\ - \hline - H & X & X & X & X & X & X & X & X & H & H & H & H & H\\ - L & H & H & H & H & H & H & H & H & H & H & H & H & L\\ - L & X & X & X & X & X & X & X & L & L & L & L & L & H\\ - L & X & X & X & X & X & X & L & H & L & L & H & L & H\\ - L & X & X & X & X & X & L & H & H & L & H & L & L & H\\ - L & X & X & X & X & L & H & H & H & L & H & H & L & H\\ - L & X & X & X & L & H & H & H & H & X & L & L & L & H\\ - L & X & X & L & H & H & H & H & H & X & L & H & L & H\\ - L & X & L & H & H & H & H & H & H & X & H & L & L & H\\ - L & L & H & H & H & H & H & H & H & X & H & H & L & H\\ - \hline - \end{tabular} - \caption{8-3 线优先编码器真值表(74HC148)} - \label{4-7} - \end{table} - \item 8-3 线优先编码器扩展为 40-6 线优先编码器(\cref{4-6}) - - 5 片 74HC148 并排用作输入,其输入从低位片到高位片排列为 - $I_0\sim I_{39}$ 。每一个高位片的输出允许端 Eo 接其相对低位片的使能端 EI。这样,当总使能$\text{EI}=0$时,允许电路进行编码工作,若高位片的诸输入中有一 - 个为$0$时,该片的 $\text{Eo}=1$,$\text{Gs}=0$,这样就禁止了低位片的编 - 码,以此类推,5 片 74HC148 的输入端编码便具有了优先性。 - - 5 片 74HC148 的允许扩展端 Gs 按低位片至高位片的顺序分别接到第六片74HC148 - 的$I_0$、$I_1$、$I_2$、$I_3$、$I_4$输入端,而$I_5$、$I_6$、$I_7$端则接 - 高电平(表示无输入)。这样第六片 74HC148 的三位输出便表示整个 40-6 线优先编 - 码器的高三位$A_5$、$A_4$、$A_3$。而 40-6 线优先编码器的低三位输出$A_2$、$A_1$、$A_0$与前 5 片 74HC148 的输出端一致。 - - 由于 74HC148 的输出端不是三态门,不能直接连接在一起。而把 5 片 74HC148的同 - 名输出端接到 74LS30(8 输入的与非门)取与非便可以解决这个问题。同时输出取反, - 输出为逻辑 1 有效。为使高三位输出与低三位输出一致,用 CD4049反相器对高三位取 - 反。 - - 40-6 线优先编码器的六个输出均为逻辑 1 有效,可以接到后续的 2051 单片机进行串 - 行传输。 -\end{enumerate} - -\section{串行传送} - -为实现将编码器输出的 6 位并行信号串行传送,同时实现数据发送和打靶射击的同步性。采 -用 89C2051 单片机便可实现要求。 - -\subsection{单片机及外围电路图} - -\begin{figure}[htbp] - \centering - \includegraphics[width = .9\linewidth]{image-0419} - \caption{2051 单片机及其外围电路图}\label{4-8} -\end{figure} - -\subsection{电路原理} - -\begin{enumerate} - \item 编码器的输出通过 2051 P1 口的低 6 位(高 2 位接地为逻辑 0)输入。 - \item 选用 $\qty{11.0592}\MHz$ 的晶振构成单片机的时钟,这样在串口工作方式 1 下可得到准确的 $\qty{9600}{bps}$ 的串行波特率,方便计算机的接收。 - \item 单片机接有复位开关按钮。 - \item 实现打靶和信号采集传送的同步化。 -\end{enumerate} - -由于采用单片机的外部中断 0($\overline{INTO}$)作为数据串行传送的使能端,且 -$\overline{INTO}$设为下降的跳变沿有效。使能开关(激光枪的开关)一端接地,另一 -端接$\overline{INTO}$,又经上拉电阻接到电源,这样当开关按下时,便有下降沿的跳变信号输入$\overline{INTO}$,产生中断。 - -同时,开关又要同步控制激光枪的发射。因此开关又接激光头的负端,从而控制激光头负端 -的接地,只有当开关按下时,激光头两端才有工作电压。 - -这样,同一个开关既控制单片机的中断,又同时控制激光枪的发射,从而达到打靶和信号采 -集传送这两个“动作”的同步化。 - -\subsection{AT89C2051 单片机\cite{cn12}} - -AT89C2051 单片机是 AT89C51 的简化型号,其指令系统和内部 RAM 均与 AT89C51相 -同。不同的是它的内部 ROM 为 2k,而 89C51 为 4k,而且 2051 比 89C51 少了 P0 -和 P2 输入/输出口以及外部 ROM、RAM 的扩展端,因此在引脚上 2051 只有 20 个脚。 -AT89C2051 单片机主要适用于较为简单的微控制系统。在本系统中,用到 AT89C2051的 -6 个外部 I/O 口,一个外部中断和串行输出口。 - -\newpage -\begin{figure}[htbp] - \centering - \includegraphics[width = .53\linewidth]{image-0439} - \caption{2051 信号引脚图} - \label{4-9} -\end{figure} - -\section{电平转换} - -在不同的数字系统中,其电平标准是不同的。该系统中就包括了 TTL 电平标准和 RS-232 -电平标准,要实现两个标准的正常通信,必须进行电平转换。该系统采用使用简单的 -MAX232CPE 芯片。 - -一片MAX232CPE芯片可完成2路TTL/CMOS~RS-23 的电平转换和2路RS-232~TTL/CMOS -的电平转换。实际电路中只有一路单片机的 TXD 串口输出,不进行RXD串口输入。因此,选 -用引脚 11 接 2051 TXD 串口输出;而对应的 14 脚则接到计算机的串口输入端。 - -\begin{figure}[htbp] - \centering - \includegraphics[width = .52\linewidth]{image-0440} - \caption{MAX232CPE 芯片内部结构} - \label{4-10} -\end{figure} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha5.tex b/macros/xetex/latex/hduthesis/examples/cha/cha5.tex deleted file mode 100644 index 9d2e255e86..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha5.tex +++ /dev/null @@ -1,135 +0,0 @@ -\chapter{软件设计} - -\section{总体方案} - -该系统的信号检测与数据传送部分,涉及的软件部分较少。主要是 2051 单片机数据串行通信及通信协议的程序设计。 - -对于 2051 的程序设计\cite{cn12},由于所需实现的功能较简单,采用汇编的形式。编译器采用 Keil 7.02b。该编译器是 51 系列单片机程序设计的常用工具,既可用汇编,也支持 C 语言编译。同时具有完善的调试功能。 - -\section{程序流图} - -\begin{figure}[!ht] - \centering - \begin{tikzpicture} - [ every node/.style = { font = \small, minimum height = 2.5em } ] - \node [draw, rectangle, minimum width = 11em, minimum height = 2em] (a) at (0,0) {初始参数设置}; - \node [draw, rectangle, minimum width = 11em, rounded corners = 1.2em, below = of a] (b) {等待中断}; - \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of b] (c) {中断服务程}; - \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of c, yshift = 2ex] (d) {读取 P1 口值}; - \node [draw, rectangle, minimum width = 11em, rectangle, below = of d, minimum height = 2em] (e) {发送数据帧}; - \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of e] (f) {延时$\qty{200}\ms$}; - \node [draw, rectangle, minimum width = 11em, rectangle, below = of f, minimum height = 2em, yshift = 2ex] (g) {清中断标志}; - \node [draw, rectangle, minimum width = 10em, rounded corners = 1.2em, below = of g] (h) {中断返回}; - \draw [->] (a.south) -- (b.north); - \draw [->] (b.south) -- (c.north); - \draw [->] (c.south) -- (d.north); - \draw [->] (d.south) -- (e.north); - \draw [->] (e.south) -- (f.north); - \draw [->] (f.south) -- (g.north); - \draw [->] (g.south) -- (h.north); - \draw [->] (h.east) --++ (1,0) |- (b.east); - \end{tikzpicture} - \caption{串行发送流程图} - \label{5-1} -\end{figure} - -\section{模块说明} - -\begin{enumerate} - \item 主程序: - \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] - MAIN: - MOV SP,#0X60 ;堆栈初始化 - CALL INIT ;各寄存器参数设置 - MOV 40H,#0x01 ;打靶次数置 1 - AJMP $ ;等待中断 - \end{lstlisting} - \item 初始化程序: - \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] - INIT: - MOV TMOD,#0X21;波特率发生器 - MOV TL1,#0XFD ;波特率 9600bps - MOV TH1,#0XFD - CLR ET1 ;禁止 timer1 - SETB PT1 ;时钟 1 优先级:高 - MOV SCON,#0x40;串口工作模式 1,SM2=0,REN=0 - MOV PCON,#0 ;波特率 9600bps - SETB EA ;中断允许 - CLR PS ;关闭串口中断 - CLR ES ;串口优先级:低 - SETB EX0 ;开外部中断 INT0 SETB IT0 ;下降沿有效 - CLR PX0 ;INT0 优先级:低 - SETB TR1 ;时钟 1 开始计数 - RET - \end{lstlisting} - \item 中断服务程序: - \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] - _INT0: ;ISR 中断服务程序 - NOP - CALL DELAY_2MS;同步延时 - MOV P1,#0xff ;读 P1 口前先置 1 - MOV A,P1 ;读 P1 口 - CALL INT0_SEND - RET - \end{lstlisting} - \item 数据帧传送子程序: - \begin{figure}[htbp] - \centering\small - \setstretch{1.4} - \caption{数据帧格式} - \begin{tabular}{|*{4}{>{\centering\arraybackslash}p{.22\linewidth}|}} - \hline - 标志位SYNC & 打靶次数 & 打靶成绩 & 校验位CHECKSUM\\ - \hline - \#0x30 & TIMES & RESULT & TIMES\ensuremath+RES\\ - \hline - \end{tabular} - \end{figure} - \clearpage - 例:30 02 15 17(十六进制) - - 表示第二次打靶,击中第 21 号(对应环数:7 环 偏移方向:右上)。 - \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] - INT0_SEND: ;数据帧传送子程序 - PUSH ACC ;保护 ACC - CLR A - ADD A,#0X30 - CALL UART_SEND ;发送标志位 - MOV A,40H - CALL UART_SEND ;发送打靶次数 - POP ACC - CALL UART_SEND ;发送打靶成绩 - ADD A,#0X30 - ADD A,0040H - CALL UART_SEND ;发送校验位 - INC 0040H ;打靶次数累加 1 - CALL DELAY_200MS;延时 200ms - CLR EX0 ;关外部中断 - CLR IE0 ;清INT0外部中断请求标志位—防止外部中断寄存 - 而引起多次中断。 - SETB EX0 ;开中断 - RETI - \end{lstlisting} - \item 串行发送字节 - \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] - UART_SEND: ;串行发送一个字节 - MOV SBUF,A - JNB TI,$ ;等待发送完毕 - CLR TI ; - RET - \end{lstlisting} - \item 定时程序: - \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true] - DELAY_2MS: ;用定时器延时 2ms - MOV R7,#21;21 - DLY1:MOV R6,#42 - DLY2:DJNZ R6,DLY2 - DJNZ R7,DLY1 - RET - DELAY_10MS: ;调用 DELAY_2MS,实现延时 10ms - MOV R5,#5 - DLY: CALL DELAY_2MS - DJNZ R5,DLY - RET -\end{lstlisting} -\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha6.tex b/macros/xetex/latex/hduthesis/examples/cha/cha6.tex deleted file mode 100644 index 1c5c628ad6..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha6.tex +++ /dev/null @@ -1,40 +0,0 @@ -\chapter{制作与调试} - -\section{硬件电路的布线与焊接} - -\subsection{总体特点} - -该系统所涉及的各部分硬件电路,总体的特点是: - -\begin{enumerate} - \item 电路原理简单,所用的器件均为常用器件。 - \item 由于路数较多(38 路),电路的规模较大,因此在制作中只做了 8 路。 - - 因此,应合理布线,以降低焊接难度,降低出错率,同时防止干扰。 -\end{enumerate} - -\subsection{电路划分} - -为方便焊接与调试,把电路划分为两大块: - -\begin{enumerate} - \item 探测器接收,放大电路和整形电路为一块电路板; - \item 编码器、2051 单片机和控制开关为一块电路板。 -\end{enumerate} - -\subsection{焊接} - -焊接前应熟悉各芯片的引脚,焊接时参照电路图,仔细地连接引脚。按照以下原则进行焊接: - -\begin{enumerate} - \item 先焊接各芯片的电源线和地线,这样确保各芯片有正确的工作电压; - \item 同类的芯片应顺序焊接,在一片焊接并检查好之后,其他的同类芯片便可以参照第一片进行焊接。这样便可大大节省时间,也可降低出错率。 -\end{enumerate} - -\section{调试} - -\begin{enumerate} - \item 在 40-6 线优先编码器,由于没有详细阅读优先编码器的真值表,我认为优先编码器为低位优先,因此所设计的编码标准(取小号有效)不符合标准。不过发现错误后,对硬件电路无需修改,只要修改编码标准为取大号有效,便可以解决问题。 - \item 由于光电池的响应信号经放大、编码,到达单片机 P1 口时有一定的延时,为使单片机准确地通过外部中断进行有效数据的采集,应知道延时的大概范围。编写单片机程序时,编写了一个延时$\qty2\ms$的子程序,可以调用进行一定的延时,通过延时时间不同的程序进行多次烧录并进行调试,然后比较所得的不同结果,这样便可以大概知道要采集正确的数所需的延时时间(最后程序采用的延时时间为$\qty2\ms$)。 - \item 电路中同时控制激光发射和单片机外部中断的开关为普通的按钮开关,因此在按下和弹起都有颤动,这样会引起单片机外部中断的多次响应,使一次``射击动作''引起多次响应,单片机输出多个值。通常的消颤方法有两种:硬消颤和软消颤。硬消颤指通过硬件上的消颤电路使开关的一次动作只能产生一个脉冲跳变;而软消颤主要通过延时或对响应的屏蔽来实现。在该设计中采用较为简便的软消颤,具体的方案见第五章。 -\end{enumerate} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/cha7.tex b/macros/xetex/latex/hduthesis/examples/cha/cha7.tex deleted file mode 100644 index 17d113c0f7..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/cha7.tex +++ /dev/null @@ -1,11 +0,0 @@ -\chapter{结论} - -本设计方案达到了任务书的要求,实现了激光信号的检测、编码和串行传输,实现了较为完整的激光打靶系统的信号处理: -\begin{enumerate} - \item 前端放大器的放大倍数适中,放大后,有效电压脉冲的幅度达到施密特触发器的上门限电压,背景干扰信号没有引起电路的误响应; - \item 经过调试,实现 40-6 优先编码器的扩展,编码值输出符合真值表,编码有效脉冲下降沿的波形正常; - \item 由开关按钮(模拟激光枪的扳机)控制的编码采集和串行传送也调试实现(通过与计算机的串口相连,用``串口调试程序''调试); - \item 信号处理电路通过串口连接到计算机,应用张雪荣同学设计的``激光打靶成绩统计''软件进行总体调试,实现对打靶成绩的显示统计和储存。 -\end{enumerate} - -由于时间、水平和经验有限,在信号的放大、编码及抗干扰等方面仍有不足之处,有改进的余地,比如电路规模的精简,其他的光干扰处理。另外在系统的调试方面,由于时间和设备的原因,只进行了短距离的调试,有待进一步的调试。这次毕业设计对于我来说,既是一次机遇,又是一次挑战。通过这次的毕业设计,我学到了很多东西,通过自己的实践,增强了动手能力。通过实际工程的设计也使我了解到书本知识和实际应用的差别。在实际应用中遇到很多的问题,这都需要我对问题进行具体的分析,并一步一步地去解决它。 \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/cha/thanks.tex b/macros/xetex/latex/hduthesis/examples/cha/thanks.tex deleted file mode 100644 index 303f13d429..0000000000 --- a/macros/xetex/latex/hduthesis/examples/cha/thanks.tex +++ /dev/null @@ -1,14 +0,0 @@ -\chapter*{致谢} -\addcontentsline{toc}{chapter}{致谢} - -在这几个月的时间里,从对课题的理解,方案的设计,到电路的制作,再到论文的写作,中间有着自己的努力,更有着老师和同学的关心和巨大的帮助。 - -感谢秦会斌老师在很忙的情况下,为我讲解课题的要点,引领设计的思路。他对学生认真负责的态度让我由衷地敬佩。 - -感谢唐大勇和章国平同学给予我无私的帮助,他们对我所遇到的难题的解答让我受益匪浅。 - -感谢罗老师对我们的关心照顾。 - -感谢母校和老师们在大学四年中对我的培养。 - -...... \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0145.png b/macros/xetex/latex/hduthesis/examples/figures/image-0145.png deleted file mode 100644 index 7d390d38de..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0145.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0162.png b/macros/xetex/latex/hduthesis/examples/figures/image-0162.png deleted file mode 100644 index 75ed76eafc..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0162.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0163.png b/macros/xetex/latex/hduthesis/examples/figures/image-0163.png deleted file mode 100644 index 9be35b5e63..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0163.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0236.png b/macros/xetex/latex/hduthesis/examples/figures/image-0236.png deleted file mode 100644 index 5bed2083f9..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0236.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0284.png b/macros/xetex/latex/hduthesis/examples/figures/image-0284.png deleted file mode 100644 index 59bca2a597..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0284.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0285.png b/macros/xetex/latex/hduthesis/examples/figures/image-0285.png deleted file mode 100644 index c1aae56755..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0285.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0289.png b/macros/xetex/latex/hduthesis/examples/figures/image-0289.png deleted file mode 100644 index 5860708d8f..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0289.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0419.png b/macros/xetex/latex/hduthesis/examples/figures/image-0419.png deleted file mode 100644 index 2af2fefab6..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0419.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0439.png b/macros/xetex/latex/hduthesis/examples/figures/image-0439.png deleted file mode 100644 index de4cc1538b..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0439.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/figures/image-0440.png b/macros/xetex/latex/hduthesis/examples/figures/image-0440.png deleted file mode 100644 index 4ccc02ea57..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/figures/image-0440.png and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-bc.pdf b/macros/xetex/latex/hduthesis/examples/hduthesis-bc.pdf deleted file mode 100644 index 7a87591efa..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/hduthesis-bc.pdf and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-bc.tex b/macros/xetex/latex/hduthesis/examples/hduthesis-bc.tex deleted file mode 100644 index 1c36b498a4..0000000000 --- a/macros/xetex/latex/hduthesis/examples/hduthesis-bc.tex +++ /dev/null @@ -1,44 +0,0 @@ -\documentclass - [ - math-font = STIX Two Math, agreed, - CJKmain-font = { {Songti SC}[AutoFakeSlant, AutoFakeBold = 2.5] }, - CJKsans-font = { {STHeiti}[AutoFakeBold = 2] } - ] {hduthesis} -\tikzset{ > = stealth } -\usetikzlibrary{positioning,shapes.geometric} - -\DocInfo - { - title = 杭州电子科技大学学位论文 \hologo{LaTeX} 模板/本科毕业设计~ (论文), - department = 理学院, - major = 物理学, - class = 英才班, - stdntid = C668668E, - author = 申智能, - supervisor = 教授:葉芷晴, - bibsource = reference - } - -\begin{document} - -\maketitle - -\input{cha/abstract.tex} - -\tableofcontents - -\input{cha/cha1.tex} -\input{cha/cha2.tex} -\input{cha/cha3.tex} -\input{cha/cha4.tex} -\input{cha/cha5.tex} -\input{cha/cha6.tex} -\input{cha/cha7.tex} -\input{cha/thanks.tex} -\printbibliography - -\appendix -\chapter*{附录} -\addcontentsline{toc}{chapter}{附录} - -\end{document} diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-pg.pdf b/macros/xetex/latex/hduthesis/examples/hduthesis-pg.pdf deleted file mode 100644 index 9b24ba3585..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/hduthesis-pg.pdf and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-pg.tex b/macros/xetex/latex/hduthesis/examples/hduthesis-pg.tex deleted file mode 100644 index dcf27d155a..0000000000 --- a/macros/xetex/latex/hduthesis/examples/hduthesis-pg.tex +++ /dev/null @@ -1,71 +0,0 @@ -\documentclass - [ - math-font = STIX Two Math, agreed, - CJKmain-font = { {Songti SC}[AutoFakeSlant] }, - CJKsans-font = { {STHeiti}[AutoFakeBold = 2] } - ] {hduthesis} - -\tikzset{ > = stealth } -\usetikzlibrary{positioning,shapes.geometric} - -\DocInfo - { - title = 基于 \hologo{LaTeX3} 开发的 - 杭州电子科技大学硕士学位论文 \hologo{LaTeX} 模板/ - \hologo{LaTeX} Template for Master's Thesis at Hangzhou Dianzi University that was Developed Based on \hologo{LaTeX3}, - major = 凝聚态物理, - stdntid = C668668E0, - author = 申智能/SAN Chi Nan, - supervisor = 教授:葉芷晴/Prof.:YIP Tsz Ching, - bibsource = reference - } - -\begin{document} - -\maketitle - -\begin{abstract}[cn] - - 设计模式被广泛用于解决软件设计和开发过程中反复出现的设计问题。设计模式在软件源码中的使用信息(即设计模式实例)能够在较大程度上反映软件系统的设计思路。准确地从软件源码中识别和挖掘设计模式实例能够帮助软件开发和维护人员快速理解软件系统的原始设计和实现,从而对软件系统的维护、升级 - 更新和二次开发等工作提供方便。 - - 近些年来软件工程领域提出了多种自动化或半自动化地挖掘设计模式实例的方法。其中部分方法将设计模式和软件源码转化为某种特定的图的形式,然后通过挖掘同构子图的方式挖掘设计模式实例。然而,由于同构子图挖掘问题是一个NP完全问题,这些方法的执行效率通常较低。 - - 为了有效解决基于子图同构的设计模式挖掘方法的效率低下问题,本文提出了一种高效的基于快速搜索序列和行为模板的结构型设计模式挖掘方法。该方法首先将设计模式和软件源码转化为一种带权有向图,即类关系图,然后从软件源码的类关系图中找出所有与设计模式的类关系图相同构的子图,每个子图的顶点所表示的类组成了一个候选设计模式实例。在挖掘过程中,本文方法为每种设计模式构建了一个快速搜索序列,该快速搜索序列描述了设计模式的结构信息并指定了一个高效的搜索设计模式角色的次序,从而大大减少了挖掘过程的搜索空间。此外,本文为每种设计模式制定了一个特定的行为模板,用于过滤候选实例集合中不满足行为特征的错误实例,进一步提高了本文方法的准确率。最后,本文选取4个常用的开源软件系统进行验证实验。实验结果表明,针对本文制定的结果基准,该方法不仅能够达到100\%的召回率和相对较高的准确率和F-measure值,而且显著提高了执行效率。 - - \keywords{设计模式, 设计模式挖掘, 快速搜索序列, 行为模板, 子图同构} -\end{abstract} - -\begin{abstract}[en] - - \setstretch{1.3} - Design patterns are widely used to address the recurring design problems during the process of software design and development. The information about design patterns used in software source code-design pattern instances reveal much about the high-level abstract design ideas. Accurately identifying and detecting design pattern instances in a software system can help developers and maintainers to understand its original design and implementation, facilitating maintenance, update and re-development. - - In recent years, many approaches have been proposed to automatically or semi-automatically detecting design pattern instances from software source code. Among these approaches, some approaches transform software source code and design patterns into certain graphs, and then exploit subgraph isomorphism techniques to detect design pattern instances. However, as mining isomorphic subgraphs is an NP-complete problem, those approaches usually fail to achieve satisfactory efficiency. - - In order to effectively solve the inefficiency of the approaches which are based on subgraph isomorphism, we propose an efficient approach to detect structural design pattern instances based on quick-search sequences and behavior templates. In the proposed approach, we transform software source code and design patterns into a certain form of weighted and directed graph namely Class Relationship Graph, and then detect all the subgraphs from the source code graph which are isomorphic to the Class Relationship Graph of a certain design pattern. The classes that each isomorphic subgraph's vertices represent then consist of a candidate instance. During the process of detecting design pattern instances, we construct a quick-search sequence for each design pattern, which describes the structural characteristics of design pattern and specify an order to efficiently search the roles of each design pattern. According to the quick-search sequence, we can greatly reduce the search space. Afterwards, we construct a specific behavior template, which is used to filter the false positives in the candidate instance set and further improve the processing efficiency. Finally, we exploit our approach on four well-known open-source software systems. The results demonstrate that our approach not only achieves nearly 100\% recall and relatively high precision and F-measure on the benchmark we construct, but also significantly. - - \keywords - { - Design Pattern, Design Pattern Detection, Quick-Search Sequence, - Behavior Template, Sub-graph Isomorphism - } -\end{abstract} - -\tableofcontents - -\chapter{绪论} - -\section{研究背景与意义} - -随着信息技术的飞速发展和广泛应用,各行各业都积累了大量的软件系统。 - -\section{国内外研究现状} - -设计模式挖掘的相关研究工作伴随着设计模式在软件工程领域的提出而应运而生,并得到了广泛的关注和研究。正如 Apostolos Ampatzoglou 的描述,关于挖掘软件源码中设计模式实例的研究是设计模式相关的所有研究工作中最受关注的一项研究课题。 - -\subsection{结构分析} - -结构分析方法是最常见的挖掘设计模式实例的方法。 - -\end{document} diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf b/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf deleted file mode 100644 index 18c98062ca..0000000000 Binary files a/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf and /dev/null differ diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex b/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex deleted file mode 100644 index 71e7bd7cd8..0000000000 --- a/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex +++ /dev/null @@ -1,31 +0,0 @@ -\documentclass[stationery]{hduthesis} - -\usepackage{lipsum} -\RequirePackage [ mono = false ] {libertine} - -\DocInfo - { - title = Recommendation Letter for SAN Chi Nan, - author = YIP Tsz Ching, - affliction = {Physics Department, Hangzhou Dianzi University}, - date = {25\textsuperscript{th} November, 2024}, - tel = (852) 3141-5926, - mail = xiamyphys@gmail.com - } - -\begin{document} - -\maketitle - -To whom it may concern: - -\lipsum[1-2] - -\vspace{\baselineskip} \raggedleft - -Sincerely yours ,\\[2ex] -\includegraphics[ height = 2em ]{hdutitle}\\[2ex] -Professor of Department of Physics\\ -Room \meta{int}, Building \meta{int}, Hangzhou Dianzi University - -\end{document} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/examples/reference.bib b/macros/xetex/latex/hduthesis/examples/reference.bib deleted file mode 100644 index 5775cc077f..0000000000 --- a/macros/xetex/latex/hduthesis/examples/reference.bib +++ /dev/null @@ -1,103 +0,0 @@ -@article{cn1, - title={激光模拟射击训练器械及其射击精度的检定方法}, - author={刘伯来 and 宋作本 and 徐忠瑞}, - journal={山东体育科技}, - volume={24}, - number={4}, - pages={17--19}, - year={2002}, -} - -@article{cn2, - title={一种新型激光射击训练模拟靶的设计}, - author={任宏岩 and 戴炳明}, - journal={大连理工大学学报}, - number={增2}, - pages={186--187}, - year={1997}, -} - -@article{cn3, - title={智能型光电打靶模拟训练系统}, - author={戴炳明 and 任宏岩 and 张雏}, - journal={半导体光电}, - number={03}, - pages={196--197}, - year={1998}, -} - -@book{cn4, - title={半导体激光器及其应用}, - author={黄德修}, - publisher={半导体激光器及其应用}, - year={1999}, - pages={1--27} -} - -@inproceedings{en5, - title={An optical photo-detector using a distributed amplifier and PIN photodiode combination}, - author={Liang, Jia Yi and Aitchison, Colin S}, - booktitle={1994 IEEE MTT-S International Microwave Symposium Digest (Cat. No. 94CH3389-4)}, - pages={1101--1104}, - year={1994}, - organization={IEEE} -} - -@article{en6, - title={Photovoltaic materials, past, present, future}, - author={Goetzberger, Adolf and Hebling, Christopher}, - journal={Solar energy materials and solar cells}, - volume={62}, - number={1-2}, - pages={1--19}, - year={2000}, - publisher={Elsevier} -} - -@book{cn7, - title={光电检测技术}, - author={高稚允 and 高岳}, - year={1995}, - publisher={国防工业出版社}, - pages={172--212} -} - -@book{cn8, - title={光电技术与实验}, - author={江月松 and 阎平 and 刘振玉}, - publisher={光电技术与实验}, - year={2000}, - pages={119--152} -} - -@book{cn9, - title={集成运算放大器应用手册}, - author={W.G}, - publisher={集成运算放大器应用手册}, - year={1990}, - pages={3--72} -} - -@book{cn10, - title={电子线路}, - author={谢嘉奎}, - publisher={北京:高等教育出版社}, - year={1999}, - pages={321--323} -} - -@book{cn11, - title={数字电路}, - author={龚之春}, - publisher={成都:电子科技大学出版}, - year={1999}, - pages={123--127} -} - -@book{cn12, - title={单片机基础}, - author={李广弟}, - publisher={北京:北京航空航天大学出版社}, - year={1994}, - pages={6--28} -} \ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-bc.config-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-bc.config-module.code.tex index fa36d01ca6..c404557382 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis-bc.config-module.code.tex +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-bc.config-module.code.tex @@ -22,9 +22,6 @@ \begin{titlepage} \__hduthesis_cover_bc_aux: \end{titlepage} - \titlepage - \__hduthesis_promise_bc_aux: - \endtitlepage \restoregeometry } @@ -44,7 +41,7 @@ { \textbf { - \exp_args:Nne \__hduthesis_cover_spread_box:nn + \__hduthesis_cover_spread_box:nn { .205\paperwidth } { \l__docinfo_entitle_tl } } } @@ -57,8 +54,7 @@ >{\large\centering\arraybackslash\kaishu}p{.65\linewidth}@{} } \__hduthesis_cover_spread_box:nn { 4\ccwd } { 题目 } & - \__hduthesis_cover_center_box:nn { .95\linewidth } - { \l__docinfo_cntitle_tl }\\[5.2ex] + \__hduthesis_cover_center_box:nn { .95\linewidth } { \@title }\\[5.2ex] \__hduthesis_cover_spread_box:nn { 4\ccwd } { 学院 } & \__hduthesis_cover_center_box:nn { .95\linewidth } { \l__docinfo_department_tl }\\[5.2ex] @@ -72,8 +68,7 @@ \__hduthesis_cover_center_box:nn { .95\linewidth } { \l__docinfo_stdntid_tl }\\[5.2ex] \__hduthesis_cover_spread_box:nn { 4\ccwd } { 学生姓名 } & - \__hduthesis_cover_center_box:nn { .95\linewidth } - { \l__docinfo_cnauthor_tl }\\[5.2ex] + \__hduthesis_cover_center_box:nn { .95\linewidth } { \@author }\\[5.2ex] \__hduthesis_cover_spread_box:nn { 4\ccwd } { 指导教师 } & \__hduthesis_cover_center_box:nn { .95\linewidth } { \l__docinfo_cnsupervisor_tl \quad \l__docinfo_cnrole_tl }\\[5.2ex] @@ -87,23 +82,44 @@ \end{center} } -\cs_new_protected_nopar:Nn \__hduthesis_promise_bc_aux: +\NewDocumentCommand \commitment { O{} } + { + \newgeometry{ margin = 3cm } + \titlepage + \__hduthesis_commitment_bc_aux:n {#1} + \endtitlepage + \restoregeometry + } +\cs_new_protected_nopar:Npn \__hduthesis_commitment_bc_aux:n #1 { \vspace*{65\p@} \begin{center} \@beginparpenalty \@lowpenalty - \Large \textsf{\bfseries \__hduthesis_cover_spread_box:nn {6\ccwd}{诚信承诺}} + \Large \textsf + { \bfseries \__hduthesis_cover_spread_box:nn { 6\ccwd }{ 诚信承诺 } } \@endparpenalty \@M \end{center} \vspace*{.4\baselineskip} \par \linespread{2.1} - {\semilarge - 我谨在此承诺:本人所写的毕业论文《\l__docinfo_cntitle_tl》均系本人独立完成, + { \semilarge + 我谨在此承诺:本人所写的毕业论文《\@title 》均系本人独立完成, 没有抄袭行为,凡涉及其他作者的观点和材料,均作了注释,若有不实,后果由本人承担。 \par\vspace*{\baselineskip} \bfseries\sffamily \hskip.48\linewidth 承诺人(签名): - \vspace*{.5\baselineskip}\par - \hskip \dim_eval:n{ .48\linewidth + 2em } 年\qquad 月\qquad 日 + \__hduthesis_signature_process_aux:nnn {#1}{1}{0} + \tl_if_empty:NF \l__hduthesis_signature_figure_tl + { + \signature { \l__hduthesis_signature_figure_tl } + \tl_clear:N \l__hduthesis_signature_figure_tl + } + \par \vspace*{.5\baselineskip} + \hskip \dim_eval:n { .48\linewidth - 1em } + \makebox [ 3em ] + { \__hduthesis_signature_process_aux:nnn {#1}{1}{1} } 年 + \makebox [ 2em ] + { \__hduthesis_signature_process_aux:nnn {#1}{1}{2} } 月 + \makebox [ 2em ] + { \__hduthesis_signature_process_aux:nnn {#1}{1}{3} } 日 } } @@ -113,15 +129,16 @@ { \tl_set:Nn \l__keywords_name_tl {Keywords:~} \tl_set:Nn \l__keywords_sep_tl {;~} + \@beginparpenalty\@lowpenalty + \chapter*{\normalfont\bfseries ABSTRACT} } \str_if_eq:nnT {#1} {cn} { \tl_set:Nn \l__keywords_name_tl {\textsf{关键词:}} \tl_set:Nn \l__keywords_sep_tl {;} + \@beginparpenalty\@lowpenalty + \chapter*{摘\qquad 要} } - \@beginparpenalty\@lowpenalty - \str_if_eq:nnT {#1} {en} {\chapter*{\normalfont\bfseries ABSTRACT}} - \str_if_eq:nnT {#1} {cn} {\chapter*{摘\qquad 要}} } { \tl_clear:N \l__abstract_name_tl @@ -157,11 +174,8 @@ { chapter = { - name = {}, fixskip = true, - beforeskip = 21pt, afterskip = 34pt, - number = \arabic{chapter}, - format+ = \sffamily\large, - pagestyle = fancy + fixskip = true, name = {}, beforeskip = 21pt, format+ = \sffamily\large, + pagestyle = fancy, afterskip = 34pt, number = \arabic{chapter}, }, section = { diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.l3doc-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.l3doc-module.code.tex index ffe1dbeac3..d0d70b9267 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.l3doc-module.code.tex +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.l3doc-module.code.tex @@ -8,7 +8,6 @@ CJKsans-font .tl_set:N = \g__docinfo_sans_CJK_font, CJKmono-font .tl_set:N = \g__docinfo_mono_CJK_font } - \NewDocumentCommand \DocInfo { m } { \keys_set:nn { hdu.l3doc / docinfo } {#1} @@ -17,8 +16,11 @@ \date { v\hduthesis@version - \footnote{\url{https://github.com/xiamyphys/hduthesis}}~ - (\hduthesis@date) + \footnote + { + \url{https://github.com/\hduthesis@maintainerid/hduthesis},~ + \url{https://gitee.com/\hduthesis@maintainerid/hduthesis} + }~ (\hduthesis@date) } \tl_if_empty:NF \g__docinfo_main_CJK_font { \exp_last_unbraced:No \setCJKmainfont \g__docinfo_main_CJK_font } @@ -28,29 +30,42 @@ { \exp_last_unbraced:No \setCJKmonofont \g__docinfo_mono_CJK_font } } -\hypersetup{urlcolor = teal, filecolor = violet} -\hologoFontSetup{general = \sffamily} -\RequirePackage[mono = false]{libertine} -\RequirePackage{geometry,framed,xeCJKfntef,tikz,pdfpages,subcaption} -\setlength{\oddsidemargin}{.9in} \setlength{\evensidemargin}{.1in} -\FrameSep = 0pt +\RequirePackage{ hyperref } +\RequirePackage [ svgnames ] { xcolor } +\hypersetup + { filecolor = DarkGreen, urlcolor = MidnightBlue, linkcolor = FireBrick } +\ExplSyntaxOff +\RenewDocumentCommand \pkg {m} { \href{https://ctan.org/pkg/#1}{\textsf{#1}} } +\RenewDocumentCommand \cls {m} { \href{https://ctan.org/pkg/#1}{\textsf{#1}} } +\NewDocumentCommand \mailto {m} { \texttt{<\href{mailto:#1}{#1}>} } +\pdfstringdefDisableCommands + { \def \file#1{<#1>} \def\pkg#1{<#1>} \def\cls#1{<#1>} \def\mailto#1{<#1>} } +\ExplSyntaxOn +\hologoFontSetup { general = \sffamily } +\RequirePackage [ mono = false ] { libertine } +\RequirePackage [ pass, verbose ] { geometry } +\RequirePackage + { fancyhdr, enumitem, tasks, tabularx, dirtree, framed, + xeCJKfntef, tikz, pdfpages, subcaption, datetime } +\pagestyle{plain} +\FrameSep = 0pt \yyyymmdddate \RequirePackage[os = mac]{menukeys} -\RequirePackage{datetime} \yyyymmdddate -\RequirePackage[fontset = none, scheme = plain]{ctex}\linespread{1.5} -\renewcommand \emph[1] - {\CJKsout*[thickness = 2.5ex, format = \color{blue!15}]{#1}} +\RequirePackage[fontset = none]{ctex} \linespread{1.4} +\def \@emph#1 { \CJKsout*[thickness = 2.5ex, format = \color{blue!15}]{#1} } +\def \s@emph#1 { \CJKunderwave*{#1} } +\renewcommand \emph { \@ifstar \s@emph \@emph } \hook_gput_code:nnn { env/function/before } { . } { \vspace{-2ex} } -\def\HoLogo@hduthesis#1 +\def \HoLogo@hduThesiS #1 { \raisebox{-.5pt} { \HOLOGO@mbox { - \tikz[baseline = (hduthesis.base)] + \tikz [ baseline = (hduthesis.base) ] { \node [ inner~sep = 0pt ] (hduthesis) - {\textsc{\cls{hduThesi\scalebox{1.2}[1.2]{S}}}}; + {\scshape \sffamily hduThesi\scalebox{1.2}[1.2]{S}}; \draw let \p1 = (hduthesis.west), \p2 = (hduthesis.east) in (\x1,\y1) (\x2,\y2) [ line~width = {.028pt * (\x2 - \x1)} ] ([yshift = -.5ex]hduthesis.north~west) to[ bend~right = 5 ] @@ -59,28 +74,28 @@ } } } +\def \HoLogo@hduthesis #1 + { \raisebox{-.5pt} { \HOLOGO@mbox { \scshape \cls{hduThesiS} } } } \let \legacy@maketitle \maketitle \RenewDocumentCommand \maketitle {} { + \newgeometry { margin = 1.2in } \titlepage - \newgeometry{margin = 1in} \legacy@maketitle \begin{center} \tikz { \node [ opacity = .8 ] - { \includegraphics[width = .15\paperwidth]{hdumotto.pdf} }; + { \includegraphics [ width = .14\paperwidth ] { hdumotto.pdf } }; \node [ opacity = .3 ] - { \includegraphics[width = .21\paperwidth]{hdulogo.pdf} }; + { \includegraphics [ width = .21\paperwidth ] { hdulogo.pdf } }; } \end{center} \thispagestyle{empty} } - -\NewDocumentCommand \mailto {m} - { \texttt{<\href{mailto:#1}{#1}>} } -\pdfstringdefDisableCommands - { \def\mailto#1{<#1>} } +\hook_gput_code:nnn { cmd/tableofcontents/before } { . } { \clearpage } +\hook_gput_code:nnn { cmd/tableofcontents/after } { . } + { \endtitlepage \restoregeometry } \endinput diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex index 1c13c626b3..43fbe1d81a 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex @@ -2,76 +2,107 @@ \keys_define:nn { hdu.stationery / docinfo } { - title .tl_set:N = \l__docinfo_title_tl, - author .tl_set:N = \l__docinfo_author_tl, - affliction .tl_set:N = \l__docinfo_affliction_tl, - date .tl_set:N = \l__docinfo_date_tl, - tel .tl_set:N = \l__docinfo_tel_tl, - mail .tl_set:N = \l__docinfo_mail_tl, + watermark .bool_set:N = \g__docinfo_watermark_bool, + watermark .initial:n = false, + watermark .default:n = true, + title .tl_set:N = \@title, + author .tl_set:N = \@author, + mail .tl_set:N = \l__docinfo_mail_tl, + date .tl_set:N = \@date } \RequirePackage{ hyperref, geometry, tikz, twemojis, fancyhdr } \NewDocumentCommand \DocInfo { m } { \keys_set:nn { hdu.stationery / docinfo } {#1} - \hypersetup { hidelinks, pdfauthor = \l__docinfo_author_tl } + \hypersetup { hidelinks, pdftitle = \@title, pdfauthor = \@author } } \geometry - { hmargin = .8in, bottom = 1.05in, top = 2.1in, + { hmargin = .8in, bottom = .75in, top = 1.95in, footskip = 15.87pt, headheight = 1.2in, headsep = .3in, footskip = .3in } \linespread{1.25} \RequirePackage [ skip = \baselineskip ] { parskip } \renewcommand* \familydefault { \sfdefault } -\tikzset{ every~node/.append~style = { opacity = .8 } } \definecolor{hdu}{HTML}{214395} -\renewcommand* \headrulewidth {1pt} -\renewcommand* \footrulewidth {1pt} +\renewcommand* \headrulewidth {2pt} +\renewcommand* \footrulewidth {2pt} \hook_gput_code:nnn { cmd/headrule/before } { . } { \color{hdu!80} } \hook_gput_code:nnn { cmd/footrule/before } { . } { \color{hdu!80} } \lhead - { - {}~ - \minipage{.64\linewidth} - \tikz [ baseline = -.6in ] - { \node { \includegraphics [ height = .75in ] { hdubadge } } } - \endminipage \hfill - \minipage{.32\linewidth} - \vbox - { - \raggedright \small - Date:~ - \tl_if_empty:NTF \l__docinfo_date_tl - { \today \par } - { \l__docinfo_date_tl \par } - \tl_if_empty:NF \l__docinfo_author_tl - { Name:~ \l__docinfo_author_tl \par } - \tl_if_empty:NF \l__docinfo_tel_tl - { Phone:~ \l__docinfo_tel_tl \par } - \tl_if_empty:NF \l__docinfo_mail_tl - { - Email:~ \href { mailto:\l__docinfo_mail_tl } - { \ttfamily \l__docinfo_mail_tl } - } - }\medskip + { {}~ + \minipage{.6\linewidth} + \medskip \leavevmode \lower -.111in + \hbox { \includegraphics [ height = .75in ] {hdubadge} } + \endminipage \medskip \hfill + \minipage{.36\linewidth} + \medskip \vbox + { \linespread{1.2} + \raggedright \small \color{hdu} + \texttwemoji{1f4cd}~ 1158~No.2~St.,~ Hangzhou,~ 310018\\ + \texttwemoji{1f4de}~ (86)~0571-86915072\\ + \texttwemoji{1f310}~ \url{www.hdu.edu.cn} + } \medskip \endminipage } -\cfoot - { \small \texttwemoji{1f4cd}~ +\lfoot + { + \small{}~ \texttwemoji{1f4cd}~ 1158~No.2~Street,~ Qiantang~District,~ - Hangzhou,~ Zhejiang~Province,~ 310018,~ China \qquad - \texttwemoji{1f310}~ www.hdu.edu.cn + Hangzhou,~ Zhejiang~Province,~ 310018,~ P.R.China } +\cfoot {} +\rfoot { \small \texttwemoji{1f310}~ www.hdu.edu.cn~ } \pagestyle{fancy} \renewcommand* \maketitle { - \l__docinfo_author_tl\\ - \l__docinfo_affliction_tl\\ - \textbf{\l__docinfo_title_tl} \par \vspace{.5\baselineskip} + \group_begin: \small + \bool_if:nF + { \tl_if_empty_p:N \@author && \tl_if_empty_p:N \l__docinfo_mail_tl } + { \makebox [ 4em ] [ l ] { \scshape From } } + \tl_if_empty:NTF \@author + { \@latex@warning@no@line {No \noexpand \author given} } { \@author{}~ } + \tl_if_empty:NF \l__docinfo_mail_tl + { \texttt { <\l__docinfo_mail_tl> } } + \bool_if:nT + { !\tl_if_empty_p:N \@author || !\tl_if_empty_p:N \l__docinfo_mail_tl } + { \\ } + \makebox [ 4em ] [ l ] { \scshape Date } + \tl_if_empty:NTF \@date \today \@date \\ + \tl_if_empty:NTF \@title + { \@latex@error {No \noexpand \title given}\@ehc } + { \makebox [ 4em ] [ l ] { \scshape Subject } \@title } + \par \vspace{.5\baselineskip} + \group_end: } \AtBeginDocument { \color_select:n {black!80} } +\DeclareHookRule { shipout / background } { hduthesis / stationery } + { before } { pgfrcs } +\AddToHook { shipout / background } [ hduthesis / stationery ] + { + \bool_if:NT \g__docinfo_watermark_bool + { + \tikz [ remember~picture, overlay ] + \node [ opacity = .2 ] at (current~page) + { \includegraphics [ width = .4\linewidth ] {hdulogo} }; + } + } + +\RequirePackage{tikzpagenodes} +\NewDocumentCommand \notelines {O{20}} + { + \tikz [ remember~picture, overlay ] + { + \int_step_inline:nn { #1 - 1 } + { + \draw [ hdu, very~thick, opacity = .6 ] + ([yshift = -##1 * (\textheight + .6in - 15.87pt ) / #1 + .3in] + current~page~text~area.north~west) --++ (\linewidth, 0); + } + } + } \newcommand \meta[1] { diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-layout-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-layout-module.code.tex index 8ff3467350..cfd2e72690 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis-layout-module.code.tex +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-layout-module.code.tex @@ -23,7 +23,7 @@ { \mode_leave_vertical: \hbox_to_wd:nn {#1} - { \exp_args:Nee \tl_map_inline:Nn {#2} { ##1 \hfil } \unskip } + { \exp_args:Nee \tl_map_inline:nn {#2} { ##1 \hfil } \unskip } } \cs_new_protected:Npn \__hduthesis_cover_center_box:nn #1#2 { % by @egreg on tex.stackexchange.com @@ -59,14 +59,10 @@ \seq_set_split:Nee \l__hduthesis_process_array_seq { / } {#1} \seq_set_split:Nee \l__hduthesis_process_array_row_seq { \c_colon_str } { \seq_item:Nn \l__hduthesis_process_array_seq {#2} } - \tl_if_eq:nnTF {#3} {~} + \tl_if_eq:nnTF {#3} {:} + { \tl_gset:Ne #4 { \seq_use:Nn \l__hduthesis_process_array_row_seq {} } } { - \tl_set:Ne #4 - { \seq_use:Nn \l__hduthesis_process_array_row_seq {} } - } - { - \tl_set:Ne #4 - { \seq_item:Nn \l__hduthesis_process_array_row_seq {#3} } + \tl_gset:Ne #4 { \seq_item:Nn \l__hduthesis_process_array_row_seq {#3} } } \seq_clear:N \l__hduthesis_process_array_seq \seq_clear:N \l__hduthesis_process_array_row_seq @@ -78,12 +74,12 @@ } \keys_define:nn { hduthesis / docinfo } { - title .clist_set:N = \l__docinfo_title_clist, + title .clist_set:N = \l__docinfo_title_tl, department .tl_set:N = \l__docinfo_department_tl, major .tl_set:N = \l__docinfo_major_tl, class .tl_set:N = \l__docinfo_class_tl, stdntid .tl_set:N = \l__docinfo_stdntid_tl, - author .clist_set:N = \l__docinfo_author_clist, + author .clist_set:N = \l__docinfo_author_tl, supervisor .tl_set:N = \l__docinfo_supervisor_tl, bibsource .tl_set:N = \l__docinfo_bibsource_tl, } @@ -95,13 +91,11 @@ } \cs_set_protected_nopar:Nn \__hduthesis_docinfo_process_aux: { - \__hduthesis_process_array:NnnN \l__docinfo_title_clist {1} {~} - \l__docinfo_cntitle_tl - \__hduthesis_process_array:NnnN \l__docinfo_title_clist {2} {~} + \__hduthesis_process_array:NnnN \l__docinfo_title_tl {1} {:} \@title + \__hduthesis_process_array:NnnN \l__docinfo_title_tl {2} {:} \l__docinfo_entitle_tl - \__hduthesis_process_array:NnnN \l__docinfo_author_clist {1} {~} - \l__docinfo_cnauthor_tl - \__hduthesis_process_array:NnnN \l__docinfo_author_clist {2} {~} + \__hduthesis_process_array:NnnN \l__docinfo_author_tl {1} {:} \@author + \__hduthesis_process_array:NnnN \l__docinfo_author_tl {2} {:} \l__docinfo_enauthor_tl \__hduthesis_process_array:NnnN \l__docinfo_supervisor_tl {1} {1} \l__docinfo_cnrole_tl @@ -130,4 +124,31 @@ } } +\cs_new_protected_nopar:Npn \__hduthesis_signature_process_aux:nnn #1#2#3 + { + \clist_set:Nn \l__hduthesis_signature_process_clist {#1} + \seq_set_split:Nne \l__hduthesis_signature_figure_seq {/} + { \clist_item:Nn \l__hduthesis_signature_process_clist {#2} } + \int_compare:nNnTF {#3} = {0} + { + \tl_set:Ne \l__hduthesis_signature_figure_tl + { \seq_item:Nn \l__hduthesis_signature_figure_seq { #3 + 1 } } + \seq_clear:N \l__hduthesis_signature_figure_seq + } + { + \seq_set_split:Nne \l__hduthesis_signature_date_seq {-} + { \seq_item:Nn \l__hduthesis_signature_figure_seq {2} } + \seq_item:Nn \l__hduthesis_signature_date_seq {#3} + \seq_clear:N \l__hduthesis_signature_date_seq + } + \clist_clear:N \l__hduthesis_signature_process_clist + } + +\NewDocumentCommand \signature { m } + { + \leavevmode@ifvmode + \lower \dimexpr \f@size\p@ * 9/16 + \hbox { \includegraphics [ height = { \fp_eval:n {2*\f@size}\p@ } ] {#1} } + } + \endinput diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-pg.config-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-pg.config-module.code.tex index 291f6a8b99..3d48d98931 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis-pg.config-module.code.tex +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-pg.config-module.code.tex @@ -24,9 +24,6 @@ \titlepage \__hduthesis_enoverleaf_pg_aux: \endtitlepage - \titlepage - \__hduthesis_promise_pg_aux: - \endtitlepage \restoregeometry \pagenumbering{Roman} \cfoot {\small \thepage} @@ -40,15 +37,13 @@ { \LARGE\__hduthesis_cover_spread_box:nn {.575\linewidth} {硕士学位论文} } \par\vspace*{100\p@} \semiLarge 题 \qquad 目: - \__hduthesis_cover_center_box:nn { .75\linewidth } - { \kaishu \l__docinfo_cntitle_tl } + \__hduthesis_cover_center_box:nn { .75\linewidth } { \kaishu \@title } \vspace*{24\p@}\par \begin{tabular} { >{\semiLarge\centering\arraybackslash}p{4\ccwd}@{} >{\semiLarge\centering\arraybackslash\kaishu}p{.65\linewidth}@{} } \__hduthesis_cover_spread_box:nn { 4\ccwd } { 研究生 } & - \__hduthesis_cover_center_box:nn { .96\linewidth } - { \l__docinfo_cnauthor_tl }\\ + \__hduthesis_cover_center_box:nn { .96\linewidth } { \@author }\\ \__hduthesis_cover_spread_box:nn { 4\ccwd } { 专业 } & \__hduthesis_cover_center_box:nn { .96\linewidth } { \l__docinfo_major_tl }\\ @@ -74,18 +69,15 @@ { \LARGE 杭州电子科技大学硕士学位论文 } \vspace*{140\p@} \par \begin{spacing}{1.15} - \huge\textsf{\l__docinfo_cntitle_tl} + \huge\textsf{ \@title } \end{spacing} \vspace*{128\p@} \par \begin{tabular}{>{\semiLarge}p{6.25\ccwd}>{\semiLarge\kaishu}l} \__hduthesis_cover_spread_box:nn { 4\ccwd } {研究生}:& - \__hduthesis_cover_spread_box:nn { 4\ccwd } - { \l__docinfo_cnauthor_tl }\\[2ex] + \__hduthesis_cover_spread_box:nn { 4\ccwd } { \@author }\\[2ex] \__hduthesis_cover_spread_box:nn { 4\ccwd } {指导教师}:& - % \exp_args:Nne \__hduthesis_cover_spread_box:nn { 4\ccwd } - { \l__docinfo_cnsupervisor_tl } \hskip1.5em - \l__docinfo_cnrole_tl + { \l__docinfo_cnsupervisor_tl } \hskip1.5em \l__docinfo_cnrole_tl \end{tabular} \par \vspace{60\p@} \semilarge \textsf{\int_use:N \c_sys_year_int} \kaishu 年 @@ -121,8 +113,17 @@ \int_use:N \c_sys_year_int \end{center} } - -\cs_new_protected_nopar:Nn \__hduthesis_promise_pg_aux: +\NewDocumentCommand \commitment { O{} } + { + \cfoot {} + \newgeometry{margin = 2.75cm} + \titlepage + \__hduthesis_commitment_pg_aux:n {#1} + \endtitlepage + \restoregeometry + \cfoot {\small \thepage} + } +\cs_new_protected_nopar:Npn \__hduthesis_commitment_pg_aux:n #1 { \vspace*{-12\p@} \begin{center} @@ -140,8 +141,21 @@ 对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。\par \noindent 申请学位论文与资料若有不实之处,本人承担一切相关责任。 \par \vspace*{1.25\baselineskip} - \noindent \makebox[.45\linewidth][l]{论文作者签名:} - 日期:\qquad 年\qquad 月\qquad 日 + \noindent \makebox[.45\linewidth][l] + { + 论文作者签名: + \__hduthesis_signature_process_aux:nnn {#1}{1}{0} + \tl_if_empty:NF \l__hduthesis_signature_figure_tl + { + \signature { \l__hduthesis_signature_figure_tl } + \tl_clear:N \l__hduthesis_signature_figure_tl + } + } + 日期: + \makebox [ 2.5em ] [ l ] + { \__hduthesis_signature_process_aux:nnn {#1}{1}{1} } 年 + \makebox [ 2em ] { \__hduthesis_signature_process_aux:nnn {#1}{1}{2} } 月 + \makebox [ 2em ] { \__hduthesis_signature_process_aux:nnn {#1}{1}{3} } 日 \par\vspace*{20\p@} \begin{center} \semilarge 学位论文使用授权说明 @@ -154,11 +168,41 @@ 学校有权保留送交论文的复印件,允许查阅和借阅论文;学校可以公布论文的全部或部分内容, 可以允许采用影印、缩印或其它复制手段保存论文。(保密论文在解密后遵守此规定) \par \vspace*{1.25\baselineskip} - \noindent \makebox[.45\linewidth][l]{论文作者签名:} - 日期:\qquad 年\qquad 月\qquad 日 + \noindent \makebox[.45\linewidth][l] + { + 论文作者签名: + \__hduthesis_signature_process_aux:nnn {#1}{2}{0} + \tl_if_empty:NF \l__hduthesis_signature_figure_tl + { + \signature { \l__hduthesis_signature_figure_tl } + \tl_clear:N \l__hduthesis_signature_figure_tl + } + } + 日期: + \makebox [ 2.5em ] [ l ] + { \__hduthesis_signature_process_aux:nnn {#1}{2}{1} } 年 + \makebox [ 2em ] + { \__hduthesis_signature_process_aux:nnn {#1}{2}{2} } 月 + \makebox [ 2em ] + { \__hduthesis_signature_process_aux:nnn {#1}{2}{3} } 日 \par \vspace*{\baselineskip} - \noindent \makebox[.45\linewidth][l]{指导教师签名:} - 日期:\qquad 年\qquad 月\qquad 日 + \noindent \makebox[.45\linewidth][l] + { + 指导教师签名: + \__hduthesis_signature_process_aux:nnn {#1}{3}{0} + \tl_if_empty:NF \l__hduthesis_signature_figure_tl + { + \signature { \l__hduthesis_signature_figure_tl } + \tl_clear:N \l__hduthesis_signature_figure_tl + } + } + 日期: + \makebox [ 2.5em ] [ l ] + { \__hduthesis_signature_process_aux:nnn {#1}{3}{1} } 年 + \makebox [ 2em ] + { \__hduthesis_signature_process_aux:nnn {#1}{3}{2} } 月 + \makebox [ 2em ] + { \__hduthesis_signature_process_aux:nnn {#1}{3}{3} } 日 \end{spacing} \end{spacing} } @@ -169,23 +213,18 @@ { \tl_set:Nn \l__keywords_name_tl {Keywords:~} \tl_set:Nn \l__keywords_sep_tl {,~} + \@beginparpenalty\@lowpenalty + \chapter*{\normalfont\bfseries Abstract} + \addcontentsline{toc}{chapter}{\bfseries Abstract} } \str_if_eq:nnT {#1} {cn} { \tl_set:Nn \l__keywords_name_tl {\textsf{关键词:}} \tl_set:Nn \l__keywords_sep_tl {,} - } - \@beginparpenalty\@lowpenalty - \str_if_eq:nnT {#1} {cn} - { + \@beginparpenalty\@lowpenalty \chapter*{摘要} \addcontentsline{toc}{chapter}{摘要} } - \str_if_eq:nnT {#1} {en} - { - \chapter*{\normalfont\bfseries Abstract} - \addcontentsline{toc}{chapter}{\bfseries Abstract} - } } { \tl_clear:N \l__abstract_name_tl diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-typeset-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-typeset-module.code.tex index 24b069a646..ed0878b025 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis-typeset-module.code.tex +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-typeset-module.code.tex @@ -7,20 +7,24 @@ \setmainfont{texgyretermes} [ - Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-italic, BoldItalicFont = *-bolditalic + Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, + ItalicFont = *-italic, BoldItalicFont = *-bolditalic ] \setsansfont{texgyreheros} [ Extension = .otf, BoldItalicFont = *-bolditalic, UprightFont = *-regular, BoldFont = *-bold, - ItalicFont = *-italic, scale = .9, + ItalicFont = *-italic, Scale = .9, ] -\RequirePackage { amssymb, extarrows, mathtools, - cancel, physics2, fixdif, derivative } +\RequirePackage { amssymb, mathtools, cancel, fixdif, derivative } +\file_if_exist:nTF { physics2.sty } + { + \RequirePackage{physics2} + \usephysicsmodule{ ab, braket, ab.legacy, op.legacy, bm-um.legacy } + } { \RequirePackage{bm} } \RequirePackage [ warnings-off = { mathtools-colon, mathtools-overbracket } ] {unicode-math} -\usephysicsmodule{ ab, braket, ab.legacy, op.legacy, bm-um.legacy } \AtBeginDocument { \dim_set:Nn \abovedisplayskip {3pt} diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis.cls b/macros/xetex/latex/hduthesis/tex/hduthesis.cls index 048f8afc6d..1a3b42ed5b 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis.cls +++ b/macros/xetex/latex/hduthesis/tex/hduthesis.cls @@ -20,15 +20,26 @@ %% hduthesis-hdu.l3doc-module.code, * %% hduthesis-hdu.stationery-module.code, * %% and README.md. * -%% available at https://github.com/xiamyphys/hduthesis * +%% available at https://github.com/myhsia/hduthesis * %% ***************************************************************************** -\def\hduthesis@date{2024/11/25} -\def\hduthesis@version{0.4.0} +\def\hduthesis@date{2024/12/23} +\def\hduthesis@version{0.5.0} +\def\hduthesis@maintainerid{myhsia} \RequirePackage{etoolbox} \ProvidesExplClass{hduthesis} {\hduthesis@date} {\hduthesis@version} {LaTeX Class for Thesis at Hangzhou Dianzi University} +% Module for TeX Live 2022 and (or) later +\cs_if_exist:NF \seq_set_split:Nne + { \cs_generate_variant:Nn \seq_set_split:Nnn { Nne } } +\cs_if_exist:NF \seq_set_split:Nee + { \cs_generate_variant:Nn \seq_set_split:Nnn { Nee } } +\cs_if_exist:NF \tl_set:Ne + { \cs_generate_variant:Nn \tl_set:Nn { Ne } } +\cs_if_exist:NF \tl_gset:Ne + { \cs_generate_variant:Nn \tl_gset:Nn { Ne } } + \cs_new_protected:Npn \hduthesis_msg_new:nn #1#2 { \msg_new:nnn { hduthesis } {#1} {#2} } \cs_new_protected:Npn \hduthesis_msg_error:nn #1#2 @@ -81,7 +92,7 @@ CJKmain-font .tl_set:N = \g__hduthesis_main_CJK_font, CJKsans-font .tl_set:N = \g__hduthesis_sans_CJK_font, CJKmono-font .tl_set:N = \g__hduthesis_mono_CJK_font, - unknown .code:n = \__hduthesis_unknown_option:n { #1 }, + unknown .code:n = \__hduthesis_unknown_option:n {#1}, } \cs_new_protected_nopar:Npn \__hduthesis_unknown_option:n #1 { @@ -98,7 +109,7 @@ \bool_if:NT \g__hduthesis_doc_bool { - \PassOptionsToClass{ 11pt, letterpaper } { l3doc } + \PassOptionsToClass { 11pt, letterpaper, kernel } { l3doc } \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { l3doc } \hduthesis_load_module:n { hdu.l3doc } \endinput @@ -106,7 +117,7 @@ \bool_if:NT \g__hduthesis_stationery_bool { - \PassOptionsToClass{ 12pt } { letter } + \PassOptionsToClass { 12pt } { letter } \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { letter } \hduthesis_load_module:n { hdu.stationery } \endinput @@ -120,8 +131,8 @@ \RequirePackage{hyperref} \pdfstringdefDisableCommands { - \def\cite#1{<#1>} - \def\hologoRobust#1{<#1>} + \def \cite#1 {<#1>} + \def \hologoRobust#1 {<#1>} } \AtBeginDocument { \hypersetup { hidelinks, pdfproducer = hduThesiS~by~Mingyu~Xia } } @@ -130,7 +141,7 @@ \RequirePackage { siunitx, circuitikz, pgfplots, listings, hologo, lipsum, zhlipsum, booktabs, multicol } \pgfplotsset { compat = newest } -\hologoFontSetup{general = \sffamily} +\hologoFontSetup { general = \sffamily } \graphicspath { {./figure/}{./figures/}{./image/}{./images/} @@ -146,5 +157,4 @@ } \endinput - % End of file hduthesis.cls -- cgit v1.2.3