diff options
Diffstat (limited to 'macros/latex/contrib/easybook/easybook.dtx')
-rw-r--r-- | macros/latex/contrib/easybook/easybook.dtx | 427 |
1 files changed, 303 insertions, 124 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 0436584b62..10d1c35ccf 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'. %<class|package>\NeedsTeXFormat{LaTeX2e}[2021/11/15] %<*class> -\ProvidesExplClass{easybook}{2024/07/09}{2024cp} +\ProvidesExplClass{easybook}{2024/08/08}{2024di} {Easily typesetting Chinese theses or books} \bool_new:N \l__eb_compile_draft_bool @@ -301,7 +301,7 @@ %</class> %<*package> \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2024/07/09}{2024cp} +\ProvidesExplPackage{easybase}{2024/08/08}{2024di} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -313,7 +313,7 @@ \cs_generate_variant:Nn \seq_set_from_clist:Nn { No } \cs_generate_variant:Nn \ctex_define:nn { nx } \cs_generate_variant:Nn \eb_set_hyperref:n { x } -\cs_generate_variant:Nn \eb_at_begin_environment:nn { on } +\cs_generate_variant:Nn \eb_at_begin_environment:nn { o } \cs_generate_variant:Nn \tl_if_novalue:nF { V } \cs_set_protected:Npn \ctex_define:nn #1 @@ -332,7 +332,7 @@ \clist_map_inline:nn {#1} { \AtBeginEnvironment{##1}{#2} } } -\cs_new_protected:Npn \eb_at_end_preamble:n +\cs_set_protected:Npn \ctex_before_end_preamble:n { \BeforeBeginEnvironment{document} } \cs_new_protected:Npn \eb_if_package_loaded:nnF #1#2#3 { @@ -372,7 +372,11 @@ \IfNoValueTF{#1} {\IfFileExists{#2.sty}{\RequirePackage{#2}[#3]}{}} {\IfFileExists{#2.sty}{\RequirePackage[#1]{#2}[#3]}{}} + \IfFileExists{#2.sty}{} + {\msg_warning:nnn { easybase } { package-not-found } {#2}} } +\msg_new:nnn { easybase } { package-not-found } + { The~macro~package~'#1'~can't~be~found. } \cs_new_protected:Npn \ebloadpackage #1 { \int_compare:nTF { \clist_count:n {#1} <= 1 } @@ -448,9 +452,9 @@ \seq_set_from_clist:Nn \l__eb_module_paths_seq { - tools,font,space, - bib,thmt,toc, - hdr,float,ref,geo + tools,font,space,bib, + thmt,toc,hdr,float, + ref,geo,cap } \seq_map_inline:Nn \l__eb_module_paths_seq { @@ -505,7 +509,6 @@ \ebloadpackage { [text]{spbmark}, - [normalem]{ulem}, [{shortlabels,inline}]{enumitem}, chemformula,siunitx,pifont, geometry,marginnote, @@ -802,7 +805,7 @@ \UseFntSymbsList{empty} \cs_set_eq:NN \DefineFntSymbols \SetFntSymbsList \cs_set_eq:NN \setfntsymbol \UseFntSymbsList -\cs_new:Npn \eb_int_format_trans:NN #1 +\cs_new:Npn \eb_int_type_trans:NN #1 { \str_case:nn {#1} { @@ -837,29 +840,44 @@ } \cs_set_eq:NN \thedownfootnote \thefootnote } +\cs_generate_variant:Nn \msg_warning:nnnn { nnnV } \cs_new_protected:Npn \eb_fnmarktext_short_label_set:Nn #1#2 { \tl_set:Nn \l__eb_fnmarktext_short_tokens_tl {#2} \clist_map_inline:nn { A,a,1,I,i,c,s } { - \regex_match:nnT {##1} {#2} + \regex_match:nnTF {##1} {#2} { \regex_replace_once:nnN {##1} - { \c{eb_int_format_trans:NN} ##1 \c{c@footnote} } + { \c{eb_int_type_trans:NN} ##1 \c{c@footnote} } \l__eb_fnmarktext_short_tokens_tl - \seq_map_break: + \cs_set_eq:NN #1 \l__eb_fnmarktext_short_tokens_tl + \clist_map_break: + } + { + \str_if_eq:nnT {##1} { s } + { + \str_if_eq:nnTF {#1} { \thefootnote } + { \str_set:Nn \l_tmpa_str { \thedownfootnote } } + { \str_set:Nn \l_tmpa_str { \theupfootnote } } + \msg_warning:nnnV { easybase } { unknown-fnt-type } {#2} \l_tmpa_str + } } } - \cs_set_eq:NN #1 \l__eb_fnmarktext_short_tokens_tl \cs_set_eq:NN \thedownfootnote \thefootnote } +\msg_new:nnn { easybase } { unknown-fnt-type } + { + The~'#1'~includes~unknown~footnote~numbering~type \\ + in~#2. + } \cs_new_protected:Npn \eb_footnote_value_handle:n #1 { \str_case:nnF {#1} { { bottom } - { \bool_set_true:N \l__eb_fnpara_bottom_bool } + { \PushFntBottom } { flush } { \tl_set:Nn \l__eb_footnote_value_tl { plain } @@ -892,7 +910,6 @@ } } -\bool_new:N \l__eb_fnpara_bottom_bool \tl_new:N \l__eb_fnmarktext_format_tl \tl_new:N \l__eb_fncustom_format_tl \clist_new:N \l__eb_footnote_value_clist @@ -940,7 +957,7 @@ unknown .code:n = \eb_msg_deprecated_option:n { hdr } } -\eb_at_end_preamble:n +\ctex_before_end_preamble:n { \bool_if:NT \l__eb_chap_counter_withpart_bool { \counterwithin*{chapter}{part} } @@ -950,58 +967,91 @@ { page } { \counterwithin*{footnote}{page} } } { \counterwithout*{footnote}{chapter} } - \eb_fnpara_if_pos_bottom: } -\cs_new_protected:Npn \setspread #1 { \linespread{#1}\selectfont } -\cs_new:Npn \eb@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi } -\cs_new_protected:Npn \eb_fnpara_if_pos_bottom: + +\def\@if@footnotes@TF #1#2 {\ifvoid\footins #2\else #1\fi} +\def\@outputbox@removebskip { - \bool_if:NT \l__eb_fnpara_bottom_bool + \ifx\@textbottom\relax\else + \@outputbox@append + { + \@tempskipa\lastskip + \ifnum\gluestretchorder\@tempskipa>\z@ + \vskip -\@tempskipa + \xdef\@outputbox@reinsertbskip + {\noexpand\@outputbox@append{\vskip\the\@tempskipa}} + \else + \global\let\@outputbox@reinsertbskip\relax + \fi + } + \fi + } +\let\@outputbox@reinsertbskip\relax +\def\@outputbox@append #1 + { + \setbox\@outputbox\vbox { - \IfPackageLoadedTF{footmisc} - {\msg_warning:nn { easybase } { bottom-not-compatible }} + \boxmaxdepth\@maxdepth + \dimen@\dp\@outputbox + \unvbox\@outputbox + #1 + } + } +\def\@outputbox@attachfloats{\@combinefloats} +\NewHook{makecol/footins/before} +\NewHook{makecol/footins/begin} +\def\@outputbox@appendfootnotes + { + \@if@footnotes@TF + { + \UseHook{makecol/footins/before} + \@outputbox@append { - \cs_set:Npn \@makecol - { - \setbox\@outputbox\box\@cclv - \let\@elt\relax - \xdef\@freelist{\@freelist\@midlist} - \global\let\@midlist\@empty - \@combinefloats - \eb@ifvoid\footins{} - { - \setbox\@outputbox\vbox - { - \boxmaxdepth\@maxdepth - \unvbox\@outputbox - \vfill\relax - \vskip\skip\footins - \color@begingroup - \normalcolor\footnoterule - \unvbox\footins - \color@endgroup - } - } - \eb@ifvoid\@kludgeins - {\@makespecialcolbox} - { - \setbox\@outputbox\vbox to\@colht - { - \@texttop\dimen@\dp\@outputbox - \unvbox\@outputbox - \vskip -\dimen@\@textbottom - } - } - \global\maxdepth\@maxdepth - } + \vskip\skip\footins + \UseHook{makecol/footins/begin} + \color@begingroup + \normalcolor + \footnoterule + \@nameuse{pdfcolfoot@current} + \unvbox\footins + \color@endgroup } + }{} + } +\def\@makenormalcolbox + { + \setbox\@outputbox\vbox to\@colht + { + \@texttop + \dimen@\dp\@outputbox + \unvbox\@outputbox + \vskip -\dimen@ + \@textbottom } } -\msg_new:nnn { easybase } { bottom-not-compatible } +\cs_new_protected:Npn \PushFntBottom { - Not~compatible~with~the~'footmisc'~package. \\ - Please~use~the~'bottom'~option~of~'footmisc'~package. + \cs_set:Npn \@makecol + { + \setbox\@outputbox\box\@cclv + \@outputbox@removebskip + \let\@elt\relax + \xdef\@freelist{\@freelist\@midlist} + \global\let\@midlist\@empty + \@outputbox@attachfloats + \@if@footnotes@TF + {\@outputbox@append{\vfill}} + {\@outputbox@reinsertbskip} + \@outputbox@appendfootnotes + \ifvbox\@kludgeins + \@makespecialcolbox + \else + \@makenormalcolbox + \fi + \global\maxdepth\@maxdepth + } } +\@onlypreamble\PushFntBottom \cs_new_protected:Npn \eb_footnote_direct_hang: { @@ -1057,6 +1107,7 @@ \l__eb_fnpara_format_tl{#1} \tl_if_eq:NnT \l__eb_footnote_value_tl { hang } { \par } } +\cs_new_protected:Npn \setspread #1 { \linespread{#1}\selectfont } \clist_map_inline:nn { \@footnotetext,\@mpfootnotetext } { \eb_patch_cmd:Nnn #1 @@ -1072,12 +1123,12 @@ \ctex_at_end_package:nn { footmisc } { \eb_package_date_check:nn { footmisc } { 2022/02/10 } - \boolfalse{FN@setspace} - \ifbool{FN@para}{} + \ifboolexpr{not (bool {FN@para} or bool {FN@sidefn})} { + \boolfalse{FN@setspace} \cs_set_eq:NN \@makefntext \eb@@makefntext \cs_set_eq:NN \@footnotetext \eb@@footnotetext - } + }{} \ifboolexpr { bool {FN@hangfoot} or @@ -1338,22 +1389,22 @@ \skip_if_eq:nnF { \eb@toc@lol@skip } { \c_zero_skip } { \addtocontents{lol}{\protect\addvspace{\skip_use:N \eb@toc@lol@skip}} } } -\cs_new_protected:Npn \eb_title_base_set_eq:nn #1#2 - { - \tl_set_eq:cc { CTEX@#2@beforeskip } { CTEX@#1@beforeskip } - \tl_set_eq:cc { CTEX@#2@afterskip } { CTEX@#1@afterskip } - \bool_set_eq:cc { CTEX@#2@numbering } { CTEX@#1@numbering } - \bool_set_eq:cc { CTEX@#2@fixskip } { CTEX@#1@fixskip } - \bool_set_eq:cc { CTEX@#2@hang } { CTEX@#1@hang } - \bool_set_eq:cc { CTEX@#2@runin } { CTEX@#1@runin } - \cs_set_eq:cc { CTEX@#2@tocline } { CTEX@#1@tocline } - \tl_set_eq:cc { CTEX@#2@break } { CTEX@#1@break } - \tl_set_eq:cc { CTEX@#2@format } { CTEX@#1@format } - \tl_set_eq:cc { CTEX@#2@nameformat } { CTEX@#1@nameformat } - \tl_set_eq:cc { CTEX@#2@numberformat } { CTEX@#1@numberformat } - \tl_set_eq:cc { CTEX@#2@titleformat } { CTEX@#1@titleformat } - \tl_set_eq:cc { CTEX@#2@aftername } { CTEX@#1@aftername } - \tl_set_eq:cc { CTEX@#2@aftertitle } { CTEX@#1@aftertitle } +\cs_new_protected:Npn \CopyTitleFormat #1#2 + { + \tl_set_eq:cc { CTEX@#1@beforeskip } { CTEX@#2@beforeskip } + \tl_set_eq:cc { CTEX@#1@afterskip } { CTEX@#2@afterskip } + \bool_set_eq:cc { CTEX@#1@numbering } { CTEX@#2@numbering } + \bool_set_eq:cc { CTEX@#1@fixskip } { CTEX@#2@fixskip } + \bool_set_eq:cc { CTEX@#1@hang } { CTEX@#2@hang } + \bool_set_eq:cc { CTEX@#1@runin } { CTEX@#2@runin } + \cs_set_eq:cc { CTEX@#1@tocline } { CTEX@#2@tocline } + \tl_set_eq:cc { CTEX@#1@break } { CTEX@#2@break } + \tl_set_eq:cc { CTEX@#1@format } { CTEX@#2@format } + \tl_set_eq:cc { CTEX@#1@nameformat } { CTEX@#2@nameformat } + \tl_set_eq:cc { CTEX@#1@numberformat } { CTEX@#2@numberformat } + \tl_set_eq:cc { CTEX@#1@titleformat } { CTEX@#2@titleformat } + \tl_set_eq:cc { CTEX@#1@aftername } { CTEX@#2@aftername } + \tl_set_eq:cc { CTEX@#1@aftertitle } { CTEX@#2@aftertitle } } \NewDocumentCommand{\NewTitleCommand}{omm} { @@ -1375,7 +1426,7 @@ { \CTEXnumberline{##1}##2 } \exp_args:Nc \providecommand { ttll@#2 }{#3} \exp_args:Nc \providecommand { toclevel@#2 }{#3} - \IfValueT{#1}{\eb_title_base_set_eq:nn {#1} {#2}} + \IfValueT{#1}{\CopyTitleFormat{#2}{#1}} } \NewDocumentCommand{\NewTitleEntryCommand}{O{toc}m} { @@ -1391,29 +1442,32 @@ \ctex_define:nn { tools } { - hyphen-figure .tl_set:N = \l__eb_hyphen_figure_tl, - hyphen-table .tl_set:N = \l__eb_hyphen_table_tl, - hyphen-listing .tl_set:N = \l__eb_hyphen_listing_tl, - hyphen-equation .tl_set:N = \l__eb_hyphen_equation_tl, - hyphen-every .meta:n = + hyphen-figure .tl_set:N = \l__eb_hyphen_figure_tl, + hyphen-table .tl_set:N = \l__eb_hyphen_table_tl, + hyphen-lstlisting .tl_set:N = \l__eb_hyphen_lstlisting_tl, + hyphen-equation .tl_set:N = \l__eb_hyphen_equation_tl, + hyphen-every .meta:n = { - hyphen-figure = {#1},hyphen-table = {#1}, - hyphen-listing = {#1},hyphen-equation = {#1} + hyphen-figure = {#1},hyphen-table = {#1}, + hyphen-lstlisting = {#1},hyphen-equation = {#1} }, - hyphen-every .initial:n = ., - unknown .code:n = \eb_msg_deprecated_option:n { tools } + hyphen-every .initial:n = ., + unknown .code:n = \eb_msg_deprecated_option:n { tools } } -\clist_map_inline:nn - { figure,table,listing,equation } +\AtBeginDocument { - \cs_set:cpn { the#1 } + \clist_map_inline:nn + { figure,table,lstlisting,equation } { - \int_compare:nNnT { \c@chapter } > { 0 } + \cs_set:cpn { the#1 } { - \thechapter - \tl_use:c { l__eb_hyphen_#1_tl } + \int_compare:nNnT { \c@chapter } > { 0 } + { + \thechapter + \tl_use:c { l__eb_hyphen_#1_tl } + } + \int_to_arabic:v { c@#1 } } - \int_to_arabic:v { c@#1 } } } @@ -1452,7 +1506,7 @@ \tl_set:Nn \eb@toc@title@level {#1} \eb_toc_extract_level: }, - level .initial:e = + level .initial:x = { \bool_if:NTF \l__eb_class_mode_book_bool { \exp_not:N \bichapter* } @@ -1595,8 +1649,9 @@ { \protect\numberline{#3}{#4} } } } -\cs_new_protected:Npn \AllotCaptionExt #1#2 +\cs_new_protected:Npn \AssignCaptionExt #1#2 { \tl_set:cn { ext@#1 } {#2} } +\cs_set_eq:NN \AllotCaptionExt \AssignCaptionExt \ctex_define:n { bicontentsname .tl_set:N = \bicontentsname, @@ -1794,6 +1849,8 @@ hang .initial:n = true, pagenumwd .code:n = \contentsmargin{#1}, pagenumwd .initial:n = 1.55em, + fileopen .tl_set:N = \l__eb_fileopen_type_tl, + fileopen .initial:n = once, unknown .code:n = \eb_msg_deprecated_option:n { toc } } @@ -1822,10 +1879,14 @@ } \AddToHook{enddocument/afterlastpage} { - \IfHookEmptyTF{starttoc/after}{} - {\iow_now:Nn \@mainaux { \RemoveFromHook{starttoc/after}[aux] }} + \tl_if_eq:NnTF \l__eb_fileopen_type_tl { once } + { \iow_now:Nn \@mainaux { \RemoveFromHook{starttoc/after}[*] } } + { + \IfHookEmptyTF{starttoc/after}{} + {\iow_now:Nn \@mainaux { \RemoveFromHook{starttoc/after}[aux] }} + } } -\cs_set_protected:Npn \AllotPartialExt #1#2 +\cs_set_protected:Npn \AssignPartialExt #1#2 { \tl_if_exist:cTF { ttl@partial#1 } { \msg_warning:nnnn { easybase } { repeated-ptoc } {#1} {#2} } @@ -1835,12 +1896,13 @@ {\ttl@topartial{#1}{##1}{##2}} } } +\cs_set_eq:NN \AllotPartialExt \AssignPartialExt \msg_new:nnn { easybase } { repeated-ptoc } { Local~directory~file~'#2'~of~directory~type~'#1'~is \\ repeatedly~allocated. } -\AllotPartialExt{lol}{pll} +\AssignPartialExt{lol}{pll} \cs_new_protected:Npn \RegisterTitleIfname #1 { @@ -1906,12 +1968,12 @@ } }, subsection = - { tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.4em } } + { tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.5em } } } \ctex_at_end_package:nn { imakeidx } { - \RenewDocumentCommand{\printindex}{st+od()} + \RenewDocumentCommand{\printindex}{st++o} { \group_begin: \tl_set_eq:NN \eb@toc@title \indexname @@ -1969,19 +2031,19 @@ \ctex_define:nn { font } { - caption-table .tl_set:N = \l__eb_font_caption_table_tl, - caption-figure .tl_set:N = \l__eb_font_caption_figure_tl, - caption-listing .tl_set:N = \l__eb_font_caption_listing_tl, - caption-every .meta:n = + caption-table .tl_set:N = \l__eb_font_caption_table_tl, + caption-figure .tl_set:N = \l__eb_font_caption_figure_tl, + caption-lstlisting .tl_set:N = \l__eb_font_caption_lstlisting_tl, + caption-every .meta:n = { - caption-table = {#1},caption-figure = {#1}, - caption-listing = {#1} + caption-table = {#1},caption-figure = {#1}, + caption-lstlisting = {#1} }, - caption-every .initial:n = \sffamily\small, - footnote .tl_set:N = \eb@font@footnote, - marginpar .tl_set:N = \marginfont, - marginpar .initial:n = \footnotesize, - unknown .code:n = \eb_msg_deprecated_option:n { font } + caption-every .initial:n = \sffamily\small, + footnote .tl_set:N = \eb@font@footnote, + marginpar .tl_set:N = \marginfont, + marginpar .initial:n = \footnotesize, + unknown .code:n = \eb_msg_deprecated_option:n { font } } \cs_new_protected:Npn \ebaddtofont #1#2 { @@ -1991,13 +2053,13 @@ { \tl_put_right:Nn \l__eb_font_caption_table_tl {#2} } { figure } { \tl_put_right:Nn \l__eb_font_caption_figure_tl {#2} } - { listing } - { \tl_put_right:Nn \l__eb_font_caption_listing_tl {#2} } + { lstlisting } + { \tl_put_right:Nn \l__eb_font_caption_lstlisting_tl {#2} } { every } { \tl_put_right:Nn \l__eb_font_caption_table_tl {#2} \tl_put_right:Nn \l__eb_font_caption_figure_tl {#2} - \tl_put_right:Nn \l__eb_font_caption_listing_tl {#2} + \tl_put_right:Nn \l__eb_font_caption_lstlisting_tl {#2} } { footnote } { \tl_put_right:Nn \eb@font@footnote {#2} } @@ -2026,7 +2088,7 @@ fntspread .initial:n = 1.2, captab-spread .fp_set:N = \l__eb_spread_caption_table_fp, capfig-spread .fp_set:N = \l__eb_spread_caption_figure_fp, - caplst-spread .fp_set:N = \l__eb_spread_caption_listing_fp, + caplst-spread .fp_set:N = \l__eb_spread_caption_lstlisting_fp, caption-spread .meta:n = { captab-spread = {#1},capfig-spread = {#1}, @@ -2066,8 +2128,30 @@ } \AfterPreamble{\skip_set:Nn \abovedisplayshortskip { 0ex plus .1ex }} +\cs_new_protected:Npn \eb@register@cap@options #1 + { + \ctex_define:nn { cap } + { + #1/unknown .code:n = + { + \use:x + { + \exp_not:N \captionsetup[#1] + { \eb_unknown_kv_handle: } + } + }, + #1/unknown .default:V = \c_novalue_tl, + #1 .meta:nn = { ctex/cap/#1 } {##1} + } + } +\cs_new_protected:Npn \RegisterCapOptions #1 + { + \clist_map_function:nN {#1} + \eb@register@cap@options + } +\RegisterCapOptions{table,figure,lstlisting} \clist_map_inline:nn - { table,figure,listing } + { table,figure,lstlisting } { \DeclareCaptionFont{eb@#1@font} { @@ -2085,7 +2169,7 @@ } \captionsetup[table]{font = eb@table@font} \captionsetup[figure]{font = eb@figure@font} -\captionsetup[lstlisting]{font = eb@listing@font} +\captionsetup[lstlisting]{font = eb@lstlisting@font} \ctex_at_end_package:nn { bicaption } { \captionsetup[figure][bi-second]{name = Figure} @@ -2259,6 +2343,9 @@ \listnumberline{#2} \thmtname\thmtifnote{~(\thmtnote)}{} } + \cs_gset:cpn { thmt@contentsline@#2 } + { \thmt@contentslineIfNamed } + \exp_args:Nc \providecommand { p@#2 }[1]{##1} } \ctex_define:nn { thmt } { @@ -2279,7 +2366,7 @@ \theoremstyle{default} \cs_undefine:N \proof \DeclareFloatList{theorem}{loe} - \AllotPartialExt{loe}{ple} + \AssignPartialExt{loe}{ple} \eb_preto_cmd:nn { listoftheorems } { \group_begin: @@ -2390,7 +2477,7 @@ { \exp_args:NV \bibliographystyle \l__eb_bib_both_style_tl } \tl_if_blank:VF \l__eb_bib_cite_style_tl { \exp_args:NV \setcitestyle \l__eb_bib_cite_style_tl } - \NewDocumentCommand{\printbibliography}{st+o} + \NewDocumentCommand{\printbibliography}{st++o} { \group_begin: \tl_set_eq:NN \eb@toc@title \bibname @@ -2438,7 +2525,7 @@ \setcounter{biburllcpenalty}{1} \setcounter{biburlnumpenalty}{1} } -\eb_at_end_preamble:n +\ctex_before_end_preamble:n { \providecommand{\bibname}{\refname} \clist_if_empty:NF \l__eb_bib_datafile_clist @@ -2663,9 +2750,101 @@ lstlistingname = Code } } + +\cs_if_exist:NF \DeclareObjectType + { \RequirePackage{xtemplate} } +\DeclareObjectType{easybook}{0} +\DeclareTemplateInterface{easybook}{cover}{0} + { + content : tokenlist = \c_empty_tl, + beforecode : tokenlist = \c_empty_tl, + aftercode : tokenlist = \c_empty_tl, + align : choice {l,r,c,n} = c + } +\DeclareTemplateCode{easybook}{cover}{0} + { + content = \l__eb_cover_content_tl, + beforecode = \l__eb_cover_before_code_tl, + aftercode = \l__eb_cover_after_code_tl, + align = + { + l = \cs_set_eq:NN \eb_cover_align: \raggedright, + r = \cs_set_eq:NN \eb_cover_align: \raggedleft, + c = \cs_set_eq:NN \eb_cover_align: \centering, + n = \cs_set:Npn \eb_cover_align: { } + } + } + { + \AssignTemplateKeys + \tl_use:N \l__eb_cover_before_code_tl + \group_begin: + \eb_cover_align: + \tl_use:N \l__eb_cover_content_tl + \tex_par:D + \group_end: + \tl_use:N \l__eb_cover_after_code_tl + } +\DeclareInstance{easybook}{top}{cover}{} +\DeclareInstance{easybook}{bottom}{cover}{} +\DeclareInstance{easybook}{middle}{cover} + { + content = + { + \notbool{@titlepage} + { + \renewcommand{\theupfootnote}{\@fnsymbol\c@footnote} + \renewcommand{\thefootnote}{\@fnsymbol\c@footnote} + } + {} + \LARGE\@title\par\vskip 3em + \large + \begin{tabular}[t]{c} + \@author + \end{tabular}\par\vskip 1.5em + \@date + \notbool{@titlepage}{\par\vskip 1.5em}{} + \@thanks + }, + beforecode = + { + \ifbool{@titlepage} + { + \begin{titlepage} + \let\footnotesize\small + \let\footnoterule\relax + \let\footnote\thanks + \null\vfil + } + {\null} + \vskip 60\p@ + }, + aftercode = + { + \ifbool{@titlepage} + { + \vfil\null + \end{titlepage} + } + {\thispagestyle{plain}} + \setcounter{footnote}{0} + } + } +\keys_define:nn { eb/cover } + { + title .tl_set:N = \@title, + author .tl_set:N = \@author, + date .tl_set:N = \@date + } +\RenewDocumentCommand{\maketitle}{+O{}} + { + \keys_set:nn { eb/cover } {#1} + \UseInstance{easybook}{top} + \UseInstance{easybook}{middle} + \UseInstance{easybook}{bottom} + } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/07/09}{2024cp} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/08/08}{2024di} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 |