From deb51d400db4c69df1cef442643a6b94428a2211 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 16 Aug 2022 03:00:42 +0000 Subject: CTAN sync 202208160300 --- macros/latex/contrib/elegantbook/README-CN.md | 34 - macros/latex/contrib/elegantbook/README.md | 29 +- .../latex/contrib/elegantbook/elegantbook-cn.pdf | Bin 1062407 -> 1282398 bytes .../latex/contrib/elegantbook/elegantbook-cn.tex | 338 ++++++++-- .../latex/contrib/elegantbook/elegantbook-en.pdf | Bin 756261 -> 1036571 bytes .../latex/contrib/elegantbook/elegantbook-en.tex | 171 +++-- macros/latex/contrib/elegantbook/elegantbook.cls | 288 +++++--- macros/latex/contrib/elegantbook/image/donate.jpg | Bin 0 -> 141078 bytes macros/latex/contrib/proflycee/README.md | 2 +- .../latex/contrib/proflycee/doc/ProfLycee-doc.pdf | Bin 732702 -> 789010 bytes .../latex/contrib/proflycee/doc/ProfLycee-doc.tex | 731 +++++++++++++++++---- macros/latex/contrib/proflycee/doc/basique.csv | 8 +- macros/latex/contrib/proflycee/doc/cap.csv | 44 +- macros/latex/contrib/proflycee/doc/perroquet.csv | 46 +- macros/latex/contrib/proflycee/tex/ProfLycee.sty | 352 +++++++++- 15 files changed, 1640 insertions(+), 403 deletions(-) delete mode 100644 macros/latex/contrib/elegantbook/README-CN.md create mode 100644 macros/latex/contrib/elegantbook/image/donate.jpg (limited to 'macros/latex') diff --git a/macros/latex/contrib/elegantbook/README-CN.md b/macros/latex/contrib/elegantbook/README-CN.md deleted file mode 100644 index 438d4fb195..0000000000 --- a/macros/latex/contrib/elegantbook/README-CN.md +++ /dev/null @@ -1,34 +0,0 @@ - - - -[Homepage](https://elegantlatex.org/) | [Github](https://github.com/ElegantLaTeX/ElegantBook) | [CTAN](https://ctan.org/pkg/elegantbook) | [Download](https://github.com/ElegantLaTeX/ElegantBook/releases) | [Wiki](https://github.com/ElegantLaTeX/ElegantBook/wiki) | [Weibo](https://weibo.com/elegantlatex) - -![License](https://img.shields.io/ctan/l/elegantbook.svg) ![CTAN Version](https://img.shields.io/ctan/v/elegantbook.svg) ![Github Version](https://img.shields.io/github/release/ElegantLaTeX/ElegantBook.svg) ![Repo Size](https://img.shields.io/github/repo-size/ElegantLaTeX/ElegantBook.svg) - ---- - -# ElegantBook 优美的 LaTeX 书籍模板 - -ElegantBook 是为 LaTeX 书籍写作而设计的模板,由 [Dongsheng Deng](https://ddswhu.me/) 和 [Liam Huang](https://liam.page/) 创立,模板创立的初衷是方便我们自己做笔记 :smile:。如果你有其他问题、建议或者报告 bug,可以提交 issues 或者给我们发邮件:elegantlatex2e@gmail.com。QQ 用户交流群:692108391,欢迎加入。 - -## 重要提示 - -**重要提示**:ElegantLaTeX 项目 **不接受** 任何非预授权的提交(pull requests)! - -## 致谢 - -特别感谢 [sikouhjw](https://github.com/sikouhjw) 长期以来对于 Github 上 issue 的快速回应,以及各个社区论坛对于 ElegantLaTeX 相关问题的回复。 - -特别感谢 ChinaTeX 以及 [LaTeX 工作室](http://www.latexstudio.net/)对于本系列模板的大力宣传与推广。 - -如果你喜欢我们的模板,你可以在 Github 上收藏我们的模板。 - -## 协议 - -本模板发布遵循 LaTeX 项目公共许可证 1.3 c 或更高版本。如果是衍生作品,请务必加入协议声明和模板信息(github、CTAN 地址)。 - -## 衍生作 - -+ [ElegantBookdown](https://github.com/XiangyunHuang/ElegantBookdown):[XiangyunHuang](https://github.com/XiangyunHuang) 开发并维护的基于 ElegantBook 的 Bookdown 模板。 -+ [bookdownplus](https://github.com/pzhaonet/bookdownplus):应网友要求,[pzhaonet](https://github.com/pzhaonet) 在 bookdownplus 收录了 ElegantPaper 模板,并为 Mac 做了字体适配。 -+ [PanBook](https://github.com/annProg/PanBook):[annProg](https://github.com/annProg) 开发并维护的基于 Markdown 写作的工作流,收录了 ElegantBook 和 ElegantPaper 模板。 \ No newline at end of file diff --git a/macros/latex/contrib/elegantbook/README.md b/macros/latex/contrib/elegantbook/README.md index 6e3bc0df80..21f5b47132 100644 --- a/macros/latex/contrib/elegantbook/README.md +++ b/macros/latex/contrib/elegantbook/README.md @@ -1,34 +1,37 @@ -[Homepage](https://elegantlatex.org/) | [Github](https://github.com/ElegantLaTeX/ElegantBook) | [CTAN](https://ctan.org/pkg/elegantbook) | [Download](https://github.com/ElegantLaTeX/ElegantBook/releases) | [Wiki](https://github.com/ElegantLaTeX/ElegantBook/wiki) | [Weibo](https://weibo.com/elegantlatex) +[Homepage](https://elegantlatex.org/) | [Github](https://github.com/ElegantLaTeX/ElegantBook) | [CTAN](https://ctan.org/pkg/elegantbook) | [Download](https://github.com/ElegantLaTeX/ElegantBook/releases) | ![License](https://img.shields.io/ctan/l/elegantbook.svg) ![CTAN Version](https://img.shields.io/ctan/v/elegantbook.svg) ![Github Version](https://img.shields.io/github/release/ElegantLaTeX/ElegantBook.svg) ![Repo Size](https://img.shields.io/github/repo-size/ElegantLaTeX/ElegantBook.svg) ------- -# ElegantBook: An Elegant LaTeX Template for Books +# ElegantBook: 优美的 LaTeX 书籍模板 An Elegant LaTeX Template for Books -ElegantBook is designed for writing books, created by [Dongsheng Deng](https://ddswhu.me/) and [Liam Huang](https://liam.page/). Just enjoy it! If you have any questions, suggestions or bug reports, you can create issues or contact us at elegantlatex2e@gmail.com. +ElegantBook 是为 LaTeX 书籍写作而设计的模板,由 [Ethan Deng](https://github.com/EthanDeng) 和 [Liam Huang](https://github.com/Liam0205) 创立,现在主要由 [Ethan Deng](https://github.com/EthanDeng)、[乙醇](https://github.com/syvshc)和[死抠](https://github.com/sikouhjw)维护。如果你有其他问题、建议或者报告 bug,可以提交 issues 或者加入我们的 QQ 用户交流群:692108391。 -## Important Notes +ElegantBook is designed for writing books, created by [Ethan Deng](https://github.com/EthanDeng) and [Liam Huang](https://github.com/Liam0205), and maintained by [Ethan Deng](https://github.com/EthanDeng), [syvshc](https://github.com/syvshc) and [sikouhjw](https://github.com/sikouhjw). Just enjoy it! If you have any questions, suggestions or bug reports, you can create issues or contact us at elegantlatex2e@gmail.com. -For some reasons, __unauthorized__ pull requests are **UNACCEPTABLE** since May 20, 2019. For those who want to help revise the templates, submit issues or clone to your own repository to modify under the LPPL-1.3c. -## Acknowledgement +## 致谢 Acknowledgement -Thank [sikouhjw](https://github.com/sikouhjw) for his quick response to Github issues and continuously support work for ElegantLaTeX. -Thank ChinaTeX and [LaTeX Studio](http://www.latexstudio.net/) for their promotion. +特别感谢 [sikouhjw](https://github.com/sikouhjw) 和 [syvshc](https://github.com/syvshc) 长期以来对于 Github 上 issue 的快速回应,以及各个社区论坛对于 ElegantLaTeX 相关问题的回复。特别感谢 ChinaTeX 以及 [LaTeX 工作室](http://www.latexstudio.net/)对于本系列模板的大力宣传与推广。 +Thank [sikouhjw](https://github.com/sikouhjw) and [syvshc](https://github.com/syvshc) for their quick response to Github issues and continuously support work for ElegantLaTeX community. Thank ChinaTeX and [LaTeX Studio](http://www.latexstudio.net/) for their promotion. -## License + +## 协议 License + +本模板发布遵循 LaTeX 项目公共许可证 1.3 c 或更高版本。 +如果是衍生作品,请务必加入协议声明和模板信息(github、CTAN 地址)。 This work is released under the LaTeX Project Public License, v1.3c or later. -## Derivative Works +## 衍生品 Derivative Works -+ [ElegantBookdown](https://github.com/XiangyunHuang/ElegantBookdown):[XiangyunHuang](https://github.com/XiangyunHuang) developed a Bookdown template based on ElegantBook. -+ [bookdownplus](https://github.com/pzhaonet/bookdownplus): maintained by [pzhaonet](https://github.com/pzhaonet). -+ [PanBook](https://github.com/annProg/PanBook):a markdown-based writing workflow Developed by [annProg](https://github.com/annProg). ++ [ElegantBookdown](https://github.com/XiangyunHuang/ElegantBookdown):[XiangyunHuang](https://github.com/XiangyunHuang) 开发并维护的基于 ElegantBook 的 Bookdown 模板。 ++ [bookdownplus](https://github.com/pzhaonet/bookdownplus):应网友要求,[pzhaonet](https://github.com/pzhaonet) 在 bookdownplus 收录了 ElegantPaper 模板,并为 Mac 做了字体适配。 ++ [PanBook](https://github.com/annProg/PanBook):[annProg](https://github.com/annProg) 开发并维护的基于 Markdown 写作的工作流,收录了 ElegantBook 和 ElegantPaper 模板。 diff --git a/macros/latex/contrib/elegantbook/elegantbook-cn.pdf b/macros/latex/contrib/elegantbook/elegantbook-cn.pdf index 5b8edc4de9..785c9c733f 100644 Binary files a/macros/latex/contrib/elegantbook/elegantbook-cn.pdf and b/macros/latex/contrib/elegantbook/elegantbook-cn.pdf differ diff --git a/macros/latex/contrib/elegantbook/elegantbook-cn.tex b/macros/latex/contrib/elegantbook/elegantbook-cn.tex index 728e69fbe9..89f89bd2eb 100644 --- a/macros/latex/contrib/elegantbook/elegantbook-cn.tex +++ b/macros/latex/contrib/elegantbook/elegantbook-cn.tex @@ -1,15 +1,15 @@ -\documentclass[lang=cn,10pt]{elegantbook} +\documentclass[lang=cn,10pt,founder,newtx]{elegantbook} \title{ElegantBook:优美的 \LaTeX{} 书籍模板} \subtitle{Elegant\LaTeX{} 经典之作} \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} -\date{April 9, 2022} -\version{4.3} +\date{Aug 15, 2022} +\version{4.4} \bioinfo{自定义}{信息} -\extrainfo{不要以为抹消过去,重新来过,即可发生什么改变。—— 比企谷八幡} +\extrainfo{要让一群人团结起来,需要的不是英明的领导,而是共同的敌人。—— 比企谷八幡} \setcounter{tocdepth}{3} @@ -21,8 +21,11 @@ \newcommand{\ccr}[1]{\makecell{{\color{#1}\rule{1cm}{1cm}}}} % 修改标题页的橙色带 -% \definecolor{customcolor}{RGB}{32,178,170} -% \colorlet{coverlinecolor}{customcolor} +\definecolor{customcolor}{RGB}{32,178,170} +\colorlet{coverlinecolor}{customcolor} +\usepackage{cprotect} + +\addbibresource[location=local]{reference.bib} % 参考文献,不要删除 \begin{document} @@ -35,21 +38,26 @@ \chapter{Elegant\LaTeX{} 系列模板介绍} -Elegant\LaTeX{} 项目组致力于打造一系列美观、优雅、简便的模板方便用户使用。目前由 \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote},\href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook},\href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper} 组成,分别用于排版笔记,书籍和工作论文。强烈推荐使用最新正式版本!本文将介绍本模板的一些设置内容以及基本使用方法。如果您有其他问题,建议或者意见,欢迎在 GitHub 上给我们提交 \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} 或者邮件联系我们。 +Elegant\LaTeX{} 项目组致力于打造一系列美观、优雅、简便的模板方便用户使用。目前由 \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote},\href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook},\href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper} 组成,分别用于排版笔记,书籍和工作论文。大版本改动较大,请关注版本信息,在未开始使用模板钱,建议直接选择最新正式版本! -我们的联系方式如下,建议加入用户 QQ 群提问,这样能更快获得准确的反馈,加群时请备注 \LaTeX{} 或者 Elegant\LaTeX{} 相关内容。 +本文将介绍本模板的一些设置内容以及基本使用方法。如果您有其他问题,建议或者意见,欢迎在 GitHub 上给我们提交 \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} 或者邮件联系我们。我们的联系方式如下,建议加入用户 QQ 群提问,这样能更快获得准确的反馈,加群时请备注 \LaTeX{} 或者 Elegant\LaTeX{} 相关内容。 \begin{itemize} - \item 官网:\href{https://elegantlatex.org/}{https://elegantlatex.org/}(暂时歇业) + \item 官网:\href{https://elegantlatex.org/}{https://elegantlatex.org/} \item GitHub 地址:\href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/} - \item Gitee 地址:\href{https://gitee.com/ElegantLaTeX}{https://gitee.com/ElegantLaTeX} \item CTAN 地址:\href{https://ctan.org/pkg/elegantbook}{https://ctan.org/pkg/elegantbook} \item 下载地址:\href{https://github.com/ElegantLaTeX/ElegantBook/releases}{正式发行版},\href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{最新版} - \item 微博:Elegant\LaTeX{}(密码有点忘了) - \item 微信公众号:Elegant\LaTeX{}(不定期更新) - \item 用户 QQ 群:692108391(建议加群) + \item 微博:Elegant\LaTeX{} + \item 微信公众号:Elegant\LaTeX{} + \item Bilibili:\href{https://space.bilibili.com/516479629}{ElegantLaTeX} + \item 用户 QQ 群:692108391 \item 邮件:\email{elegantlatex2e@gmail.com} \end{itemize} +\begin{quotation} + \textbf{注意:} 由于 ElegantLaTeX 的模板涉及宏包和设定比较多,不建议没有 \LaTeX{} 基础的用户使用。我们会通过 \href{https://space.bilibili.com/516479629}{B 站}进行直播或者交流分享会,录屏也将发布在该账户下,如果大家在模板的使用上有问题,可以观看视频、加群咨询或者查看模板自带的文档说明(如果安装了 TeX Live,可以使用在命令行提示符下运行 \lstinline{texdoc elegantbook} 命令获得模板的说明文档。 +\end{quotation} + + \section{模板安装与更新} 你可以通过免安装的方式使用本模板,包括在线使用和本地(文件夹内)使用两种方式,也可以通过 \TeX{} 发行版安装使用。 @@ -90,8 +98,18 @@ tlmgr update --self --all --reinstall-forcibly-removed \section{关于提交} -出于某些因素的考虑,Elegant\LaTeX{} 项目自 2019 年 5 月 20 日开始,\textbf{不再接受任何非作者预约性质的提交}(pull request)!如果你想改进模板,你可以给我们提交 issues,或者可以在遵循协议(LPPL-1.3c)的情况下,克隆到自己仓库下进行修改。 +由于精力有限,本人维护模板的时间并不多,考虑到模板的用户还挺多,本模板自 2022 年 8 月开始,开放特性提交(features pull requests)!不过在提交之前,请务必在 issue 区将问题、解决方式以及对应的示例(最简单的使用示例)写清楚,我们会根据 issue 的信息,接受合适的提交。 + +\section{赞助} + +如果您非常喜爱我们的模板,你还可以选择赞助的方式支持这个项目,赞助主要用于网站域名和服务器的购买、QQ 用户群的维护以及对于管理员的奖励。赞赏费用的使用解释权归 ElegantLaTeX/EthanDeng 所有,不接受监督。 + +\begin{figure}[htbp] + \centering + \includegraphics[width=0.5\textwidth]{donate.jpg} +\end{figure} + \chapter{ElegantBook 设置说明} @@ -180,7 +198,7 @@ tlmgr update --self --all --reinstall-forcibly-removed \end{table} 如果需要自定义颜色的话请选择 \lstinline{nocolor} 选项或者使用 \lstinline{color=none},然后在导言区定义 structurecolor、main、second、third 颜色,具体方法如下: -\begin{lstlisting}[tabsize=4]] +\begin{lstlisting}[tabsize=4] \definecolor{structurecolor}{RGB}{0,0,0} \definecolor{main}{RGB}{70,70,70} \definecolor{second}{RGB}{115,45,2} @@ -197,13 +215,13 @@ tlmgr update --self --all --reinstall-forcibly-removed \centering \caption{封面元素信息} \begin{tabular}{p{0.07\textwidth}p{0.15\textwidth}|p{0.07\textwidth}p{0.15\textwidth}|p{0.07\textwidth}p{0.15\textwidth}} - \toprule + \hline 信息 & 命令 & 信息 & 命令 & 信息 & 命令 \\ - \midrule + \hline 标题 & \lstinline|\title| & 副标题 & \lstinline|\subtitle| & 作者 & \lstinline|\author| \\ 机构 & \lstinline|\institute| & 日期 & \lstinline|\date| & 版本 & \lstinline|\version| \\ 箴言 & \lstinline|\extrainfo| & 封面图 & \lstinline|\cover| & 徽标 & \lstinline|\logo| \\ - \bottomrule + \hline \end{tabular} \end{table} @@ -258,59 +276,140 @@ tlmgr update --self --all --reinstall-forcibly-removed \item \textit{定理类环境},包含标题和内容两部分,全部定理类环境的编号均以章节编号。根据格式的不同分为 3 种 \begin{itemize} \item \textcolor{main}{\textbf{definition}} 环境,颜色为 \textcolor{main}{main}; - \item \textcolor{second}{\textbf{theorem、lemma、corollary}} 环境,颜色为 \textcolor{second} {second}; + \item \textcolor{second}{\textbf{theorem、lemma、corollary、axiom、postulate}} 环境,颜色为 \textcolor{second} {second}; \item \textcolor{third}{\textbf{proposition}} 环境,颜色为 \textcolor{third}{third}。 \end{itemize} \item \textit{示例类环境},有 \textbf{example、problem、exercise} 环境(对应于例、例题、练习),自动编号,编号以章节为单位,其中 \textbf{exercise} 有提示符。 \item \textit{提示类环境},有 \textbf{note} 环境,特点是:无编号,有引导符。 - \item \textit{结论类环境},有 \textbf{conclusion、assumption、property、remark、solution} 环境\footnote{本模板还添加了一个 result 选项,用于隐藏 \lstinline{solution} 和 \lstinline{proof} 环境,默认为显示(\lstinline{result=answer}),隐藏使用 \lstinline{result=noanswer}。},三者均以粗体的引导词为开头,和普通段落格式一致。 + \item \textit{结论类环境},有 \textbf{conclusion、assumption、property、remark、solution} 环境\footnote{本模板还添加了一个 \lstinline|result| 选项,用于隐藏 \lstinline{solution} 和 \lstinline{proof} 环境,默认为显示(\lstinline{result=answer}),隐藏使用 \lstinline{result=noanswer}。},三者均以粗体的引导词为开头,和普通段落格式一致。 \end{itemize} +其中,定理类环境均有带星号的版本:\textcolor{main}{\textbf{definition*}}、\textcolor{second}{\textbf{theorem*}}、\textcolor{second}{\textbf{lemma*}}、\textcolor{second}{\textbf{corollary*}}、\textcolor{second}{\textbf{axiom*}}、\textcolor{second}{\textbf{postulate*}}、\textcolor{third}{\textbf{proposition*}},带星号的定理类环境不会编号。 + \subsection{定理类环境的使用} -由于本模板使用了 \lstinline{tcolorbox} 宏包来定制定理类环境,所以和普通的定理环境的使用有些许区别,定理的使用方法如下: +\subsubsection{\texttt{fancy} 模式} + +在 \lstinline{fancy} 模式下使用了 \lstinline{tcolorbox} 宏包来定制定理类环境,所以和普通的定理环境的使用有些许区别,有编号定理的使用方法如下: + \begin{lstlisting} +% 有名字,有标签 \begin{theorem}{theorem name}{label} - The content of theorem. + 这是一个有名字和标签的定理。 + 用 \ref{thm:label} 来引用这个定理。 +\end{theorem} +% 无名字,有标签 +\begin{theorem}{}{label no name} + 这是一个没有名字但是有标签的定理。 + 用 \ref{thm:label no name} 来引用这个定理。 +\end{theorem} +% 有名字,无标签 +\begin{theorem}{theorem name}{} + 这是一个有名字但是没有标签的定理。 + 这个定理不能被引用。 + 最后的 {} 可以省略不写。 +\end{theorem} +% 无名字,无标签 +\begin{theorem}{}{} + 这是一个没有名字也没有标签的定理。 + 这个定理不能被引用。 + 两个 {} 均可以省略不写。 \end{theorem} \end{lstlisting} -第一个必选项 \lstinline{theorem name} 是定理的名字,第二个必选项 \lstinline{label} 是交叉引用时所用到的标签,交叉引用的方法为 \verb|\ref{thm:label}|。请注意,交叉引用时必须加上前缀 \lstinline{thm:}。 +第一个选项 \lstinline{theorem name} 是定理的名字,如果定理没有名字请使用 \lstinline|{}|\cprotect\footnote{除非这个定理也没有标签,否则不能省略。}。第二个选项 \lstinline{label} 是交叉引用时所用到的标签,如果定理没有标签,可以不写 \lstinline|{label}| 或使用 \lstinline|{}|。交叉引用的方法为 \lstinline|\ref{thm:label}|。请注意,交叉引用时必须加上前缀 \lstinline{thm:}。其他相同用法的定理类环境见表 \ref{tab:theorem-class}。 -在用户多次反馈下,4.x 之后,引入了原生定理的支持方式,也就是使用可选项方式: +不编号的定理使用方法如下: \begin{lstlisting} -\begin{theorem}[theorem name] \label{thm:theorem-label} - The content of theorem. +% 有名字 +\begin{theorem*}{theorem name} + 这是一个不编号的有名字的定理。 + 这个定理不能被引用。 +\end{theorem*} +% 无名字 +\begin{theorem*}{} + 这是一个不编号且没有名字的定理。 + 最后的 {} 可以省略不写。 + 这个定理不能被引用。 +\end{theorem*} +\end{lstlisting} +其中的选项 \lstinline{theorem name} 是定理的名字,如果没有名字可以不写 \lstinline|{theorem name}| 或使用 \lstinline|{}| + +\begin{table}[htbp] + \centering + \caption{定理类环境} + \begin{tabular}{llll} + \toprule + 环境名 & 标签名 & 前缀 & 交叉引用 \\ + \midrule + definition & label & def & \lstinline|\ref{def:label}| \\ + theorem & label & thm & \lstinline|\ref{thm:label}| \\ + postulate & label & pos & \lstinline|\ref{pos:label}| \\ + axiom & label & axi & \lstinline|\ref{axi:label}|\\ + lemma & label & lem & \lstinline|\ref{lem:label}| \\ + corollary & label & cor & \lstinline|\ref{cor:label}| \\ + proposition & label & pro & \lstinline|\ref{pro:label}| \\ + \bottomrule + \end{tabular}% + \label{tab:theorem-class}% +\end{table}% + +在用户多次反馈下,在 4.1 版本引入了原生定理的支持方式,使用方法如下: + +\begin{lstlisting} +% 有名字,有标签 +\begin{theorem}[theorem name]\label{thm:label} + 这是一个有名字和标签的定理。 + 用 \ref{thm:label} 来引用这个定理。 +\end{theorem} +% 无名字,有标签 +\begin{theorem}\label{thm:label no name} + 这是一个没有名字但是有标签的定理。 + 用 \ref{thm:label no name} 来引用这个定理。 \end{theorem} -% or -\begin{theorem} \label{thm:theorem-withou-name} - The content of theorem without name. +% 有名字,无标签 +\begin{theorem}[theorem name] + 这是一个有名字但是没有标签的定理。 + 这个定理不能被引用。 +\end{theorem} +% 无名字,无标签 +\begin{theorem} + 这是一个没有名字也没有标签的定理。 + 这个定理不能被引用。 \end{theorem} \end{lstlisting} +这时引用不需要加前缀,\lstinline{\ref} 中的内容与 \lstinline{\label} 中的内容相同,换句话说,这时的使用方法与使用原生定理环境的时候几乎相同。 -其他相同用法的定理类环境有: +\subsubsection{\texttt{simple} 模式} + +在 \lstinline{simple} 模式下使用了 \lstinline{amsthm} 宏包,定理类环境使用方法与原生一致,定理的使用方法如下: + +\begin{lstlisting} +% 有名字,有标签 +\begin{theorem}[theorem name]\label{thm:label} + 这是一个有名字和标签的定理。 + 用 \ref{thm:label} 来引用这个定理。 +\end{theorem} +% 无名字,有标签 +\begin{theorem}\label{thm:label no name} + 这是一个没有名字但是有标签的定理。 + 用 \ref{thm:label no name} 来引用这个定理。 +\end{theorem} +% 有名字,无标签 +\begin{theorem}[theorem name] + 这是一个有名字但是没有标签的定理。 + 这个定理不能被引用。 +\end{theorem} +% 无名字,无标签 +\begin{theorem} + 这是一个没有名字也没有标签的定理。 + 这个定理不能被引用。 +\end{theorem} +\end{lstlisting} -\begin{table}[htbp] - \centering - \caption{定理类环境} - \begin{tabular}{llll} - \toprule - 环境名 & 标签名 & 前缀 & 交叉引用 \\ - \midrule - definition & label & def & \lstinline|\ref{def:label}| \\ - theorem & label & thm & \lstinline|\ref{thm:label}| \\ - lemma & label & lem & \lstinline|\ref{lem:label}| \\ - corollary & label & cor & \lstinline|\ref{cor:label}| \\ - proposition & label & pro & \lstinline|\ref{pro:label}| \\ - \bottomrule - \end{tabular}% - \label{tab:theorem-class}% - \end{table}% - % \subsection{算法环境} - % \begin{algorithm}\label{alg:test} % \Input{A bitmap $I$ of size $w \times l$} % \Output{A partition of the bitmap} @@ -340,13 +439,93 @@ tlmgr update --self --all --reinstall-forcibly-removed \subsection{修改计数器} -当前定理等环境计数器按章计数,如果想修改定理类环境按节计数,可以修改计数器选项 thmcnt: +当前定理等环境计数器按章计数,如果想修改定理类环境按节计数,可以修改计数器选项 \lstinline{thmcnt},可用选项为 \lstinline{chapter} (默认)与 \lstinline{section}: + +\begin{lstlisting} +\documentclass[section]{elegantbook} %or +\documentclass[thmcnt=section]{elegantbook} +\end{lstlisting} + +\subsection{自定义定理类环境} + +4.4 版本新增了一个自定义定理类环境的命令:\lstinline|\elegantnewtheorem|,它的参数含义如下: + +\begin{lstlisting} +% fancy 模式(默认) +\elegantnewtheorem{env}{title}{style}{prefix} +% simple 模式 +\elegantnewtheorem{env}{title}{style} +\end{lstlisting} +该命令可以同时定义编号环境 \lstinline|env| 和不编号环境 \lstinline|env*|。 + +其中 \lstinline|style| 支持的参数有:\lstinline|defstyle|,\lstinline|thmstyle|,\lstinline|prostyle|,分别对应“定义”,“定理”,“命题”三种样式。 + + +\begin{itemize} + \item 在炫彩模式(\lstinline{fancy})下,需要 4 个参数来定义一个新的定理类环境,分别是: + 定理类环境名,定理类环境的标题,定理类环境的样式,该定理类环境的前缀: + +\begin{lstlisting} +% 导言区 +\elegantnewtheorem{examplefancy}{自定义定理类环境}{thmstyle}{exfancy} +% 正文 +\begin{examplefancy}{定理名}{label} + 这里是自定义定理类环境 \ref{exfancy:label} +\end{examplefancy} +\begin{examplefancy*}{定理名} + 这里是无编号自定义定理类环境 +\end{examplefancy*} +\end{lstlisting} + 如果不给出第四个参数,或第四个参数置空的话,将会用定理类环境名来作为默认前缀,即 \begin{lstlisting} - \documentclass[section]{elegantbook} %or - \documentclass[thmcnt=section]{elegantbook} +% 导言区 +\elegantnewtheorem{test}{TEST}{thmstyle} +% 或 +\elegantnewtheorem{test}{TEST}{thmstyle}{} +% 正文 +\begin{test}{name}{label} + 默认前缀为 test。 + 使用 \ref{test:label} 来引用这个定理类环境。 +\end{test} \end{lstlisting} +这时会在终端以及 \verb|.log| 文件中输出一个警告信息来提示用户没有定义前缀: + +\begin{lstlisting}[language=bash] +Class elegantbook Warning: Because you didn't provide a prefix. +(elegantbook) We use test as the default prefix. +(elegantbook) You have to use +(elegantbook) \ref {test:label} to refer a +(elegantbook) \begin {test}{name}{label} environment. +(elegantbook) on input line 3. +\end{lstlisting} + + \item 在简单模式(\lstinline{simple})下,需要 3 个参数来定义一个新的定理类环境,分别是: + 定理类环境名,定理类环境的标题,定理类环境的样式,该定理类环境的前缀: +\begin{lstlisting} +% 导言区 +\elegantnewtheorem{examplesimple}{自定义定理类环境}{thmstyle} +% 正文 +\begin{examplesimple}[定理名]\label{exsimple:label} + 这里是自定义定理类环境 \ref{exsimple:label} +\end{examplesimple} +\begin{examplesimple*}[定理名] + 这里是无编号自定义定理类环境 +\end{examplesimple*} +\end{lstlisting} + + 如果此时错误地给出了第四个参数,那么将会在终端以及 \verb|.log| 文件中输出一个错误信息: +\begin{lstlisting} +% elegantbook-cn.tex +\elegantnewtheorem{test}{TEST}{thmstyle}{} +% .log file +./elegantbook-cn.tex:3: Class elegantbook Error: You can't set a prefix in mode ``simple''. +(elegantbook) Just use +(elegantbook) \elegantnewtheorem {test}{TEST}{thmstyle} . +\end{lstlisting} + +\end{itemize} \subsection{其他环境的使用} @@ -397,7 +576,25 @@ tlmgr update --self --all --reinstall-forcibly-removed \end{minipage} \section{参考文献} -文献部分,本模板调用了 biblatex 宏包,并提供了 biber(默认) 和 bibtex 两个后端选项,可以使用 \lstinline{bibend} 进行修改: + +\subsection{打印文献} + +之前我们将文献调用的命令放在模板里面,然后用户反馈 \lstinline{\cite} 命令无法自动补全,因此我们新版本将其拿到外面来,新版本打印参考文献的命令的方法是,在导言区(也即 \lstinline|\begin{document}| 之前),加入: + +\begin{lstlisting} + \lstinline|\addbibresource[location=local]{reference.bib}|。 +\end{lstlisting} + +然后再需要打印文献的地方使用: +\begin{lstlisting} + \printbibliography[heading=bibintoc, title=\ebibname] +\end{lstlisting} + +其中 \lstinline{reference.bib} 为参考文献存放的文件,需要放在项目文件夹下。 + +\subsection{修改文献格式} + +此外,本模板调用了 biblatex 宏包,并提供了 biber(默认) 和 bibtex 两个后端选项,可以使用 \lstinline{bibend} 进行修改: \begin{lstlisting} \documentclass[bibtex]{elegantbook} @@ -413,12 +610,13 @@ tlmgr update --self --all --reinstall-forcibly-removed \documentclass[citestyle=gb7714-2015, bibstyle=gb7714-2015]{elegantbook} \end{lstlisting} -如果需要添加排序方式,可以在导言区加入 +如果需要添加排序方式,可以在导言区加入下面命令: \begin{lstlisting} \ExecuteBibliographyOptions{sorting=ynt} \end{lstlisting} -启用国标之后,可以加入 \lstinline{sorting=gb7714-2015}。 +如果使用的是国标,可以将 \lstinline{ynt} 改为 \lstinline{gb7714-2015},使文献按照国标规定进行文献排序。 + \section{添加序章} @@ -483,7 +681,7 @@ The content of introduction. 效果如下: -\begin{problemset} +\begin{problemset}[我的题目] \item exercise 1 \item exercise 2 \item exercise 3 @@ -568,12 +766,12 @@ The content of introduction. 如果使用 \lstinline{newtx} 系列字体宏包,需要注意下连字符的问题。 \begin{equation} - \int_{R^q} f(x,y) dy.\emph{of\kern0pt f} + \int_{R^q} f(x,y) dy.\emph{of\kern0pt f} \sin x \end{equation} 的代码为 \begin{lstlisting} \begin{equation} - \int_{R^q} f(x,y) dy.\emph{of \kern0pt f} + \int_{R^q} f(x,y) dy.\emph{of\kern0pt f} \sin x \end{equation} \end{lstlisting} @@ -607,10 +805,6 @@ LaTeX Error: \item \lstinline{nofont}:后台会调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,不设定中文字体,用户可以自行设置中文字体,具体见后文。 \end{enumerate} -\begin{remark} - 使用 \lstinline{founder} 选项或者 \lstinline{nofont} 时,必须使用 \hologo{XeLaTeX} 进行编译。 -\end{remark} - \subsection{方正字体选项} 由于使用 \lstinline{ctex} 宏包默认调用系统已有的字体,部分系统字体缺失严重,因此,用户希望能够使用其它字体,我们推荐使用方正字体。方正的{\songti 方正书宋}、{\heiti 方正黑体}、{\kaishu 方正楷体}、{\fangsong 方正仿宋}四款字体均可免费试用,且可用于商业用途。用户可以自行从\href{http://www.foundertype.com/}{方正字体官网}下载此四款字体,在下载的时候请\textbf{务必}注意选择 GBK 字符集,也可以使用 \href{https://www.latexstudio.net/}{\LaTeX{} 工作室}提供的\href{https://pan.baidu.com/s/1BgbQM7LoinY7m8yeP25Y7Q}{方正字体,提取码为:njy9} 进行安装。安装时,{\kaishu Win 10 用户请右键选择为全部用户安装,否则会找不到字体。} @@ -699,7 +893,7 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 \int_{\mathcal{R}^p\times\mathcal{R}^q} f(x,y) dxdy=\int_{\mathcal{R}^p}\left(\int_{\mathcal{R}^q}f(x,y)dy\right)dx. \end{equation} -(2)若 $f(x,y)$ 是 $\mathcal{R}^p\times\mathcal{R}^q$ 上的可积函数,则对几乎处处的 $x\in\mathcal{R}^p$,$f(x,y)$ 作为 $y$ 的函数是 $\mathcal{R}^q$ 上的可积函数,并且 $g(x)=\int_{\mathcal{R}^q}f(x,y) dy$ 是 $\mathcal{R}^p$ 上的可积函数。而且~\ref{eq:461} 成立。 +(2)若 $f(x,y)$ 是 $\mathcal{R}^p\times\mathcal{R}^q$ 上的可积函数,则对几乎处处的 $x\in\mathcal{R}^p$,$f(x,y)$ 作为 $y$ 的函数是 $\mathcal{R}^q$ 上的可积函数,并且 $g(x)=\int_{\mathcal{R}^q}f(x,y) dy$ 是 $\mathcal{R}^p$ 上的可积函数。而且~\eqref{eq:461} 成立。 \end{theorem} \ref{thm:fubi} @@ -751,8 +945,6 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 见前文介绍,可以使用 \lstinline{scheme=chinese} 设置。 \item \question{大佬,我想把正文字体改为亮色,背景色改为黑灰色。} 页面颜色可以使用 \lstinline{\pagecolor} 命令设置,文本命令可以参考\href{https://tex.stackexchange.com/questions/278544/xcolor-what-is-the-equivalent-of-default-text-color}{这里}进行设置。 - \item \question{\lstinline[breaklines]{Package ctex Error: CTeX fontset 'Mac' is unavailable.}} - 在 Mac 系统下,中文编译请使用 \hologo{XeLaTeX}。 \item \question{\lstinline{! LaTeX Error: Unknown option 'scheme=plain' for package 'ctex'.}} 你用的 C\TeX{} 套装吧?这个里面的 \lstinline{ctex} 宏包已经是已经是 10 年前的了,与本模板使用的 \lstinline{ctex} 宏集有很大区别。不建议 C\TeX{} 套装了,请卸载并安装 \TeX{} Live 2022。 \item \question{我该使用什么版本?} @@ -764,7 +956,7 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 \item \question{请问交叉引用是什么?} 本群和本模板适合有一定 \LaTeX{} 基础的用户使用,新手请先学习 \LaTeX{} 的基础,理解各种概念,否则你将寸步难行。 \item \question{代码高亮环境能用其他语言吗?} - 可以的,ElegantBook 模板用的是 \lstinline{listings} 宏包,你可以在环境(\lstinline{lstlisting})之后加上语言(比如 Python 使用 \lstinline{language=Python} 选项),全局语言修改请使用 \lstinline{lsset} 命令,更多信息请参考宏包文档。 + 可以的,ElegantBook 模板用的是 \lstinline{listings} 宏包,你可以在环境(\lstinline{lstlisting})之后加上语言(比如 Python 使用 \lstinline{language=Python} 选项),全局语言修改请使用 \lstinline{lstset} 命令,更多信息请参考宏包文档。 \item \question{群主,什么时候出 Beamer 的模板(主题),ElegantSlide 或者 ElegantBeamer?} 由于 Beamer 中有一个很优秀的主题 \href{https://github.com/matze/mtheme}{Metropolis}。后续确定不会再出任何主题/模板,请大家根据需要修改已有主题。 \end{enumerate} @@ -773,11 +965,22 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 根据用户的反馈,我们不断修正和完善模板。由于 3.00 之前版本与现在版本差异非常大,在此不列出 3.00 之前的更新内容。 +\datechange{2022/08/15}{版本 4.4 正式发布。} + +\begin{change} + \item \textbf{重要改动}:提供了一个定义定理类环境的命令 \lstinline|\elegantnewtheorem|; + \item \textbf{重要改动}:为所有内置定理类环境提供了带星号的版本,带星号的定理类环境不会编号,修复 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/167}{issue: \#167}; + \item \textbf{重要改动}:在 \lstinline{scheme=chinese} 下将目录中的“第 1 章”修改为“第一章”; + \item 将 TeX Gyre Termes 改为 TeX Gyre TermesX,使英文部分字形与 newtx 系列宏包更相近; + \item 重写了内置定理类环境的实现方法,修复了一些 bug,由于修改部分较大,如果引入了新的 bug,请及时在 QQ 群或 \href{https://github.com/ElegantLaTeX}{Github} 上进行反馈; + \item 删除 Gitee 仓库地址,恢复 GitHub 提交(pull requests); + \item 将参考文献命令添加到导言区,使编辑器能够对参考文献自动补全。 +\end{change} \datechange{2022/04/09}{版本 4.3 正式发布。} \begin{change} - \item 放弃 newtx 系列宏包的设置,改用 TeX Gyre Terms,并设置其他字体; + \item 放弃 newtx 系列宏包的设置,改用 TeX Gyre Termes,并设置其他字体; \item 修改定理类环境内部字体设置,修复环境内部中文无法加粗问题; \item 增加定理类环境的计数器选项 \lstinline{thmcnt},可选 \lstinline{chapter} 和 \lstinline{section}; \item 增加 \lstinline{bibend} 选项,可选 \lstinline{bibend=biber}(默认)和 \lstinline{bibend=bibtex}。 @@ -926,13 +1129,14 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 \item 修改英文字体为 \lstinline{newtx} 系列,另外大型操作符号维持 cm 字体。 \item 中文字体改用 \lstinline{ctex} 宏包自动设置。 \item 删除 \lstinline{xeCJK} 字体设置,原因是不同系统字体不方便统一。 - \item 定理换用 \lstinline{tcolobox} 宏包定义,并基本维持原有的定理样式,优化显示效果,支持跨页;定理类名字重命名,如 etheorem 改为 theorem 等等。 + \item 定理换用 \lstinline{tcolorbox} 宏包定义,并基本维持原有的定理样式,优化显示效果,支持跨页;定理类名字重命名,如 etheorem 改为 theorem 等等。 \item 删去自定义的缩进命令 \lstinline{\Eindent}。 \item 添加参考文献宏包 \lstinline{natbib}。 \item 颜色名字重命名。 \end{change} \nocite{*} + \printbibliography[heading=bibintoc, title=\ebibname] \appendix diff --git a/macros/latex/contrib/elegantbook/elegantbook-en.pdf b/macros/latex/contrib/elegantbook/elegantbook-en.pdf index 102ca2c429..42be810cd6 100644 Binary files a/macros/latex/contrib/elegantbook/elegantbook-en.pdf and b/macros/latex/contrib/elegantbook/elegantbook-en.pdf differ diff --git a/macros/latex/contrib/elegantbook/elegantbook-en.tex b/macros/latex/contrib/elegantbook/elegantbook-en.tex index 00e7f67208..ee46a40015 100644 --- a/macros/latex/contrib/elegantbook/elegantbook-en.tex +++ b/macros/latex/contrib/elegantbook/elegantbook-en.tex @@ -5,8 +5,8 @@ \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} -\date{April 9, 2022} -\version{4.3} +\date{Aug 15, 2022} +\version{4.4} \bioinfo{Bio}{Information} \extrainfo{Victory won\rq t come to us unless we go to it. } @@ -17,6 +17,9 @@ % modify the color in the middle of titlepage \definecolor{customcolor}{RGB}{32,178,170} \colorlet{coverlinecolor}{customcolor} +\usepackage{cprotect} + +\addbibresource[location=local]{reference.bib} % bib \begin{document} @@ -49,7 +52,7 @@ For portable version, simply download lastest ElegantBook-master from GitHub or \section{Update Templates} You can use cmd/terminal to update the tlmgr itself and all the packages, the commands are: \begin{lstlisting} -tlmgr update --self +tlmgr update --self tlmgr update --all \end{lstlisting} @@ -58,14 +61,12 @@ To learn more, please refer to \href{https://tex.stackexchange.com/questions/554 \section{Other Release Versions} If you are a \TeX{} Live 2018/2019/2020/2021 user and would like to update, the official solution is to uninstall the previous version. If you want to save the bother of uninstallation and re-installation, please copy \lstinline{elegantbook.cls} to the installation directory of \TeX{} Live 2022 (default: \lstinline|C:\texlive\2022\texmf-dist\tex\latex\elegantbook| ), run \lstinline{texhash} in cmd. - - \chapter{ElegantBook Settings} - -This template is based on the Standard \LaTeX{} book class, so the options of book class work as well (Note that the option of papersize has no effect due to \lstinline{device} option). The default encoding is UTF-8 while \TeX{} Live is recommended. The test environment is Win10/Ubuntu 20.04/macOS + \TeX{} Live 2022/ Mac\TeX{} 2022, either \hologo{pdfLaTeX} or \hologo{XeLaTeX} works fine. +This template is based on the Standard \LaTeX{} book class, so the options of book class work as well (Note that the option of papersize has no effect due to \lstinline{device} option). The default encoding is UTF-8 while \TeX{} Live is recommended. The test environments are Win10/Ubuntu 20.04/macOS + \TeX{} Live 2022/ Mac\TeX{} 2022, either \hologo{pdfLaTeX} or \hologo{XeLaTeX} works fine for \lstinline{lang=en}. \section{Languages} We defined one option named \lstinline{lang} which has two basic values, \lstinline{lang=en} (default) , \lstinline{lang=cn}. Different values will alter the captions of figure/table, abstract name, refname, etc. You can use this option as + \begin{lstlisting} \documentclass[en]{elegantbook} \documentclass[lang=en]{elegantbook} @@ -78,7 +79,7 @@ Besides the two basic language translation, our user provide more options, here \item French translation \lstinline{lang=fr}, provided by \href{https://github.com/abfek66}{abfek66} , please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/85}{Italian translation}; \item Dutch Translation \lstinline{lang=nl}, provided by \href{https://github.com/inktvis75}{inktvis75} , please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/108}{Dutch Translation}; \item Hungarian translation \lstinline{lang=hu}, provided by \href{https://github.com/palkotamas}{palkotamas}, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/111}{Hungarian translation}; - \item Deutsch translation \lstinline{lang=de}, provided by Lisa, please refer to\href{https://github.com/ElegantLaTeX/ElegantBook/issues/113}{Deutsch translation}; + \item Deutsch translation \lstinline{lang=de}, provided by Lisa, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/113}{Deutsch translation}; \item Spanish translation \lstinline{lang=es}, provided by Gustavo A. Corradi, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/133}{Spanish translation}; \item Mongolian translation \lstinline{lang=mn}, provided by \href{https://github.com/Altantsooj}{Altantsooj}, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/137}{Mongolian translation}; \item Japanese translation \lstinline{lang=jp}, provided by \href{https://github.com/inusturbo}{inusturbo}, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/172}{Japanese translation}. @@ -96,7 +97,7 @@ The option for device (\lstinline{device}) was originally used in ElegantNote, n \end{lstlisting} \section{Color Themes} -This template contains 5 color themes, i.e. \textcolor{structure1}{\lstinline{green}}\footnote{Original default theme.}, \textcolor{structure2}{\lstinline{cyan}}, \textcolor{structure3}{\lstinline{blue}}(default), \textcolor{structure4}{\lstinline{gray}}, \textcolor{structure5}{\lstinline{black}}. You can choose \lstinline{green} with +This template contains 5 color themes, i.e., \textcolor{structure1}{\lstinline{green}}\footnote{Original default theme.}, \textcolor{structure2}{\lstinline{cyan}}, \textcolor{structure3}{\lstinline{blue}}(default), \textcolor{structure4}{\lstinline{gray}}, \textcolor{structure5}{\lstinline{black}}. You can choose \lstinline{green} with \begin{lstlisting} \documentclass[green]{elegantbook} %or \documentclass[color=green]{elegantbook} @@ -210,7 +211,7 @@ In this template, we defined four different theorem class environments \item \textit{Theorem Environments}, including title and content, numbering corresponding to chapter. Three types depending on the format: \begin{itemize} \item \textcolor{main}{\textbf{definition}} environment, the color is \textcolor{main}{main}; - \item \textcolor{second}{\textbf{theorem, lemma, corollary}} environment, the color is \textcolor{second} {second}; + \item \textcolor{second}{\textbf{theorem, lemma, corollary, axiom, postulate}} environment, the color is \textcolor{second} {second}; \item \textcolor{third}{\textbf{proposition}} environment, the color is \textcolor{third}{third}. \end{itemize} \item \textit{Example Environment}, including \textbf{example, exercise, problem} environment, auto numbering according to chapter. @@ -218,49 +219,91 @@ In this template, we defined four different theorem class environments \item \textit{Conclusion Environment}, including \textbf{conclusion, assumption, property, remark and solution}\footnote{We also define an option \lstinline{result}, which can hide the \lstinline{solution} and \lstinline{proof} environments. You can switch between \lstinline{result=answer} and \lstinline{result=noanswer}.} environments, all of which begin with boldfaced words, with format consistent with normal paragraphs. \end{itemize} +All of theorem environments have star versions: \textcolor{main}{\textbf{definition*}}, \textcolor{second}{\textbf{theorem*}}, \textcolor{second}{\textbf{lemma*}}, \textcolor{second}{\textbf{corollary*}}, \textcolor{second}{\textbf{axiom*}}, \textcolor{second}{\textbf{postulate*}}, \textcolor{third}{\textbf{proposition*}}. Environments with an asterisk are not numbered. + \subsection{Theorem Class Environments} -Since the template uses the \lstinline{tcolorbox} package to customize the theorem class environments, it is slightly different from the normal theorem environments. The usage is as follows: + +\subsubsection{\lstinline{fancy} mode} + +In \lstinline{fancy} mode, the template uses the \lstinline{tcolorbox} package to customize the theorem class environments, it is slightly different from the normal theorem environments. The usage is as follows: \begin{lstlisting} -\begin{theorem}{theorem name}{label text} -The content of theorem. -\end{theorem} -\end{lstlisting} + % name + label + \begin{theorem}{theorem name}{label} + The content of a theorem with name and label. + Use \ref{thm:label} to refer this theorem. + \end{theorem} + % no name + label + \begin{theorem}{}{label no name} + The content of a theorem without name. + Use \ref{thm:label no name} to refer this theorem. + \end{theorem} + % name + no label + \begin{theorem}{theorem name}{} + The content of a theorem without label. + Can't refer this theorem. + The last {} can be removed. + \end{theorem} + % no name + no label + \begin{theorem}{}{} + The content of a theorem without name and label. + Can't refer this theorem. + Both of {} can be removed. + \end{theorem} + \end{lstlisting} + +The first parameter \lstinline{theorem name} represents the name of the theorem. If the current theorem has no name, please use \lstinline|{}|\cprotect\footnote{Unless this theorem has neither no label, you should not omit this \verb|{}|.}, and the second parameter \lstinline{label} represents the label used in cross-reference with \verb|\ref{thm:label}|. Note that cross-references must be prefixed with \lstinline{thm:}. -The first parameter \lstinline{} represents the name of the theorem, and the second parameter \lstinline{label} represents the label used in cross-reference with \verb|ref{thm:label}|. Note that cross-references must be prefixed with \lstinline{thm:}. +Other theorem class environments with the same usage includes: + +\begin{table}[htbp] +\centering +\caption{Theorem Class Environments} + \begin{tabular}{llll} + \toprule + Environment & Label text & Prefix & Cross-reference \\ + \midrule + definition & label & def & \lstinline|\ref{def:label}| \\ + theorem & label & thm & \lstinline|\ref{thm:label}| \\ + postulate & label & pos & \lstinline|\ref{pos:label}| \\ + axiom & label & axi & \lstinline|\ref{axi:label}|\\ + lemma & label & lem & \lstinline|\ref{lem:label}| \\ + corrlary & label & cor & \lstinline|\ref{cor:label}| \\ + proposition & label & pro & \lstinline|\ref{pro:label}| \\ + \bottomrule + \end{tabular}% +\label{tab:theorem-class}% +\end{table}% From version 4.1, you can write your theorem environments as follows: \begin{lstlisting} -\begin{theorem}[theorem name]\label{thm:label text} +\begin{theorem}[theorem name]\label{thm:theorem-label} The content of theorem. \end{theorem} % or -\begin{theorem} +\begin{theorem}\label{thm:theorem-without-name} The content of theorem. \end{theorem} \end{lstlisting} -Other theorem class environments with the same usage includes: - -\begin{table}[htbp] - \centering - \caption{Theorem Class Environments} - \begin{tabular}{llll} - \toprule - Environment & Label text & Prefix & Cross-reference \\ - \midrule - definition & label & def & \lstinline|\ref{def:label}| \\ - theorem & label & thm & \lstinline|\ref{thm:label}| \\ - lemma & label & lem & \lstinline|\ref{lem:label}| \\ - corrlary & label & cor & \lstinline|\ref{cor:label}| \\ - proposition & label & pro & \lstinline|\ref{pro:label}| \\ - \bottomrule - \end{tabular}% - \label{tab:theorem-class}% - \end{table}% +In this case, cross-reference don't have to be prefixed, i.e. the parameter of \lstinline{\ref} is the same as that of \lstinline{\label}. +\subsubsection{\lstinline{simple} mode} + +In \lstinline{simple} mode, the template uses the \lstinline{amsthm} package to customize the theorem class environments. The usage is as follows: + +\begin{lstlisting} +\begin{theorem}[theorem name]\label{thm:theorem-label} + The content of theorem. +\end{theorem} +% or +\begin{theorem}\label{thm:theorem-without-name} + The content of theorem without name. +\end{theorem} +\end{lstlisting} + \subsection{Counter for Theorem Environments} -You can use \lstinline{thmcnt} option to control the theorem counter/number display style for the theorem environments, the acceptable options are \lstinline{chapter} (default) and \lstinline{section}. +You can use \lstinline{thmcnt} option to control the theorem counter/number display style for the theorem environments, the acceptable options are \lstinline{chapter} (default) and \lstinline{section}: \begin{lstlisting} \documentclass[section]{elegantbook} % turn the Theorem 4.1 to Theorem 4.1.1 @@ -268,7 +311,6 @@ You can use \lstinline{thmcnt} option to control the theorem counter/number disp \end{lstlisting} - \subsection{Other Customized Environments} The other three math environments can be called directly since there are no additional option for them, e.g. \lstinline{example}: \begin{lstlisting} @@ -339,13 +381,13 @@ If you use \lstinline{newtx} fonts, type in: When you are using \lstinline{newtx}, please pay attention to the hyphens. For instance, \begin{equation} -\int_{R^q} f(x,y) dy.\emph{of\kern0pt f} +\int_{R^q} f(x,y) dy.\emph{of\kern0pt f} \sin x \end{equation} The corresponding code is: \begin{lstlisting} \begin{equation} - \int_{R^q} f(x,y) dy.\emph{of \kern0pt f} + \int_{R^q} f(x,y) dy.\emph{of \kern0pt f} \sin x \end{equation} \end{lstlisting} @@ -375,6 +417,19 @@ This template uses biblatex to generate the bibliography, the default citestyle If you want to use biblatex, you must create a file named \lstinline{reference.bib}, add bib items (from Google Scholar, Mendeley, EndNote, and etc.) to \lstinline{reference.bib} file, then cite the bibkey in the \lstinline{tex} file. The biber will automatically generate the bibliography for the reference you cited. +In order to get the editors' auto-completion working, you need to add following code in your preamble: + +\begin{lstlisting} + \addbibresource[location=local]{reference.bib} +\end{lstlisting} + +Then include the print commands where you want to print the bibliography: +\begin{lstlisting} + \printbibliography[heading=bibintoc, title=\ebibname] +\end{lstlisting} + + + To change the bibliography style, this version introduces two options: \lstinline{citestyle} and \lstinline{bibstyle}, please refer to \href{https://ctan.org/pkg/biblatex}{CTAN:biblatex} for more detail about these options. You can change your bibliography style as @@ -532,19 +587,27 @@ Note that a subgroup~$H$ of a group $G$ is itself a left coset of $H$ in $G$. \lipsum[2] \begin{theorem}[Lagrange's Theorem] \label{thm:lg} -Let $G$ be a finite group, and let $H$ be a subgroup of $G$. Then the order of $H$ divides the order of $G$. +Let $G$ be a finite group, and let $H$ be a subgroup of $G$. Then the order of $H$ divides the order of $G$. \end{theorem} -\ref{thm:lg} +As theorem \ref{thm:lg} refered. + \lipsum[3] - + +\begin{theorem}{theorem name}{label text} + The content of theorem. +\end{theorem} + +we can refer this theorem as \ref{thm:label text}. + + \begin{proposition}[Size of Left Coset] Let $H$ be a finite subgroup of a group $G$. Then each left coset of $H$ in $G$ has the same number of elements as $H$. \end{proposition} \begin{proof} -Let $z$ be some element of $xH \cap yH$. Then $z = xa$ for some $a \in H$, and $z = yb$ for some $b \in H$. If $h$ is any element of $H$ then $ah \in H$ and $a^{-1}h \in H$, since $H$ is a subgroup of $G$. But $zh = x(ah)$ and $xh = z(a^{-1}h)$ for all $h \in H$. Therefore $zH \subset xH$ and $xH \subset zH$, and thus $xH = zH$. Similarly $yH = zH$, and thus $xH = yH$, as required. + Let $z$ be some element of $xH \cap yH$. Then $z = xa$ for some $a \in H$, and $z = yb$ for some $b \in H$. If $h$ is any element of $H$ then $ah \in H$ and $a^{-1}h \in H$, since $H$ is a subgroup of $G$. But $zh = x(ah)$ and $xh = z(a^{-1}h)$ for all $h \in H$. Therefore $zH \subset xH$ and $xH \subset zH$, and thus $xH = zH$. Similarly $yH = zH$, and thus $xH = yH$, as required. \end{proof} \begin{figure}[htbp] @@ -629,10 +692,24 @@ We list some FAQs for users to refer to: We revised our templates now and then. This section shows the version story of ElegantBook. +\datechange{2022/08/15}{release of v4.4.} + +\begin{change} + \item Add custome theorem definition command \lstinline{\elegantnewtheorem}; + \item Fix star environment(*) for inner environments (\href{https://github.com/ElegantLaTeX/ElegantBook/issues/167}{issue \#167}); + \item Change English fonts from TeX Gyre Termes to TeX Gyre TermesX; + \item Re-construct some theorem environments to enchance compatibility; + \item Remove Gitee repo due the privacy policy; + \item Re-open Github pull requests. +\end{change} + + + + \datechange{2022/04/09}{release of v4.3.} \begin{change} - \item Remove part newtx settings, set TeX Gyre Terms/Heros fonts under \hologo{XeLaTeX}. + \item Remove part newtx settings, set TeX Gyre Termes/Heros fonts under \hologo{XeLaTeX}. \item Fix Chinese fonts in the theorem environments. \item Add theorem counter option, \lstinline{thmcnt=section}. \item Add bib option \lstinline{bibend}, which can take value of biber and bibtex. @@ -697,12 +774,12 @@ We revised our templates now and then. This section shows the version story of E \item Revise \lstinline{problemset}. \end{change} + \nocite{en2,en3} \printbibliography[heading=bibintoc, title=\ebibname] - \appendix -% \renewcommand\chaptername{\eappendix \thechapter} + \chapter{Mathematical Tools} diff --git a/macros/latex/contrib/elegantbook/elegantbook.cls b/macros/latex/contrib/elegantbook/elegantbook.cls index 0966c3fc12..93f4dd9919 100644 --- a/macros/latex/contrib/elegantbook/elegantbook.cls +++ b/macros/latex/contrib/elegantbook/elegantbook.cls @@ -123,6 +123,10 @@ pdfborder={0 0 0}, linktocpage } +\newif\ifELEGANT@Hy@later + \@ifpackagelater{hyperref}{2022/05/16} + {\ELEGANT@Hy@latertrue} + {\ELEGANT@Hy@laterfalse} %% device settings \RequirePackage{geometry} @@ -165,13 +169,16 @@ \PassOptionsToPackage{quiet}{fontspec} \RequirePackage{iftex} -\ifXeTeX +\ifpdftex + \RequirePackage{newtxtext} + \RequirePackage[scaled=.90]{helvet} +\else \RequirePackage[no-math]{fontspec} - \setmainfont{texgyretermes}[ - UprightFont = *-regular , - BoldFont = *-bold , - ItalicFont = *-italic , - BoldItalicFont = *-bolditalic , + \setmainfont{TeXGyreTermesX}[ + UprightFont = *-Regular , + BoldFont = *-Bold , + ItalicFont = *-Italic , + BoldItalicFont = *-BoldItalic , Extension = .otf , Scale = 1.0] @@ -182,14 +189,11 @@ BoldItalicFont = *-bolditalic , Extension = .otf , Scale = 0.9] -\else - \RequirePackage{newtxtext} - \RequirePackage[scaled=.90]{helvet} \fi \ifdefstring{\ELEGANT@lang}{cn}{ \ifdefstring{\ELEGANT@chinesefont}{founder}{ - \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex} + \RequirePackage[UTF8, scheme=plain, fontset=none]{ctex} \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01} \setCJKsansfont[BoldFont={FZHei-B01}]{FZKai-Z03} \setCJKmonofont[BoldFont={FZHei-B01}]{FZFangSong-Z02} @@ -203,10 +207,14 @@ \newcommand*{\fangsong}{\CJKfamily{zhfs}}}{\relax} \ifdefstring{\ELEGANT@chinesefont}{nofont}{ - \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}}{\relax} + \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex} + \xeCJKsetup{AutoFakeBold=true} + }{\relax} \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{ - \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax} + \RequirePackage[UTF8,scheme=plain]{ctex} + \xeCJKsetup{AutoFakeBold=true} + }{\relax} \AfterEndPreamble{ \setlength\parindent{2\ccwd}} @@ -238,7 +246,19 @@ \RequirePackage{anyfontsize} \ifdefstring{\ELEGANT@math}{newtx}{ + \let\oldencodingdefault\encodingdefault + \let\oldrmdefault\rmdefault + \let\oldsfdefault\sfdefault + \let\oldttdefault\ttdefault + \def\encodingdefault{T1} + \renewcommand{\rmdefault}{ntxtlf} + \renewcommand{\sfdefault}{qhv} + \renewcommand{\ttdefault}{ntxtt} \RequirePackage{newtxmath} + \let\encodingdefault\oldencodingdefault + \let\rmdefault\oldrmdefault + \let\sfdefault\oldsfdefault + \let\ttdefault\oldttdefault \let\Bbbk\relax \RequirePackage{esint} %%% use yhmath pkg, uncomment following code @@ -387,7 +407,6 @@ backend=\ELEGANT@bibend, citestyle=\ELEGANT@citestyle, bibstyle=\ELEGANT@bibstyle]{biblatex} -\defbibheading{elegantbook}[\ebibname]{#1} \ifdefstring{\ELEGANT@lang}{cn}{ \renewcommand{\baselinestretch}{1.3} @@ -833,8 +852,22 @@ \ifdefstring{\ELEGANT@lang}{cn}{ \ifdefstring{\ELEGANT@scheme}{chinese}{ \newcommand{\xchaptertitle}{第\zhnumber{\arabic{chapter}}章} }{ - \newcommand{\xchaptertitle}{第 \thechapter{} 章}} }{ - \newcommand{\xchaptertitle}{\chaptername~\thechapter~}} + \newcommand{\xchaptertitle}{第 \thechapter{} 章}} +% Hyperref 2022/05/16's changelog.txt said +% * nameref is loaded always and earlier (issue#235) + \AtBeginDocument{ + \ifELEGANT@Hy@later + \patchcmd{\NR@chapter}% + {\numberline{\thechapter}}{\numberline{\xchaptertitle}}% + {}{\fail} + \else + \patchcmd{\Hy@org@chapter}% + {\numberline{\thechapter}}{\numberline{\xchaptertitle}}% + {}{\fail} + \fi + } + } + {\newcommand{\xchaptertitle}{\chaptername~\thechapter~}} \setcounter{secnumdepth}{5} \titleformat{\chapter}[\style]{\bfseries}{ @@ -855,7 +888,9 @@ -%%define the note and proof environment +%%define the +%%definition theorem postulate axiom corollary lemma proposition +%%and proof environment \RequirePackage{pifont,manfnt,bbding} \RequirePackage[many]{tcolorbox} % \newlength{\normalparindent} @@ -899,49 +934,78 @@ overlay unbroken and last={ \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { \textcolor{second}{$\heartsuit$}};}}, - propstyle/.style={ + prostyle/.style={ common, colframe=third, colback=third!5, colbacktitle=third, overlay unbroken and last={ \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { - \textcolor{third}{$\spadesuit$}};}},} - % \newtcbtheorem[auto counter,number within=chapter]{definition}{\definitionname}{defstyle}{def} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{definition}{ o t\label g }{ - common,defstyle, - IfValueTF={#1}{title={\definitionname~\thetcbcounter\ (#1)}}{title=\definitionname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} - % \newtcbtheorem[auto counter,number within=chapter]{theorem}{\theoremname}{thmstyle}{thm} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{theorem}{ o t\label g }{ - common,thmstyle, - IfValueTF={#1}{title={\theoremname~\thetcbcounter\ (#1)}}{title=\theoremname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} - % \newtcbtheorem[auto counter,number within=chapter]{postulate}{\postulatename}{thmstyle}{pos} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{postulate}{ o t\label g }{ - common,thmstyle, - IfValueTF={#1}{title={\postulatename~\thetcbcounter\ (#1)}}{title=\postulatename~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} - % \newtcbtheorem[auto counter,number within=chapter]{axiom}{\axiomname}{thmstyle}{axi} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{axiom}{ o t\label g }{ - common,thmstyle, - IfValueTF={#1}{title={\axiomname~\thetcbcounter\ (#1)}}{title=\axiomname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} - % \newtcbtheorem[auto counter,number within=chapter]{corollary}{\corollaryname}{thmstyle}{cor} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{corollary}{ o t\label g }{ - common,thmstyle, - IfValueTF={#1}{title={\corollaryname~\thetcbcounter\ (#1)}}{title=\corollaryname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} - % \newtcbtheorem[auto counter,number within=chapter]{lemma}{\lemmaname}{thmstyle}{lem} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{lemma}{ o t\label g }{ - common,thmstyle, - IfValueTF={#1}{title={\lemmaname~\thetcbcounter\ (#1)}}{title=\lemmaname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} - % \newtcbtheorem[auto counter,number within=chapter]{proposition}{\propositionname}{propstyle}{pro} - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{proposition}{ o t\label g }{ - common,propstyle, - IfValueTF={#1}{title={\propositionname~\thetcbcounter\ (#1)}}{title=\propositionname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}}}{\relax} + \textcolor{third}{$\spadesuit$}};}}, + ELEGANT@title/.code n args={2} + { + \ifblank{#2} + {\tcbset{title={\csname #1name\endcsname~\thetcbcounter}}} + {\tcbset{title={\csname #1name\endcsname~\thetcbcounter\ (#2)}}} + }, + ELEGANT@label/.code n args={2} + { + \ifblank{#2} + {}{\tcbset{label={#1:#2}}} + } + } + + % define an internal control sequence \ELEGANT@newtheorem for fancy mode's newtheorem + % #1 is the environment name, #2 is the prefix of label, #3 is the style + % style: thmstyle, defstyle, prostyle + % e.g. \ELEGANT@newtheorem{theorem}{thm}{thmstyle} + % will define two environments: numbered ``theorem'' and no-numbered ``theorem*'' + % WARNING FOR MULTILINGUAL: this cs will automatically find \theoremname's definition, + % WARNING FOR MULTILINGUAL: it should be defined in language settings. + \newcommand{\ELEGANT@newtheorem}[3]{ + \ifcsundef{#1name}{% + \ClassError{elegantbook}{% + \ #1name undefined, \MessageBreak + Please check in language setting + }{} + }{\relax} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{#1}{ g o t\label g }{ + common,#3, + IfValueTF={##1} + {ELEGANT@title={#1}{##1}} + { + IfValueTF={##2} + {ELEGANT@title={#1}{##2}} + {ELEGANT@title={#1}{}} + }, + IfValueT={##4} + { + IfBooleanTF={##3} + {label={##4}} + {ELEGANT@label={#2}{##4}} + } + } + \DeclareTColorBox{#1*}{ g o }{ + common,#3, + IfValueTF={##1} + {ELEGANT@title={#1}{##1}} + { + IfValueTF={##2} + {ELEGANT@title={#1}{##2}} + {ELEGANT@title={#1}{}} + }, + } + } + % define several environment + % we define headers like \definitionname before + \ELEGANT@newtheorem{definition}{def}{defstyle} + \ELEGANT@newtheorem{theorem}{thm}{thmstyle} + \ELEGANT@newtheorem{postulate}{pos}{thmstyle} + \ELEGANT@newtheorem{axiom}{axi}{thmstyle} + \ELEGANT@newtheorem{corollary}{cor}{thmstyle} + \ELEGANT@newtheorem{lemma}{lem}{thmstyle} + \ELEGANT@newtheorem{proposition}{pro}{prostyle} +}{\relax} \ifdefstring{\ELEGANT@mode}{simple}{ @@ -951,7 +1015,7 @@ % \let\proofname\relax \let\endproof\relax - % declare a new theorem style + % declare new theorem styles: defstyle, thmstyle, prostyle \newtheoremstyle{defstyle}{3pt}{3pt}{\citshape}{-3pt}{ \bfseries\color{main}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}} \newtheoremstyle{thmstyle}{3pt}{3pt}{\citshape}{-3pt}{ @@ -959,21 +1023,85 @@ \newtheoremstyle{prostyle}{3pt}{3pt}{\citshape}{-3pt}{ \bfseries\color{third}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}} + % define an internal control sequence \ELEGANT@newtheorem for simple mode's newtheorem + % #1 is the environment name, #2 is the style + % style: thmstyle, defstyle, prostyle + % e.g. \ELEGANT@newtheorem{theorem}{thmstyle} + % will define two environments: numbered ``theorem'' and no-numbered ``theorem*'' + % WARNING FOR MULTILINGUAL: this cs will automatically find \theoremname's definition, + % WARNING FOR MULTILINGUAL: it should be defined in language settings. + \newcommand{\ELEGANT@newtheorem}[2]{ + \theoremstyle{#2} + \newtheorem{#1}{\csname #1name\endcsname}[\ELEGANT@thmcnt] + \newtheorem*{#1*}{\csname #1name\endcsname} + } - \theoremstyle{defstyle} % definition style - \newtheorem{definition}{\definitionname}[\ELEGANT@thmcnt] - - \theoremstyle{thmstyle} %theorem style - \newtheorem{theorem}{\theoremname}[\ELEGANT@thmcnt] - \newtheorem{lemma}{\lemmaname}[\ELEGANT@thmcnt] - \newtheorem{corollary}{\corollaryname}[\ELEGANT@thmcnt] - \newtheorem{postulate}{\postulatename}[\ELEGANT@thmcnt] - \newtheorem{axiom}{\axiomname}[\ELEGANT@thmcnt] - - \theoremstyle{prostyle} % proposition style - \newtheorem{proposition}{\propositionname}[\ELEGANT@thmcnt] + % define several environment + % we define headers like \definitionname before + \ELEGANT@newtheorem{definition}{defstyle} + \ELEGANT@newtheorem{theorem}{thmstyle} + \ELEGANT@newtheorem{postulate}{thmstyle} + \ELEGANT@newtheorem{axiom}{thmstyle} + \ELEGANT@newtheorem{corollary}{thmstyle} + \ELEGANT@newtheorem{lemma}{thmstyle} + \ELEGANT@newtheorem{proposition}{prostyle} }{\relax} +% define an user control sequence \elegantnewtheorem +% #1 is the evironment, #2 is the theorem header +% #3 is the style #4 is the prefix for fancy mode +% style: thmstyle, defstyle, prostyle +% if #4 is given in simple mode, an error will be raised +% if #4 isn't given in fancy mode, the prefix will be set equal to #1, +% and a warning will be raised +\newcommand{\ELEGANT@newtheorem@warning}{} +\newcommand{\ELEGANT@newtheorem@error}{} +\NewDocumentCommand\elegantnewtheorem{ m m m g } + { + \renewcommand{\ELEGANT@newtheorem@warning}{ + \ClassWarning{elegantbook}{% + Because you didn't provide a prefix. \MessageBreak + We use #1 as the default prefix. \MessageBreak + You have to use \MessageBreak + \ref{#1:label} to refer a \MessageBreak + \begin{#1}{name}{label} environment. \MessageBreak + } + } + \renewcommand{\ELEGANT@newtheorem@error}{ + \ClassError{elegantbook}{% + You can't set a prefix in mode ``simple''.\MessageBreak + Just use \MessageBreak + \elegantnewtheorem{#1}{#2}{#3} + }{% + We are using ``amsthm'' package to \MessageBreak + generate theorem-like theorem. \MessageBreak + The 4th parameter ``prefix'' isn't allowed. + } + } + \expandafter\def\csname #1name\endcsname{#2} + \ifdefstring{\ELEGANT@mode}{simple}{% + \IfValueTF{#4} + {\ELEGANT@newtheorem@error} + {\ELEGANT@newtheorem{#1}{#3}} + }{\relax} + \ifdefstring{\ELEGANT@mode}{fancy}{% + \IfValueTF{#4} + { + \def\ELEGANT@temp@prefix{#4} + \ifdefempty{\ELEGANT@temp@prefix} + { + \ELEGANT@newtheorem{#1}{#1}{#3} + \ELEGANT@newtheorem@warning + } + {\ELEGANT@newtheorem{#1}{#4}{#3}} + } + { + \ELEGANT@newtheorem{#1}{#1}{#3} + \ELEGANT@newtheorem@warning + } + }{\relax} + } + % main(green-def): example exercise problem solution % second(orange-thm): proof note remark % third(blue-prop): assumptions property conclusion custom @@ -1045,6 +1173,7 @@ }, } + \newenvironment{introduction}[1][\introductionname]{ \begin{tcolorbox}[introductionsty,title={#1}] \begin{multicols}{2} @@ -1194,7 +1323,7 @@ commentstyle=\color{gray}, emph={elegantpaper,fontenc,fontspec,xeCJK,citestyle,FiraMono,xunicode,figure,fig,image,img,table,itemize,enumerate,ctex,microtype,description,times,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle,cite,ctex,listings,base,math,scheme,toc,esint,chinesefont,amsmath,bibstyle,natbib,pgfornament}, emphstyle={\color{frenchplum}}, - morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,definecolor,extrainfo,logo,cover,subtitle,appendix,chapter,hypersetup,mainmatter,frontmatter,tableofcontents,elegantpar,heiti,kaishu,lstset,pagecolor,zhnumber,marginpar,part,equote,marginnote,bioinfo,datechange,listofchange,lvert,lastpage,songti,heiti,fangsong,setCJKfamilyfont,textbf}, + morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,definecolor,extrainfo,logo,cover,subtitle,appendix,chapter,section,hypersetup,mainmatter,frontmatter,tableofcontents,elegantpar,heiti,kaishu,lstset,pagecolor,zhnumber,marginpar,part,equote,marginnote,bioinfo,datechange,listofchange,lvert,lastpage,songti,heiti,fangsong,setCJKfamilyfont,textbf,elegantnewtheorem,thmcnt,colorlet}, frame=single, tabsize=2, rulecolor=\color{structurecolor}, @@ -1233,7 +1362,7 @@ \begin{enumerate}[label=\small\protect\circled{\arabic*}]}{ \end{enumerate}} -\addbibresource[location=local]{reference.bib} + \renewcommand\tableofcontents{% \hypersetup{linktoc=all, linkcolor=black} @@ -1251,24 +1380,35 @@ \@starttoc{toc} \end{multicols}}{ \@starttoc{toc}} - \if@restonecol\twocolumn\fi} + \if@restonecol\twocolumn\fi + \hypersetup{linkcolor=winered}} \renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else \hbox{}% \thispagestyle{empty}% -\newpage% +beforechap\newpage% \if@twocolumn\hbox{}\newpage\fi\fi\fi} % https://tex.stackexchange.com/questions/56839/chaptername-is-used-even-for-appendix-chapters-in-toc -\usepackage{calc} -\usepackage[titles]{tocloft} +\RequirePackage{calc} +\RequirePackage[titles]{tocloft} \ifdefstring{\ELEGANT@lang}{cn}{ - \renewcommand{\cftchappresnum}{\beforechap\space} - \renewcommand{\cftchapaftersnum}{\space\afterchap} + % \renewcommand{\cftchappresnum}{\beforechap\space} + % \renewcommand{\cftchapaftersnum}{\space\afterchap} \setlength{\cftchapnumwidth}{\widthof{\textbf{附录~999}}} \g@addto@macro\appendix{% + % recover \thechapter in the \NR@chapter's \numberline + \ifELEGANT@Hy@later + \patchcmd{\NR@chapter}% + {\numberline{\xchaptertitle}}{\numberline{\thechapter}}% + {}{\fail} + \else + \patchcmd{\Hy@org@chapter}% + {\numberline{\xchaptertitle}}{\numberline{\thechapter}}% + {}{\fail} + \fi \addtocontents{toc}{% \protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}% \protect\renewcommand{\protect\cftchapaftersnum}{}% diff --git a/macros/latex/contrib/elegantbook/image/donate.jpg b/macros/latex/contrib/elegantbook/image/donate.jpg new file mode 100644 index 0000000000..60741efcde Binary files /dev/null and b/macros/latex/contrib/elegantbook/image/donate.jpg differ diff --git a/macros/latex/contrib/proflycee/README.md b/macros/latex/contrib/proflycee/README.md index d987cf2976..11502d6f77 100644 --- a/macros/latex/contrib/proflycee/README.md +++ b/macros/latex/contrib/proflycee/README.md @@ -4,7 +4,7 @@ proflycee may be a useful package to daily use of LaTeX. ---------------- Vous êtes un enseignant de mathématiques en lycée ? -lycee est un package qui pourra vous aider à utiliser LaTeX au quotidien. +proflycee est un package qui pourra vous aider à utiliser LaTeX au quotidien. ---------------- diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf index 950f44259d..9deffa7cd7 100644 Binary files a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf and b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf differ diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex index 5036e35a4f..300a92293f 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -11,7 +11,7 @@ \usepackage[build]{ProfLycee} \usepackage{tkz-euclide} \usetikzlibrary{hobby} -\usepackage{siunitx} +\usepackage[group-minimum-digits=4]{siunitx} \usepackage{fancyvrb} \usepackage{fancyhdr} %fancy @@ -55,8 +55,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\PLversion{1.2} -\def\PLdate{10 Août 2022} +\def\PLversion{1.2.2} +\def\PLdate{15 Août 2022} \tcbset{vignettes/.style={% nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,% @@ -222,7 +222,7 @@ Une commande pour afficher un petit schéma, en \TikZ, sur le signe d'une foncti Deux commandes pour, en \TikZ, créer des petits schémas \og de signe \fg. -Une commande pour déterminer des paramètres ($a$, $b$, $r$ et $r^2$) d'une régression linéaire par moindres carrés. +Une commande pour travailler sur les statistiques à deux variables (algébriques et graphiques). Quelques commandes pour convertir bin/dec/hex avec certains détails. @@ -2656,6 +2656,493 @@ Quelques \Cle{Clés} sont disponibles pour cette commande, essentiellement pour \newpage +\section{Statistiques à deux variables} + +\subsection{Idées} + +\begin{codeidee} +L'idée est de \textit{prolonger} le paragraphe précédent pour proposer un environnement \TikZ{} adapté à des situations venant de statistiques à deux variables. + +\smallskip + +Un des soucis pour ces situations est le fait que le repère dans lequel on travaille n'a pas forcément pour origine $(0\,;\,0)$. + +De ce fait - pour éviter des erreurs de \ctex{dimension too large} liées à \TikZ{} - il faut \textit{décaler les axes} pour se ramener à une origine en $O$. + +\smallskip + +Le code, intimement lié à un environnement \ctex{tikzpicture}, va donc : + +\begin{itemize} + \item préciser les informations utiles comme \ctex{xmin}, \ctex{xmax}, \ctex{Ox}, \ctex{xgrille}, etc + \item proposer des commandes (sans se soucier des \textit{translations} !) pour : + \begin{itemize} + \item tracer une grille (principale et/ou secondaire) ; + \item tracer les axes (avec légendes éventuelles) et éventuellement les graduer ; + \end{itemize} +\end{itemize} + +En utilisant les commandes de \textsf{régression linéaire} du paragraphe précédent, il sera de plus possible (sans calculs !) de : + +\begin{itemize} + \item représenter le nuage de points ; + \item placer le point moyen ; + \item tracer la droite d'ajustement (obtenue par \ctex{ProfLycee}) ou une autre courbe. +\end{itemize} +\end{codeidee} + +\begin{codeinfo} +Le package \ctex{pgfplots} peut être utilisé pour traiter ce genre de situation, mais ne l'utilisant pas, j'ai préféré préparer des \textsf{macros} permettant de s'affranchir de ce package (est-ce pertinent, ça c'est une autre question\ldots). +\end{codeinfo} + +\begin{codetex}[listing only] +%Listes et calculs +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} +\end{codetex} + +\begin{codetex}[listing only] +%tracé (simple), les options seront présentées juste après +\begin{tikzpicture}% + [x=0.5cm,y=0.1cm, %unités + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1, %axe Ox + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] %axe Oy + \PLgrilletikz \PLaxestikz %grilles et axes + \PLaxextikz[annee]{1992,1994,...,2010} %axeOx + \PLaxeytikz{1640,1650,...,1720} %axeOy + \PLnuagepts{\LLX}{\LLY} %nuage + \PLcourbe[line width=1.25pt,ForestGreen,samples=2]% + {\COEFFa*\x+\COEFFb}{\LXmin:\LXmax} %droite de régression + \PLnuageptmoy %point moyen +\end{tikzpicture} +\end{codetex} + +\begin{codetex}[listing only] +%tracé avec options fenêtre par défaut +\begin{tikzpicture}% + [....] %paramètres + \PLfenetresimple{1992,1994,...,2010}{1640,1650,...,1720} %fenêtre "simple" + \PLnuagepts{\LLX}{\LLY} %nuage + \PLcourbe[line width=1.25pt,ForestGreen,samples=2]% + {\COEFFa*\x+\COEFFb}{\LXmin:\LXmax} %droite de régression + \PLnuageptmoy %point moyen +\end{tikzpicture} +\end{codetex} + +\begin{codesortie} +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} + +\begin{tikzpicture}[x=0.5cm,y=0.1cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts{\LLX}{\LLY} + \PLcourbe[line width=1.25pt,ForestGreen,samples=2]{\COEFFa*\x+\COEFFb}{\LXmin:\LXmax} + \PLnuageptmoy +\end{tikzpicture} +\end{codesortie} + +\subsection{Commandes, clés et options} + +\begin{codeinfo} +Les \Cle{paramètres} nécessaires à la bonne utilisation des commandes suivantes sont à déclarer directement dans l'environnement \ctex{tikzpicture}, seules versions \og x \fg{} sont présentées ici: + +\begin{itemize} + \item \Cle{xmin}, stockée dans \ctex{\textbackslash{}xmin} ;\hfill{}défaut \Cle{-3} + \item \Cle{xmax}, stockée dans \ctex{\textbackslash{}xmax} ;\hfill{}défaut \Cle{3} + \item \Cle{Ox}, stockée dans \ctex{\textbackslash{}axexOx}, origine de l'axe $(Ox)$ ;\hfill{}défaut \Cle{0} + \item \Cle{xgrille}, stockée dans \ctex{\textbackslash{}xgrille}, graduation principale ;\hfill{}défaut \Cle{1} + \item \Cle{xgrilles}, stockée dans \ctex{\textbackslash{}xgrilles}, graduation secondaire.\hfill{}défaut \Cle{0.5} +\end{itemize} + +La fenêtre d'affichage (de sortie) sera donc \textit{portée} par le rectangle de coins $(xmin\,;\,ymin)$ et $(xmax\,;\,ymax)$ ; ce qui correspond en fait à la fenêtre \TikZ{} \textit{portée} par le rectangle de coins $(xmin-Ox\,;\,ymin-Oy)$ et $(xmax-Ox\,;\,ymax-Oy)$. + +\smallskip + +Les commandes ont -- pour certaines -- pas mal de \Cle{clés} pour des réglages fins, mais dans la majorité des cas elles ne sont pas forcément \textit{utiles}. +\end{codeinfo} + +\begin{codeinfo} +Pour illustrer les commandes et options de ce paragraphe, la base sera le graphique présenté précédemment. +\end{codeinfo} + +\begin{codetex}[listing only] +%...code tikz + \PLgrilletikz[][][] +\end{codetex} + +\begin{codecles} +Cette commande permet de tracer une grille principale et/ou une grille secondaire : + +\begin{itemize} + \item les premières \Cle{clés} sont les booléens \Cle{affp} et \Cle{affs} qui affichent ou non les grilles ;\hfill~défaut \Cle{true} + \item les options des grilles sont en \TikZ. \hfill~défaut \Cle{thin,lightgray} et \Cle{very thin,lightgray} +\end{itemize} +\end{codecles} + +\begin{codetex}[listing only] +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz +\end{tikzpicture} +~~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz[affp=false][][orange,densely dotted] +\end{tikzpicture} +\end{codetex} + +\begin{codesortie} +\hfill~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz +\end{tikzpicture} +~~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz[affp=false][][orange,densely dotted] +\end{tikzpicture} +\hfill~ +\end{codesortie} + +\begin{codetex}[listing only] +%...code tikz + \PLaxestikz[] +\end{codetex} + +\begin{codecles} +Cette commande permet de tracer les axes, avec des \Cle{clés} : + +\begin{itemize} + \item \Cle{epaisseur} qui est l'épaisseur des traits ; \hfill~défaut \Cle{1.25pt} + \item \Cle{police} qui est le style des labels des axes ; \hfill~défaut \Cle{\textbackslash{}normalsize\textbackslash{}normalfont} + \item \Cle{labelx} qui est le label de l'axe $(Ox)$ ; \hfill~défaut \Cle{\${}x\$} + \item \Cle{labely} qui est le label de l'axe $(Oy)$ ; \hfill~défaut \Cle{\${}y\$} + \item \Cle{afflabel} qui est le code pour préciser quels labels afficher, entre \Cle{x}, \Cle{y} ou \Cle{xy} ; \hfill~défaut \Cle{vide} + \item \Cle{poslabelx} pour la position du label de $(Ox)$ en bout d'axe ; \hfill~défaut \Cle{right} + \item \Cle{poslabely} pour la position du label de $(Oy)$ en bout d'axe ; \hfill~défaut \Cle{above} + \item \Cle{echellefleche} qui est l'échelle de la flèche des axes ; \hfill~défaut \Cle{1} + \item \Cle{typefleche} qui est le type de la flèche des axes.\hfill~défaut \Cle{>} +\end{itemize} +\end{codecles} + +\begin{codetex}[listing only] +%code tikz + \PLaxestikz + +%code tikz + \PLaxestikz% + [afflabel=xy,labelx={Année},labely={Altitude},% + poslabelx={below right},poslabely={above left}% + police=\small\sffamily] +\end{codetex} + +\begin{codesortie} +\hfill~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLaxestikz +\end{tikzpicture} +~~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLaxestikz% + [afflabel=xy,labelx={Année},labely={Altitude},% + poslabelx={below right},poslabely={above left},% + police=\small\sffamily] +\end{tikzpicture} +\hfill~ +\end{codesortie} + +%les axes + +\begin{codetex}[listing only] +%...code tikz + \PLaxextikz[]{valeurs} + \PLaxeytikz[]{valeurs} +\end{codetex} + +\begin{codecles} +Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} identiques pour les deux directions : + +\begin{itemize} + \item \Cle{epaisseur} qui est l'épaisseur des graduations ; \hfill~défaut \Cle{1.25pt} + \item \Cle{police} qui est le style des labels des graduations ; \hfill~défaut \Cle{\textbackslash{}normalsize\textbackslash{}normalfont} + \item \Cle{posgrad} qui est la position des graduations par rapport à l'axe ; \hfill~défaut \Cle{below} et \Cle{left} + \item \Cle{hautgrad} qui est la position des graduations (sous la forme \Cle{lgt} ou \Cle{lgta/lgtb}) ; \hfill~défaut \Cle{4pt} + \item le booléen \Cle{affgrad} pour afficher les valeurs (formatés avec \ctex{num} donc dépendant de \ctex{sisetup}) des graduations ; \hfill~défaut \Cle{true} + \item le booléen \Cle{afforigine} pour afficher la graduation de l'origine ; \hfill~défaut \Cle{true} + \item le booléen \Cle{annee} qui permet de ne pas formater les valeurs des graduations (type \textsf{année}). \hfill~défaut \Cle{false} +\end{itemize} +\end{codecles} + +\begin{codetex}[listing only] +%code tikz + \PLaxextikz[police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + +%code tikz + \PLaxextikz[police=\small,annee,hautgrad=0pt/4pt]{1992,1994,...,2010} + \PLaxeytikz[affgrad=false,hautgrad=6pt]{1640,1650,...,1720} + +%des axes fictifs (en gris) sont rajoutés pour la lisibilité du code de sortie +\end{codetex} + +\begin{codesortie} +\hfill~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \draw[gray,line width=1.25pt,->] ({\xmin-\axexOx},0) -- ({\xmax-\axexOx},0) ; + \draw[gray,line width=1.25pt,->] (0,{\ymin-\axeyOy}) -- (0,{\ymax-\axeyOy}) ; + \PLaxextikz[police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} +\end{tikzpicture} +~~ +\begin{tikzpicture}% + [x=0.35cm,y=0.07cm,% + Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% + Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \draw[gray,line width=1.25pt,->] ({\xmin-\axexOx},0) -- ({\xmax-\axexOx},0) ; + \draw[gray,line width=1.25pt,->] (0,{\ymin-\axeyOy}) -- (0,{\ymax-\axeyOy}) ; + \PLaxextikz[police=\small,annee,hautgrad=0pt/4pt]{1992,1994,...,2010} + \PLaxeytikz[affgrad=false,hautgrad=6pt]{1640,1650,...,1720} +\end{tikzpicture} +\hfill~ +\end{codesortie} + +\subsection{Commandes annexes} + +\begin{codeinfo} +Il existe, de manière marginale, quelques commandes complémentaires qui ne seront pas trop détaillées mais qui sont présentes dans l'introduction : + +\begin{itemize} + \item \ctex{\textbackslash{}PLfenetre} qui restreint les tracés à la fenêtre (utile pour des courbes qui \textit{débordent}) ; + \item \ctex{\textbackslash{}PLfenetresimple} qui permet d'automatiser le tracé des grilles/axes/graduations dans leurs versions par défaut, avec peut de paramétrages ; + \item \ctex{\textbackslash{}PLorigine} pour rajouter le libellé de l'origine si non affiché par les axes. +\end{itemize} +\end{codeinfo} + +\begin{codetex}[listing only] +%code tikz + \PLfenetre %on restreint les tracés + \PLfenetresimple{liste abscisses}{liste ordonnées} +\end{codetex} + +%%l'origine +% +%\begin{codetex}[listing only] +%%...code tikz +% \PLorigine[] +%\end{codetex} + +\subsection{Interactions avec PLreglin} + +\begin{codetex}[listing only] +%...code tikz + \PLnuagepts[]{listeX}{listeY} +\end{codetex} + +\begin{codecles} +Cette commande, liée à la commande \ctex{\textbackslash{}PLreglin} permet de représenter le nuage de points associé aux deux listes, avec les \Cle{clés} suivantes : + +\begin{itemize} + \item \Cle{taille} qui est la taille des points du nuage ; \hfill~défaut \Cle{2pt} + \item \Cle{style} parmi \Cle{o} (rond) ou \Cle{x} (croix) ou \Cle{+} (plus) ; \hfill~défaut \Cle{o} + \item \Cle{couleur} qui est la couleur (éventuellement \Cle{couleurA/couleurB} pour les ronds). \hfill~défaut \Cle{blue} +\end{itemize} +\end{codecles} + +\begin{codetex}[listing only] +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} + +\begin{tikzpicture}[...] + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} +\end{tikzpicture} +~~ +\begin{tikzpicture}[...] + \PLnuagepts[couleur=ForestGreen,style=x,taille=6pt]{\LLX}{\LLY} +\end{tikzpicture} +\end{codetex} + +\begin{codesortie} +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} + +\begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee,police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} +\end{tikzpicture} +~~ +\begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee,police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts[couleur=ForestGreen,style=x,taille=6pt]{\LLX}{\LLY} +\end{tikzpicture} +\end{codesortie} + +%point moyen +\begin{codetex}[listing only] +%...code tikz + \PLnuageptmoy[] +\end{codetex} + +\begin{codecles} +Cette commande permet de rajouter le point moyen du nuage, calculé par la commande \ctex{\textbackslash{}PLreglin}, avec les \Cle{clés} : + +\begin{itemize} + \item \Cle{police}, comme précédemment ; \hfill~défaut \Cle{\textbackslash{}normalsize\textbackslash{}normalfont} ; + \item \Cle{taille}, taille du point moyen ; \hfill~défaut \Cle{4pt} + \item \Cle{couleur}, couleur du point moyen ; \hfill~défaut \Cle{red} + \item \Cle{style} parmi \Cle{o} (rond) ou \Cle{x} (croix) ou \Cle{+} (plus) ; \hfill~défaut \Cle{o} + \item \Cle{xg}, abscisse du point moyen, récupérable via \ctex{PLRegLin} ; \hfill~défaut \Cle{\textbackslash{}LXmoy} + \item \Cle{xy}, abscisse du point moyen, récupérable via \ctex{PLRegLin} ; \hfill~défaut \Cle{\textbackslash{}LYmoy} + \item \Cle{nom}, label du point moyen ; \hfill~défaut \Cle{G} + \item \Cle{pos} qui est la position du label par rapport au point ; \hfill~défaut \Cle{above} + \item \Cle{decal} qui est l'éloignement de la position du label par rapport au point ; \hfill~défaut \Cle{0pt} + \item la booléen \Cle{affnom} qui affiche ou non le libellé.\hfill~défaut \Cle{true} +\end{itemize} +\end{codecles} + +\begin{codetex}[listing only] +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} + +\begin{tikzpicture}[...] + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} + \PLnuageptmoy +\end{tikzpicture} +~~ +\begin{tikzpicture}[...] + \PLnuagepts[couleur=ForestGreen,style=x,taille=6pt]{\LLX}{\LLY} + \PLnuageptmoy[couleur=orange,taille=8pt,style=+,nom={$G_1$}] +\end{tikzpicture} +\end{codetex} + +\begin{codesortie} +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} + +\begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee,police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} + \PLnuageptmoy +\end{tikzpicture} +~~ +\begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee,police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts[couleur=ForestGreen,style=x,taille=6pt]{\LLX}{\LLY} + \PLnuageptmoy[couleur=orange,taille=8pt,style=+,nom={$G_1$},pos=below] +\end{tikzpicture} +\end{codesortie} + +%courbe +\begin{codetex}[listing only] +%...code tikz + \PLcourbe[]{formule}{domaine} +\end{codetex} + +\begin{codecles} +Cette commande permet de rajouter une courbe sur le graphique (sans se soucier de la transformation de son expression) avec les arguments : + +\begin{itemize} + \item \Cle{optionnels} qui sont - en \TikZ{} - les paramètres du tracé ; + \item le premier mandataire, est - en langage \TikZ{} - l'expression de la fonction à tracer, donc avec \ctex{\textbackslash{}x} comme variable ; + \item le second mandataire est le domaine du tracé , sous la forme \ctex{valxmin:valxmax}. +\end{itemize} +\end{codecles} + +\begin{codeinfo} +L'idée principale est de récupérer les variables de la régression linéaire pour tracer la droite d'ajustement \textit{à moindres frais} ! +\end{codeinfo} + +\begin{codetex}[listing only] +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} + +\begin{tikzpicture}[...] + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} + \PLnuageptmoy + \PLcourbe[line width=1.25pt,ForestGreen,samples=2]{\COEFFa*\x+\COEFFb}{\xmin:\xmax} +\end{tikzpicture} +\end{codetex} + +\begin{codesortie} +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} +\PLreglin{\LLX}{\LLY} + +\begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee,police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} + \PLnuageptmoy + \PLcourbe[line width=1.25pt,ForestGreen,samples=2]{\COEFFa*\x+\COEFFb}{\xmin:\xmax} +\end{tikzpicture} +\end{codesortie} + +\begin{codeinfo} +Toute courbe peut être tracée sur ce principe, par contre il faudra saisir la fonction \textit{à la main}. +\end{codeinfo} + +\begin{codetex}[listing only] +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} + +\begin{tikzpicture}[...] + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} + %on fixe la fenêtre d'affichage pour éviter les débordements + \PLfenetre + \PLcourbe[line width=1.25pt,orange,samples=500]{-(\x-2000)*(\x-2000)+1700}{\xmin:\xmax} +\end{tikzpicture} +\end{codetex} + +\begin{codesortie} +\def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} +\def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} + +\begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] + \PLgrilletikz \PLaxestikz + \PLaxextikz[annee,police=\small]{1992,1994,...,2010} + \PLaxeytikz{1640,1650,...,1720} + \PLnuagepts[couleur=blue/red]{\LLX}{\LLY} + \PLfenetre + \PLcourbe[line width=1.25pt,orange,samples=500]{-(\x-2000)*(\x-2000)+1700}{\xmin:\xmax} +\end{tikzpicture} +\end{codesortie} + +\newpage + \section{Conversions binaire/hexadécimal/décimal} \subsection{Idée} @@ -2775,8 +3262,7 @@ Quelques \Cle{clés} sont disponibles pour cette commande : \begin{itemize} \item le booléen \Cle{affbase} qui permet d'afficher ou non la base des nombres ; \hfill{}défaut \Cle{true} \item le booléen \Cle{details} qui permet d'afficher ou le détail par bloc de 4 ; \hfill{}défaut \Cle{true} - \item la clé \Cle{trait} qui permet de modifier l'épaisseur du crochet. \hfill{}défaut \Cle{0. - 5pt} + \item la clé \Cle{trait} qui permet de modifier l'épaisseur du crochet. \hfill{}défaut \Cle{0.5pt} \end{itemize} Le formatage est géré par le package \ctex{sinuitx}, le mieux est de positionner la commande dans un environnement mathématique. @@ -2945,7 +3431,6 @@ Avant toute chose, quelques petites infos sur les données au format \textsf{csv \begin{itemize} \item le fichier de données \textsf{csv} doit être formaté avec le séparateur décimal \og , \fg ; - \item chaque ligne doit se terminer par \og \texttt{,ZZ} \fg{} (choix arbitraire de l'auteur, sinon il y a un \textsf{bug} non réglé pour le moment\ldots) ; \item des cases vides seront codées par \og \texttt{-} \fg. \end{itemize} @@ -2953,14 +3438,14 @@ Le fichier \textsf{csv} peut être déclaré directement dans le fichier \textsf \begin{Verbatim}[tabsize=2,fontsize=\scriptsize] \begin{filecontents*}{.csv} -A,B,C,D,ZZ -A,B,D,C,ZZ -B,A,C,D,ZZ -B,A,D,C,ZZ +A,B,C,D +A,B,D,C +B,A,C,D +B,A,D,C \end{filecontents*} \end{Verbatim} -À la compilation, le fichier \textsf{.csv} sera créé automatiquement, cependant toute modification dans le fichier \textsf{tex} ne sera pas répercutée dans le fichier\ldots +À la compilation, le fichier \textsf{.csv} sera créé automatiquement, et l'option \Cle{[overwrite]} permet (logiquement) de propager les modifications au fichier \textsf{csv}. \end{codeinfo} \subsection{Package csvsimple et option} @@ -2990,12 +3475,12 @@ L'option \Cle{csvii} permet de passer l'appel au package en version \LaTeXe. \begin{codetex}[listing only] %déclaration du fichier csv -\begin{filecontents*}{basique.csv} -A,B,C,D,ZZ -A,B,D,C,ZZ -B,A,C,D,ZZ -B,A,D,C,ZZ -C,A,B,D,ZZ +\begin{filecontents*}[overwrite]{basique.csv} +A,B,C,D +A,B,D,C +B,A,C,D +B,A,D,C +C,A,B,D \end{filecontents*} \begin{tikzpicture}%avec lettres @@ -3010,11 +3495,11 @@ C,A,B,D,ZZ \end{codetex} \begin{codesortie} -\begin{filecontents*}{basique.csv} -A,B,C,D,ZZ -A,B,D,C,ZZ -B,A,D,C,ZZ -C,A,B,D,ZZ +\begin{filecontents*}[overwrite]{basique.csv} +A,B,C,D +A,B,D,C +B,A,D,C +C,A,B,D \end{filecontents*} \begin{center} @@ -3075,30 +3560,30 @@ Quelques \Cle{Clés} sont nécessaires au bon fonctionnement de la commande : %codes simples et sans ambiguïté %une case vide sera codée par - -\begin{filecontents*}{perroquet.csv} --,-,-,-,-,-,4,4,4,4,-,-,-,-,-,-,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9,9,9,4,4,4,4,9,9,9,9,4,- +-,4,9,4,9,9,4,4,4,4,9,4,9,9,4,- +-,4,1,9,9,9,4,4,4,4,9,9,9,1,4,- +-,-,4,1,1,9,4,4,4,4,9,1,1,4,-,- +-,-,4,1,1,1,4,4,4,4,1,1,1,4,-,- +-,-,-,4,1,1,1,4,4,1,1,1,4,-,-,- +-,-,4,3,1,1,1,1,1,1,1,1,3,4,-,- +-,4,6,3,1,1,1,1,1,1,1,1,3,6,4,- +-,4,6,6,1,1,1,1,1,1,1,1,6,6,4,- +-,4,6,6,1,1,1,1,1,1,1,1,6,6,4,- +-,4,6,4,1,1,1,4,4,1,1,1,4,6,4,- +2,2,4,2,4,4,4,2,2,4,4,4,2,4,2,2 +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 +-,-,-,-,-,4,1,1,1,1,4,-,-,-,-,- +-,-,-,-,-,-,4,1,1,4,-,-,-,-,-,- +-,-,-,-,-,-,-,4,4,-,-,-,-,-,-,- \end{filecontents*} \begin{tikzpicture}[x=0.35cm,y=0.35cm] @@ -3117,30 +3602,30 @@ Les symboles affichés dans les cases sont situés aux nœuds de coordonnées $( \end{codeinfo} \begin{codesortie} -\begin{filecontents*}{perroquet.csv} --,-,-,-,-,-,4,4,4,4,-,-,-,-,-,-,ZZ --,-,-,-,4,4,1,1,1,1,4,4,-,-,-,-,ZZ --,-,-,4,1,1,1,1,1,1,1,1,4,-,-,-,ZZ --,-,4,1,1,1,1,1,1,1,1,1,1,4,-,-,ZZ --,-,4,1,1,1,1,1,1,1,1,1,1,4,-,-,ZZ --,4,1,9,9,1,1,1,1,1,1,9,9,1,4,-,ZZ --,4,9,9,9,9,4,4,4,4,9,9,9,9,4,-,ZZ --,4,9,4,9,9,4,4,4,4,9,4,9,9,4,-,ZZ --,4,1,9,9,9,4,4,4,4,9,9,9,1,4,-,ZZ --,-,4,1,1,9,4,4,4,4,9,1,1,4,-,-,ZZ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4,4,1,1,1,4,6,4,- +2,2,4,2,4,4,4,2,2,4,4,4,2,4,2,2 +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 +-,-,-,-,-,4,1,1,1,1,4,-,-,-,-,- +-,-,-,-,-,-,4,1,1,4,-,-,-,-,-,- +-,-,-,-,-,-,-,4,4,-,-,-,-,-,-,- \end{filecontents*} \begin{center} @@ -3170,38 +3655,46 @@ Les symboles affichés dans les cases sont situés aux nœuds de coordonnées $( \PLpixelart[codes=123469,couleurs={Red,Brown,Yellow,Black,Blue,White},correction]{perroquet.csv} \filldraw[Blue] (14,-1) circle[radius=1] ; \filldraw[Yellow] (14,-1) circle[radius=0.8] ; + \draw[ForestGreen,very thick,<-] (15,-1) to[bend left=30] (18,-2) node[right,font=\scriptsize\sffamily] {rajouté en \TikZ} ; \end{tikzpicture} \end{center} \end{codesortie} +\begin{codetex}[listing only] +%code tikz et pixelart +\filldraw[Blue] (14,-1) circle[radius=1] ; +\filldraw[Yellow] (14,-1) circle[radius=0.8] ; +\draw[ForestGreen,very thick,<-] (15,-1) to[bend left=30] (18,-2) node[right,font=\scriptsize\sffamily] {rajouté en \TikZ} ; +\end{codetex} + \pagebreak \begin{codetex}[listing only] %codes avec ambiguïté -\begin{filecontents*}{cap.csv} --,-,-,-,-,-,-,-,D,-,D,-,D,-,-,-,-,-,-,-,-,-,ZZ --,D,D,-,-,-,-,D,D,D,D,D,D,-,-,D,D,D,D,-,-,-,ZZ -D,-,-,D,-,D,D,F,F,F,F,F,F,D,D,-,-,-,-,D,-,-,ZZ --,D,-,-,D,F,F,F,-,-,F,F,F,F,F,D,-,D,D,-,-,-,ZZ --,-,D,D,F,F,F,-,F,F,-,F,F,F,F,F,D,D,-,-,-,-,ZZ --,-,-,D,F,F,F,F,F,F,F,F,F,F,F,F,D,-,-,-,-,-,ZZ --,-,-,D,F,J,J,J,J,J,J,J,F,F,F,F,D,-,-,-,-,-,ZZ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,F,F,F,-,-,F,F,F,F,F,D,-,D,D,-,-,- +-,-,D,D,F,F,F,-,F,F,-,F,F,F,F,F,D,D,-,-,-,- +-,-,-,D,F,F,F,F,F,F,F,F,F,F,F,F,D,-,-,-,-,- +-,-,-,D,F,J,J,J,J,J,J,J,F,F,F,F,D,-,-,-,-,- +-,-,-,D,J,-,-,-,J,-,-,-,J,J,F,F,D,-,-,-,-,- +-,-,-,D,J,-,D,-,J,-,D,-,J,J,B,B,D,-,-,-,-,- +-,-,-,D,J,-,-,-,J,-,-,-,J,J,B,B,D,-,-,-,-,- +-,-,-,D,C,J,J,J,J,J,J,J,J,C,C,C,D,-,-,-,-,- +-,-,-,D,C,C,C,C,C,C,C,C,C,C,C,D,D,D,-,-,-,- +-,-,-,D,C,C,C,D,D,D,D,D,D,C,D,A,A,A,D,-,-,- +-,-,-,D,F,C,C,C,C,C,C,C,C,D,A,-,-,-,A,D,-,- +-,-,-,D,F,C,F,C,C,C,C,F,D,A,-,A,A,A,-,A,D,- +-,-,D,C,F,F,F,F,C,C,F,D,A,-,A,F,F,F,A,-,A,D +-,-,D,C,F,F,F,F,F,F,F,D,A,-,A,F,-,F,A,-,A,D +-,-,D,A,D,-,A,-,A,-,A,D,A,-,A,F,F,F,A,-,A,D +-,-,-,D,D,-,A,-,A,-,A,-,D,A,-,A,A,A,-,A,D,- +-,-,-,-,-,D,D,F,D,D,D,D,F,D,A,-,-,-,A,D,-,- +-,-,-,-,-,-,D,A,D,-,-,D,-,-,D,A,A,A,D,-,-,- +-,-,-,-,-,-,D,D,D,-,-,D,D,D,D,D,D,D,-,-,-,- \end{filecontents*} \begin{center} @@ -3254,6 +3747,10 @@ D,-,-,D,-,D,D,F,F,F,F,F,F,D,D,-,-,-,-,D,-,-,ZZ \section{Historique} +{\small \bverb|v1.2.2|~:~~~~Commandes pour travailler sur des stats à 2 variables + +{\small \bverb|v1.2.1|~:~~~~Amélioration de la gestion du csv pour Pixelart + {\small \bverb|v1.2 |~:~~~~Correction d'un méchant bug sur Pixelart {\small \bverb|v1.1.9|~:~~~~Pixelart en \TikZ diff --git a/macros/latex/contrib/proflycee/doc/basique.csv b/macros/latex/contrib/proflycee/doc/basique.csv index b15c24713c..0b9de46575 100644 --- a/macros/latex/contrib/proflycee/doc/basique.csv +++ b/macros/latex/contrib/proflycee/doc/basique.csv @@ -1,4 +1,4 @@ -A,B,C,D,ZZ -A,B,D,C,ZZ -B,A,D,C,ZZ -C,A,B,D,ZZ +A,B,C,D +A,B,D,C +B,A,D,C +C,A,B,D diff --git a/macros/latex/contrib/proflycee/doc/cap.csv b/macros/latex/contrib/proflycee/doc/cap.csv index 850d0c2152..f1c61f342e 100644 --- a/macros/latex/contrib/proflycee/doc/cap.csv +++ b/macros/latex/contrib/proflycee/doc/cap.csv @@ -1,22 +1,22 @@ --,-,-,-,-,-,-,-,D,-,D,-,D,-,-,-,-,-,-,-,-,-,ZZ --,D,D,-,-,-,-,D,D,D,D,D,D,-,-,D,D,D,D,-,-,-,ZZ -D,-,-,D,-,D,D,F,F,F,F,F,F,D,D,-,-,-,-,D,-,-,ZZ --,D,-,-,D,F,F,F,-,-,F,F,F,F,F,D,-,D,D,-,-,-,ZZ --,-,D,D,F,F,F,-,F,F,-,F,F,F,F,F,D,D,-,-,-,-,ZZ --,-,-,D,F,F,F,F,F,F,F,F,F,F,F,F,D,-,-,-,-,-,ZZ --,-,-,D,F,J,J,J,J,J,J,J,F,F,F,F,D,-,-,-,-,-,ZZ --,-,-,D,J,-,-,-,J,-,-,-,J,J,F,F,D,-,-,-,-,-,ZZ --,-,-,D,J,-,D,-,J,-,D,-,J,J,B,B,D,-,-,-,-,-,ZZ --,-,-,D,J,-,-,-,J,-,-,-,J,J,B,B,D,-,-,-,-,-,ZZ --,-,-,D,C,J,J,J,J,J,J,J,J,C,C,C,D,-,-,-,-,-,ZZ --,-,-,D,C,C,C,C,C,C,C,C,C,C,C,D,D,D,-,-,-,-,ZZ --,-,-,D,C,C,C,D,D,D,D,D,D,C,D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-,-,-,D,F,C,C,C,C,C,C,C,C,D,A,-,-,-,A,D,-,- +-,-,-,D,F,C,F,C,C,C,C,F,D,A,-,A,A,A,-,A,D,- +-,-,D,C,F,F,F,F,C,C,F,D,A,-,A,F,F,F,A,-,A,D +-,-,D,C,F,F,F,F,F,F,F,D,A,-,A,F,-,F,A,-,A,D +-,-,D,A,D,-,A,-,A,-,A,D,A,-,A,F,F,F,A,-,A,D +-,-,-,D,D,-,A,-,A,-,A,-,D,A,-,A,A,A,-,A,D,- +-,-,-,-,-,D,D,F,D,D,D,D,F,D,A,-,-,-,A,D,-,- +-,-,-,-,-,-,D,A,D,-,-,D,-,-,D,A,A,A,D,-,-,- +-,-,-,-,-,-,D,D,D,-,-,D,D,D,D,D,D,D,-,-,-,- diff --git a/macros/latex/contrib/proflycee/doc/perroquet.csv b/macros/latex/contrib/proflycee/doc/perroquet.csv index 4bcbe1d191..8bffe43be3 100644 --- a/macros/latex/contrib/proflycee/doc/perroquet.csv +++ b/macros/latex/contrib/proflycee/doc/perroquet.csv @@ -1,23 +1,23 @@ --,-,-,-,-,-,4,4,4,4,-,-,-,-,-,-,ZZ --,-,-,-,4,4,1,1,1,1,4,4,-,-,-,-,ZZ --,-,-,4,1,1,1,1,1,1,1,1,4,-,-,-,ZZ --,-,4,1,1,1,1,1,1,1,1,1,1,4,-,-,ZZ --,-,4,1,1,1,1,1,1,1,1,1,1,4,-,-,ZZ --,4,1,9,9,1,1,1,1,1,1,9,9,1,4,-,ZZ --,4,9,9,9,9,4,4,4,4,9,9,9,9,4,-,ZZ --,4,9,4,9,9,4,4,4,4,9,4,9,9,4,-,ZZ --,4,1,9,9,9,4,4,4,4,9,9,9,1,4,-,ZZ --,-,4,1,1,9,4,4,4,4,9,1,1,4,-,-,ZZ --,-,4,1,1,1,4,4,4,4,1,1,1,4,-,-,ZZ --,-,-,4,1,1,1,4,4,1,1,1,4,-,-,-,ZZ --,-,4,3,1,1,1,1,1,1,1,1,3,4,-,-,ZZ --,4,6,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,-,-,-,- +-,-,-,-,-,-,4,1,1,4,-,-,-,-,-,- +-,-,-,-,-,-,-,4,4,-,-,-,-,-,-,- diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty index 1f3e210420..8da7dca149 100644 --- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -3,7 +3,9 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2022/08/10 - v1.2 - Aide pour l'utilisation de LaTeX en lycée] +\ProvidesPackage{ProfLycee}[2022/08/15 - v1.2.2 - Aide pour l'utilisation de LaTeX en lycée] +% 1.2.2 Ajouts de commandes pour des stats à 2 variables +% 1.2.1 Amélioration de la gestion du csv pour les pixelart % 1.2 Correction d'un méchant bug avec pixelart, erf... % 1.1.9 Commande pour du pixelart en tikz (avec option csvii pour compatibilité) % 1.1.8 Ajout d'un style mainlevee pour tikz @@ -1476,6 +1478,7 @@ {% \csvloop{file=#2,no head,command={% \foreach \l [count=\n] in \csvline {% + \StrDel{\l}{ }[\l] \setsepchar{,} \readlist\LCPA\PATcouleurs \StrPosition{\PATlettres}{\l}[\pixcnt]% @@ -1494,6 +1497,7 @@ {%affichage du pixelart versions chiffres si besoin \csvloop{file=#2,no head,command={% \foreach \l [count=\n] in \csvline {% + \StrDel{\l}{ }[\l] \setsepchar{,} \readlist\LCNA\PATchiffres \StrPosition{\PATlettres}{\l}[\pixpos]% @@ -1510,6 +1514,7 @@ {%affichage du pixelart versions lettres ou chiffres simples (<=9) \csvloop{file=#2,no head,command={% \foreach \l [count=\n] in \csvline {% + \StrDel{\l}{ }[\l] \IfSubStr{\PATlettres}{\l}% {% \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};} @@ -1521,4 +1526,349 @@ } } +%=========STATS2VAR========= +%variables directement dans tikzpicture +\tikzset{% + Ox/.store in=\axexOx,Ox/.default=0,Ox=0,%essai + Oy/.store in=\axeyOy,Oy/.default=0,Oy=0,%essai + xmin/.store in=\xmin,xmin/.default=-5,xmin=-5, + xmax/.store in=\xmax,xmax/.default=5,xmax=5, + ymin/.store in=\ymin,ymin/.default=-5,ymin=-5, + ymax/.store in=\ymax,ymax/.default=5,ymax=5, + xgrille/.store in=\xgrille,xgrille/.default=1,xgrille=1, + xgrilles/.store in=\xgrilles,xgrilles/.default=0.5,xgrilles=0.5, + ygrille/.store in=\ygrille,ygrille/.default=1,ygrille=1, + ygrilles/.store in=\ygrilles,ygrilles/.default=0.5,ygrilles=0.5, + xunit/.store in=\xunit,xunit/.default=1,xunit=1, + yunit/.store in=\yunit,yunit/.default=1,yunit=1 +} + +%style point croix +\tikzset{pics/PLdotcross/.style args={#1/#2}{ + code={ + \draw[line width={0.5*#1},rotate=#2] (-#1,0) -- (#1,0); + \draw[line width={0.5*#1},rotate=#2] (0,-#1) -- (0, #1); + } + }, + pics/PLdotcross/.default={4pt/0} +} + +%axeOx +\defKV[PLaxextkz]{% + epaisseur=\def\axexwidth{#1},% + police=\def\axexfont{#1},% + hautgrad=\def\axextickwidth{#1},% + posgrad=\def\axexposlabel{#1} +} + +\setKVdefault[PLaxextkz]{% + epaisseur=1.25pt,% + police=\normalsize\normalfont,% + posgrad=below,% + hautgrad=4pt,% + affgrad=true,% + afforigine=true,% + annee=false +} + +\DeclareDocumentCommand\PLaxextikz{ O{} m }{% + \useKVdefault[PLaxextkz] + \setKV[PLaxextkz]{#1}% on paramètres les nouvelles clés et on les simplifie + %formatage des années + \IfSubStr{\axextickwidth}{/} + {\StrCut{\axextickwidth}{/}{\axextickwidthA}{\axextickwidthB}} + {\def\axextickwidthA{\axextickwidth}\def\axextickwidthB{\axextickwidth}} + \foreach \x in {#2}{% + \draw[line width=\axexwidth] ({\x-\axexOx},{\axextickwidthA}) -- ({\x-\axexOx},{-\axextickwidthB})% + \ifboolKV[PLaxextkz]{affgrad}%on affiche les graduations + {% + \ifboolKV[PLaxextkz]{afforigine}%si on demande d'afficher l'origine + {node[\axexposlabel,font=\axexfont] + {\ifboolKV[PLaxextkz]{annee}% + {\num[group-digits=none]{\x}}% + {\num[text-family-to-math=true,text-series-to-math=true]{\x}}% + } + } + {\xintifboolexpr{\x==\axexOx}{}{node[\axexposlabel,font=\axexfont] {\ifboolKV[PLaxextkz]{annee}% + {\num[group-digits=none]{\x}}% + {\num[text-family-to-math=true,text-series-to-math=true]{\x}}% + } + } + } + } + {} + ;} +} + +%axeOy +\defKV[PLaxeytkz]{% + epaisseur=\def\axeywidth{#1},% + police=\def\axeyfont{#1},% + hautgrad=\def\axeytickwidth{#1},% + posgrad=\def\axeyposlabel{#1} +} + +\setKVdefault[PLaxeytkz]{% + epaisseur=1.25pt,% + police=\normalsize\normalfont,% + posgrad=left,% + hautgrad=4pt,% + affgrad=true,% + afforigine=true,% + annee=false +} + +\DeclareDocumentCommand\PLaxeytikz{ O{} m }{% + \useKVdefault[PLaxeytkz] + \setKV[PLaxeytkz]{#1}% on paramètres les nouvelles clés et on les simplifie + \IfSubStr{\axeytickwidth}{/} + {\StrCut{\axeytickwidth}{/}{\axeytickwidthA}{\axeytickwidthB}} + {\def\axeytickwidthA{\axeytickwidth}\def\axeytickwidthB{\axeytickwidth}} + \foreach \y in {#2}{% + \draw[line width=\axeywidth] ({\axeytickwidthA},{\y-\axeyOy}) -- ({-\axeytickwidthB},{\y-\axeyOy})% + \ifboolKV[PLaxeytkz]{affgrad}%on affiche les graduations + {% + \ifboolKV[PLaxeytkz]{afforigine}%si on demande d'afficher l'origine + {node[\axeyposlabel,font=\axeyfont] + {\ifboolKV[PLaxeytkz]{annee}% + {\num[group-digits=none]{\y}}% + {\num[text-family-to-math=true,text-series-to-math=true]{\y}}% + } + } + {\xintifboolexpr{\y==\axeyOy}{}{node[\axeyposlabel,font=\axeyfont] {\ifboolKV[PLaxeytkz]{annee}% + {\num[group-digits=none]{\y}}% + {\num[text-family-to-math=true,text-series-to-math=true]{\y}}% + } + } + } + } + {} + ;} +} + +%axes +\defKV[PLaxestkz]{% + epaisseur=\def\axeswidth{#1},% + police=\def\axesfont{#1},% + labelx=\def\axeslabelx{#1},% + labely=\def\axeslabely{#1},% + poslabelx=\def\axesposlabelx{#1},% + poslabely=\def\axesposlabely{#1},% + echellefleche=\def\axesechellefleche{#1},% + typefleche=\def\axestypefleche{#1},% + afflabel=\def\axesafflabel{#1} +} + +\setKVdefault[PLaxestkz]{% + epaisseur=1.25pt,% + police=\normalsize\normalfont,% + labelx=$x$,% + labely=$y$,% + afflabel=,% + poslabelx=right,% + poslabely=above,% + echellefleche=1,% + typefleche=> +} + +\DeclareDocumentCommand\PLaxestikz{ O{} }{% + \useKVdefault[PLaxestkz] + \setKV[PLaxestkz]{#1}% + %on affiche les deux axes + \draw[line width=\axeswidth,-{\axestypefleche[scale=\axesechellefleche]}] ({\xmin-\axexOx},0) -- ({\xmax-\axexOx},0) ; + \draw[line width=\axeswidth,-{\axestypefleche[scale=\axesechellefleche]}] (0,{\ymin-\axeyOy}) -- (0,{\ymax-\axeyOy}) ; + %les labels éventuels + \IfSubStr{\axesafflabel}{x}% + {\draw ({\xmax-\axexOx},0) node[\axesposlabelx,font=\axesfont] {\axeslabelx} ;} + {} + \IfSubStr{\axesafflabel}{y}% + {\draw (0,{\ymax-\axeyOy}) node[\axesposlabely,font=\axesfont] {\axeslabely} ;} + {} +} + +%fenêtre clippée +\newcommand\PLfenetre{% + \clip ({\xmin-\axexOx},{\ymin-\axeyOy}) rectangle ({\xmax-\axexOx},{\ymax-\axeyOy}) ; +} + +%origine +\defKV[PLaxesorig]{% + police=\def\axesorfont{#1},% + pos=\def\axesorpos{#1},% + decal=\def\axesordecal{#1},% + valeur=\def\axesorval{#1} +} + +\setKVdefault[PLaxesorig]{% + police=\normalsize\normalfont,% + pos={below left},% + decal=2pt,% + valeur=0 +} + +\DeclareDocumentCommand\PLorigine{ O{} }{% + \useKVdefault[PLaxesorig] + \setKV[PLaxesorig]{#1}% + \draw (0,0) node[\axesorpos=\axesordecal,font=\axesorfont] {\axesorval} ; +} + +%grilles +\setKVdefault[PLgrillestkz]{% + affp=true,% + affs=true +} + +\DeclareDocumentCommand\PLgrilletikz{ O{} O{thin,lightgray} O{ultra thin,lightgray} }{% + \useKVdefault[PLgrillestkz] + \setKV[PLgrillestkz]{#1}% + \ifboolKV[PLgrillestkz]{affs} + {\draw[xstep=\xgrilles,ystep=\ygrilles,#3] ({\xmin-\axexOx},{\ymin-\axeyOy}) grid ({\xmax-\axexOx},{\ymax-\axeyOy});} + {} + \ifboolKV[PLgrillestkz]{affp} + {\draw[xstep=\xgrille,ystep=\ygrille,#2] ({\xmin-\axexOx},{\ymin-\axeyOy}) grid ({\xmax-\axexOx},{\ymax-\axeyOy});} + {} +} + +%point(s) avec changement origines +\defKV[PLpts]{% + taille=\def\ptstaille{#1},% + couleur=\def\ptscouleur{#1},% + style=\def\ptsstyle{#1} +} + +\setKVdefault[PLpts]{% + taille=2pt,% + couleur=blue,% + style=o +} + +\newcommand\PLnuagepoints[2][]{% + \useKVdefault[PLpts] + \setKV[PLpts]{#1}% + \setsepchar{§}% + \readlist\listepointsaffiches{#2} + \foreachitem\point\in\listepointsaffiches{% + \StrBetween{\point}{(}{,}[\XPT] + \StrBetween{\point}{,}{)}[\YPT] + \IfStrEq{\ptsstyle}{o}% + {\filldraw[\ptscouleur] ({\XPT-\axexOx},{\YPT-\axeyOy}) circle[radius=\ptstaille] ;} + {} + \IfStrEq{\ptsstyle}{x}% + {\draw[\ptscouleur] ({\XPT-\axexOx},{\YPT-\axeyOy}) pic {PLdotcross=\ptstaille/45} ;} + {} + \IfStrEq{\ptsstyle}{+}% + {\draw[\ptscouleur] ({\XPT-\axexOx},{\YPT-\axeyOy}) pic {PLdotcross=\ptstaille/0} ;} + {} + } +} + +\newcommand\PLnuagepts[3][]{% + \useKVdefault[PLpts] + \setKV[PLpts]{#1}% on paramètres les nouvelles clés et on les simplifie + \def\xliste{#2} + \def\yliste{#3} + \readlist*\LX{\xliste} + \readlist*\LY{\yliste} + %taille des listes + \def\LNB{\inteval{\LXlen}} + \foreach \i in {1,2,...,\LNB} { + \IfStrEq{\ptsstyle}{o}% + { + \IfSubStr{\ptscouleur}{/} + {\StrCut{\ptscouleur}{/}{\ptscouleurA}{\ptscouleurB}\draw[thick,\ptscouleurA,fill=\ptscouleurB] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) circle[radius=\ptstaille] ;} + {\draw[\ptscouleur,fill=\ptscouleur] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) circle[radius=\ptstaille] ;} + } + {} + \IfStrEq{\ptsstyle}{x}% + {\draw[\ptscouleur] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) pic {PLdotcross=\ptstaille/45} ;} + {} + \IfStrEq{\ptsstyle}{+}% + {\draw[\ptscouleur] ({\LX[\i]-\axexOx},{\LY[\i]-\axeyOy}) pic {PLdotcross=\ptstaille/0} ;} + {} + } +} + +\defKV[PLptmoy]{% + police=\def\ptmoyfont{#1},% + taille=\def\ptmoytaille{#1},% + couleur=\def\ptmoycouleur{#1},% + style=\def\ptmoystyle{#1},% + xg=\def\ptmoyx{#1},% + yg=\def\ptmoyy{#1},% + nom=\def\ptmoynom{#1},% + pos=\def\ptmoypos{#1},% + decal=\def\ptmoydecal{#1},% +} + +\setKVdefault[PLptmoy]{% + police=\normalsize\normalfont,% + taille=4pt,% + couleur=red,% + style=x,% + xg=\LXmoy,% + yg=\LYmoy,% + nom=G,% + pos=above,% + decal=0pt,% + affnom=true +} + +\newcommand\PLnuageptmoy[1][]{% + \useKVdefault[PLptmoy] + \setKV[PLptmoy]{#1}% on paramètres les nouvelles clés et on les simplifie + \IfStrEq{\ptmoystyle}{o}% + { + \IfSubStr{\ptmoycouleur}{/} + {\StrCut{\ptmoycouleur}{/}{\ptmoycouleurA}{\ptmoycouleurB}\draw[thick,\ptmoycouleurA,fill=\ptmoycouleurB] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) circle[radius=\ptmoytaille] ;} + {\draw[\ptmoycouleur,fill=\ptmoycouleur] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) circle[radius=\ptmoytaille] ;} + } + {} + \IfStrEq{\ptmoystyle}{x}% + {\draw[\ptmoycouleur] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) pic {PLdotcross=\ptmoytaille/45} ;} + {} + \IfStrEq{\ptmoystyle}{+}% + {\draw[fill=\ptmoycouleur] ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) pic {PLdotcross=\ptmoytaille/0} ;} + {} + \ifboolKV[PLptmoy]{affnom} + {\draw ({\ptmoyx-\axexOx},{\ptmoyy-\axeyOy}) node[\ptmoypos={\ptmoytaille+\ptmoydecal},font=\ptmoyfont] {\ptmoynom} ;} + {} + +} + +%courbe ? +\newcommand\PLcourbe[3][]{% + \setsepchar{:}% + \readlist\PLdomaine{#3} + \itemtomacro\PLdomaine[1]\PLDm + \itemtomacro\PLdomaine[2]\PLDM + \saveexpandmode\noexpandarg + \StrSubstitute{#2}{\x}{(\x+\axexOx)}[\fctdecx] + \restoreexpandmode % restore the previous mode + \draw[#1] plot[domain={\PLDm-\axexOx}:{\PLDM-\axexOx}] (\x,{\fctdecx-\axeyOy}) ; +} + +\setKVdefault[PLsimplewindow]{% + axes=true,% + grille=true,% +} + +\DeclareDocumentCommand\PLfenetresimple{ O{} D<>{} m D<>{} m }{% + \useKVdefault[PLsimplewindow] + \setKV[PLsimplewindow]{#1}% on paramètres les nouvelles clés et on les simplifie + \ifboolKV[PLsimplewindow]{grille} + {\PLgrilletikz} + {} + \ifboolKV[PLsimplewindow]{axes} + {\PLaxestikz\PLaxextikz[#2]{#3}\PLaxeytikz[#4]{#5}} + {} +} + +\NewDocumentEnvironment{PLstats}{ O{} } +{% + \begin{tikzpicture}[#1] + }% + {% + \end{tikzpicture}% +} + \endinput \ No newline at end of file -- cgit v1.2.3