diff options
author | Norbert Preining <norbert@preining.info> | 2021-01-13 03:03:59 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-01-13 03:03:59 +0000 |
commit | 71afdd6fa05b7d22995dc2c38eb3242311d8c23a (patch) | |
tree | 5e86daf5cbf8cb836e9943dc99c1ada3b1fcc9aa /macros/latex/contrib/easybook/easybook.cls | |
parent | 59f820c29fe15f643154da97419acf78749bde8f (diff) |
CTAN sync 202101130303
Diffstat (limited to 'macros/latex/contrib/easybook/easybook.cls')
-rw-r--r-- | macros/latex/contrib/easybook/easybook.cls | 386 |
1 files changed, 209 insertions, 177 deletions
diff --git a/macros/latex/contrib/easybook/easybook.cls b/macros/latex/contrib/easybook/easybook.cls index 48f079ad66..3102ff922f 100644 --- a/macros/latex/contrib/easybook/easybook.cls +++ b/macros/latex/contrib/easybook/easybook.cls @@ -9,10 +9,12 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e} \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/01/11}{v1.21}{} +\ProvidesExplClass{easybook}{2021/01/12}{v1.21b}{} \cs_generate_variant:Nn \keys_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} +\cs_new_protected:Npn \__ctex_define:n #1 + {\keys_define:nn {ctex/#1}} \cs_new_protected:Npn \__put_ctexbook:n #1 {\PassOptionsToClass{#1}{ctexbook}} \cs_new_protected:Npn \__patch_cmd:Nnn #1#2#3 @@ -23,10 +25,9 @@ \bool_set_false:N \l__draft_bool \bool_set_false:N \l__newline_bool \bool_set_false:N \l__enstyle_bool +\bool_set_false:N \l__myfont_bool \bool_set_true:N \l__zhtitle_bool -\bool_set_true:N \l__myfont_bool \bool_set_true:N \l__lang_chinese_bool -\bool_set_false:N \l__paper_bfive_bool \bool_set_true:N \l__paper_afour_bool \bool_set_true:N \l__page_twoside_bool \clist_new:N \g__options_clist @@ -40,43 +41,32 @@ english .code:n = {\bool_set_false:N \l__lang_chinese_bool}, font .choice:, + font .value_required:n = true, + font/overleaf .code:n = {}, font/adobe .code:n = - { - \__put_ctexbook:n {fontset = #1} - \bool_set_false:N \l__myfont_bool - }, + {\__put_ctexbook:n {fontset = #1}}, font/founder .code:n = - { - \__put_ctexbook:n {fontset = #1} - \bool_set_false:N \l__myfont_bool - }, + {\__put_ctexbook:n {fontset = #1}}, font/mac .code:n = - { - \__put_ctexbook:n {fontset = #1} - \bool_set_false:N \l__myfont_bool - }, + {\__put_ctexbook:n {fontset = #1}}, font/windows .code:n = - { - \__put_ctexbook:n {fontset = #1} - \bool_set_false:N \l__myfont_bool - }, + {\__put_ctexbook:n {fontset = #1}}, font/linux .code:n = - { - \__put_ctexbook:n {fontset = ubuntu} - \bool_set_false:N \l__myfont_bool - }, - font/overleaf .code:n = - {\bool_set_false:N \l__myfont_bool}, + {\__put_ctexbook:n {fontset = ubuntu}}, font/none .code:n = + {\__put_ctexbook:n {fontset = #1}}, + font/myfont .code:n = { - \__put_ctexbook:n {fontset = #1} - \bool_set_false:N \l__myfont_bool + \bool_set_true:N \l__myfont_bool + \__put_ctexbook:n {fontset = none} }, - font .default:n = windows, + font .initial:n = overleaf, paper .choice:, + paper .value_required:n = true, paper/a4 .code:n = {}, - paper/b5 .code:n = {\bool_set_true:N \l__paper_bfive_bool}, + paper/b5 .code:n = + {\bool_set_false:N \l__paper_afour_bool}, paper .initial:n = a4, oneside .value_forbidden:n = true, @@ -90,7 +80,6 @@ \ProcessKeysOptions{easybook} -\bool_if:NT \l__myfont_bool{\__put_ctexbook:n {fontset = none}} \bool_if:NT \l__enstyle_bool { \bool_set_false:N \l__lang_chinese_bool @@ -106,28 +95,13 @@ \LoadClass[UTF8]{ctexbook} \bool_set_true:N \l__backend_bibtex_bool -\clist_new:N \l__hyperref_clist -\bool_new:N \l__thmbox_bool -\bool_new:N \l__capdash_bool -\bool_new:N \l__multoc_bool -\bool_new:N \l__chap_withpart_bool -\bool_new:N \l__foot_perpart_bool -\bool_new:N \l__foot_perpage_bool -\fp_new:N \l__line_spread_fp -\fp_new:N \l__tab_spread_fp -\tl_new:N \l__math_spread_tl -\tl_new:N \l__cap_spread_tl -\tl_new:N \l__foot_spread_tl -\tl_new:N \l__tab_font_tl -\tl_new:N \l__fig_font_tl -\tl_new:N \l__lst_font_tl -\tl_new:N \l__foot_font_tl -\tl_new:N \l__margin_font_tl -\tl_new:N \l__bib_mysty_tl -\tl_new:N \l__bib_style_tl -\tl_new:N \l__bib_citesty_tl -\tl_new:N \l__bib_file_tl -\tl_new:N \g__config_tl +\bool_new:N \l__capdash_bool +\bool_new:N \l__multoc_bool +\bool_new:N \l__chap_withpart_bool +\bool_new:N \l__foot_perpart_bool +\bool_new:N \l__foot_perpage_bool +\clist_new:N \l__hyperref_clist +\tl_new:N \g__config_tl \ctex_define:n { @@ -136,75 +110,28 @@ spread .meta:nn = {ctex/spread}{#1}, elfont .meta:nn = {ctex/elfont}{#1}, bibset .meta:nn = {ctex/bibset}{#1}, + thmset .meta:nn = {ctex/thmset}{#1}, config .tl_set:N = \g__config_tl, - - style/thmbox .bool_set:N = \l__thmbox_bool, - style/thmbox .default:n = true, - style/thmbox .initial:n = false, - style/capdash .bool_set:N = \l__capdash_bool, - style/capdash .default:n = true, - style/capdash .initial:n = false, - style/multoc .bool_set:N = \l__multoc_bool, - style/multoc .default:n = true, - style/multoc .initial:n = false, - style/withpart .bool_set:N = \l__chap_withpart_bool, - style/withpart .default:n = true, - style/withpart .initial:n = false, - style/perpart .bool_set:N = \l__foot_perpart_bool, - style/perpart .default:n = true, - style/perpart .initial:n = false, - style/perpage .bool_set:N = \l__foot_perpage_bool, - style/perpage .default:n = true, - style/perpage .initial:n = false, - - spread/linespread .fp_set:N = \l__line_spread_fp, - spread/linespread .initial:n = 1.3, - spread/tabspread .fp_set:N = \l__tab_spread_fp, - spread/tabspread .initial:n = 1, - spread/mathspread .tl_set:N = \l__math_spread_tl, - spread/mathspread .initial:n = 1, - spread/capspread .tl_set:N = \l__cap_spread_tl, - spread/capspread .initial:n = 1, - spread/fnspread .tl_set:N = \l__foot_spread_tl, - spread/fnspread .initial:n = 1, - - elfont/tabfont .tl_set:N = \l__tab_font_tl, - elfont/tabfont .initial:n = \sffamily\small, - elfont/figfont .tl_set:N = \l__fig_font_tl, - elfont/figfont .initial:n = \sffamily\small, - elfont/lstfont .tl_set:N = \l__lst_font_tl, - elfont/lstfont .initial:n = \sffamily\small, - elfont/fnfont .tl_set:N = \l__foot_font_tl, - elfont/fnfont .initial:n = \rmfamily, - elfont/marfont .tl_set:N = \l__margin_font_tl, - elfont/marfont .initial:n = \rmfamily\footnotesize, - - bibset/backend .choice:, - bibset/backend/bibtex .code:n = {}, - bibset/backend/biblatex .code:n = - {\bool_set_false:N \l__backend_bibtex_bool}, - bibset/bibstyle .choice:, - bibset/bibstyle .value_required:n = true, - bibset/bibstyle/number .code:n = - { - \tl_set:Nn \l__bib_style_tl{number} - \tl_clear:N \l__bib_mysty_tl - }, - bibset/bibstyle/authoryear .code:n = - { - \tl_set:Nn \l__bib_style_tl{authoryear} - \tl_clear:N \l__bib_mysty_tl - }, - bibset/bibstyle/unknown .code:n = - {\tl_set_eq:NN \l__bib_mysty_tl\l_keys_value_tl}, - bibset/bibstyle .initial:n = number, - bibset/citestyle .code:n = - {\tl_set:Nn \l__bib_citesty_tl{#1}}, - bibset/bibfile .tl_set:N = \l__bib_file_tl, - bibset/bibfile .initial:n = ref/refs.bib, - - lstlistlistingname .tl_set:N = \lstlistlistingname, - lstlistingname .tl_set:N = \lstlistingname + lstlistlistingname .tl_set:N = \lstlistlistingname, + lstlistingname .tl_set:N = \lstlistingname + } +\__ctex_define:n {style} + { + capdash .bool_set:N = \l__capdash_bool, + capdash .default:n = true, + capdash .initial:n = false, + multoc .bool_set:N = \l__multoc_bool, + multoc .default:n = true, + multoc .initial:n = false, + withpart .bool_set:N = \l__chap_withpart_bool, + withpart .default:n = true, + withpart .initial:n = false, + perpart .bool_set:N = \l__foot_perpart_bool, + perpart .default:n = true, + perpart .initial:n = false, + perpage .bool_set:N = \l__foot_perpage_bool, + perpage .default:n = true, + perpage .initial:n = false } \RequirePackage[svgnames]{xcolor} @@ -333,7 +260,7 @@ } \cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont} -\bool_if:NT \l__paper_afour_bool +\bool_if:NTF \l__paper_afour_bool { \geometry { @@ -348,9 +275,7 @@ marginparsep = 8pt, marginparwidth = 2.54cm } - } -\bool_if:NT \l__paper_bfive_bool - { + }{ \geometry { b5paper, @@ -628,6 +553,26 @@ {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} {\__markboth:n \indexname} +\tl_new:N \l__tab_font_tl +\tl_new:N \l__fig_font_tl +\tl_new:N \l__lst_font_tl +\tl_new:N \l__foot_font_tl +\tl_new:N \l__margin_font_tl + +\__ctex_define:n {elfont} + { + tabfont .tl_set:N = \l__tab_font_tl, + tabfont .initial:n = \sffamily\small, + figfont .tl_set:N = \l__fig_font_tl, + figfont .initial:n = \sffamily\small, + lstfont .tl_set:N = \l__lst_font_tl, + lstfont .initial:n = \sffamily\small, + fnfont .tl_set:N = \l__foot_font_tl, + fnfont .initial:n = \rmfamily, + marfont .tl_set:N = \l__margin_font_tl, + marfont .initial:n = \rmfamily\footnotesize + } + \DeclareCaptionLabelSeparator{ccwd}{\hspace{\ccwd}} \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)} \DeclareCaptionFont{tabfont}{\l__tab_font_tl} @@ -679,6 +624,29 @@ \AtBeginEnvironment{tabular} {\exp_args:Nx \linespread{\fp_use:N \l__tab_spread_fp}\selectfont\ignorespaces} +\fp_new:N \l__line_spread_fp +\fp_new:N \l__tab_spread_fp +\tl_new:N \l__math_spread_tl +\tl_new:N \l__cap_spread_tl +\tl_new:N \l__foot_spread_tl +\tl_new:N \l__foot_fnsep_tl + +\__ctex_define:n {spread} + { + linespread .fp_set:N = \l__line_spread_fp, + linespread .initial:n = 1.3, + tabspread .fp_set:N = \l__tab_spread_fp, + tabspread .initial:n = 1, + mathspread .tl_set:N = \l__math_spread_tl, + mathspread .initial:n = 1, + capspread .tl_set:N = \l__cap_spread_tl, + capspread .initial:n = 1, + fnspread .tl_set:N = \l__foot_spread_tl, + fnspread .initial:n = 1, + fnsep .tl_set:N = \l__foot_fnsep_tl, + fnsep .initial:n = 0ex + } + \skip_set:Nn \parskip{0pt plus 2pt minus 1pt} \skip_set:Nn \floatsep{12pt plus 2pt minus 2pt} \skip_set:Nn \intextsep{14pt plus 2pt minus 2pt} @@ -758,37 +726,69 @@ }{\__thmname_set:nn #1} } -\declaretheoremstyle[ - spaceabove = .75ex plus .1ex, - spacebelow = .75ex plus .1ex, - headindent = 0\ccwd, - headfont = \color{ctex@emph}\sffamily, - notefont = {}, - notebraces = {}{}, - bodyfont = \normalfont, - headpunct = {.}, - postheadspace = \ccwd, - numberwithin = chapter, - headformat = \NAME\space\NUMBER\NOTE - ]{mythm} -\declaretheorem[style = mythm,name = \c__name_theorem_tl]{theorem} -\declaretheorem[style = mythm,name = \c__name_definition_tl]{definition} -\declaretheorem[style = mythm,name = \c__name_lemma_tl]{lemma} -\declaretheorem[style = mythm,name = \c__name_corollary_tl]{corollary} -\declaretheorem[style = mythm,name = \c__name_proposition_tl]{proposition} -\declaretheorem[style = mythm,name = \c__name_example_tl]{example} -\cs_gset_eq:NN \proof\relax -\declaretheorem{remark}[ - style = mythm, - name = \faCommentingO\space\c__name_remark_tl, - numbered = no - ] -\declaretheorem{proof}[ - style = mythm, - name = \faPencilSquareO\space\proofname, - numbered = no, - qed = \qedsymbol - ] +\bool_new:N \l__thmbox_bool +\tl_new:N \l__thm_numberwith_tl +\tl_new:N \l__thm_headpunct_tl +\tl_new:N \l__thm_bodyfont_tl +\tl_new:N \l__thm_notefont_tl +\tl_new:N \l__thm_headindent_tl +\tl_new:N \l__thm_spaceabove_tl +\tl_new:N \l__thm_spacebelow_tl + +\__ctex_define:n {thmset} + { + thmbox .bool_set:N = \l__thmbox_bool, + thmbox .default:n = true, + thmbox .initial:n = false, + numberwith .tl_set:N = \l__thm_numberwith_tl, + numberwith .initial:n = {chapter}, + headpunct .tl_set:N = \l__thm_headpunct_tl, + headpunct .initial:n = {}, + bodyfont .tl_set:N = \l__thm_bodyfont_tl, + bodyfont .initial:n = {}, + notefont .tl_set:N = \l__thm_notefont_tl, + notefont .initial:n = {}, + headindent .tl_set:N = \l__thm_headindent_tl, + headindent .initial:n = {0\ccwd}, + spaceabove .tl_set:N = \l__thm_spaceabove_tl, + spaceabove .initial:n = {.75ex plus .1ex}, + spacebelow .tl_set:N = \l__thm_spacebelow_tl, + spacebelow .initial:n = {.75ex plus .1ex} + } +\ctex_at_end_preamble:n + { + \declaretheoremstyle[ + spaceabove = \l__thm_spaceabove_tl, + spacebelow = \l__thm_spacebelow_tl, + headindent = \l__thm_headindent_tl, + headfont = \color{ctex@emph}\sffamily, + notefont = \l__thm_notefont_tl, + notebraces = {}{}, + bodyfont = \l__thm_bodyfont_tl, + headpunct = \l__thm_headpunct_tl, + postheadspace = \ccwd, + numberwithin = \l__thm_numberwith_tl, + headformat = \NAME\space\NUMBER\NOTE + ]{mythm} + \declaretheorem[style = mythm,name = \c__name_theorem_tl]{theorem} + \declaretheorem[style = mythm,name = \c__name_definition_tl]{definition} + \declaretheorem[style = mythm,name = \c__name_lemma_tl]{lemma} + \declaretheorem[style = mythm,name = \c__name_corollary_tl]{corollary} + \declaretheorem[style = mythm,name = \c__name_proposition_tl]{proposition} + \declaretheorem[style = mythm,name = \c__name_example_tl]{example} + \cs_gset_eq:NN \proof\relax + \declaretheorem{remark}[ + style = mythm, + name = \c__name_remark_tl, + numbered = no + ] + \declaretheorem{proof}[ + style = mythm, + name = \proofname, + numbered = no, + qed = \qedsymbol + ] + } \settasks { @@ -930,7 +930,7 @@ center~title, IfValueT = {#2}{title = #2} } -\NewTCBox{\fuzzy}{O{yellow}O{}} +\NewTCBox{\fuzzy}{O{DarkSeaGreen}O{}} {nobeforeafter,tcbox~raise~base,blank,fuzzy~halo = 2pt~with~#1,#2} \DeclareTotalTCBox{\concise}{O{Aqua}O{}v} { @@ -940,6 +940,38 @@ colback = #1!15!white,#2 }{#3} +\tl_new:N \l__bib_mysty_tl +\tl_new:N \l__bib_style_tl +\tl_new:N \l__bib_citesty_tl +\tl_new:N \l__bib_file_tl + +\__ctex_define:n {bibset} + { + backend .choice:, + backend/bibtex .code:n = {}, + backend/biblatex .code:n = + {\bool_set_false:N \l__backend_bibtex_bool}, + bibstyle .choice:, + bibstyle .value_required:n = true, + bibstyle/number .code:n = + { + \tl_set:Nn \l__bib_style_tl{#1} + \tl_clear:N \l__bib_mysty_tl + }, + bibstyle/authoryear .code:n = + { + \tl_set:Nn \l__bib_style_tl{#1} + \tl_clear:N \l__bib_mysty_tl + }, + bibstyle/unknown .code:n = + {\tl_set_eq:NN \l__bib_mysty_tl\l_keys_value_tl}, + bibstyle .initial:n = number, + citestyle .code:n = + {\tl_set:Nn \l__bib_citesty_tl{#1}}, + bibfile .tl_set:N = \l__bib_file_tl, + bibfile .initial:n = ref/refs.bib + } + \cs_new_protected:Npn \__bibtex_set: { \tl_if_empty:NTF \l__bib_mysty_tl @@ -952,7 +984,7 @@ {\bibliographystyle{gbt7714-author-year}} \cs_set_eq:NN \cite\citep } - }{ + }{ \exp_args:NV \bibliographystyle\l__bib_mysty_tl } \cs_set:Npn \bibsection{\__title_mark_intoc:n \bibname} @@ -998,18 +1030,18 @@ } } -\skip_set:Nn \footnotemargin{0.5\ccwd} -\skip_set:Nn \footnotesep{0ex} -\cs_gset:Npn \hangfootparskip{0ex} -\cs_gset:Npn \footnoterule - { - \color{ctex@frame}\hrule width 0.35\columnwidth height 0.75pt - \vspace*{2.6pt}\color{black} - } -\bool_if:NT \l__lang_chinese_bool - {\cs_gset:Npn \hangfootparindent{2\ccwd}} \ctex_at_end_preamble:n { + \skip_set:Nn \footnotemargin{0.5\ccwd} + \skip_set:Nn \footnotesep{\l__foot_fnsep_tl} + \cs_gset:Npn \hangfootparskip{0ex} + \cs_gset:Npn \footnoterule + { + \color{ctex@frame}\hrule width 0.35\columnwidth height 0.75pt + \vspace*{2.6pt}\color{black} + } + \bool_if:NT \l__lang_chinese_bool + {\cs_gset:Npn \hangfootparindent{2\ccwd}} \bool_if:NT \l__chap_withpart_bool {\counterwithin*{chapter}{part}} \bool_if:NT \l__foot_perpart_bool @@ -1249,10 +1281,10 @@ \bool_if:NTF \l__newline_bool {\par\nobreak\vskip 1.5pc}{\hspace{\ccwd}} }, - beforeskip = -1.5ex, - afterskip = 3ex, - lotskip = 0.8pc, - lofskip = 0.8pc, + beforeskip = {-1.5ex}, + afterskip = {3ex}, + lotskip = {0.8pc}, + lofskip = {0.8pc}, tocline = {\CTEXifname{\CTEXthechapter\hspace{\ccwd}}{}#2} }, section = @@ -1260,8 +1292,8 @@ hang = true, format = {\color{ctex@frame}\sffamily\Large}, aftername = {\hspace{0.5\ccwd}}, - beforeskip = 1.5ex plus .2ex minus .1ex, - afterskip = 1.5ex plus .2ex minus .1ex, + beforeskip = {1.5ex plus .2ex minus .1ex}, + afterskip = {1.5ex plus .2ex minus .1ex}, tocline = {\CTEXifname{\CTEXthesection\hspace{\ccwd}}{}#2} }, subsection = @@ -1269,8 +1301,8 @@ hang = true, format = {\color{ctex@frame}\sffamily\large}, aftername = {\hspace{0.5\ccwd}}, - beforeskip = 1.3ex plus .2ex minus .1ex, - afterskip = 1.3ex plus .2ex minus .1ex, + beforeskip = {1.3ex plus .2ex minus .1ex}, + afterskip = {1.3ex plus .2ex minus .1ex}, tocline = {\CTEXifname{\CTEXthesubsection\hspace{\ccwd}}{}#2} }, subsubsection = @@ -1278,8 +1310,8 @@ hang = true, format = {\color{ctex@frame}\sffamily}, aftername = {\hspace{0.5\ccwd}}, - beforeskip = \parskip, - afterskip = \parskip + beforeskip = {\parskip}, + afterskip = {\parskip} } } |