diff options
Diffstat (limited to 'macros/latex/contrib/easybook')
13 files changed, 303 insertions, 241 deletions
diff --git a/macros/latex/contrib/easybook/README.md b/macros/latex/contrib/easybook/README.md index 8f75b0f891..6ad00b0e33 100644 --- a/macros/latex/contrib/easybook/README.md +++ b/macros/latex/contrib/easybook/README.md @@ -1,7 +1,11 @@ # Easybook book document class -Easybook is a minimalist style template based on the ctexbook book document class. It is mainly suitable for typesetting Chinese books or notes, and can even be slightly modified to become a dissertation template. Some commonly used macro packages have been loaded to achieve general typesetting requirements. Although some details have been considered as much as possible, there are still deficiencies. + +Easybook is a minimalist style template based on the ctexbook book document class. It is mainly suitable for typesetting Chinese books or notes, and can even be slightly modified to become a dissertation template. Some commonly used macro packages have been loaded to achieve general typesetting requirements. Although some details have been considered as much as possible, there are still deficiencies. + ## Compilation method + Please use the UTF8 encoding and enter the following command on the command line + ``` xelatex -shell-escape easybook-demo bibtex easybook-demo @@ -9,22 +13,31 @@ makeindex easybook-demo xelatex -shell-escape easybook-demo xelatex -shell-escape easybook-demo ``` + ## Reference documents + - [CTeX macro collection manual](https://ctan.org/pkg/ctex) - [Xiamen University graduation thesis template](https://github.com/CamuseCao/XMU-thesis) - [Fudan University graduation thesis template](https://github.com/stone-zeng/fduthesis) - [Wuhan University graduation thesis template](https://github.com/mtobeiyf/whu-thesis) - [ElegantBook book template](https://ctan.org/pkg/elegantbook) -## Website -| [Gitee](https://gitee.com/TeX-doc/easybook) | [Github](https://github.com/TeX-doc/easybook) | [CTAN]() | [Font](https://wws.lanzous.com/b01ns361i) | +## License + +This work may be distributed and/or modified under the conditions of the CC-BY-NC 4.0 License. The latest version of this license is in https://creativecommons.org/licenses/by-nc/4.0/legalcode. +## Website + +| [Gitee](https://gitee.com/TeX-doc/easybook) | [Github](https://github.com/TeX-doc/easybook) | [CTAN](https://ctan.org/pkg/easybook) | [Font](https://wws.lanzous.com/b01ns361i) | # easybook 书籍文档类 easybook 是基于 ctexbook 书籍文档类的极简风格模板。它主要适用于中文书籍或笔记的排版,甚至可以稍作修改成为论文模板。已加载一些常用的宏程序包以实现一般的排版要求。尽管已尽可能多地考虑了一些细节,但仍然存在不足。 -## 编制方法 + +## 编译方法 + 请使用 UTF8 编码,并在命令行上输入以下命令 + ``` xelatex -shell-escape easybook-demo bibtex easybook-demo @@ -32,11 +45,19 @@ makeindex easybook-demo xelatex -shell-escape easybook-demo xelatex -shell-escape easybook-demo ``` + ## 参考文档 + - [CTeX 宏集手册](https://ctan.org/pkg/ctex) - [厦门大学毕业论文模板](https://github.com/CamuseCao/XMU-thesis) - [复旦大学毕业论文模板](https://github.com/stone-zeng/fduthesis) - [武汉大学毕业论文模板](https://github.com/mtobeiyf/whu-thesis) - [ElegantBook 书籍模板](https://ctan.org/pkg/elegantbook) -## 网址 -| [Gitee](https://gitee.com/TeX-doc/easybook) | [Github](https://github.com/TeX-doc/easybook) | [CTAN]() | [字体](https://wws.lanzous.com/b01ns361i) |
\ No newline at end of file + +## 协议 + +可以使用 CC-BY-NC 4.0 许可协议传播和修改此作品。此许可协议的最新版本位于 https://creativecommons.org/licenses/by-nc/4.0/legalcode。 + +## 网址 + +| [Gitee](https://gitee.com/TeX-doc/easybook) | [Github](https://github.com/TeX-doc/easybook) | [CTAN](https://ctan.org/pkg/easybook) | [字体](https://wws.lanzous.com/b01ns361i) |
\ No newline at end of file diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.pdf b/macros/latex/contrib/easybook/doc/easybook-demo.pdf Binary files differnew file mode 100644 index 0000000000..a5e66104c1 --- /dev/null +++ b/macros/latex/contrib/easybook/doc/easybook-demo.pdf diff --git a/macros/latex/contrib/easybook/easybook-demo.tex b/macros/latex/contrib/easybook/doc/easybook-demo.tex index 91a0848dd0..9f9531bd4f 100644 --- a/macros/latex/contrib/easybook/easybook-demo.tex +++ b/macros/latex/contrib/easybook/doc/easybook-demo.tex @@ -3,7 +3,7 @@ { style = { - color = navygreen, + color = forest, % cite = authoryear, thmbox = true, % capdash = true, @@ -15,7 +15,7 @@ link = { hyperlink = various, - linkcolor = lightblue, + linkcolor = skyblue, linktopage = false }, spread = @@ -26,6 +26,14 @@ capspread = 1, fnspread = 1 }, + elfont = + { + tabfont = \sffamily\small, + figfont = \sffamily\small, + lstfont = \sffamily\small, + fnfont = \rmfamily, + marfont = \sffamily\footnotesize + }, % secnumdepth = 2, % tocdepth = 2 } @@ -35,12 +43,13 @@ \title{\sffamily easybook书籍文档类} \author { - Qu Yi\thanks{texeasybook@foxmail.com.} \\ + 瞿毅\thanks{texeasybook@foxmail.com.} \\ \textcolor[HTML]{c71d23}{\faGit}~\url{https://gitee.com/TeX-doc/easybook}\thanks{Gitee为项目的主要发布地址。} \\ \faGithub~\url{https://github.com/TeX-doc/easybook} \\ - \textcolor[HTML]{00c2ff}{\faEdge}~\url{https://latexstudio.net} + \textcolor[HTML]{00c2ff}{\faEdge}~\url{https://latexstudio.net} \\ + \url{https://ctan.org/pkg/easybook} } - \date{2021/01/03\hskip\ccwd\relax v1.0} + \date{2021/01/08\hskip\ccwd\relax v1.1} } \begin{document} diff --git a/macros/latex/contrib/easybook/doc/easybook.pdf b/macros/latex/contrib/easybook/doc/easybook.pdf Binary files differindex 19b4476b98..43a82ee62d 100644 --- a/macros/latex/contrib/easybook/doc/easybook.pdf +++ b/macros/latex/contrib/easybook/doc/easybook.pdf diff --git a/macros/latex/contrib/easybook/pages/appendix.tex b/macros/latex/contrib/easybook/doc/pages/appendix.tex index f5981487b1..f5981487b1 100644 --- a/macros/latex/contrib/easybook/pages/appendix.tex +++ b/macros/latex/contrib/easybook/doc/pages/appendix.tex diff --git a/macros/latex/contrib/easybook/pages/chapter1.tex b/macros/latex/contrib/easybook/doc/pages/chapter1.tex index 280e356900..ffb86ee290 100644 --- a/macros/latex/contrib/easybook/pages/chapter1.tex +++ b/macros/latex/contrib/easybook/doc/pages/chapter1.tex @@ -5,7 +5,7 @@ \chapter{常用环境} \section{公式}\index{g@公式} -\lstinline{amsmath} 宏包提供多种公式环境以及许多相关的排版命令,可用以改进和提高数学结构的排版效果。\textsf{注意,公式前不要空行。} +\zhlipsum*[42][name = aspirin] \begin{equation}\label{eq1} \bm{A} = \left[ \begin{matrix} @@ -22,7 +22,7 @@ \end{equation} 可以通过添加标签在正文中引用公式,如带有中文括号的引用\cref{eq1}。 -\lstinline{align} 环境用于\textsf{两个及以上}需要垂直对齐的公式,一般的像等于号之类的二元算符是被对齐的。变体的块环境 \lstinline{aligned} 使得内容的长度就是它的\textsf{实际长度},可以用作包含表达式的组件。\lstinline{split} 环境是针对\textsf{单个长公式},使用\& 标记对齐点。\lstinline{split} 环境不提供编号,只能在其他行间公式结构中使用。 +\zhlipsum*[56][name = aspirin] \begin{equation} \begin{split} \iint_{A}E\rho(\bm{v}\cdot\bm{n})\mathrm{d}A+\frac{\partial}{\partial t}\iiint_{V}E\rho \mathrm{d}V & = \frac{\delta Q}{\mathrm{d}t}-\frac{\delta W}{\mathrm{d}t} @@ -31,7 +31,7 @@ \end{split} \end{equation} -调用 \lstinline{cases} 括号宏包提供的左花括号 \lstinline{subnumcases} 环境,可将花括号右侧的每行公式都给出一个子序号。 +\zhlipsum*[42][name = aspirin] \begin{subnumcases}{y =} C_1e^{r_1x}+C_2e^{r_2x} & \quad $p^2-4q > 0$ \\ @@ -40,7 +40,7 @@ e^{\alpha x}\left(C_1\cos\beta x+C_2\sin\beta x\right) & \quad $p^2-4q<0$ \end{subnumcases} -\lstinline{multline} 环境适用于一行无法放下的公式。\lstinline{multline} 的第一行在最左边,最后一行在最右边,除了在两边有缩进量,中间的任何其他行都会在行间公式宽度内独立居中,例子见\cref{defi1}。 +\zhlipsum*[57][name = aspirin] \clearpage \section{插图}\index{c@插图} @@ -74,52 +74,30 @@ \clearpage \section{列表}\index{l@列表} -\lstinline{enumitem} 宏包为系统自带的列表环境提供了更灵活的标签以及间距的控制。已设置默认格式,若自定义标签可例如 -\begin{lstlisting}[numbers = none] -\begin{enumerate}[label = \arabic*(a),leftmargin = 1cm,resume] -\begin{itemize}[label = \textbullet] -\begin{description}[font = \sffamily\bfseries,style = nextline] -\end{lstlisting} +\zhlipsum*[10][name = aspirin] \subsection{排序列表}\label{subsec1}\index{l@列表!p@排序列表} \begin{enumerate} - \item 使用 \lstinline{enumerate} 环境可创建有序列表。 - \item 第二项 + \item \zhlipsum*[41][name = aspirin] \begin{enumerate} - \item 第二项中的第一项 + \item \zhlipsum*[42][name = aspirin] \end{enumerate} + \item \zhlipsum*[41][name = aspirin] \end{enumerate} -使用 \lstinline{enumerate*} 环境产生行内部列表。可以使用\textsf{A、a、I、i和1}作为可选项为 \lstinline{enumerate*} 与 \lstinline{enumerate} 格式化标签, -\begin{enumerate*}[(a)] - \item 行内第一项 - \item 行内第二项 -\end{enumerate*}。 -若生成\textbf{Item I、Item II、Item III}格式可以这样 -\begin{lstlisting}[numbers = none] -\begin{enumerate*}[(a)] -\begin{enumerate}[\bfseries{Item}I] -\end{lstlisting} \subsection{常规列表}\index{l@列表!c@常规列表} \begin{itemize} - \item 第一项 \\ - 使用 \lstinline{itemize} 环境可创建不计数列表,若换行不缩进。 \par - 若在列表中分段后则缩进两字符。 - \item 第二项 + \item \zhlipsum[41-42][name = aspirin] \begin{itemize} - \item \lstinline{itemize*} 为行内常规列表,也提供一个可选参数。 + \item \zhlipsum*[42][name = aspirin] \end{itemize} + \item \zhlipsum*[41][name = aspirin] \end{itemize} -用$\star$取代默认的符号 -\begin{lstlisting}[numbers = none] -\begin{itemize*}[$\star$] -\begin{itemize}[$\star$] -\end{lstlisting} \subsection{主题列表}\index{l@列表!z@主题列表} \begin{description} - \item[主题一] 使用 \lstinline{description} 环境可创建带有主题词的列表。 - \item[主题二] 详细内容 + \item[主题一] \zhlipsum*[42][name = aspirin] + \item[主题二] \zhlipsum*[42][name = aspirin] \end{description} \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/easybook/pages/chapter2.tex b/macros/latex/contrib/easybook/doc/pages/chapter2.tex index 5b59aad56b..b8ab64147d 100644 --- a/macros/latex/contrib/easybook/pages/chapter2.tex +++ b/macros/latex/contrib/easybook/doc/pages/chapter2.tex @@ -56,12 +56,12 @@ The Stokes formula is an extension of the basic calculus formula in the case of \end{proof} \begin{mybox}*[My title]\index{z@自定义盒子} -环境 \lstinline{mybox} 创建一个段落盒子,可以添加可选参数的标题,否则无标题框。 + \zhlipsum*[3][name = aspirin] \tcblower -带有星号的环境会生成浅灰背景,否则是纯白背景。 + \zhlipsum*[8][name = aspirin] \end{mybox} -习题环境 \lstinline{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号环境时不进行编号。它含有三个可选参数 \lstinline{[<颜色>][<编号>][<标题>]},其中颜色为自定义或 \lstinline{xcolor} 包含的颜色名称(深色),正文编号格式与\cref{subsec1} 相同,标题名默认为摘要,参数只能\textsf{从右往左}省略。 +\zhlipsum*[3][name = aspirin] \begin{exercise}[black][1.][习题]\index{x@习题环境} \item 设$w = f(x+y+z,xyz)$,$f$具有二阶连续偏导数,求$\dfrac{{\partial w}}{{\partial x}}$和$\dfrac{{{\partial ^2}w}}{{\partial x\partial z}}$。 \item 已知$y = y(x)$在任意点$x$处的增量$\Delta y = \dfrac{y\Delta x}{1+x^2}+\alpha$,其中$\alpha$是$\Delta x$的高阶无穷小($\Delta x\to 0$时),$y(0) = \pi$,则$y(1) = \uline{\mbox{\hspace{2em}}}$。 diff --git a/macros/latex/contrib/easybook/doc/pages/chapter3.tex b/macros/latex/contrib/easybook/doc/pages/chapter3.tex new file mode 100644 index 0000000000..6ca662ca0d --- /dev/null +++ b/macros/latex/contrib/easybook/doc/pages/chapter3.tex @@ -0,0 +1,54 @@ +% Chapter 3 +\documentclass[../easybook-demo]{subfiles} +\begin{document} + +\chapter{其它格式}\label{chap1} + +\section{代码}\index{d@代码} +\zhlipsum[42][name = aspirin] +\begin{lstlisting}[language = Python,caption = {python程序练习题}] +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +if __name__ == '__main__': + ptr = [] + for i in range(5): + num = int(raw_input('please input a number:\n')) + ptr.append(num) + print ptr +\end{lstlisting} + +\section{物理量}\index{w@物理量} +阿司匹林还有三种作用方式 \num{-21x.3e5}。一是使线粒体的氧化磷酸化解偶联。阿司匹林会携带质子从线粒体膜间隙扩散进入线粒体基质,然后再次电离释放质子 \SI{.5}{mol}。 + +\section{化学式}\index{h@化学式} +阿司匹林还有三种作用方式。一是使线粒体的氧化磷酸化解偶联。阿司匹林会携带质子从线粒体膜间隙扩散进入线粒体基质,然后再次电离释放质子\ch{(NH4)2S}、\ch{[Cu(NH3)4]^2+}。 +\[\ch{$x$ Na(NH4)HPO4 ->[$\Delta$] (NaPO3)_{$x$} + $x$ NH3 ^ + $x$ H2O}\] +阿司匹林还有三种作用方式。 +\[\zihao{-5}\chemfig[cram width=5pt]{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2] +HN-[::+60]CH_3)=-(-HO)=)}\] + +\clearpage +\section{引用}\index{y@引用} +\zhlipsum[8][name = aspirin] +\subsection{索引}\index{y@引用!s@索引} +\zhlipsum[8][name = aspirin] + +\subsection{脚注}\index{y@引用!j@脚注} +六年之后的1859年,冯·基尔姆让水杨酸和乙酰氯反应,制得了分析纯的乙酰水杨酸,他称之为“乙酰化水杨酸”(acetylierte*Salicyls+"aure)\footnote{这是一个悬挂缩进的脚注。\par 这是分段将会缩进两字符。}。 + +60和70年代,约翰·范恩等人发现了阿司匹林的作用机理,60至80年代的其他研究和临床试验证明该药有抗凝血的药效,可降低血栓疾病的发病率\Footnote{*}{这是可以自定义标记的脚注。}。 + +\subsection{边注}\index{y@引用!b@边注} +对乙酰氨基酚和布洛芬\marginnote{这是一个边注。}于1956年和1959年相继问世以后,阿司匹林的使用率开始下降。 + +\subsection{引用章节}\label{sec1}\index{y@引用!s@索引} +兽医有时用阿司匹林来镇痛或抗血栓,主要给狗用\cref{chap1},有时给马用\cref{sec1},不过现在一般会用副作用较少的新疗法。 + +\subsection{参考文献}\index{y@引用!c@参考文献} +这是一个参考文献引用的范例\cite{1979Prospect}。引用多个文献,将引用标号中的多个文献序号按升序排列,若其中有2个以上的连续序号,则改用范围序号,例如\cite{1979Prospect,1989The,2010An}。 + +\section{行内盒子}\index{h@行内盒子} +对乙酰氨基酚和布洛芬 \concise[Aqua][fontupper = \rmfamily]{concise} 于1956年和1959年相继问世以后,阿司匹林 \fuzzy[yellow][fontupper = \ttfamily,colupper = black]{fuzzy} 的使用率开始下降。 + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/easybook/pages/preface.tex b/macros/latex/contrib/easybook/doc/pages/preface.tex index 559df6d5be..de5c7d8a0c 100644 --- a/macros/latex/contrib/easybook/pages/preface.tex +++ b/macros/latex/contrib/easybook/doc/pages/preface.tex @@ -4,13 +4,14 @@ \chapter*{前言} -\lstinline{easybook} 使用\LaTeX 3语法将选项扩展入\CTeX 宏集接口命令 \lstinline{\ctexset} 的列表。如果无法编译以及选项说明细节参见~\href{./doc/easybook.pdf}{easybook使用帮助}。 +\lstinline{easybook} 使用\LaTeX 3语法将选项扩展入\CTeX 宏集接口命令 \lstinline{\ctexset} 的列表。如果无法编译以及选项说明细节参见~\href{../easybook.pdf}{easybook用户手册}。 -\begin{enumerate}[label=\color{DarkBlue}\protect\circled{\arabic*}] +\begin{enumerate}[label = \color{DarkBlue}\protect\circled{\arabic*}] +\item 修复了 \lstinline{linktopage} 选项关闭时目录中标题编号无超链接的问题。 +\item 增加 \lstinline{elfont} 选项可以自定义图表、代码、脚注和边注的字体。 +\item 增加 \lstinline{config} 选项可以载入用户配置文件。 \item 优化页眉页脚,单面或双面排版适配了不同风格。 -\item 增加章前摘要、定理和段落、行内盒子,增加习题环境。 \item 更改草稿选项,与标准文类行为一致并显示页面边框。 -\item 增加超链接颜色风格及目录链接格式,调整配色,删除文章模式。 \item 使用功能更丰富的 \lstinline{thmtools} 设置定理环境。 \item 可自定义正文、表格、公式环境、图表标题以及脚注的行距。 \item 图表可以使用双语标题,增加代码索引和索引目录,脚注标记可以设置为自定义的符号。 diff --git a/macros/latex/contrib/easybook/ref/refs.bib b/macros/latex/contrib/easybook/doc/ref/refs.bib index 187a693805..187a693805 100644 --- a/macros/latex/contrib/easybook/ref/refs.bib +++ b/macros/latex/contrib/easybook/doc/ref/refs.bib diff --git a/macros/latex/contrib/easybook/easybook-demo.pdf b/macros/latex/contrib/easybook/easybook-demo.pdf Binary files differdeleted file mode 100644 index 7ec299677d..0000000000 --- a/macros/latex/contrib/easybook/easybook-demo.pdf +++ /dev/null diff --git a/macros/latex/contrib/easybook/easybook.cls b/macros/latex/contrib/easybook/easybook.cls index 71b1d47f47..318c80d9e6 100644 --- a/macros/latex/contrib/easybook/easybook.cls +++ b/macros/latex/contrib/easybook/easybook.cls @@ -5,17 +5,21 @@ %% The original source files were: %% %% easybook.dtx (with options: `class') +%% %% Copyright (C) 2021 by Qu Yi <texeasybook@foxmail.com> +%% %% This work may be distributed and/or modified under the %% conditions of the CC-BY-NC 4.0 License. -%% Gitee: https://gitee.com/TeX-doc/easybook -%% Github: https://github.com/TeX-doc/easybook +%% The latest version of this license is in +%% https://creativecommons.org/licenses/by-nc/4.0/legalcode \NeedsTeXFormat{LaTeX2e} \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/01/03}{v1.0}{} +\ProvidesExplClass{easybook}{2021/01/08}{v1.1}{} \cs_generate_variant:Nn \keys_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} +\cs_new_protected:Npn \__patch_cmd:Nnn #1#2#3 + {\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}} \cs_new_protected:Npn \__appto_cmd:Nn #1#2 {\ctex_appto_cmd:NnnTF #1{}{#2}{}{\ctex_patch_failure:N #1}} @@ -33,6 +37,7 @@ \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 \g__hyperref_clist \clist_new:N \g__options_clist @@ -117,16 +122,21 @@ \tl_new:N \g__math_spread_tl \tl_new:N \g__cap_spread_tl \tl_new:N \g__foot_spread_tl +\tl_new:N \g__tab_font_tl +\tl_new:N \g__fig_font_tl +\tl_new:N \g__lst_font_tl +\tl_new:N \g__foot_font_tl +\tl_new:N \g__margin_font_tl +\tl_new:N \g__config_tl \ctex_define:n { style .meta:nn = {ctex/style}{#1}, link .meta:nn = {ctex/link}{#1}, spread .meta:nn = {ctex/spread}{#1}, - style/color .choices:nn = - {black,navygreen,navyblue} - {\tl_set_eq:NN \g__keys_color_tl\l_keys_choice_tl}, - style/color .initial:n = black, + elfont .meta:nn = {ctex/elfont}{#1}, + config .tl_set:N = \g__config_tl, + style/cite .choices:nn = {number,authoryear} {\tl_set_eq:NN \g__keys_cite_tl\l_keys_choice_tl}, @@ -162,21 +172,22 @@ spread/fnspread .tl_set:N = \g__foot_spread_tl, spread/fnspread .initial:n = 1, + elfont/tabfont .tl_set:N = \g__tab_font_tl, + elfont/tabfont .initial:n = \sffamily\small, + elfont/figfont .tl_set:N = \g__fig_font_tl, + elfont/figfont .initial:n = \sffamily\small, + elfont/lstfont .tl_set:N = \g__lst_font_tl, + elfont/lstfont .initial:n = \sffamily\small, + elfont/fnfont .tl_set:N = \g__foot_font_tl, + elfont/fnfont .initial:n = \rmfamily, + elfont/marfont .tl_set:N = \g__margin_font_tl, + elfont/marfont .initial:n = \rmfamily\footnotesize, + lstlistlistingname .tl_set:N = \lstlistlistingname, lstlistingname .tl_set:N = \lstlistingname } \RequirePackage[svgnames]{xcolor} -\cs_new_protected:Nn \__load_color_black: - {\definecolorset{HTML}{ctex@}{}{frame,000000;emph,000000;verb,000000}} -\cs_new_protected:Nn \__load_color_navygreen: - {\definecolorset{HTML}{ctex@}{}{frame,005752;emph,004986;verb,a40000}} -\cs_new_protected:Nn \__load_color_navyblue: - {\definecolorset{HTML}{ctex@}{}{frame,005982;emph,eb6877;verb,a4005b}} -\cs_new_protected:Nn \__load_color: - {\use:c {__load_color_ \g__keys_color_tl :}} -\ctex_at_end_preamble:n {\__load_color:} - \RequirePackage{pdfpages,subfiles} \includepdfset{fitpaper = true} \RequirePackage[hang,stable]{footmisc} @@ -202,6 +213,17 @@ \RequirePackage[most]{tcolorbox} \RequirePackage[sort&compress]{gbt7714} \RequirePackage[xindy]{imakeidx} +\RequirePackage[ + lang = {chinese-utf8}, + type = {CC}, + modifier = {by-nc}, + version = {4.0} + ]{doclicense} +\ctex_at_end_preamble:n + { + \tl_if_empty:NF \g__config_tl + {\file_input:n {\g__config_tl}} + } \sys_if_engine_xetex:TF { @@ -395,7 +417,7 @@ \fancyfoot[C]{\color{ctex@frame}\thepage} \fancypagestyle{plain} { - \fancyhf{}\cs_gset:Npn\headrule{} + \fancyhf{}\cs_gset:Npn \headrule{} \fancyfoot[C]{\color{ctex@frame}\thepage} } } @@ -426,47 +448,58 @@ \titlecontents{part} [0\ccwd] {\addvspace{1pc}\sffamily\large} - {} - {} + {}{} {\normalsize\titlerule*{}\bf\contentspage} \titlecontents{chapter} [0\ccwd] {\addvspace{1pc}\sffamily\large} - {\thecontentslabel\hspace{\ccwd}} - {} - {\normalsize\titlerule*[0.55pc]{\scalebox{1.2}{$\cdot$}}\bf\contentspage} + {}{} + {\normalsize\titlerule*[0.65pc]{\scalebox{1.2}{$\cdot$}}\bf\contentspage} \titlecontents{section} [1.5\ccwd] {\addvspace{0.35pc}} - {\thecontentslabel\hspace{\ccwd}} - {} - {\titlerule*[0.55pc]{\scalebox{1.2}{$\cdot$}}\contentspage} + {}{} + {\titlerule*[0.65pc]{\scalebox{1.2}{$\cdot$}}\contentspage} \titlecontents{subsection} [3.8\ccwd] {\addvspace{0.35pc}} - {\thecontentslabel\hspace{\ccwd}} - {} - {\titlerule*[0.55pc]{\scalebox{1.2}{$\cdot$}}\contentspage} + {}{} + {\titlerule*[0.65pc]{\scalebox{1.2}{$\cdot$}}\contentspage} \titlecontents{figure} [0\ccwd] {\addvspace{0.2pc}} - {\thecontentslabel\hspace{\ccwd}} - {} - {\titlerule*[0.55pc]{\scalebox{1.2}{$\cdot$}}\contentspage} + {}{} + {\titlerule*[0.65pc]{\scalebox{1.2}{$\cdot$}}\contentspage} \titlecontents{table} [0\ccwd] {\addvspace{0.2pc}} - {\thecontentslabel\hspace{\ccwd}} - {} - {\titlerule*[0.55pc]{\scalebox{1.2}{$\cdot$}}\contentspage} + {}{} + {\titlerule*[0.65pc]{\scalebox{1.2}{$\cdot$}}\contentspage} \contentsuse{lstlisting}{lol} \titlecontents{lstlisting} [0\ccwd] {\addvspace{0.2pc}} - {\thecontentslabel\hspace{\ccwd}} - {} - {\titlerule*[0.55pc]{\scalebox{1.2}{$\cdot$}}\contentspage} + {}{} + {\titlerule*[0.65pc]{\scalebox{1.2}{$\cdot$}}\contentspage} +\ctex_patch_cmd:Nnn \caption@@@addcontentsline + {\addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}} + {\addcontentsline{#1}{#2}{#3\hspace{\ccwd}#4}} +\ctex_patch_cmd:Nnn \lst@MakeCaption + { + \addcontentsline{lol}{lstlisting} + {\protect\numberline{\thelstlisting}\lst@@caption} + }{ + \addcontentsline{lol}{lstlisting} + {\thelstlisting\hspace{\ccwd}\lst@@caption} + } +\cs_new_protected:Npn \__header_mark:n #1 + { + \chapter*{\phantomsection#1} + \bool_if:NTF \l__page_twoside_bool + {\markboth{\MakeUppercase#1}{\MakeUppercase#1}} + {\markboth{\MakeUppercase#1}{}} + } \cs_gset:Npn \tableofcontents { \if@twocolumn @@ -476,10 +509,7 @@ \@restonecolfalse \bool_if:NT \l__multoc_bool{\twocolumn} \fi - \chapter*{\contentsname} - \bool_if:NTF \l__page_twoside_bool - {\markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}} - {\markboth{\MakeUppercase\contentsname}{}} + \__header_mark:n {\contentsname} \vspace*{-1pc} \@starttoc{toc} \if@restonecol @@ -497,11 +527,8 @@ \@restonecolfalse \bool_if:NT \l__multoc_bool{\twocolumn} \fi - \chapter*{\phantomsection\listfigurename} - \addcontentsline{toc}{chapter}{\listfigurename} - \bool_if:NTF \l__page_twoside_bool - {\markboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}} - {\markboth{\MakeUppercase\listfigurename}{}} + \__header_mark:n {\listfigurename} + \CTEX@addtocline{chapter}{\listfigurename} \vspace*{-1pc} \@starttoc{lof} \if@restonecol @@ -519,11 +546,8 @@ \@restonecolfalse \bool_if:NT \l__multoc_bool{\twocolumn} \fi - \chapter*{\phantomsection\listtablename} - \addcontentsline{toc}{chapter}{\listtablename} - \bool_if:NTF \l__page_twoside_bool - {\markboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}} - {\markboth{\MakeUppercase\listtablename}{}} + \__header_mark:n {\listtablename} + \CTEX@addtocline{chapter}{\listtablename} \vspace*{-1pc} \@starttoc{lot} \if@restonecol @@ -534,7 +558,7 @@ } \cs_new:Npn \listoflistings { - \begingroup + \group_begin: \@ifundefined{@restonecoltrue}{} { \if@twocolumn @@ -545,11 +569,8 @@ \bool_if:NT \l__multoc_bool{\twocolumn} \fi } - \chapter*{\phantomsection\lstlistlistingname} - \addcontentsline{toc}{chapter}{\lstlistlistingname} - \bool_if:NTF \l__page_twoside_bool - {\markboth{\MakeUppercase\lstlistlistingname}{\MakeUppercase\lstlistlistingname}} - {\markboth{\MakeUppercase\lstlistlistingname}{}} + \__header_mark:n {\lstlistlistingname} + \CTEX@addtocline{chapter}{\lstlistlistingname} \vspace*{-0.2pc} \@starttoc{lol} \@ifundefined{@restonecoltrue}{} @@ -560,7 +581,7 @@ \onecolumn \fi } - \endgroup + \group_end: } \cs_gset:Npn \bibsection{\chapter{\bibname}} @@ -588,34 +609,49 @@ toclevel = chapter, firstpagestyle = plain } -\patchcmd\imki@indexheaders +\__patch_cmd:Nnn \imki@indexheaders {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} { \bool_if:NTF \l__page_twoside_bool {\markboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} {\markboth{\MakeUppercase\indexname}{}} } - {}{} \DeclareCaptionLabelSeparator{ccwd}{\hspace{\ccwd}} \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)} +\DeclareCaptionFont{tabfont}{\g__tab_font_tl} +\DeclareCaptionFont{figfont}{\g__fig_font_tl} +\DeclareCaptionFont{lstfont}{\g__lst_font_tl} \captionsetup { format = hang, % figurewithin = section, % tablewithin = section, - labelfont = {sf,small,color = ctex@frame}, labelsep = ccwd, - textfont = {sf,small,stretch = \g__cap_spread_tl}, belowskip = 0pt,aboveskip = 10pt } +\captionsetup[table] + { + labelfont = {tabfont,color = ctex@frame}, + textfont = {tabfont,stretch = \g__cap_spread_tl} + } +\captionsetup[figure] + { + labelfont = {figfont,color = ctex@frame}, + textfont = {figfont,stretch = \g__cap_spread_tl} + } \captionsetup[subfigure] { labelfont = {sf,small,color = ctex@frame}, labelformat = parens, belowskip = 2pt,aboveskip = 6pt } -\captionsetup[lstlisting]{singlelinecheck = false} +\captionsetup[lstlisting] + { + singlelinecheck = false, + labelfont = {lstfont,color = ctex@frame}, + textfont = {lstfont,stretch = \g__cap_spread_tl} + } \captionsetup[figure][bi-second]{name = Figure} \captionsetup[table][bi-second]{name = Table} \cs_new:Npn \__arabic:n #1{\int_to_arabic:v {c@#1}} @@ -683,34 +719,33 @@ \hbox{\tikz\draw(0pt,0pt)circle(.5\ccwd)node{\makebox[\ccwd][c]{\small#1}};} } -\tl_new:N \theoremname -\tl_new:N \definitioname -\tl_new:N \lemmaname -\tl_new:N \corollaryname -\tl_new:N \propositioname -\tl_new:N \examplename -\tl_new:N \remarkname -\tl_new:N \exercisename - +\cs_new_protected:Npn \__thmname_set:nn #1#2 + {\tl_const:cn {c__name_#1_tl}{#2}} \bool_if:NTF \l__lang_chinese_bool { - \tl_set:Nn \theoremname{定理} - \tl_set:Nn \definitioname{定义} - \tl_set:Nn \lemmaname{引理} - \tl_set:Nn \corollaryname{推论} - \tl_set:Nn \propositioname{性质} - \tl_set:Nn \examplename{例} - \tl_set:Nn \remarkname{注} - \tl_set:Nn \exercisename{练习} - }{ - \tl_set:Nn \theoremname{Theorem} - \tl_set:Nn \definitioname{Definition} - \tl_set:Nn \lemmaname{Lemma} - \tl_set:Nn \corollaryname{Corollary} - \tl_set:Nn \propositioname{Proposition} - \tl_set:Nn \examplename{Example} - \tl_set:Nn \remarkname{Remark} - \tl_set:Nn \exercisename{Exercise} + \clist_map_inline:nn + { + {theorem}{定理}, + {definition}{定义}, + {lemma}{引理}, + {corollary}{推论}, + {proposition}{性质}, + {example}{例}, + {remark}{注}, + {exercise}{练习} + }{\__thmname_set:nn #1} + }{ + \clist_map_inline:nn + { + {theorem}{Theorem}, + {definition}{Definition}, + {lemma}{Lemma}, + {corollary}{Corollary}, + {proposition}{Proposition}, + {example}{Example}, + {remark}{Remark}, + {exercise}{Exercise} + }{\__thmname_set:nn #1} } \declaretheoremstyle[ @@ -726,16 +761,16 @@ numberwithin = chapter, headformat = \NAME\space\NUMBER\NOTE ]{mythm} -\declaretheorem[style = mythm,name = \theoremname]{theorem} -\declaretheorem[style = mythm,name = \definitioname]{definition} -\declaretheorem[style = mythm,name = \lemmaname]{lemma} -\declaretheorem[style = mythm,name = \corollaryname]{corollary} -\declaretheorem[style = mythm,name = \propositioname]{proposition} -\declaretheorem[style = mythm,name = \examplename]{example} +\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\remarkname, + name = \faCommentingO\space\c__name_remark_tl, numbered = no ] \declaretheorem{proof}[ @@ -842,12 +877,12 @@ \end{outlinelist} \end{tcolorbox} } -\NewDocumentEnvironment{exercise}{sO{black}O{1.}O{\exercisename}} +\NewDocumentEnvironment{exercise}{sO{black}O{1.}O{\c__name_exercise_tl}} { \IfBooleanF{#1} { \refstepcounter{section} - \addcontentsline{toc}{section}{\CTEXthesection\hspace{\ccwd}#4} + \CTEX@addtocline{section}{#4} \markright { \ifnum\c@secnumdepth>\z@ @@ -920,19 +955,15 @@ \counterwithin*{footnote}{page} } } -\patchcmd\@footnotetext - {\def\baselinestretch{\ZhLS@footlinespread}} - {\def\baselinestretch{\g__foot_spread_tl}} - {}{} -\patchcmd\@mpfootnotetext - {\def\baselinestretch{\ZhLS@footlinespread}} - {\def\baselinestretch{\g__foot_spread_tl}} - {}{} -\patchcmd\@makefnmark - {\normalfont} - {\normalfont\rmfamily} - {}{} -\cs_gset:Npn \marginfont{\sffamily\footnotesize} +\__patch_cmd:Nnn \@footnotetext + {\def\baselinestretch{\ZhLS@footlinespread}\reset@font} + {\def\baselinestretch{\g__foot_spread_tl}\g__foot_font_tl} +\__patch_cmd:Nnn \@mpfootnotetext + {\def\baselinestretch{\ZhLS@footlinespread}\reset@font} + {\def\baselinestretch{\g__foot_spread_tl}\g__foot_font_tl} +\__patch_cmd:Nnn \@makefnmark + {\normalfont}{\g__foot_font_tl} +\cs_gset:Npn \marginfont{\g__margin_font_tl} \lstdefinestyle{mystyle} { @@ -950,7 +981,7 @@ emphstyle = \color{ctex@emph}, emph = { - amsmath,align,aligned,chemfig,cleveref,cases,caption,chemformula,compactenum,description,enumitem,enumerate,exercise,easybook,footmisc,hang,itemize,imakeidx,listings,LaTeX,multline,mybox,paralist,Python,siunitx,split,subnumcases,subcaption,tabularx,thmtools,xcolor + caption,config,easybook,elfont,linktopage,subcaption,tabularx,thmtools }, keywordstyle = \lst@ifdisplaystyle\bfseries\color{ctex@emph}\else\color{ctex@verb}\fi, morekeywords = @@ -980,7 +1011,9 @@ {\clist_gput_right:Nn \g__hyperref_clist{#1}} \cs_new_protected:Npn \__define_linkcolor:nnn #1#2#3 {\definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3}} -\cs_new:Npn \__set_linkcolor:n #1 +\cs_new_protected:Npn \__define_themecolor:nnn #1#2#3 + {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3}} +\cs_new:Npn \__linkcolor_set:n #1 { linkcolor/\clist_item:nn {#1}{1} .code:n = { @@ -996,6 +1029,17 @@ } }, } +\cs_new:Npn \__themecolor_set:n #1 + { + color/\clist_item:nn {#1}{1} .code:n = + { + \__define_themecolor:nnn + {\clist_item:nn {#1}{2}} + {\clist_item:nn {#1}{3}} + {\clist_item:nn {#1}{4}} + }, + } + \cs_new:Npn \__allow_urlbreak: { \cs_new:Npn \__add_urlbreak_points: @@ -1009,7 +1053,6 @@ \keys_define:nx {ctex/link} { hyperlink .choice:, - hyperlink .value_required:n = true, hyperlink/edge .code:n = {}, hyperlink/various .code:n = {\__clist_put_hyperref:n {colorlinks}}, hyperlink/none .code:n = {\__clist_put_hyperref:n {hidelinks}}, @@ -1017,32 +1060,37 @@ hyperlink .initial:n = edge, linkcolor .choice:, - linkcolor .value_required:n = true, \clist_map_function:nN { - {darkgray, 626262,0000B2,005752}, - {lightblue, 0000ff,004986,eb6877}, - {crimson, dc143c,00c1c9,afcd20}, - {hotpink, ff69b4,9d5196,57b5e5} + {graphite, 626262,0000B2,005752}, + {cutepink, ff69b4,9d5196,57b5e5}, + {skyblue, 0000ff,004986,eb6877}, + {crimson, dc143c,00c1c9,afcd20} } - \__set_linkcolor:n, - linkcolor .default:n = darkgray, - linkcolor .initial:n = darkgray, + \__linkcolor_set:n, + linkcolor .default:n = graphite, + linkcolor .initial:n = graphite, linktopage .choice:, - linktopage .value_required:n = true, linktopage/true .code:n = {\__clist_put_hyperref:n {linktocpage}}, - linktopage/false .code:n = {\__clist_put_hyperref:n {linktocpage = false}}, + linktopage/false .code:n = {}, linktopage .default:n = true, linktopage .initial:n = false } - -\RequirePackage[ - lang = {chinese-utf8}, - type = {CC}, - modifier = {by-nc}, - version = {4.0} - ]{doclicense} +\keys_define:nx {ctex/style} + { + color .choice:, + color .value_required:n = true, + \clist_map_function:nN + { + {none, 000000,000000,000000}, + {forest, 005752,004986,a40000}, + {energy, f39800,00a0e9,893895}, + {cyberpunk, 005982,eb6877,a4005b} + } + \__themecolor_set:n, + color .initial:n = none + } \ctex_at_end_preamble:n { @@ -1129,12 +1177,15 @@ \bool_if:NF \l__newline_bool{\centering} }, aftername = - {\bool_if:NTF \l__newline_bool{\par\nobreak\vskip 1.5pc}{\hspace{\ccwd}}}, + { + \bool_if:NTF \l__newline_bool + {\par\nobreak\vskip 1.5pc}{\hspace{\ccwd}} + }, beforeskip = -1.5ex, afterskip = 3ex, lotskip = 0.8pc, lofskip = 0.8pc, - tocline = {\CTEXifname{\protect\numberline{\CTEXthechapter}}{}#2} + tocline = {\CTEXifname{\CTEXthechapter\hspace{\ccwd}}{}#2} }, section = { @@ -1143,7 +1194,7 @@ aftername = {\hspace{0.5\ccwd}}, beforeskip = 1.5ex plus .2ex minus .1ex, afterskip = 1.5ex plus .2ex minus .1ex, - tocline = {\CTEXifname{\protect\numberline{\CTEXthesection}}{}#2} + tocline = {\CTEXifname{\CTEXthesection\hspace{\ccwd}}{}#2} }, subsection = { @@ -1152,7 +1203,7 @@ aftername = {\hspace{0.5\ccwd}}, beforeskip = 1.3ex plus .2ex minus .1ex, afterskip = 1.3ex plus .2ex minus .1ex, - tocline = {\CTEXifname{\protect\numberline{\CTEXthesubsection}}{}#2} + tocline = {\CTEXifname{\CTEXthesubsection\hspace{\ccwd}}{}#2} }, subsubsection = { diff --git a/macros/latex/contrib/easybook/pages/chapter3.tex b/macros/latex/contrib/easybook/pages/chapter3.tex deleted file mode 100644 index 2c7c27ce7f..0000000000 --- a/macros/latex/contrib/easybook/pages/chapter3.tex +++ /dev/null @@ -1,52 +0,0 @@ -% Chapter 3 -\documentclass[../easybook-demo]{subfiles} -\begin{document} - -\chapter{其它格式}\label{chap1} - -\section{代码}\index{d@代码} -使用 \lstinline{listings} 宏包可以对代码格式进行高度定制,默认语言为 \lstinline{LaTeX},这里以 \lstinline{Python} 为例 -\begin{lstlisting}[language = Python,caption = {python程序练习题}] -#!/usr/bin/python -# -*- coding: UTF-8 -*- - -if __name__ == '__main__': - ptr = [] - for i in range(5): - num = int(raw_input('please input a number:\n')) - ptr.append(num) - print ptr -\end{lstlisting} - -\section{物理量}\index{w@物理量} -\lstinline{siunitx} 宏包的 \lstinline{\num} 命令可以输出科学计数法 \num{-21x.3e5},而 \lstinline{\SI} 命令可用来输出带有单位的量,比如 \SI{.5}{mol}。 - -\section{化学式}\index{h@化学式} -除了以普通公式的方式,化学式还可用 \lstinline{chemformula} 实现,无机化学式例如\ch{(NH4)2S}、\ch{[Cu(NH3)4]^2+}。 -\[\ch{$x$ Na(NH4)HPO4 ->[$\Delta$] (NaPO3)_{$x$} + $x$ NH3 ^ + $x$ H2O}\] -有机化学式推荐使用 \lstinline{chemfig} 完成。 -\[\zihao{-5}\chemfig[cram width=5pt]{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2] -HN-[::+60]CH_3)=-(-HO)=)}\] - -\clearpage -\section{引用}\index{y@引用} -使用 \lstinline{cleveref} 宏包的 \lstinline{\cref} 命令进行引用,将会自动检测环境并添加相应的前缀。 -\subsection{索引}\index{y@引用!s@索引} -使用 \lstinline{imakeidx} 生成索引,仅做了简单的设置如将索引设为双栏并加入目录,其他选项可另外配置。 - -\subsection{脚注}\index{y@引用!j@脚注} -脚注应在注释与正文之间加细线分隔,使用 \lstinline{footmisc} 宏包设置,选项为悬挂缩进(\lstinline{hang})形式\footnote{这是一个悬挂缩进的脚注。\par 这是分段将会缩进两字符。}。这是自定义标记的脚注且不影响正常编号\Footnote{*}{这是可以自定义标记的脚注。}。 - -\subsection{边注}\index{y@引用!b@边注} -命令 \lstinline{\marginnote} 可以生成简单的边注\marginnote{这是一个边注。}。 - -\subsection{引用章节}\label{sec1}\index{y@引用!s@索引} -如引用\cref{chap1}、\cref{sec1}。 - -\subsection{参考文献}\index{y@引用!c@参考文献} -这是一个参考文献引用的范例\cite{1979Prospect}。引用多个文献,将引用标号中的多个文献序号按升序排列,若其中有2个以上的连续序号,则改用范围序号,例如\cite{1979Prospect,1989The,2010An}。 - -\section{行内盒子}\index{h@行内盒子} -设置了两个行内盒子,这个盒子 \concise[Aqua][fontupper = \rmfamily]{concise} 可以为抄录盒子有三个参数 \lstinline{[<颜色>][<配置>][<内容>]},行内盒子内容是必选参数其他可选。设置等宽字体可在配置参数中 \lstinline{fontupper = \ttfamily}。这个盒子 \fuzzy[yellow][fontupper = \ttfamily,colupper = black]{fuzzy} 的参数选项与上个盒子相同,具有模糊边缘类似高亮的效果。 - -\end{document}
\ No newline at end of file |