From 5a0d7cfdda1dbe41b31e7c9a7f7b26bf0b54e7c9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 20 Apr 2021 20:13:34 +0000 Subject: easybook (20apr21) git-svn-id: svn://tug.org/texlive/trunk@58926 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/easybook/easybook.cls | 270 ++++++++++++---------- 1 file changed, 152 insertions(+), 118 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index c63f009edcb..7e550bf31c2 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,etoolbox} -\ProvidesExplClass{easybook}{2021/04/18}{1.24n}{beta} +\ProvidesExplClass{easybook}{2021/04/19}{1.24o}{beta} \cs_generate_variant:Nn \__ctex_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} @@ -427,21 +427,18 @@ } \cs_new:Npn \__eb_upper_chaptermark_bool:n #1 { - \bool_if:NTF \l__eb_uppercase_bool - {\text_uppercase:n {\__eb_fancyhf_chap_mark:n {#1}}} - {\text_titlecase_first:n {\__eb_fancyhf_chap_mark:n {#1}}} + \bool_if:NT \l__eb_uppercase_bool + {\text_uppercase:n}{\__eb_fancyhf_chap_mark:n {#1}} } \cs_new:Npn \__eb_upper_sectionmark_bool:n #1 { - \bool_if:NTF \l__eb_uppercase_bool - {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}} - {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}} + \bool_if:NT \l__eb_uppercase_bool + {\text_uppercase:n}{\__eb_fancyhf_sec_mark:n {#1}} } \cs_new:Npn \__eb_upper_subsectionmark_bool:n #1 { - \bool_if:NTF \l__eb_uppercase_bool - {\text_uppercase:n {\__eb_fancyhf_subsec_mark:n {#1}}} - {\text_titlecase_first:n {\__eb_fancyhf_subsec_mark:n {#1}}} + \bool_if:NT \l__eb_uppercase_bool + {\text_uppercase:n}{\__eb_fancyhf_subsec_mark:n {#1}} } \ctex_at_end_preamble:n { @@ -452,32 +449,26 @@ \pagestyle{fancy} \bool_if:NTF \l__eb_class_book_bool { - \bool_if:NTF \l__eb_page_twoside_bool + \cs_gset:Npn \chaptermark#1 { - \cs_gset:Npn \chaptermark#1 + \markboth + {\__eb_upper_chaptermark_bool:n {#1}} { - \markboth - {\__eb_upper_chaptermark_bool:n {#1}} + \bool_if:NT \l__eb_page_twoside_bool {\__eb_upper_chaptermark_bool:n {#1}} } - }{ - \cs_gset:Npn \chaptermark#1 - {\markboth{\__eb_upper_chaptermark_bool:n {#1}}{}} } \cs_gset:Npn \sectionmark#1 {\markright{\__eb_upper_sectionmark_bool:n {#1}}} }{ - \bool_if:NTF \l__eb_page_twoside_bool + \cs_gset:Npn \sectionmark#1 { - \cs_gset:Npn \sectionmark#1 + \markboth + {\__eb_upper_sectionmark_bool:n {#1}} { - \markboth - {\__eb_upper_sectionmark_bool:n {#1}} + \bool_if:NT \l__eb_page_twoside_bool {\__eb_upper_sectionmark_bool:n {#1}} } - }{ - \cs_gset:Npn \sectionmark#1 - {\markboth{\__eb_upper_sectionmark_bool:n {#1}}{}} } \cs_gset:Npn \subsectionmark#1 {\markright{\__eb_upper_subsectionmark_bool:n {#1}}} @@ -509,24 +500,26 @@ lists/lolskip .initial:n = 0.8pc, lists/belowoffset .dim_set:N = \l__eb_toc_listsoffset_dim, lists/belowoffset .initial:n = 0pc, - tocline-fig .cs_set:Np = \eb@labelname@lof#1#2, + tocline-fig .cs_set:Np = \eb@labelname@lof#1, tocline-fig .initial:n = - {\figurename\space#1\hspace{\eb@list@labelsep}#2}, - tocline-tab .cs_set:Np = \eb@labelname@lot#1#2, + {\figurename\space#1\hspace{\eb@list@labelsep}}, + tocline-tab .cs_set:Np = \eb@labelname@lot#1, tocline-tab .initial:n = - {\tablename\space#1\hspace{\eb@list@labelsep}#2}, + {\tablename\space#1\hspace{\eb@list@labelsep}}, tocline-lst .tl_set:N = \eb@labelname@lol, tocline-lst .initial:n = { \lstlistingname\space \thelstlisting\hspace{\eb@list@labelsep} - \lstcaption }, belowoffset .dim_set:N = \l__eb_toc_offset_dim, belowoffset .initial:n = -1pc, line-align .bool_set:N = \l__eb_toc_line_align_bool, line-align .default:n = true, - line-align .initial:n = true + line-align .initial:n = true, + hang .bool_set:N = \eb@titletoc@hang@fix, + hang .default:n = true, + hang .initial:n = false } \ctex_set:nn {tocset} { @@ -566,7 +559,12 @@ { \titlecontents{#1} [\use:c {l__toc_#2_indent_tl}] - {\use:c {l__toc_#2_format_tl}}{}{} + {\use:c {l__toc_#2_format_tl}} + { + \ifodd\eb@titletoc@hang@fix + \contentspush{\color{ctex@link}\thecontentslabel} + \fi + }{} {\use:c {l__toc_#2_rule_tl}} } \contentsuse{lstlisting}{lol} @@ -587,19 +585,49 @@ figure = \eb@labelname@lof, table = \eb@labelname@lot } -\cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 +\cs_new:Npn \eb@numberline#1#2 { - \addcontentsline{#1}{#2} - {\prop_item:Nn \l_label_name_prop{#2}{#3}{#4}} + \CTEXifname + { + \protect\numberline{\use:c {CTEXthe#1}} + \hspace{#2} + }{} } -\ctex_patch_cmd:Nnn \lst@MakeCaption +\ctex_at_end_preamble:n { - \addcontentsline{lol}{lstlisting} - {\protect\numberline{\thelstlisting}\lst@@caption} - }{ - \let\lstcaption\lst@@caption - \addcontentsline{lol}{lstlisting}{\eb@labelname@lol} + \cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 + { + \addcontentsline{#1}{#2} + { + \ifodd\eb@titletoc@hang@fix + \protect\numberline + \fi + {\prop_item:Nn \l_label_name_prop{#2}{#3}}{#4} + } + } + \ctex_patch_cmd:Nnn \lst@MakeCaption + { + \addcontentsline{lol}{lstlisting} + {\protect\numberline{\thelstlisting}\lst@@caption} + }{ + \addcontentsline{lol}{lstlisting} + { + \ifodd\eb@titletoc@hang@fix + \protect\numberline + \fi + {\eb@labelname@lol}\lst@@caption + } + } + \ifodd\eb@titletoc@hang@fix + \ctex_set:n + { + chapter/tocline = \eb@numberline{#1}{\ccwd}#2, + section/tocline = \eb@numberline{#1}{\ccwd}#2, + subsection/tocline = \eb@numberline{#1}{\ccwd}#2 + } + \fi } + \__eb_appto_cmd:Nn \@chapter { \skip_if_eq:nnF {\l__eb_toc_lolskip_skip}{\c_zero_skip} @@ -627,15 +655,17 @@ {\text_uppercase:n {#1}} {\text_titlecase_first:n {#1}} } -\cs_new_protected:Npn \eb@markdouble#1 +\cs_new_protected:Npn \eb@nonumber@markdouble#1 { - \bool_if:NTF \l__eb_page_twoside_bool + \markboth + {\__eb_uppercase_bool:n {#1}} { - \markboth + \bool_if:NT \l__eb_page_twoside_bool {\__eb_uppercase_bool:n {#1}} - {\__eb_uppercase_bool:n {#1}} - }{\markboth{\__eb_uppercase_bool:n {#1}}{}} + } } +\cs_new_protected:Npn \eb@nonumber@markright#1 + {\markright{\__eb_uppercase_bool:n {#1}}} \tl_set:Nn \l__eb_toc_type_tl{book} \keys_define:nn {listoc} @@ -654,18 +684,27 @@ { \chapter*{\phantomsection#1} \CTEX@addtocline{chapter}{#1} + \eb@nonumber@markdouble{#1} }{ \section*{\phantomsection#1} \CTEX@addtocline{section}{#1} + \bool_if:NTF \l__eb_class_book_bool + {\eb@nonumber@markright{#1}} + {\eb@nonumber@markdouble{#1}} } - \eb@markdouble{#1} } \cs_new_protected:Npn \__eb_title_mark_notoc:n #1 { \tl_if_eq:NnTF \l__eb_toc_type_tl{book} - {\chapter*{\phantomsection#1}} - {\section*{\phantomsection#1}} - \eb@markdouble{#1} + { + \chapter*{\phantomsection#1} + \eb@nonumber@markdouble{#1} + }{ + \section*{\phantomsection#1} + \bool_if:NTF \l__eb_class_book_bool + {\eb@nonumber@markright{#1}} + {\eb@nonumber@markdouble{#1}} + } } \cs_new_protected:Npn \__eb_class_title_bool:n #1 { @@ -677,7 +716,7 @@ \section*{\phantomsection#1} \CTEX@addtocline{section}{#1} } - \eb@markdouble{#1} + \eb@nonumber@markdouble{#1} } \cs_new_protected:Npn \__eb_multoc_pre_bool: { @@ -778,7 +817,7 @@ } \ctex_patch_cmd:Nnn \imki@indexheaders {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} - {\eb@markdouble{\indexname}} + {\eb@nonumber@markdouble{\indexname}} } \tl_new:N \l__eb_font_table_tl @@ -897,16 +936,21 @@ \__ctex_define:nn {spread} { - line .fp_set:N = \l__eb_spread_line_fp, - line .initial:n = 1.3, - table .fp_set:N = \l__eb_spread_table_fp, - table .initial:n = 1.05, - math .fp_set:N = \l__eb_spread_math_fp, - math .initial:n = 1.05, - caption .fp_set:N = \l__eb_spread_caption_fp, - caption .initial:n = 1, - footnote .fp_set:N = \l__eb_spread_footnote_fp, - footnote .initial:n = 1 + line .fp_set:N = \l__eb_spread_line_fp, + line .initial:n = 1.3, + table .fp_set:N = \l__eb_spread_table_fp, + table .initial:n = 1.05, + math .fp_set:N = \l__eb_spread_math_fp, + math .initial:n = 1.05, + caption .fp_set:N = \l__eb_spread_caption_fp, + caption .initial:n = 1, + footnote .fp_set:N = \l__eb_spread_footnote_fp, + footnote .initial:n = 1, + spread-all .meta:n = + { + line = {#1},table = {#1},math = {#1}, + caption = {#1},footnote = {#1} + } } \skip_set:Nn \parskip{0pt plus 2pt minus 1pt} @@ -962,19 +1006,19 @@ \cs_new_protected:Npn \__eb_thmname_set:nnn #1#2#3 { \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} - {\tl_const:cn {c__eb_name_#1_tl}{#2}} {\tl_const:cn {c__eb_name_#1_tl}{#3}} + {\tl_const:cn {c__eb_name_#1_tl}{#2}} } \clist_map_inline:nn { - {example}{例}{Example}, - {definition}{定义}{Definition}, - {theorem}{定理}{Theorem}, - {proposition}{性质}{Proposition}, - {lemma}{引理}{Lemma}, - {corollary}{推论}{Corollary}, - {remark}{注}{Remark}, - {exercise}{练习}{Exercise} + {proposition}{Proposition}{性质}, + {definition}{Definition}{定义}, + {corollary}{Corollary}{推论}, + {exercise}{Exercise}{练习}, + {theorem}{Theorem}{定理}, + {example}{Example}{例}, + {remark}{Remark}{注}, + {lemma}{Lemma}{引理} }{\__eb_thmname_set:nnn #1} \bool_new:N \l__eb_thmbox_bool @@ -1135,8 +1179,7 @@ enhanced~jigsaw,pad~at~break* = 3pt, opacityback = 0, colframe = ctex@emph, - left = 6pt,right = 6pt,top = 8pt,bottom = 8pt,middle= 8pt, - arc = 0pt + left = 6pt,right = 6pt,top = 8pt,bottom = 8pt,middle= 8pt }, tc-outline/.style = { @@ -1153,14 +1196,14 @@ }, tc-exercise/.style = { - enhanced,on~line, - fontupper = \sffamily\Large, - boxrule = 1pt,arc = 5pt, - left = 6pt,right = 6pt,top = 3.5pt,bottom = 3.5pt, - before~skip = 4ex,after~skip = 2.25ex + blank,on~line,center, + fontupper = \Large\sffamily, + before~skip = 3.5ex,after~skip = 2.25ex }, breakable, boxsep = 0pt, + arc = 0pt, + fonttitle = \sffamily, boxrule = \l__eb_rule_width_dim } \NewDocumentEnvironment{outline}{D(){\abstractname}o+b} @@ -1172,39 +1215,32 @@ \end{tcolorbox} }{} \NewDocumentEnvironment{exercise} - {sO{LightYellow}O{1.}D(){\c__eb_name_exercise_tl}o+b} - { - \begin{center} - \bool_if:NTF \l__eb_thmbox_bool - { - \tcbox[ - tc-exercise, - colback = #2,colframe = black, - drop~fuzzy~shadow = #2, - IfValueT = {#5}{#5}, - phantom = - \IfBooleanF{#1} - { - \CTEX@ifnametrue - \refstepcounter{section} - \markright{\CTEXthesection\hspace{0.5\ccwd}#4} - \CTEX@addtocline{section}{#4} - } - ]{\IfBooleanF{#1}{\CTEXthesection\hspace{0.5\ccwd}}#4} - }{ - \color{ctex@frame}\sffamily\Large - \IfBooleanF{#1} - { - \CTEX@ifnametrue - \refstepcounter{section} - \markright{\CTEXthesection\hspace{0.5\ccwd}#4} - \CTEX@addtocline{section}{#4} - \CTEXthesection\hspace{0.5\ccwd} - }#4 - } - \end{center} - \begin{enumerate}[#3,labelsep = 0.5\ccwd] - #6 + {st+O{LightBlue}O{1.}D(){\c__eb_name_exercise_tl}o+O{}+b} + { + \IfBooleanTF{#2} + { + \tcbox[ + tc-exercise, + fuzzy~halo = 5pt~with~#3, + IfValueT = {#6}{#6}, + phantom = + \IfBooleanF{#1} + { + \CTEX@ifnametrue + \refstepcounter{section} + \markright{\CTEXthesection\hspace{0.5\ccwd}#5} + \CTEX@addtocline{section}{#5} + } + ]{\IfBooleanF{#1}{\CTEXthesection\hspace{0.5\ccwd}}#5} + }{ + \group_begin: + \keys_set:nn {ctex/section}{format += \centering} + \IfValueT{#6}{\keys_set:nn {ctex/section}{#6}} + \IfBooleanTF{#1}{\section*{#5}}{\section{#5}} + \group_end: + }#7 + \begin{enumerate}[#4,labelsep = 0.5\ccwd] + #8 \end{enumerate} }{} \DeclareTColorBox{easybox}{sO{DarkCyan}d()O{}} @@ -1216,9 +1252,8 @@ IfValueT = {#3}{title = #3}, colback = #2!8!white,colbacktitle = #2!8!white, coltitle = black,colframe = black, - fonttitle = \sffamily, left = 6pt,right = 6pt,bottom = 8pt,middle= 8pt, - bottomtitle = 8pt,arc = 0pt, + bottomtitle = 8pt, beforeafter~skip = 2ex, halign~upper = left,halign~lower = left, center~title,#4 @@ -1240,10 +1275,9 @@ bottom = 8pt,toptitle = 8pt }, left = 8pt,right = 8pt,middle= 8pt, - bottomtitle = 8pt,arc = 0pt, + bottomtitle = 8pt, beforeafter~skip = 1.5ex, - colframe = #2,coltitle = #2, - fonttitle = \sffamily,#4 + colframe = #2,coltitle = #2,#4 } \DeclareTotalTCBox{\fuzzy}{O{DarkSeaGreen}vO{}} { @@ -1254,7 +1288,7 @@ { nobeforeafter,tcbox~raise~base, top = 2pt,bottom = 2.5pt,left = 2pt,right = 2pt, - boxsep = 0pt,boxrule = 0.75pt,arc = 1pt, + boxrule = 0.75pt,arc = 1pt, colback = #1!15!white,#3 }{#2} } @@ -1386,8 +1420,8 @@ \footnotesize \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont - \skip_gset:Nn \footnotesep{\ht\strutbox} - \group_end: + \exp_args:NNNo \group_end: + \dim_set:Nn \footnotesep{\dim_use:N \box_ht:N \strutbox} \bool_if:NT \l__eb_chap_withpart_bool {\counterwithin*{chapter}{part}} \tl_if_eq:NnT \l__eb_foot_numberwith_tl{part} -- cgit v1.2.3