diff options
author | Karl Berry <karl@freefriends.org> | 2021-06-16 20:43:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-06-16 20:43:19 +0000 |
commit | 38ff5bfc6797433b09363c3e187b6395f9bb09da (patch) | |
tree | d56d1fb1c7e2c882e85001ca287281750acc4ed9 /Master/texmf-dist/tex/latex | |
parent | 06ec64595c3f158672d23aadefeff2d07439700f (diff) |
easybook (16jun21)
git-svn-id: svn://tug.org/texlive/trunk@59609 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/easybook/easybase.sty | 180 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/easybook/easybook.cls | 24 |
2 files changed, 110 insertions, 94 deletions
diff --git a/Master/texmf-dist/tex/latex/easybook/easybase.sty b/Master/texmf-dist/tex/latex/easybook/easybase.sty index 6eed832fb2e..47448bdbe93 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybase.sty +++ b/Master/texmf-dist/tex/latex/easybook/easybase.sty @@ -13,7 +13,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2021/06/14}{1.26b}{beta} +\ProvidesExplPackage{easybase}{2021/06/16}{1.26d}{beta} \cs_generate_variant:Nn \eb_ctex_define:nn { nx } \cs_generate_variant:Nn \int_to_arabic:n { v } @@ -83,8 +83,16 @@ \keys_define:nn { easybase } { - draft .code:n = + draft .code:n = { \bool_set_true:N \l__eb_compile_draft_bool }, + floatpage .bool_set:N = \l__eb_float_page_bool, + floatpage .default:n = true, + floatpage .initial:n = false, + + paper .choice:, + paper .value_required:n = true, + paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, + paper .initial:n = a4paper, class .choice:, class .value_required:n = true, @@ -93,7 +101,8 @@ { \bool_set_false:N \l__eb_class_book_bool \bool_set_false:N \l__eb_page_twoside_bool - } + }, + class .initial:n = book } \clist_map_inline:nn @@ -127,6 +136,26 @@ } \keys_define:nn { } { ctex/link .inherit:n = ctex/refset } \cs_set_eq:NN \link \refset +\cs_if_exist:NF \chapter + { + \newcounter{chapter} + \bool_set_false:N \l__eb_class_book_bool + \ctex_define:n { chapter/tocline .code:n = { } } + } +\bool_if:NF \l__eb_class_book_bool + { + \cs_undefine:N \chapter + \ctex_after_end_preamble:n + { + \NewDocumentCommand{\chapter}{som} + {\msg_error:nn { easybase } { no-chapter }} + } + } +\msg_new:nnn { easybase } { no-chapter } + { + Your~document~class~is~in~article~mode. \\ + The~\string\chapter\space~command~will~not~be~used. + } \ctex_define:n { link .meta:nn = { ctex/link } {#1}, @@ -354,11 +383,13 @@ fnmark-num .value_required:n = true } +\cs_set_eq:NN \eb@text@uppercase \text_uppercase:n +\cs_set_eq:NN \eb@text@nouppercase \text_titlecase_first:n \cs_new:Npn \eb_mark_uppercase_bool:nn #1#2 { \bool_if:NTF \l__eb_mark_uppercase_bool - { \text_uppercase:n } - { \text_titlecase_first:n } + { \eb@text@uppercase } + { \eb@text@nouppercase } { \use:c { eb_fancyhf_#1_mark:n } {#2} } } \cs_new:Npn \eb@level@markdouble #1#2 @@ -424,7 +455,8 @@ \counterwithin*{footnote}{page} } \bool_if:NTF \l__eb_footnote_hang_bool - { \booltrue{FN@hangfoot} } { \boolfalse{FN@hangfoot} } + { \booltrue{FN@hangfoot} } + { \boolfalse{FN@hangfoot} } } \eb_patch_cmd:nnn { \@footnotetext,\@mpfootnotetext } { \reset@font } @@ -568,12 +600,6 @@ \hspace{\use:c { eb@toc@#1@numsep }} }{} } -\cs_if_exist:NF \chapter - { - \newcounter{chapter} - \bool_set_false:N \l__eb_class_book_bool - \ctex_define:n { chapter/tocline .code:n = { } } - } \newbool{eb@titletoc@hang@fix} \eb_ctex_define:nn { tocset } { @@ -667,7 +693,8 @@ {\thecontentspage} { \bool_if:NTF \l__eb_toc_line_align_bool - { \contentspage } { \thecontentspage } + { \contentspage } + { \thecontentspage } } } } @@ -809,20 +836,8 @@ \addtocontents{lol} {\protect\addvspace{\skip_use:N \l__eb_toc_lolskip_skip}} } - \bool_if:NF \l__eb_class_book_bool - { \msg_error:nn { easybase } { no-chapter } } - } - \eb_appto_cmd:Nn \@schapter - { - \bool_if:NF \l__eb_class_book_bool - { \msg_error:nn { easybase } { no-chapter } } } } -\msg_new:nnn { easybase } { no-chapter } - { - Your~document~class~is~in~article~mode. \\ - The~\string\chapter\space~command~will~not~be~used. - } \tl_set:Nx \l__eb_toc_type_tl { \bool_if:NTF \l__eb_class_book_bool { chapter } { section } } @@ -989,11 +1004,10 @@ binmuber .tl_set:N = \CTEX@bichapter@number, binmuber .initial:n = \arabic{chapter} } -\cs_new_protected:Npn \eb_counter_set:nn #1#2 +\cs_new_protected:Npn \eb_counter_zero:n #1 { - \seq_set_from_clist:No \l__eb_counter_name_seq {#2} - \seq_map_inline:Nn \l__eb_counter_name_seq - { \setcounter{##1}{#1} } + \seq_set_from_clist:No \l__eb_counter_name_seq {#1} + \seq_map_inline:Nn \l__eb_counter_name_seq { \setcounter{##1}{0} } } \RenewDocumentCommand{\appendix} {O{Appendix\space}D(){\Alph{chapter}}} @@ -1020,7 +1034,7 @@ \gdef\CTEX@thechapter{\CTEX@appendix@number} \gdef\CTEX@postchapter{\CTEX@postappendix} \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering} - \eb_counter_set:nn { 0 } { chapter,section,bichapter,bisection } + \eb_counter_zero:n { chapter,section,bichapter,bisection } } { \gdef\thesection{\@Alph\c@section} @@ -1030,7 +1044,7 @@ \gdef\CTEX@postsection{\CTEX@postappendix} \gdef\CTEX@section@numbering{\CTEX@appendix@numbering} \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } } - \eb_counter_set:nn { 0 } { section,subsection,bisection,bisubsection } + \eb_counter_zero:n { section,subsection,bisection,bisubsection } } } @@ -1173,21 +1187,33 @@ \selectfont\ignorespaces } +\cs_new_protected:Npn \eb_float_proportion_set:nn #1#2 + { \tl_gset:cn { #1fraction } {#2} } +\bool_if:NF \l__eb_float_page_bool + { + \clist_map_inline:nn + { + { text } { 0.1 }, + { top } { 0.9 }, + { bottom } { 0.9 }, + { floatpage } {0.9 }, + { dbltop } { 0.9 }, + { dblfloatpage } { 0.9 } + } + { \eb_float_proportion_set:nn #1 } + } \skip_set:Nn \parskip { 0pt plus 2pt minus 1pt } \skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt } \skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt } -\skip_set:Nn \multicolsep { 10pt plus 4pt minus 3pt } +\skip_set:Nn \multicolsep { 12pt plus 4pt minus 3pt } \skip_set:Nn \dbltextfloatsep { 16pt plus 2pt minus 4pt } +\int_gset:Nn \vbadness { 10000 } +\int_gset:Nn \hbadness { 10000 } \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} -\tl_gset:Nn \textfraction { 0.15 } -\tl_gset:Nn \topfraction { 0.8 } -\tl_gset:Nn \bottomfraction { 0.8 } -\tl_gset:Nn \floatpagefraction { 0.9 } -\tl_gset:Nn \dblfloatpagefraction { 0.9 } -\tl_gset:Nn \ULthickness { 0.75pt } \allowdisplaybreaks[4] +\tl_gset:Nn \ULthickness { \eb@rule@width@dim } \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_new_protected:Npn \eb_enumitem_label_set:nn #1#2 @@ -1209,7 +1235,7 @@ \setlist { labelsep = .75\ccwd,listparindent = 2\ccwd,leftmargin = *, - itemsep = .75ex plus .1ex,topsep = .75ex plus .1ex, + itemsep = 0.75ex plus .1ex,topsep = 0.75ex plus .1ex, partopsep = 0ex,parsep = 0ex } \newlist{eb@outline@list}{itemize}{1} @@ -1247,60 +1273,51 @@ \labelformat{#1}{\tl_use:c { c__eb_name_#1_tl }~##1} } } +\cs_set_eq:NN \eb@declare@theorem@save \declaretheorem +\RenewDocumentCommand{\declaretheorem}{O{}m} + {\AfterPreamble{\eb@declare@theorem@save[#1]{#2}}} +\cs_set_eq:NN \newtheorem \declaretheorem -\bool_new:N \l__eb_thmbox_bool -\tl_new:N \l__eb_thm_numberwith_tl -\tl_new:N \l__eb_thm_headpunct_tl -\tl_new:N \l__eb_thm_bodyfont_tl -\tl_new:N \l__eb_thm_notefont_tl -\tl_new:N \l__eb_thm_headindent_tl -\tl_new:N \l__eb_thm_spaceabove_tl -\tl_new:N \l__eb_thm_spacebelow_tl - -\RenewDocumentCommand{\newtheorem}{O{}m} - {\AfterPreamble{\declaretheorem[#1]{#2}}} -\eb_ctex_define:nn { thmset } - { - thmbox .bool_set:N = \l__eb_thmbox_bool, - thmbox .default:n = true, - thmbox .initial:n = false, - within .tl_set:N = \l__eb_thm_numberwith_tl, - within .initial:n = \bool_if:NT \l__eb_class_book_bool { chapter }, - bodyfont .tl_set:N = \l__eb_thm_bodyfont_tl, - bodyfont .initial:n = { }, - notefont .tl_set:N = \l__eb_thm_notefont_tl, - notefont .initial:n = { }, - headfont .tl_set:N = \l__eb_thm_headfont_tl, - headfont .initial:n = \color{ctex@emph}\sffamily, - headpunct .tl_set:N = \l__eb_thm_headpunct_tl, - headpunct .initial:n = { }, - spacepost .tl_set:N = \l__eb_thm_spacepost_tl, - spacepost .initial:n = \ccwd, - headindent .tl_set:N = \l__eb_thm_headindent_tl, - headindent .initial:n = 0\ccwd, - spaceabove .tl_set:N = \l__eb_thm_spaceabove_tl, - spaceabove .initial:n = .75ex plus .1ex, - spacebelow .tl_set:N = \l__eb_thm_spacebelow_tl, - spacebelow .initial:n = .75ex plus .1ex - } -\tl_const:Nn \c__eb_thmtools_keyval_tl +\prop_new:N \l__eb_thmtools_entry_prop +\clist_const:Nn \c__eb_thmtools_entry_clist { spaceabove = \l__eb_thm_spaceabove_tl, spacebelow = \l__eb_thm_spacebelow_tl, headindent = \l__eb_thm_headindent_tl, headfont = \l__eb_thm_headfont_tl, notefont = \l__eb_thm_notefont_tl, - notebraces = { }{ }, + notebraces = \l__eb_thm_notebraces_tl, bodyfont = \l__eb_thm_bodyfont_tl, headpunct = \l__eb_thm_headpunct_tl, - postheadspace = \l__eb_thm_spacepost_tl, - within = \l__eb_thm_numberwith_tl, + postheadspace = \l__eb_thm_postheadspace_tl, + within = \l__eb_thm_within_tl, + headformat = \l__eb_thm_headformat_tl + } +\exp_args:NNV +\prop_set_from_keyval:Nn \l__eb_thmtools_entry_prop +\c__eb_thmtools_entry_clist +\prop_map_inline:Nn \l__eb_thmtools_entry_prop + { \eb_ctex_define:nn { thmset } { #1 .tl_set:N = #2 } } +\eb_ctex_define:nn { thmset } + { + thmbox .bool_set:N = \l__eb_thmbox_bool, + thmbox .default:n = true, + thmbox .initial:n = false + } +\ctex_set:nn { thmset } + { + spaceabove = 0.75ex plus .1ex, + spacebelow = 0.75ex plus .1ex, + headindent = 0\ccwd, + headfont = \color{ctex@emph}\sffamily, + postheadspace = \ccwd, + within = \bool_if:NT \l__eb_class_book_bool { chapter }, headformat = \NAME\space\NUMBER\NOTE } \eb_at_end_preamble:n { \exp_last_unbraced:NNV - \declaretheoremstyle[\c__eb_thmtools_keyval_tl]{easy-theorem} + \declaretheoremstyle[\c__eb_thmtools_entry_clist]{easy-theorem} \eb_thmname_set:nnn { exercise } { Exercise } { 练习 } \cs_undefine:N \proof \clist_map_inline:nn @@ -1758,10 +1775,7 @@ \clist_map_inline:nn { page,none } { \tl_if_eq:NnT \l_keys_value_tl {##1} - { - \clist_map_break:n - { \colorlet{ctex@toc@number}{black} } - } + { \clist_map_break:n { \colorlet{ctex@toc@number}{black} } } } }, linktoc .default:n = all, diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index a0f73b2f5ca..843df4dc485 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybook.cls +++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls @@ -13,7 +13,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/06/14}{1.26b}{beta} +\ProvidesExplClass{easybook}{2021/06/16}{1.26d}{beta} \bool_set_false:N \l__eb_compile_draft_bool \bool_set_false:N \l__eb_title_newline_bool @@ -32,10 +32,10 @@ scheme .code:n = \eb_put_ctexbook:n { scheme = #1 }, enmode .meta:n = { newline,scheme = plain }, - font .choices:nn = + font .choices:nn = { adobe,founder,mac,windows,none } { \eb_put_ctexbook:n { fontset = \l_keys_choice_tl } }, - font/noto .code:n = + font/noto .code:n = { \bool_set_true:N \l__eb_font_noto_bool \eb_put_ctexbook:n { fontset = none } @@ -48,16 +48,15 @@ paper .choice:, paper .value_required:n = true, paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, - paper .initial:n = a4paper, oneside .value_forbidden:n = true, twoside .value_forbidden:n = true, - oneside .code:n = + oneside .code:n = { \bool_set_false:N \l__eb_page_twoside_bool \eb_put_ctexbook:n { oneside } }, - twoside .code:n = + twoside .code:n = { \bool_set_true:N \l__eb_page_twoside_bool \eb_put_ctexbook:n { twoside } @@ -71,10 +70,11 @@ \bool_set_false:N \l__eb_class_book_bool \keys_set:nn { easybook } { oneside } }, - class .initial:n = book, - config .tl_set:N = \g__eb_config_tl, - unknown .code:n = + config .tl_set:N = \g__eb_config_tl, + floatpage .bool_set:N = \l__eb_float_page_bool, + floatpage .default:n = true, + unknown .code:n = { \clist_gput_right:NV \g__eb_options_clist \CurrentOption } } @@ -198,7 +198,8 @@ aftername = { \bool_if:NTF \l__eb_title_newline_bool - { \par\nobreak } { \hspace{\ccwd} } + { \par\nobreak } + { \hspace{\ccwd} } } }, chapter = @@ -212,7 +213,8 @@ aftername = { \bool_if:NTF \l__eb_title_newline_bool - { \par\nobreak\vskip 1.5pc } { \hspace{\ccwd} } + { \par\nobreak\vskip 1.5pc } + { \hspace{\ccwd} } }, beforeskip = -1.5ex, afterskip = 3ex, |